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.
Related
When I execute mycode from intelliJ Idea it works fine but when I run the jar on my server it throws the below error. I am using 'org.mongodb:mongodb-driver:3.4.1' version.
Exception in thread "main" java.lang.NoClassDefFoundError: org/bson/conversions/Bson
at com.myapp.server.mongo.MongoDbHandler.prepareMongoDb(MongoDbHandler.java:68)
at com.myapp.server.mongo.MongoDbHandler.<init>(MongoDbHandler.java:22)
at com.myapp.server.Client.main(Client.java:167)
Caused by: java.lang.ClassNotFoundException: org.bson.conversions.Bson
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
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)
... 3 more
I know its an old thread and its just for those who have the similar issues. Few days back I was also facing the same issue with same error trace while running the jar by command line.After rechecking the code found that
It was not a problem of the jar version but its problem of the packaging of the
jar
After packing the jar with all proper dependencies will solve this issue.
I have used
maven-assembly-plugin
for packaging and its works.
.
If I had to guess you need to get yourself whatever BSON library you're using; I wouldn't say that Mongo is your problem.
key line here is:
"Caused by: java.lang.ClassNotFoundException: org.bson.conversions.Bson"
So it's saying that it's not finding that particular class, I would look in IntelliJ and see what BSON library it is, then put it in your build directory (or java lib) on your server.
Trying to start java program on linux but it fails to locate JSoup jar file. I have checked other questions and found on how to add libraries while compiling and while trying to run it but I am not sure if I am doing it correctly because it still fails to load the library....
I enter the following commands:
root#vps5441:/var/www/var/www/TimetableLoader# javac -cp /var/www/var/www/TimetableLoader/jsoup-1.8.1.jar:/var/www/var/www/TimetableLoader/mysql-connector-java-5.0.8/mysql-connector-java-5.0.8-bin.jar. TimetableLoader.java
root#vps5441:/var/www/var/www/TimetableLoader# java -cp /var/www/var/www/TimetableLoader/jsoup-1.8.1.jar:/var/www/var/www/TimetableLoader/mysql-connector-java-5.0.8/mysql-connector-java-5.0.8-bin.jar. -classpath /var/www/var/www/TimetableLoader/ TimetableLoader
And I get the following error when the program tries to access the JSoup library.
Exception in thread "main" java.lang.NoClassDefFoundError: org/jsoup/Jsoup
at TimetableLoader.main(TimetableLoader.java:46)
Caused by: java.lang.ClassNotFoundException: org.jsoup.Jsoup
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)
... 1 more
I assume jsoup-1.8.1.jar is in the current directory?
You don't generally need both -classpath and -cp. It's probably ignoring the values given by -cp as a result.
Put your own classes ahead of the 3rd-party ones.
You're already in /var/www/var/www/TimetableLoader so keep it simple:-
root#vps5441:/var/www/var/www/TimetableLoader# java -cp .:jsoup-1.8.1.jar:mysql-connector-java-5.0.8/mysql-connector-java-5.0.8-bin.jar TimetableLoader
(Best to get out of the habit of running things as "root" unless you have a genuine need, just sayin')
The problem is as follows, during startup of the jzy3d demo ScatterDemo.java :
Exception in thread "main" java.lang.NoClassDefFoundError: javax/media/opengl/GLProfile
at org.jzy3d.chart.Settings.<init>(Settings.java:19)
at org.jzy3d.chart.Settings.getInstance(Settings.java:48)
at org.jzy3d.analysis.AnalysisLauncher.open(AnalysisLauncher.java:18)
at org.jzy3d.analysis.AnalysisLauncher.open(AnalysisLauncher.java:13)
at org.jzy3d.demos.scatter.ScatterDemo.main(ScatterDemo.java:16)
Caused by: java.lang.ClassNotFoundException: javax.media.opengl.GLProfile
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)
... 5 more
Java Result: 1
Configuration is NetBeans 7.3.1, jzy3d-api-0.9.1, jzy3d-swt-0.9.1, log4j-1.2.17, gluegen-rt (latest stable), jogl-all (latest stable), JDK1.7
I am aware of the following change (Moving all of javax.media.opengl to com.jogamp.opengl, https://jogamp.org/bugzilla/show_bug.cgi?id=682). I have gone through the usual process of including .jar files into the project.
Project compiles fine, does not run.
My question(s) are: Can I somehow redirect javax.media.opengl.* to com.jogamp.opengl.* ? What is the correct way to resolve this problem?
As you can see here, even the code on the master branch (0.9.2) isn't based on the latest version of JOGL. Please ask Martin Pernollet to make the necessary changes (replace javax.media.* by com.jogamp.*) or do it yourself. You can rebuild Jzy3d to test it with the modifications of the import clauses. This is the correct way of solving this simple problem.
I am generating java classes from xsd using JAXB 1.0 (JDK 1.5 and Java Web Service Developer Pack 1.5). It is working fine in local. When, I tried in server, I am getting the following exception.
ErrMsg=[Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/xml/bind/unmarshaller/InterningXMLReader at
com.impl.runtime.UnmarshallerImpl.unmarshal(Unknown Source)
at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:157)
at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:162)
at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:171)
at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:189)
Caused by: java.lang.ClassNotFoundException: com.sun.xml.bind.unmarshaller.InterningXMLReader
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) ... 9 more].
Any help?
You need to add jaxb-impl.jar to your Java Build Path.
If you are using Eclipse then
right-click your project, go to Properties->Java Build Path, click the Add External JARs... button, and finally select jaxb-ri-20110512/lib/jaxb-impl.jar. This should automatically add jaxb-api.jar, activation.jar, jsr173_1.0_api.jar, and jaxb1-impl.jar in addition to jaxb-impl.jar. Now there shouldn't be any more problems.
You miss the jaxb-impl.jar in your classpath. Download and add it.
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.