Java using ZMQ (and Eve EMDR) - java

I'm trying to connect to eve EMDR using ZMQ in java, and I just get this error, any ideas?
http://eve-market-data-relay.readthedocs.org/en/latest/using.html#java
Code: https://gist.github.com/Sparcster/d140654cd157c73e0957
> Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/collect/Multimap
at zmq.Reaper.<init>(Reaper.java:49)
at zmq.Ctx.create_socket(Ctx.java:270)
at org.zeromq.ZMQ$Socket.<init>(ZMQ.java:362)
at org.zeromq.ZMQ$Context.socket(ZMQ.java:311)
at spacevac.Spacevac.main(Spacevac.java:18)
Caused by: java.lang.ClassNotFoundException: com.google.common.collect.Multimap
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 5 more
Java Result: 1
Also: I'm using JeroMQ instead of JZMQ.

This sounds like it is related to the new use of the Guava library. Adding guava to the dependency pulls and the eclass path in the maven.xml file fixes these errors, according to (1) https://github.com/zeromq/jeromq/issues/174 and (2) https://github.com/zeromq/jeromq/issues/176. You also may have a stale Ant build.xml, and might need to blow that away and regenerate it, if that is what you are using.

Related

Raspberry pi - java - Serial Com

I've got a serious problem with my Raspberry Pi (OS: Raspbian) and Java (JDK-7-Armhf). My code wont execute without creating a Exception.
I'll been reading and trying several proposals and nothing have worked yet.
So now i am confused of what went wrong..?
So it goes like this:
I've got a Java source code that will run in my Eclipes IDE.
But when i export the .jar-file, even with library (JRE System lib. _86, JavaSE1.7, JAVAX.comm), as "Runnabel JAR" or just .JAR and execute it om my Raspberry pi, i've got "NoCLassDefFoundExecption: SerialPortEventListener..!
I just don't know why, it won't find the library and use it..!
On my Pi i have librxtx-java installed and JDK-7-oracle-armhf.
librxtx-java should be setting its JAVA_PATH on it's own when installed, but not sure that is done correct!
(I've got a folder /usr/jni and it contains: librxtxSerial.so and
/usr/lib/jvm/jdk-7-oracle-armhf/).
Looking at the library Javax.RXTXcomm in Eclipse, i've got RXTXcomm.jar, that contains SerialPortEventListener, so it is defininated i the .jar.
I'm thinking about, could it be, that there is a missing link between my Java JVM and linux serialport driver? My JRE is working in some way, because it will execute a code to readout HOSTNAME & IP-Adress.
So is there some one who knows how to fix this..?
This is a readout of Java Exception:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/comm/SerialPortEventListener
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:792)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
Caused by: java.lang.ClassNotFoundException: javax.comm.SerialPortEventListener
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 13 more
A copy of my code. "SimpleRead.java" The original from java comm API samples
You have to change the reference from javax.comm to gnu.io in your source code.
Try following:
Switch to root and run the program you created
If that helps do following
sudo adduser username dialout
then log out and log in from all terminals and GUIs

Java program that uses pptx4j throws org/apache/commons/lang/NotImplementedException

I'm using sample code from www.docx4java.org to run the program that will create a powerpoint slide so that i can learn the use of the docx4j library. But it gives me an exception even tough i have already added both commons-logging-1.2.jar and commons-logging-1.2-javadoc.jar to my classpaths library as (in which i also have apache-logging-log4j.jar, docx4j-3.2.1.jar, slf4j-nop-1.6.1 and slf4j-api-1.7.5.jar). This is the output:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/lang/NotImplementedException
at org.docx4j.openpackaging.packages.PresentationMLPackage.createPackage(PresentationMLPackage.java:169)
at org.docx4j.openpackaging.packages.PresentationMLPackage.createPackage(PresentationMLPackage.java:146)
at org.docx4j.samples.CreateHelloWorld.main(CreateHelloWorld.java:30)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.lang.NotImplementedException
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 3 more
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)
Is there an incompatibility betweent the jars i am using or am i missing more jar files to work with pptx4j?
Originally i added docx4j-3.2.1.jar and slf4j-api-1.7.5.jar to work with this sample code that creates a word file. But with the pptx4j i haven't found a solution, shouldn't it work since i already have apache-logging-log4j and commons-logging-1.2?
It's not throwing org/apache/commons/lang/NotImplementedException, it's saying it can't find it:
NoClassDefFoundError: org/apache/commons/lang/NotImplementedException
You need to add Apache Commons Lang v2.x (not v3, that uses a different package name to the one the error mentions) to your classpath.

What does this java error mean java.lang.NoClassDefFoundError: org/apache/mahout/cf/taste/impl/model/jdbc/ConnectionPoolDataSource

I've been trying to run Mahout on a amazon ec2 instance. I keep getting an error when the script executes.
my config script is like this
CLASSPATH=recommender/recommender.jar:async/async-command.jar:async/lib/:./.m2/repository/org/apache/mahout/mahout-core/0.6/
java.lang.NoClassDefFoundError: org/apache/mahout/cf/taste/impl/model/jdbc/ConnectionPoolDataSource
at org.drupal.project.recommender.RunRecommender$AlgorithmImpl.initDataModel(RunRecommender.java:671)
at org.drupal.project.recommender.RunRecommender$AlgorithmImpl.run(RunRecommender.java:954)
at org.drupal.project.recommender.RunRecommender.run(RunRecommender.java:435)
at org.drupal.project.async_command.Druplet.runSerial(Druplet.java:379)
at org.drupal.project.async_command.Druplet.run(Druplet.java:284)
at org.drupal.project.async_command.CommandLineLauncher.handleExecutables(CommandLineLauncher.java:107)
at org.drupal.project.async_command.CommandLineLauncher.launch(CommandLineLauncher.java:66)
at org.drupal.project.recommender.RecommenderApp.main(RecommenderApp.java:37)
Caused by: java.lang.ClassNotFoundException: org.apache.mahout.cf.taste.impl.model.jdbc.ConnectionPoolDataSource
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
I understand that this means that some class was not found, I have no idea how to fix it
On you amazon box you need to ensure that this path :./.m2/repository/org/apache/mahout/mahout-core/0.6/
exists and unless you are reading class files from this directory, then you modify this line to include that jar file name
e.g.
:./.m2/repository/org/apache/mahout/mahout-core/0.6/mahout_core.0.6.jar

Unable to run Scala-Neo4j project from command line [duplicate]

This question already has answers here:
Building JAR that includes all its dependencies
(5 answers)
Closed 8 years ago.
I developed a Java project in which I wrote some Scala classes and some Java classes. I used Scala-Neo4j wrapper in the project to write Scala functions for inserting and retrieval of Neo4j nodes. I also wrote Thrift services in java in the project as I need to call these Scala functions from Php. Finally I extracted a jar file using Eclipse and I tried to run it from the command line and I got the following Exception
Exception in thread "main" java.lang.NoClassDefFoundError: org/neo4j/scala/Neo4jWrapper
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at dum.Sad.main(Sad.scala)
at dum.ScalaRunner.main(ScalaRunner.java:7)
Caused by: java.lang.ClassNotFoundException: org.neo4j.scala.Neo4jWrapper
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 14 more
It works completely fine when I run the project from Eclipse. But, while running the jar file which I extracted from the project I get the Exception above. Where did i go wrong?
It seems your are not setting the classpath up properly. Try this:
scala -cp ./where/is/Neo4jWrapper/jar YourClass
Of course, replace ./where/is/Neo4jWrapper/jar with the path to the .jar. Notice that if you need to point to more than one jar or class directory you need to separate them with : if on Linux/Mac or ; if in Windows. And avoid spaces in the classpath.

HttpClient on GAE

I'm really curious as how JIQL admin demo was able to run on Appengine cloud (appspot.com)
Whereas where I tried to port the available sources like the Guestbook and the Jqladmin app I get this error:
Caused by: java.lang.ClassNotFoundException: org.apache.commons.httpclient.HttpException
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at com.google.appengine.tools.development.IsolatedAppClassLoader.loadClass(IsolatedAppClassLoader.java:176)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 44 more
However, there is a running JiqlAdmin that runs on top of GAE and I have tried and was able to execute a SQL query:
http://jiqladmin.appspot.com/Jiqladmin.html
Just wondering what went wrong in my app.
Error seems obvious, you should add Apache commons Http client as dependency. Try putting that in your war/WEB_INF/lib or add it as dependency in Eclipse.

Categories

Resources