如何在" / dist"中导入.JAR文件netbeans中的Java应用程序项目的文件夹到eclipse

时间:2015-02-26 15:04:57

标签: java eclipse spring web-services netbeans

我在eclipe spring工具套件IDE中有一个spring mvc项目,我想从WSDL中添加一些类,我尝试使用maven-jaxb2-plugin但是当我使用maven更新我的项目时它什么都不做。所以我尝试在eclipse中创建一个Web服务客户端,在服务定义中我把我的WSDL url但是在加载几秒后它给了我一个Invalid segment definition,毕竟我尝试在Netbeans中创建一个Java应用程序项目然后这次使用我的WSDL url在该项目中添加一个Web服务客户端!这样我尝试添加位于D:/Users/myUser/Documents/NetBeansProjects/ImportClassesFromWSDL/dist/ImportClassesFromWSDL.jar

中的该项目的.JAR文件

我按照这个步骤How to import a jar in Eclipse添加了这个jar作为外部JAR,添加了.JAR但是我有这个警告 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 在eclipse文本编辑器中,我可以毫无问题地编写类的名称并创建这个类的对象没有问题,但是当我运行我的项目并且从导入的类创建这个对象时到达该部分的那一刻我得到一个未找到类的异常

HTTP 500 - 处理程序处理失败;嵌套异常是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)

1 个答案:

答案 0 :(得分:0)

我让它工作,我将.jar复制到我的WEB-INF / lib目录。

感谢@Arkantos的建议。