Errors when trying to get a connection to cassandra - java

I'm trying to create a Java program that uses a Cassandra database.
I'm 'trying' to use Hector client but when I run I'm getting some errors. I have searched on the internet but could find a fix that worked for me (it's probably something obvious).
Libs I included in my build path:
hector
libthrift-0.9.1
slf4j-simple-1.75
Errors im getting:
[main] INFO me.prettyprint.cassandra.connection.CassandraHostRetryService - Downed Host Retry service started with queue size -1 and retry delay 10s
[main] INFO me.prettyprint.cassandra.service.JmxMonitor - Registering JMX me.prettyprint.cassandra.service_Test Cluster:ServiceType=hector,MonitorType=hector
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/cassandra/thrift/InvalidRequestException
at me.prettyprint.cassandra.connection.factory.HThriftClientFactoryImpl.createClient(HThriftClientFactoryImpl.java:42)
at me.prettyprint.cassandra.connection.ConcurrentHClientPool.createClient(ConcurrentHClientPool.java:179)
at me.prettyprint.cassandra.connection.ConcurrentHClientPool.<init>(ConcurrentHClientPool.java:61)
at me.prettyprint.cassandra.connection.RoundRobinBalancingPolicy.createConnection(RoundRobinBalancingPolicy.java:68)
at me.prettyprint.cassandra.connection.HConnectionManager.<init>(HConnectionManager.java:56)
at me.prettyprint.cassandra.service.AbstractCluster.<init>(AbstractCluster.java:67)
at me.prettyprint.cassandra.service.ThriftCluster.<init>(ThriftCluster.java:21)
at me.prettyprint.hector.api.factory.HFactory.createCluster(HFactory.java:197)
at me.prettyprint.hector.api.factory.HFactory.getOrCreateCluster(HFactory.java:144)
at me.prettyprint.hector.api.factory.HFactory.getOrCreateCluster(HFactory.java:133)
at org.codox.lobbyserver.data.CassandraAccess.test(CassandraAccess.java:39)
at org.codox.lobbyserver.Server.main(Server.java:22)
Caused by: java.lang.ClassNotFoundException: org.apache.cassandra.thrift.InvalidRequestException
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 12 more
Any help is welcome, if you need more info tell me.

That class seems to be in the cassandra-thrift library which you can find here.

Related

Apache Ignite 2.7.5: server crash with "NoClassDefFoundError: sun/nio/ch/Invoker$2"

For the current moment, this error occurred only once. Ignite starts with one node in server mode and about 30 in client mode.
In the server's log, I found this stack trace:
Failed to reinitialize local partitions (rebalancing will be stopped):
...
java.lang.NoClassDefFoundError: sun/nio/ch/Invoker$2
...
at sun.nio.ch.Invoker.invokeIndirectly(Unknown Source)
at sun.nio.ch.Invoker.invoke(Unknown Source)
at sun.nio.ch.Invoker.invoke(Unknown Source)
at sun.nio.ch.WindowsAsynchronousFileChannelImpl$ReadTask.run(Unknown Source)
at sun.nio.ch.WindowsAsynchronousFileChannelImpl.implRead(Unknown Source)
at sun.nio.ch.AsynchronousFileChannelImpl.read(Unknown Source)
at org.apache.ignite.internal.processors.cache.persistence.file.AsyncFileIO.read(AsyncFileIO.java:77)
at org.apache.ignite.internal.processors.cache.persistence.file.AbstractFileIO$1.run(AbstractFileIO.java:82)
I inspected the rt.jar the server is used and found this Invoker$2.
Also I found this sun.nio.ch.Invoker$2 in the list of loaded classes in Java VisualVM.
So I don't understand at all what's the problem.

AWS Kinesis client fails with java.lang.NoClassDefFoundError

I am following the http://docs.aws.amazon.com/streams/latest/dev/learning-kinesis-module-one.html tutorial on Kinesis Streams.
I have created two packages, one with the Producer and one with the Consumer. I can correctly produce data and I can see from the metrics dashboard that the data is getting into the stream.
When I run my consumer, I am getting the following stack trace:
1246 [main] DEBUG com.amazonaws.services.kinesis.samples.stocktrades.processor.StockTradesProcessor - Caught throwable while processing data.
java.lang.NoClassDefFoundError: com/amazonaws/util/json/JSONObject
at com.amazonaws.services.kinesis.leases.impl.Lease.toString(Lease.java:229)
at java.lang.String.valueOf(Unknown Source)
at java.lang.StringBuilder.append(Unknown Source)
at com.amazonaws.services.kinesis.leases.impl.LeaseManager.createLeaseIfNotExists(LeaseManager.java:281)
at com.amazonaws.services.kinesis.clientlibrary.lib.worker.ShardSyncer.syncShardLeases(ShardSyncer.java:127)
at com.amazonaws.services.kinesis.clientlibrary.lib.worker.ShardSyncer.checkAndCreateLeasesForNewShards(ShardSyncer.java:88)
at com.amazonaws.services.kinesis.clientlibrary.lib.worker.ShardSyncTask.call(ShardSyncTask.java:68)
at com.amazonaws.services.kinesis.clientlibrary.lib.worker.MetricsCollectingTaskDecorator.call(MetricsCollectingTaskDecorator.java:49)
at com.amazonaws.services.kinesis.clientlibrary.lib.worker.Worker.initialize(Worker.java:395)
at com.amazonaws.services.kinesis.clientlibrary.lib.worker.Worker.run(Worker.java:330)
at com.amazonaws.services.kinesis.samples.stocktrades.processor.StockTradesProcessor.main(StockTradesProcessor.java:102)
Caused by: java.lang.ClassNotFoundException: com.amazonaws.util.json.JSONObject
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 11 more
I just got the same problem .
Just change the version of aws-sdk to 1.10.x. I used 1.10.7
May be you are working with aws-sdk version 1.11.x
Kinesis Client Library (KCL) not compatible with AWS Java SDK 1.11. You need to use 1.10.x.
This has been fixed in KCL 1.6.4. So, you can update KCL ( > 1.6.4) to work with SDK 1.11.x
https://github.com/awslabs/amazon-kinesis-client/pull/75

Ode server error on stopping (as well as BPEL deploy error)

I am very new to this and have been looking all through the apache forums and elsewhere for solutions, but have not been able to find anything.
Firstly, I have followed the following guides on getting Apache ODE 1.3.6 setup as well as BPEL with eclipse:
http://www-inf.it-sudparis.eu/~nguyen_n/teaching_assistant/bpel/installing_bpel_designer_and_apache_ode_on_eclipse
and the following guide to create and deploy a hello world project:
http://www-inf.it-sudparis.eu/~nguyen_n/teaching_assistant/bpel/deploying_hello_world_bpel_process_with_eclipse_bpel_designer_and_apache_ode
I have gone over others and these seem to be very on point and correct.
Now here are my two issues:
I can start the ODE server fine; but when I stop it I get an alert:
A Java Exception has Occurred
and in the console I get the following:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory
at org.apache.catalina.startup.Bootstrap.<clinit>(Bootstrap.java:60)
Caused by: java.lang.ClassNotFoundException: org.apache.juli.logging.LogFactory
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 1 more
After a minute or two the server has to be killed as it won't stop
The tomcat-juli.jar is in the classpath (or else I would also get this error when starting the server)
By second issue is:
2) When I try to deploy the HelloWorld project on the Ode server, I get the following (in the console:
11:49:54,599 WARN [ProcessStoreImpl] Deployment failed within the engine, store undeploying process.
org.apache.ode.bpel.iapi.ContextException: Could not activate endpoint for service {http://helloworld.localhost}HelloWorldService and port HelloWorldPort
at org.apache.ode.axis2.BindingContextImpl.activateMyRoleEndpoint(BindingContextImpl.java:83)
at org.apache.ode.bpel.engine.BpelProcess.activate(BpelProcess.java:588)
at org.apache.ode.bpel.engine.BpelEngineImpl.registerProcess(BpelEngineImpl.java:346)
at org.apache.ode.bpel.engine.BpelServerImpl.register(BpelServerImpl.java:321)
at org.apache.ode.axis2.ODEServer.handleEvent(ODEServer.java:665)
at org.apache.ode.axis2.ODEServer.access$100(ODEServer.java:89)
at org.apache.ode.axis2.ODEServer$ProcessStoreListenerImpl.onProcessStoreEvent(ODEServer.java:641)
at org.apache.ode.store.ProcessStoreImpl.fireEvent(ProcessStoreImpl.java:592)
at org.apache.ode.store.ProcessStoreImpl.fireStateChange(ProcessStoreImpl.java:598)
at org.apache.ode.store.ProcessStoreImpl.deploy(ProcessStoreImpl.java:311)
at org.apache.ode.store.ProcessStoreImpl.deploy(ProcessStoreImpl.java:172)
at org.apache.ode.axis2.deploy.DeploymentPoller.check(DeploymentPoller.java:160)
at org.apache.ode.axis2.deploy.DeploymentPoller.access$300(DeploymentPoller.java:60)
at org.apache.ode.axis2.deploy.DeploymentPoller$PollingThread.run(DeploymentPoller.java:251)
Caused by: org.apache.ode.axis2.OdeFault: The soap:address http://localhost:8080/HelloWorld used for service {http://helloworld.localhost}HelloWorldService and port HelloWorldPort should be of the form http://hostname:port/ode/processes/myProcessEndpointName
at org.apache.ode.axis2.hooks.ODEAxisService.extractServiceName(ODEAxisService.java:226)
at org.apache.ode.axis2.hooks.ODEAxisService.createService(ODEAxisService.java:86)
at org.apache.ode.axis2.BindingContextImpl.createService(BindingContextImpl.java:120)
at org.apache.ode.axis2.BindingContextImpl.activateMyRoleEndpoint(BindingContextImpl.java:78)
... 13 more
11:49:54,640 INFO [BpelServerImpl] Unregistered process {http://helloworld.localhost}HelloWorld-5.
11:49:54,641 ERROR [DeploymentPoller] Deployment of BPEL_HelloWorld failed, aborting for now.
org.apache.ode.bpel.iapi.ContextException: Could not activate endpoint for service {http://helloworld.localhost}HelloWorldService and port HelloWorldPort
at org.apache.ode.axis2.BindingContextImpl.activateMyRoleEndpoint(BindingContextImpl.java:83)
at org.apache.ode.bpel.engine.BpelProcess.activate(BpelProcess.java:588)
at org.apache.ode.bpel.engine.BpelEngineImpl.registerProcess(BpelEngineImpl.java:346)
at org.apache.ode.bpel.engine.BpelServerImpl.register(BpelServerImpl.java:321)
at org.apache.ode.axis2.ODEServer.handleEvent(ODEServer.java:665)
at org.apache.ode.axis2.ODEServer.access$100(ODEServer.java:89)
at org.apache.ode.axis2.ODEServer$ProcessStoreListenerImpl.onProcessStoreEvent(ODEServer.java:641)
at org.apache.ode.store.ProcessStoreImpl.fireEvent(ProcessStoreImpl.java:592)
at org.apache.ode.store.ProcessStoreImpl.fireStateChange(ProcessStoreImpl.java:598)
at org.apache.ode.store.ProcessStoreImpl.deploy(ProcessStoreImpl.java:311)
at org.apache.ode.store.ProcessStoreImpl.deploy(ProcessStoreImpl.java:172)
at org.apache.ode.axis2.deploy.DeploymentPoller.check(DeploymentPoller.java:160)
at org.apache.ode.axis2.deploy.DeploymentPoller.access$300(DeploymentPoller.java:60)
at org.apache.ode.axis2.deploy.DeploymentPoller$PollingThread.run(DeploymentPoller.java:251)
Caused by: org.apache.ode.axis2.OdeFault: The soap:address http://localhost:8080/HelloWorld used for service {http://helloworld.localhost}HelloWorldService and port HelloWorldPort should be of the form http://hostname:port/ode/processes/myProcessEndpointName
at org.apache.ode.axis2.hooks.ODEAxisService.extractServiceName(ODEAxisService.java:226)
at org.apache.ode.axis2.hooks.ODEAxisService.createService(ODEAxisService.java:86)
at org.apache.ode.axis2.BindingContextImpl.createService(BindingContextImpl.java:120)
at org.apache.ode.axis2.BindingContextImpl.activateMyRoleEndpoint(BindingContextImpl.java:78)
... 13 more
As far as I can tell the BPEL was configured to run on ODE environment, but I cannot seem to get much more out of this trace.
Any assistance is greatly appreciated, thank you!
You need to use the ODE service address:
http://localhost:8080/ode/processes/HelloWorld
As I can see from your logs your address is
http://localhost:8080/HelloWorld
It worked for me.

Can't get JavaPNS to work for Push notifications

Okay, so I'm working on a java server for an Apps backend, it must be able to issue iOS push notifications as part of a larger code-base, so I used the JavaPNS library (v2.1.1), which was used(and worked) previously on the tomcat version of the server. I'm developing locally using Eclipse on Arch Linux.
I'm trying the simplest test possible for it:
try{
Push.alert("Hello", "cert.p12", "password", false, "<my iPods UDID>");
}catch(Exception e){
e.printStackTrace();
}
The result exception is:
Exception in thread "main" java.lang.NoClassDefFoundError:org/bouncycastle/jce/provider/BouncyCastleProvider
at javapns.notification.PushNotificationManager.initializeConnection(PushNotificationManager.java:107)
at javapns.Push.sendPayload(Push.java:171)
at javapns.Push.alert(Push.java:47)
at testIOS.main(testIOS.java:20)
Caused by: java.lang.ClassNotFoundException: org.bouncycastle.jce.provider.BouncyCastleProvider
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 4 more
the cert file is in the local directory(there were no complaints about it loading), the password and the UDID are both correct. I've tried a few things(in vain probably), such as installing the unlimited policy JCE from oracle:
http://www.bouncycastle.org/wiki/display/JA1/Provider+Installation
But I really have no clue what's wrong, it just seems to be unable to find that class/library, but I really don't know how to fix it. Thanks in advance for any tips.
Do you've bcprov-jdk15-146.jar in your lib ?
If not, download jar from this link and place it in your lib.
Bouncy Castle

False errors in eclipse?

Okay, so eclipse says my code has errors in it, but there are no red lines. When I try to run my project (Called Game2) it gives me this error:
java.lang.NoClassDefFoundError: Game2
Caused by: java.lang.ClassNotFoundException: Game2
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Exception in thread "main"
Now clearly I know my class exists, and I know I put a main method in it, so what the hell is eclipse trying to do?
Edit: Validation says there are no errors in my project.
If Eclipse says there are errors but you are not actually sure what the problem is you can check the problems view (Ctrl-3, type 'problems', enter) to see what's wrong (e.g. project setup issues).
Clean the project once. It remove those false error.

Categories

Resources