我现在在Eclipse中使用Web服务一直在努力。 每当我得到一些工作,它似乎只是基于运气,我已经以多种方式尝试了一切。
我的最新问题涉及以下方面: 我有一个使用大量外部引用(jar)的java应用程序。 我已经使用Fat-jar插件(http://fjep.sourceforge.net/)将这个java项目导出到一个简单的jar文件中,以确保导出的jar包含所有需要的资源。 然后,我创建了一个动态Web项目,并将之前的jar添加到此项目中。 当我做一些基本测试时,一切正常,即Eclipse找到所有需要的引用。
但是,当我尝试创建一个Web服务时,其方法使用与测试完全相同的逻辑,我得到错误。 我不明白为什么我得到一个ClassNotFoundException,因为就像我之前说过的那样,在进行本地测试时,Eclipse会找到所有需要的资源。
[INFO] Deploying module: addressing-1.6.1 - file:/C:/Users/Flamant/My master/code/WorkspaceEclipse/.metadata/.plugins/org.eclipse.wst.server.core/tmp3/wtpwebapps /org.openmarkov.webservice.engine/WEB-INF/modules/addressing-1.6.1.mar
[INFO] Deploying module: metadataExchange-1.6.1 - file:/C:/Users/Flamant/My master/code/WorkspaceEclipse/.metadata/.plugins/org.eclipse.wst.server.core/tmp3/wtpwebapps /org.openmarkov.webservice.engine/WEB-INF/modules/mex-1.6.1.mar
[INFO] Deploying module: mtompolicy-1.6.1 - file:/C:/Users/Flamant/My master/code/WorkspaceEclipse/.metadata/.plugins/org.eclipse.wst.server.core/tmp3/wtpwebapps /org.openmarkov.webservice.engine/WEB-INF/modules/mtompolicy-1.6.1.mar
[INFO] Deploying module: ping-1.6.1 - file:/C:/Users/Flamant/My master/code/WorkspaceEclipse/.metadata/.plugins/org.eclipse.wst.server.core/tmp3/wtpwebapps /org.openmarkov.webservice.engine/WEB-INF/modules/ping-1.6.1.mar
[INFO] Deploying module: script-1.6.1 - file:/C:/Users/Flamant/My master/code/WorkspaceEclipse/.metadata/.plugins/org.eclipse.wst.server.core/tmp3/wtpwebapps /org.openmarkov.webservice.engine/WEB-INF/modules/scripting-1.6.1.mar
[INFO] Deploying module: soapmonitor-1.6.1 - file:/C:/Users/Flamant/My master/code/WorkspaceEclipse/.metadata/.plugins/org.eclipse.wst.server.core/tmp3/wtpwebapps /org.openmarkov.webservice.engine/WEB-INF/modules/soapmonitor-1.6.1.mar
[INFO] The Engine service, which is not valid, caused java.lang.NoClassDefFoundError: [Lorg/openmarkov/webservice/Finding;
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.privateGetPublicMethods(Unknown Source)
at java.lang.Class.getMethods(Unknown Source)
at org.apache.axis2.description.java2wsdl.bytecode.MethodTable.loadMethods(MethodTable.java:43)
at org.apache.axis2.description.java2wsdl.bytecode.MethodTable.<init>(MethodTable.java:33)
at org.apache.axis2.description.java2wsdl.DefaultSchemaGenerator.<init>(DefaultSchemaGenerator.java:141)
at org.apache.axis2.deployment.util.Utils.fillAxisService(Utils.java:453)
at org.apache.axis2.deployment.ServiceBuilder.populateService(ServiceBuilder.java:389)
at org.apache.axis2.deployment.repository.util.ArchiveReader.buildServiceGroup(ArchiveReader.java:101)
at org.apache.axis2.deployment.repository.util.ArchiveReader.processServiceGroup(ArchiveReader.java:178)
at org.apache.axis2.deployment.ServiceDeployer.deploy(ServiceDeployer.java:82)
at org.apache.axis2.deployment.repository.util.DeploymentFileData.deploy(DeploymentFileData.java:136)
at org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:813)
at org.apache.axis2.deployment.repository.util.WSInfoList.update(WSInfoList.java:144)
at org.apache.axis2.deployment.RepositoryListener.update(RepositoryListener.java:370)
at org.apache.axis2.deployment.RepositoryListener.checkServices(RepositoryListener.java:254)
at org.apache.axis2.deployment.DeploymentEngine.loadServices(DeploymentEngine.java:142)
at org.apache.axis2.deployment.WarBasedAxisConfigurator.loadServices(WarBasedAxisConfigurator.java:283)
at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:95)
at org.apache.axis2.transport.http.AxisServlet.initConfigContext(AxisServlet.java:584)
at org.apache.axis2.transport.http.AxisServlet.init(AxisServlet.java:454)
at org.apache.axis2.webapp.AxisAdminServlet.init(AxisAdminServlet.java:60)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1228)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1147)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1043)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4957)
at org.apache.catalina.core.StandardContext$3.call(StandardContext.java:5284)
at org.apache.catalina.core.StandardContext$3.call(StandardContext.java:5279)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.openmarkov.webservice.Finding
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1678)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1523)
... 34 more
[INFO] org.apache.axis2.deployment.DeploymentException: java.lang.NoClassDefFoundError: [Lorg/openmarkov/webservice/Finding;
[INFO] Deploying Web service: version.aar - file:/C:/Users/Flamant/My master/code/WorkspaceEclipse/.metadata/.plugins/org.eclipse.wst.server.core/tmp3/wtpwebapps/org.openmarkov.webservice.engine/WEB-INF/services/version.aar
[WARN] No transportReceiver for org.apache.axis2.transport.http.AxisServletListener found. An instance for HTTP will be configured automatically. Please update your axis2.xml file!
apr 11, 2012 10:51:45 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8081"]
apr 11, 2012 10:51:45 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8010"]
apr 11, 2012 10:51:45 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 1928 ms
如果有人有想法,我会非常感激。
谢谢, 托马斯
答案 0 :(得分:1)
实际上,您正面临NoClassDefFoundError,当在运行时找不到所需的lib时会发生这种情况...检查libs是否在您的运行时类路径中。
答案 1 :(得分:0)
你的意思是在eclipse环境中你的web服务工作正常,但在你的动态web项目中不起作用?你的动态网络项目中缺少jar?
答案 2 :(得分:0)
确保至少这些 激活1.1.jar, 公理-API-1.2.8.jar, 公理-DOM-1.2.8.jar, 公理IMPL-1.2.8.jar, Axis2的-ADB-1.5.1.jar, Axis2的内核-1.5.1.jar, Axis2的运输-HTTP-1.5.1.jar, Axis2的运输和本地1.5.1.jar, 公地编解码器1.3.jar, 公地文件上传-1.2.jar, 公地httpclient的-3.1.jar, 共享记录-1.1.1.jar, Geronimo的StAX的api_1.0_spec-1.0.1.jar, 的HttpCore-4.0.jar, 邮件1.4.jar, neethi-2.0.4.jar, 沃登-API 1.0M8.jar, 沃登-IMPL-DOM-1.0M8.jar, WSDL4J-1.6.2.jar, wstx-ASL-3.2.4.jar, XMLSchema的1.4.3.jar
答案 3 :(得分:0)
我也遇到了这个问题。就我而言,我没有在[1]文章中清楚地遵循这些步骤。在步骤12中,不要更改“服务项目”名称。