I've made JAR file from a project I made, however when I try to execute it, it gives:
Exception in thread "main" java.lang.NoClassDefFoundError: org/jboss/netty/channel/socket/ServerSocketChannelFactory
at org.ddosdefense.httpfilter.HTTPInterceptor.main(HTTPInterceptor.java:66)
Caused by: java.lang.ClassNotFoundException: org.jboss.netty.channel.socket.ServerSocketChannelFactory
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
Inside the jar file all the libraries are present.
In the .classpath file the netty jar library is present:
<classpathentry kind="lib" path="ddos2_lib/netty-3.6.2.Final.jar"/>
When I execute the project in eclipse it works perfectly. Anyone has an idea how to solve this problem?
Thanks in advance!
Most likely you don't have the jar packaged into the jar you produce or missed to specify the netty jar via the -cp option.
Related
When I try to do java -jar app.jar I get this:
Exception in thread "JavaFX Application Thread" Exception in thread "main"
java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
at tao.qaflash.GUI.<clinit>(GUI.java:14)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplicationWithArgs$156(LauncherImpl.java:352)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 12 more
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.NullPointerException
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:383)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
... 5 more
My environment is: Java 1.8.0_92, Gradle 2.16, Eclipse Mars 4.5.0, Java FX.
Also I have googled this error and I have tried everything from there , but with no success. I tried to add to the build.gradle as dependencies slfj-simple, log4j, logback-classic, slf4j-jdk14,junit,vaadin-slf4j-jdk14 but the error kept appearing.
When I run the application from Eclipse, everything works fine, the logs are written, only when I try to run the jar from command line, I get this ClassNotFoundException.
build.gradle looks like :
dependencies {
compile 'net.sf.staf:jstaf:3.4.4'
// SLF4J API module which will be used for logging
compile 'org.slf4j:slf4j-api:1.7.21'
// Log4J2 logging framework including the binding module to slf4j
compile 'org.apache.logging.log4j:log4j-slf4j-impl:2.5'
compile 'org.apache.logging.log4j:log4j-api:2.5'
compile 'org.apache.logging.log4j:log4j-core:2.5'
testCompile 'junit:junit:4.12'
testCompile "org.testfx:testfx-core:4.0.+"
testCompile "org.testfx:testfx-junit:4.0.+"
}
Any help is greately appreciated.
Simple: the classpath that you are using when trying to execute your JAR file does not contain the required sl4j logger library.
That is all there is to this. This is not about your build setup - it is about the setup that gets used when you run java on the command line!
See here for further reading.
I have unzipped the zip file that was created in the dist folder and it works :) because in the lib folder there was the sl4j-api.
It seems you need slf4j at runtime as well. Have a look at the gradle dependency configuration options
There is my following problem :
java.lang.ClassNotFoundException: javax.vecmath.Point3f
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)
at org.netbeans.ProxyClassLoader.loadClass(ProxyClassLoader.java:244)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
Caused: java.lang.NoClassDefFoundError: javax/vecmath/Point3f
I don't really understand why it can't find this class. I have the latest version of Java 1.7. Any ideas ?
Best regards.
If you are using Maven, try to add this dependency please :
<dependency>
<groupId>java3d</groupId>
<artifactId>vecmath</artifactId>
<version>1.3.1</version>
</dependency>
Otherwise, download the latest java3d library : https://java3d.java.net/binary-builds.html
After imported, update your imports in your Java class and it should be fine to compile.
Point3f is part of the Java3D API, which is a separate download. Read more here.
Cheers,
I am trying to create a play framework project in intellij idea .But when i am trying to run or debug my project it shows the below error in my console.
java.lang.NoClassDefFoundError: org/jboss/netty/channel/ChannelFactory
at play.api.test.TestServer.start(Selenium.scala:142)
at play.api.test.PlayRunners$class.running(Helpers.scala:59)
at play.api.test.Helpers$.running(Helpers.scala:364)
at play.api.test.WithBrowser.around(Specs.scala:57)
at org.specs2.mutable.Around$class.delayedInit(Around.scala:12)
at play.api.test.WithBrowser.delayedInit(Specs.scala:45)
at IntegrationSpec$$anonfun$1$$anonfun$apply$1$$anon$1.<init>(IntegrationSpec.scala:17)
at IntegrationSpec$$anonfun$1$$anonfun$apply$1.apply(IntegrationSpec.scala:17)
at IntegrationSpec$$anonfun$1$$anonfun$apply$1.apply(IntegrationSpec.scala:17)
at org.specs2.specification.FragmentsBuilder$$anon$1.asResult(FragmentsBuilder.scala:142)
at org.specs2.specification.FragmentsBuilder$$anon$1.asResult(FragmentsBuilder.scala:141)
at org.specs2.execute.AsResult$.apply(Result.scala:250)
at org.specs2.specification.Example$$anonfun$apply$1.apply(Fragment.scala:209)
at org.specs2.specification.Example$$anonfun$apply$1.apply(Fragment.scala:209)
at org.specs2.specification.Example.execute(Fragment.scala:176)
at org.specs2.specification.FragmentExecution$$anonfun$1.apply(FragmentExecution.scala:52)
at org.specs2.specification.FragmentExecution$$anonfun$1.apply(FragmentExecution.scala:52)
at org.specs2.execute.ResultExecution$class.execute(ResultExecution.scala:22)
at org.specs2.execute.ResultExecution$.execute(ResultExecution.scala:116)
at org.specs2.specification.FragmentExecution$class.executeBody(FragmentExecution.scala:28)
at org.specs2.runner.JUnitRunner$$anon$3.executeBody(JUnitRunner.scala:43)
at org.specs2.specification.FragmentExecution$class.execute(FragmentExecution.scala:52)
at org.specs2.runner.JUnitRunner$$anon$3.execute(JUnitRunner.scala:43)
at org.specs2.specification.FragmentExecution$$anonfun$executeFragment$1$$anonfun$apply$1.apply(FragmentExecution.scala:35)
at org.specs2.specification.FragmentExecution$$anonfun$executeFragment$1$$anonfun$apply$1.apply(FragmentExecution.scala:35)
at org.specs2.control.Exceptions$class.catchAllOr(Exceptions.scala:54)
at org.specs2.control.Exceptions$.catchAllOr(Exceptions.scala:109)
at org.specs2.specification.FragmentExecution$$anonfun$executeFragment$1.apply(FragmentExecution.scala:35)
at org.specs2.specification.FragmentExecution$$anonfun$executeFragment$1.apply(FragmentExecution.scala:35)
at org.specs2.reporter.JUnitReporter$$anonfun$executeFragment$1.execute$1(JUnitReporter.scala:47)
at org.specs2.reporter.JUnitReporter$$anonfun$executeFragment$1.apply(JUnitReporter.scala:54)
at org.specs2.reporter.JUnitReporter$$anonfun$executeFragment$1.apply(JUnitReporter.scala:46)
at org.specs2.reporter.DefaultExecutionStrategy$class.executeWithBarrier$1(ExecutionStrategy.scala:103)
at org.specs2.reporter.DefaultExecutionStrategy$$anonfun$executeConcurrently$1$$anonfun$apply$2.apply(ExecutionStrategy.scala:105)
at org.specs2.reporter.DefaultExecutionStrategy$$anonfun$executeConcurrently$1$$anonfun$apply$2.apply(ExecutionStrategy.scala:105)
at scalaz.concurrent.Promise$Unfulfilled$.fulfill(Promise.scala:125)
at scalaz.concurrent.Promise$Done.eval(Promise.scala:153)
at scalaz.concurrent.Promise$$anonfun$e$1.apply(Promise.scala:17)
at scalaz.concurrent.Promise$$anonfun$e$1.apply(Promise.scala:17)
at scalaz.concurrent.Actor.batchHandle(Actor.scala:73)
at scalaz.concurrent.Actor.scalaz$concurrent$Actor$$act(Actor.scala:57)
at scalaz.concurrent.Actor$$anonfun$schedule$1.apply$mcV$sp(Actor.scala:52)
at scalaz.concurrent.Actor$$anonfun$schedule$1.apply(Actor.scala:52)
at scalaz.concurrent.Actor$$anonfun$schedule$1.apply(Actor.scala:52)
at scalaz.concurrent.StrategysLow$$anon$3$$anon$4.call(Strategy.scala:65)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.ClassNotFoundException: org.jboss.netty.channel.ChannelFactory
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)
... 50 more
java.lang.RuntimeException: java.lang.NoClassDefFoundError: org/jboss/netty/channel/ChannelFactory
at play.api.test.TestServer.start(Selenium.scala:146)
at play.api.test.PlayRunners$class.running(Helpers.scala:59)
at play.api.test.Helpers$.running(Helpers.scala:364)
at play.api.test.WithBrowser.around(Specs.scala:57)
at play.api.test.WithBrowser.delayedInit(Specs.scala:45)
at IntegrationSpec$$anonfun$1$$anonfun$apply$1$$anon$1.<init>(IntegrationSpec.scala:17)
at IntegrationSpec$$anonfun$1$$anonfun$apply$1.apply(IntegrationSpec.scala:17)
at IntegrationSpec$$anonfun$1$$anonfun$apply$1.apply(IntegrationSpec.scala:17)
Caused by: java.lang.NoClassDefFoundError: org/jboss/netty/channel/ChannelFactory
at play.api.test.TestServer.start(Selenium.scala:142)
... 7 more
Caused by: java.lang.ClassNotFoundException: org.jboss.netty.channel.ChannelFactory
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
... 8 more
Disconnected from the target VM, address: '127.0.0.1:1698', transport: 'socket'
Process finished with exit code -1
I have play plugins installed in intellij and created my project from File -> New Project -> scala ->Play2.x
Why my play project is not able to run?
Thanks
First of all , check that your class name and file name is same, if it is true.
Then , check that your class path is specified properly and after the declaration of the class path you have not edited the folders name which are there in the class path or have changed there location .
I'm looking for an updated answer to this question. Previously, a minimal Neo4j "Hello World" app required two jars. Now it apparently requires some other jars, but I don't know which ones.
If I include neo4j-kernel-2.1.2 and geronimo-jta_1.1_spec-1.1.1 as suggested in that other question, I get this error:
java.lang.ClassNotFoundException: org.neo4j.collection.primitive.PrimitiveLongIterator
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)
If I add neo4j-primitive-collections-2.1.2, I then get an error with this root cause:
Caused by: java.lang.IllegalArgumentException: No schema index provider org.neo4j.kernel.api.index.SchemaIndexProvider found.
Answers on this question suggest I need neo4j-lucene-index. When I add that jar, I get this error:
Caused by: java.lang.ClassNotFoundException: org.apache.lucene.store.Directory
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)
Finally, when I add lucene-core, I get this error:
Caused by: java.lang.ClassNotFoundException: org.apache.lucene.document.Fieldable
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)
What do I need to add to get past that?
I believe I've found the minimal set of dependencies for Neo4j 2.x. I was originally trying to use lucene-core-4.9.0, but the org.apache.lucene.document.Fieldable interface was removed from that library sometime after version 3.6.2. The minimal set of jars is thus:
neo4j-kernel (2.1.2)
neo4j-primitive-collections (2.1.2)
neo4j-lucene-index (2.1.2)
lucene-core (3.6.2)
jta (1.1)
These weigh in at about 4.5 MB, which is larger than I'd like, but I guess I can live with it. I've also been told that neo4j-lucene-index (which is what requires lucene-core) is not strictly required. Like jta, it's actually only one possible implementation of a required interface. But I don't know of any other implementation.
As the other answer correctly mention the most easy way is use a build tool featuring a dependency manager. Most widely these days used are Maven and Gradle. Both use Maven Central repository by default to pull dependencies and transitive dependencies.
Depending whether your embedded application uses cypher or not you should add the following dependencies your pom.xml:
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-lucene-index</artifactId>
<version>2.1.2</version>
</dependency>
or (when cypher is used):
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-cypher</artifactId>
<version>2.1.2</version>
</dependency>
Both of them transitively include all necessary libraries.
I'm trying to generate Java classes with WSDL2Java. I run the simplest example and get errors.
$ jar tvf XmlSchema-1.4.7.jar | grep org/apache/ws/commons/schema/XmlSchema.class
14803 Wed Sep 22 17:28:44 CEST 2010 org/apache/ws/commons/schema/XmlSchema.class
$ ./bin/wsdl2java.sh -classpath $(echo lib/*.jar | tr ' ' ';') -uri HelloWorld.wsdl
Using AXIS2_HOME: /C/Documents and Settings/ixos/axis2-1.6.2
Using JAVA_HOME: /C/Program Files/Java/jdk1.7.0_07/
Retrieving document at 'samples/wsdl/Axis2SampleDocLit.wsdl'.
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/ws/commons/schema/XmlSchema
at org.apache.axis2.description.WSDLToAxisServiceBuilder.<init>(WSDLToAxisServiceBuilder.java:103)
at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.<init>(WSDL11ToAxisServiceBuilder.java:226)
at org.apache.axis2.description.WSDL11ToAllAxisServicesBuilder.<init>(WSDL11ToAllAxisServicesBuilder.java:63)
at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerationEngine.java:166)
at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35)
at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24)
Caused by: java.lang.ClassNotFoundException: org.apache.ws.commons.schema.XmlSchema
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)
... 6 more
The libraries are in the path and now I'm stuck and don't know to do next. Google isn't helpful at all ...
CLASSPATH
lib/XmlSchema-1.4.7.jar;lib/activation-1.1.jar;lib/antlr-2.7.7.jar;lib/apache-mime4j-core-0.7.2.jar;lib/axiom-api-1.2.13.jar;lib/axiom-dom-1.2.13.jar;lib/axiom-
impl-1.2.13.jar;lib/axis2-adb-1.6.2.jar;lib/axis2-adb-codegen-1.6.2.jar;lib/axis2-ant-plugin-1.6.2.jar;lib/axis2-clustering-1.6.2.jar;lib/axis2-codegen-1.6.2.ja
r;lib/axis2-corba-1.6.2.jar;lib/axis2-fastinfoset-1.6.2.jar;lib/axis2-java2wsdl-1.6.2.jar;lib/axis2-jaxbri-1.6.2.jar;lib/axis2-jaxws-1.6.2.jar;lib/axis2-jibx-1.
6.2.jar;lib/axis2-json-1.6.2.jar;lib/axis2-kernel-1.6.2.jar;lib/axis2-metadata-1.6.2.jar;lib/axis2-mtompolicy-1.6.2.jar;lib/axis2-saaj-1.6.2.jar;lib/axis2-soapm
onitor-servlet-1.6.2.jar;lib/axis2-spring-1.6.2.jar;lib/axis2-transport-http-1.6.2.jar;lib/axis2-transport-local-1.6.2.jar;lib/axis2-xmlbeans-1.6.2.jar;lib/bcel
-5.1.jar;lib/commons-cli-1.2.jar;lib/commons-codec-1.3.jar;lib/commons-fileupload-1.2.jar;lib/commons-httpclient-3.1.jar;lib/commons-io-1.4.jar;lib/commons-logg
ing-1.1.1.jar;lib/geronimo-annotation_1.0_spec-1.1.jar;lib/geronimo-jaxws_2.2_spec-1.0.jar;lib/geronimo-jta_1.1_spec-1.1.jar;lib/geronimo-saaj_1.3_spec-1.0.1.ja
r;lib/geronimo-stax-api_1.0_spec-1.0.1.jar;lib/geronimo-ws-metadata_2.0_spec-1.1.2.jar;lib/httpcore-4.0.jar;lib/jalopy-1.5rc3.jar;lib/jaxb-api-2.1.jar;lib/jaxb-
impl-2.1.7.jar;lib/jaxb-xjc-2.1.7.jar;lib/jaxen-1.1.1.jar;lib/jaxws-tools-2.1.3.jar;lib/jettison-1.0-RC2.jar;lib/jibx-bind-1.2.jar;lib/jibx-run-1.2.jar;lib/jsr3
11-api-1.0.jar;lib/juli-6.0.16.jar;lib/log4j-1.2.15.jar;lib/mail-1.4.jar;lib/mex-1.6.2-impl.jar;lib/neethi-3.0.2.jar;lib/regexp-1.2.jar;lib/tribes-6.0.16.jar;li
b/woden-api-1.0M9.jar;lib/woden-impl-commons-1.0M9.jar;lib/woden-impl-dom-1.0M9.jar;lib/wsdl4j-1.6.2.jar;lib/wstx-asl-3.2.9.jar;lib/xalan-2.7.0.jar;lib/xml-reso
lver-1.2.jar;lib/xmlbeans-2.3.0.jar
The problem is with your jdk (1.7): axis2 doesn't get along with it. Download the jdk 1.6 library and link it in your eclipse, then re-try.