I'm trying to use a Trigger in Cassandra 4.1, but initialization fails when loading the jar file
Trace:
cassandra_1 | INFO [OptionalTasks:1] 2022-11-17 22:35:17,483 CustomClassLoader.java:83 - Loading new jar /etc/cassandra/triggers/cassandra-logger-0.2.jar
cassandra_1 | ERROR [OptionalTasks:1] 2022-11-17 22:35:17,488 JVMStabilityInspector.java:68 - Exception in thread Thread[OptionalTasks:1,5,OptionalTasks]
cassandra_1 | org.apache.cassandra.io.FSWriteError: java.nio.file.FileAlreadyExistsException: /tmp/lib/cassandra-0.jar
(...)
cassandra_1 | Caused by: java.nio.file.FileAlreadyExistsException: /tmp/lib/cassandra-0.jar
cassandra_1 | at java.base/sun.nio.fs.UnixCopyFile.copy(Unknown Source)
cassandra_1 | at java.base/sun.nio.fs.UnixFileSystemProvider.copy(Unknown Source)
cassandra_1 | at java.base/java.nio.file.Files.copy(Unknown Source)
cassandra_1 | at org.apache.cassandra.triggers.CustomClassLoader.addClassPath(CustomClassLoader.java:86)
cassandra_1 | ... 22 common frames omitted
cassandra_1 | ERROR [OptionalTasks:1] 2022-11-17 22:35:17,493 DefaultFSErrorHandler.java:64 - Stopping transports as disk_failure_policy is stop
cassandra_1 | ERROR [OptionalTasks:1] 2022-11-17 22:35:17,494 StorageService.java:501 - Stopping native transport
cassandra_1 | INFO [OptionalTasks:1] 2022-11-17 22:35:17,505 Server.java:176 - Stop listening for CQL clients
cassandra_1 | ERROR [OptionalTasks:1] 2022-11-17 22:35:17,506 StorageService.java:506 - Stopping gossiper
cassandra_1 | WARN [OptionalTasks:1] 2022-11-17 22:35:17,507 StorageService.java:405 - Stopping gossip by operator request
cassandra_1 | INFO [OptionalTasks:1] 2022-11-17 22:35:17,507 Gossiper.java:2087 - Announcing shutdown
cassandra_1 | INFO [OptionalTasks:1] 2022-11-17 22:35:17,509 StorageService.java:2950 - Node /192.168.96.2:7000 state jump to shutdown
cassandra_1 | INFO [OptionalTasks:1] 2022-11-17 22:35:17,513 StorageService.java:2950 - Node /192.168.96.2:7000 state jump to shutdown
Jar file:
https://github.com/felipead/cassandra-logger/releases/download/v0.2/cassandra-logger-0.2.jar
docker-compose.yaml, and cassandra.yaml:
https://github.com/hofstede-matheus/MATB09-postgres-vs-cassandra
This error also happens with hms-cassandra-triggers-1.0.1.jar, so I think there is no problem with
cassandra-logger-0.2.jar
Tried with other .jar files and no success.
Thanks in advance
Using cassandra:3.0 image in the docker-compose.yaml solved this startup issue.
I think the triggers are not compatible with version 4.1 of Cassandra.
4.1.0 release of Apache Cassandra has changed the way to load the triggers jars using java.nio (java.nio.file.Files), in earlier releases ( 4.0 or 3.X ) uses Guava (com.google.common.io.Files).
Guava copy method, by default, overwrite a file if you have permissions but java.nio not.
To solve this problem it's as easy as modify the class org.apache.cassandra.triggers.CustomClassLoader on line 86 from:
copy(inputJar.toPath(), out.toPath());
to:
copy(inputJar.toPath(), out.toPath(),StandardCopyOption.REPLACE_EXISTING);
I have Installed npm install pdfjs-dist i want to load PDF on the browser on mobile phones. However I am getting the below error. How can i resolve this?
Failed to compile.
./node_modules/pdfjs-dist/build/pdf.js
SyntaxError: C:\node\node_modules\pdfjs-dist\build\pdf.js: Missing class properties transform.
3520 |
3521 | class PixelsPerInch {
> 3522 | static CSS = 96.0;
| ^^^^^^^^^^^^^^^^^^
3523 | static PDF = 72.0;
3524 | static PDF_TO_CSS_UNITS = this.CSS / this.PDF;
3525 | }
I have a nginx hosted on a VM with an authentication service that expose a simple login page and some other services hosted onto a secondary VM (create-react-app builds served through serve -s build).
If the user tries to access a protected resource gets promped the login page.
The architecture is as follow:
+-------------------------------+
| Other VM |
| |
| +-----------------------+ |
| |serve -s build -l 8000 | |
+--------------------> localhost:8000 | |
| /resource1 | | | |
| | +-----------------------+ |
| | |
+----------+ | | |
| | | | +-----------------------+ |
/static? | Linux | | | |serve -s build -l 7000 | |
+---------->+ nginx +-----+--------------------> localhost:7000 | |
| Auth sys | /resource2 | | | |
| | | +-----------------------+ |
+----------+ | |
| ● |
| ● |
| ● |
| |
| |
+-------------------------------+
I have correctly configured nginx to reverse proxy all the resources.
resource1, resource2, resourcen and auth system access to a /static folder to take css, js, etc...
I have done a "workaround" to retrieve the correct static folder that is as follow:
location /static {
try_files $uri $uri/ =404;
if ($http_referer ~ ^http://linuxhostname/resource1) {
proxy_pass http://otherVMhostname:8000;
}
if ($http_referer ~ ^http://linuxhostname/resource2) {
proxy_pass http://otherVMhostname:7000;
}
}
Seemed to work fine until I faced this situation:
trying to access /resource1 without authentication:
The user is requesting /resource1 but the login page is prompted, nginx is proxying static files onto the other vm while they are on its file system, this results in a 404 error.
To mitigate this issue I thought to change the static folder name into something specific (e.g. for resource1, put static_r1) but I found that is not straightforward (see this link).
Do you have any ideas on how this can be approached nginx side or application side?
Thanks
After some experience and the updates made to the create-react-app I learned that you can use an environment variable when you build your package that is PUBLIC_URL=basepath.
This will make the index.html (the entrypoint of the React SPA) look for static files inside /basepath/static, hence by setting this variable the job is done.
The only thing you need to be aware of is the actual path on the websever, for example: if you use the nginx directive try_files $uri it will actually look inside $root_dir/basepath since the $uri will contain the base path.
I would like to know what mistake I've made that, after I set my connection details, the log panel started to trace this in my grails app:
I a using NB 6.9 RC2 with Grails 2.4.3 and PostGreSQL 9.4
24/04/2016 07:31:11 org.codehaus.groovy.runtime.m12n.MetaInfExtensionModule newModule
ADVERTENCIA: Module [groovy-all] - Unable to load extension class [org.codehaus.groovy.runtime.NioGroovyMethods]
24/04/2016 07:31:12 org.codehaus.groovy.runtime.m12n.MetaInfExtensionModule newModule
ADVERTENCIA: Module [groovy-all] - Unable to load extension class [org.codehaus.groovy.runtime.NioGroovyMethods]
|Loading Grails 2.4.3
|Configuring classpath
.
|Environment set to development
.................................
|Packaging Grails application
....................................
|Running Grails application
24/04/2016 07:31:29 org.codehaus.groovy.runtime.m12n.MetaInfExtensionModule newModule
ADVERTENCIA: Module [groovy-all] - Unable to load extension class [org.codehaus.groovy.runtime.NioGroovyMethods]
Error |
2016-04-24 07:31:51,632 [localhost-startStop-1] ERROR spring.BeanBuilder - WARNING: Your cache provider is set to 'net.sf.ehcache.hibernate.EhCacheRegionFactory' in DataSource.groovy, however the class for this provider cannot be found.
Using Grails' default cache region factory: 'org.hibernate.cache.ehcache.EhCacheRegionFactory'
Error |
2016-04-24 07:31:54,554 [localhost-startStop-1] ERROR context.GrailsContextLoaderListener - Error initializing the application: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource': Cannot resolve reference to bean 'dataSourceLazy' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSourceLazy': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy]: Constructor threw exception; nested exception is java.lang.UnsupportedClassVersionError: org/postgresql/Driver : Unsupported major.minor version 51.0
Message: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource': Cannot resolve reference to bean 'dataSourceLazy' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSourceLazy': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy]: Constructor threw exception; nested exception is java.lang.UnsupportedClassVersionError: org/postgresql/Driver : Unsupported major.minor version 51.0
Line | Method
->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 138 | run in java.util.concurrent.FutureTask
| 886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker
| 908 | run in ''
^ 662 | run . . in java.lang.Thread
Caused by BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource': Cannot resolve reference to bean 'dataSourceLazy' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSourceLazy': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy]: Constructor threw exception; nested exception is java.lang.UnsupportedClassVersionError: org/postgresql/Driver : Unsupported major.minor version 51.0
->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 138 | run in java.util.concurrent.FutureTask
| 886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker
| 908 | run in ''
^ 662 | run . . in java.lang.Thread
Caused by BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource': Cannot resolve reference to bean 'dataSourceLazy' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSourceLazy': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy]: Constructor threw exception; nested exception is java.lang.UnsupportedClassVersionError: org/postgresql/Driver : Unsupported major.minor version 51.0
->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 138 | run in java.util.concurrent.FutureTask
| 886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker
| 908 | run in ''
^ 662 | run . . in java.lang.Thread
Caused by BeanCreationException: Error creating bean with name 'dataSource': Cannot resolve reference to bean 'dataSourceLazy' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSourceLazy': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy]: Constructor threw exception; nested exception is java.lang.UnsupportedClassVersionError: org/postgresql/Driver : Unsupported major.minor version 51.0
->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 138 | run in java.util.concurrent.FutureTask
| 886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker
| 908 | run in ''
^ 662 | run . . in java.lang.Thread
Caused by BeanCreationException: Error creating bean with name 'dataSourceLazy': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy]: Constructor threw exception; nested exception is java.lang.UnsupportedClassVersionError: org/postgresql/Driver : Unsupported major.minor version 51.0
->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 138 | run in java.util.concurrent.FutureTask
| 886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker
| 908 | run in ''
^ 662 | run . . in java.lang.Thread
Caused by BeanInstantiationException: Could not instantiate bean class [org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy]: Constructor threw exception; nested exception is java.lang.UnsupportedClassVersionError: org/postgresql/Driver : Unsupported major.minor version 51.0
->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 138 | run in java.util.concurrent.FutureTask
| 886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker
| 908 | run in ''
^ 662 | run . . in java.lang.Thread
Caused by UnsupportedClassVersionError: org/postgresql/Driver : Unsupported major.minor version 51.0
->> 632 | defineClassCond in java.lang.ClassLoader
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 616 | defineClass in ''
| 141 | defineClass in java.security.SecureClassLoader
| 283 | defineClass in java.net.URLClassLoader
| 58 | access$000 in ''
| 197 | run in java.net.URLClassLoader$1
| 190 | findClass in java.net.URLClassLoader
| 307 | loadClass in java.lang.ClassLoader
| 247 | forName in java.lang.Class
| 303 | innerRun in java.util.concurrent.FutureTask$Sync
| 138 | run . . in java.util.concurrent.FutureTask
| 886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker
| 908 | run . . in ''
^ 662 | run in java.lang.Thread
Error |
Forked Grails VM exited with error
Thankx
I run ActiveMQ 5.5.0 broker on Ubuntu, downloaded and compiled APR 1.4.5 and C API related libactivmq and libopenwire.
The test c supplied in Examples at:
http://svn.apache.org/repos/asf/activemq/sandbox/openwire-c/src/examples/
does not work, the issue is with the WireFormat magic code, see debug lines from the log:
2011-07-07 15:35:30,324 | DEBUG | Sending: WireFormatInfo { version=7, properties={CacheSize=1024, CacheEnabled=true, SizePrefixDisabled=false, MaxInactivityDurationInitalDelay=10000, TcpNoDelayEnabled=true, MaxInactivityDuration=30000, TightEncodingEnabled=true, StackTraceEnabled=true}, magic=[A,c,t,i,v,e,M,Q]} | org.apache.activemq.transport.WireFormatNegotiator | ActiveMQ Task-2
2011-07-07 15:35:30,327 | DEBUG | Using min of local: WireFormatInfo { version=7, properties={CacheSize=1024, CacheEnabled=true, SizePrefixDisabled=false, MaxInactivityDurationInitalDelay=10000, TcpNoDelayEnabled=true, MaxInactivityDuration=30000, TightEncodingEnabled=true, StackTraceEnabled=true}, magic=[A,c,t,i,v,e,M,Q]} and remote: WireFormatInfo { version=1297154048, properties={}, magic=[^A,^#,A,c,t,i,v,e]} | org.apache.activemq.transport.InactivityMonitor | ActiveMQ Transport: tcp:///127.0.0.1:51606
2011-07-07 15:35:30,327 | DEBUG | Received WireFormat: WireFormatInfo { version=1297154048, properties={}, magic=[^A,^#,A,c,t,i,v,e]} | org.apache.activemq.transport.WireFormatNegotiator | ActiveMQ Transport: tcp:///127.0.0.1:51606
2011-07-07 15:35:30,333 | DEBUG | tcp:///127.0.0.1:51606 before negotiation: OpenWireFormat{version=7, cacheEnabled=false, stackTraceEnabled=false, tightEncodingEnabled=false, sizePrefixDisabled=false} | org.apache.activemq.transport.WireFormatNegotiator | ActiveMQ Transport: tcp:///127.0.0.1:51606
2011-07-07 15:35:30,337 | DEBUG | Transport failed: java.io.IOException: Remote wire format magic is invalid | org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ Transport: tcp:///127.0.0.1:51606
I debugged the client side and captured values sent to the broker, 15 bytes, I will list them below:
1: '\001'
2: '\001'
3: '\000'
4: 'A'
5: 'c'
6: 't'
7: 'i'
8: 'v'
9: 'e'
10:'M'
11:'Q'
12:'\000'
13:'\000'
14:'\000'
15:'\002'
here last four bytes is version, which is set to 2
Somehow this message is shifted/misinterpreted by broker, so the magic token and version are wrong.
One more piece of information: I compiled libopenwire using both supplied versions ow_commands_v1.[ch] and ow_commands_v2.[ch], so I tried to link the test with both, the result is the same with either version. Does anyone know the reason for two versions? which one should I use?
Note: this message has been posted several days ago on apache forum, but no response. I hope on this site message will get more traffic.
The OpenWire C API is not maintained by anyone so its not surprising that its broken. There is a C wrapper for ActiveMQ-CPP in the ActiveMQ svn repo you could try using instead, if you are really married to using C.