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.
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
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'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.
I have a problem with compiling this java project https://github.com/nkitsul/pdfformfiller2
mkdir PdfFormFiller
cd PdfFormFiller/
git clone https://github.com/nkitsul/pdfformfiller2.git .
cd lib/
wget https://github.com/itext/itextpdf/releases/download/5.5.0/itext-5.5.0.zip
unzip itext-5.5.0.zip
cd ..
mkdir bin
javac -cp lib/itextpdf-5.5.0.jar PdfFormFiller.java -d bin/
java -cp ./bin PdfFormFiller.PdfFormFiller
After that I get this:
Exception in thread "main" java.lang.NoClassDefFoundError: com/itextpdf/text/DocumentException
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2531)
at java.lang.Class.getMethod0(Class.java:2774)
at java.lang.Class.getMethod(Class.java:1663)
at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486)
Caused by: java.lang.ClassNotFoundException: com.itextpdf.text.DocumentException
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)
... 6 more
What am I doing wrong?
My OS - Debian wheezy java version "1.7.0_55" OpenJDK Runtime
Environment (IcedTea 2.4.7) (7u55-2.4.7-1~deb7u1) OpenJDK 64-Bit
Server VM (build 24.51-b03, mixed mode)
javac 1.7.0_55
Add the iText JAR file to the runtime classpath
java -cp ./bin:lib/itextpdf-5.5.0.jar PdfFormFiller.PdfFormFiller
i'm trying a simple example about Struts2 ,i encountered an below issue
----------------
Mar 02, 2014 7:16:05 PM org.apache.catalina.core.ApplicationDispatcher invoke SEVERE: Servlet.service() for servlet jsp threw exception
------------------------------------------------------------------------
java.lang.ClassNotFoundException: javax.el.ELContext
----------------------------------------------------
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 java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2442)
at java.lang.Class.privateGetPublicMethods(Class.java:2562)
at java.lang.Class.privateGetPublicMethods(Class.java:2578)
at java.lang.Class.privateGetPublicMethods(Class.java:2578)
at java.lang.Class.getMethods(Class.java:1427)
at freemarker.ext.beans.BeansWrapper.discoverAccessibleMethods(BeansWrapper.java:1395)
at freemarker.ext.beans.BeansWrapper.discoverAccessibleMethods(BeansWrapper.java:1385)
at freemarker.ext.beans.BeansWrapper.populateClassMapWithBeanInfo(BeansWrapper.java:1129)
at freemarker.ext.beans.BeansWrapper.populateClassMap(BeansWrapper.java:1072)
at freemarker.ext.beans.BeansWrapper.introspectClassInternal(BeansWrapper.java:1010)
at freemarker.ext.beans.BeansWrapper.introspectClass(BeansWrapper.java:969)
at freemarker.ext.beans.BeanModel.<init>(BeanModel.java:140)
at freemarker.ext.beans.StringModel.<init>(StringModel.java:90)
at freemarker.ext.beans.StringModel$1.create(StringModel.java:75)
at freemarker.ext.beans.BeansModelCache.create(BeansModelCache.java:45)
at freemarker.ext.util.ModelCache.getInstance(ModelCache.java:115)
at freemarker.ext.beans.BeansWrapper.wrap(BeansWrapper.java:468)
at freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:867)
at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:106)
at freemarker.core.MethodCall._getAsTemplateModel(MethodCall.java:93)
at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
at freemarker.core.ExistsExpression._getAsTemplateModel(ExistsExpression.java:71)
.........
It's it caused by the conflict of of the packages i import?
The Apache Tomcat web server already contains and loaded this classes from el-api.jar. To compile your application you might also include Java EE libraries including javax.servlet.jsp.jar but it's not necessary to deploy them. To choose which classes are available between classloaders see Apache Tomcat 7: Class Loader HOW-TO the documentation page.