1

i have a spring mvc project in eclipe spring tools suite IDE and i wanted to add some classes from a WSDL, i try using maven-jaxb2-plugin but it dont do nothing when i update my project using maven. So i try to create a web service client in eclipse and in the service definition i put my WSDL url but after a few seconds loading it gives me a Invalid segment definition, after all this i try creating a Java Application Project in Netbeans and then add a web services client in that project with my WSDL url this time it worked!, so i try to add the .JAR file of that project that locates in D:/Users/myUser/Documents/NetBeansProjects/ImportClassesFromWSDL/dist/ImportClassesFromWSDL.jar

i added this jar as a external JAR following this steps How to import a jar in Eclipse , the .JAR was added but i have this warning Classpath entry D:/Users/myUser/Documents/NetBeansProjects/ImportClassesFromWSDL/dist/ImportClassesFromWSDL.jar will not be exported or published. Runtime ClassNotFoundExceptions may result. WSproject P/WSproject Classpath Dependency Validator Message in the eclipse text editor i can write with no problems the name of the classes and create objects of this classes with no problem, but at the moment when i run my project and get to the part when i create this objects from the imported classes i get a class not found exception

HTTP 500 - Handler processing failed; nested exception is java.lang.NoClassDefFoundError: mycompany/myws/myschema/myClassWs

:  Servlet.service()  servlet [appServlet]  [/app]  [Handler processing failed; nested exception is java.lang.NoClassDefFoundError: mycompany/myws/myschema/myClassWs]     java.lang.ClassNotFoundException: mycompany/myws/myschema/myClassWs
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571)
    at com.pruebaWsCompany.app.HomeController.myWsPage(HomeController.java:54)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:213)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:96)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:617)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:578)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Community
  • 1
  • 1
stackUser2000
  • 1,615
  • 11
  • 32
  • 55
  • 1
    just copy your jar to `WEB-INF/lib` directory in your project, that way its available during run-time as well – Arkantos Feb 26 '15 at 15:10
  • thanks i no longer have the classNotFound exception but is there a way to remove that Warning `Classpath entry D:/Users/myUser/Documents/NetBeansProjects/ImportClassesFromWSDL/dist/ImportClassesFromWSDL.jar will not be exported or published. Runtime ClassNotFoundExceptions may result. WSproject P/WSproject Classpath Dependency Validator Message` in a legit way? nad other question what happends if there a new methods or classes in the wsdl? by doing in it in this way is there no way to update my JAR right? should i see this as a temporary solution and try to do it using maven-plug – stackUser2000 Feb 26 '15 at 15:28
  • I suggest you use `maven-jaxb2-plugin` that way when there's a change in your WSDL all the changes will be picked up when you do a new maven build. It will build your updated source files first from WSDL and then add them to your `src` directory. Check the plugin configuration options [here](http://mojo.codehaus.org/jaxb2-maven-plugin/xjc-mojo.html) – Arkantos Feb 26 '15 at 15:43
  • @Arkantos i try in that in the firts place but i have this problem http://stackoverflow.com/questions/28728528/error-trying-to-generate-classes-from-a-wsdl-using-maven-in-spring-mvc?noredirect=1#comment45744426_28728528 my error is that after i update my maven pom.xml nothing happends, my classes dont get created – stackUser2000 Feb 26 '15 at 16:42
  • I posted my answer for that question, that should resolve the issue with generating sources. For more info on possible configurations for `maven-jaxb2-plugin`, have a look at this [cheat sheet](https://github.com/highsource/maven-jaxb2-plugin/wiki/Configuration-Cheat-Sheet) – Arkantos Feb 26 '15 at 17:06

1 Answers1

0

I got this to work, I copied the .jar to my WEB-INF/lib directory.

Thanks for @Arkantos who suggested it.

enkor
  • 7,527
  • 3
  • 31
  • 55
stackUser2000
  • 1,615
  • 11
  • 32
  • 55