java.lang.NoClassDefFoundError:org / apache / ws / commons / schema / resolver / URIResolver

时间:2016-02-03 21:28:50

标签: servlets axis2 noclassdeffounderror

我试图创建一个简单的" Hello"网络服务,我收到以下错误:

type Exception report

message Servlet.init() for servlet AxisServlet threw exception

description The server encountered an internal error that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Servlet.init() for servlet AxisServlet threw exception
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
java.lang.Thread.run(Thread.java:745)

root cause

java.lang.NoClassDefFoundError: org/apache/ws/commons/schema/resolver/URIResolver
org.apache.axis2.deployment.ModuleDeployer.deploy(ModuleDeployer.java:128)
org.apache.axis2.deployment.repository.util.DeploymentFileData.deploy(DeploymentFileData.java:144)
org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:585)
org.apache.axis2.deployment.RepositoryListener.init(RepositoryListener.java:264)
org.apache.axis2.deployment.RepositoryListener.init2(RepositoryListener.java:66)
org.apache.axis2.deployment.RepositoryListener.<init>(RepositoryListener.java:61)
org.apache.axis2.deployment.DeploymentEngine.loadRepository(DeploymentEngine.java:152)
org.apache.axis2.deployment.WarBasedAxisConfigurator.getAxisConfiguration(WarBasedAxisConfigurator.java:233)
org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:64)
org.apache.axis2.transport.http.AxisServlet.initConfigContext(AxisServlet.java:620)
org.apache.axis2.transport.http.AxisServlet.init(AxisServlet.java:471)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
java.lang.Thread.run(Thread.java:745)

root cause

java.lang.ClassNotFoundException: org.apache.ws.commons.schema.resolver.URIResolver
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1856)
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1705)
org.apache.axis2.deployment.ModuleDeployer.deploy(ModuleDeployer.java:128)
org.apache.axis2.deployment.repository.util.DeploymentFileData.deploy(DeploymentFileData.java:144)
org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:585)
org.apache.axis2.deployment.RepositoryListener.init(RepositoryListener.java:264)
org.apache.axis2.deployment.RepositoryListener.init2(RepositoryListener.java:66)
org.apache.axis2.deployment.RepositoryListener.<init>(RepositoryListener.java:61)
org.apache.axis2.deployment.DeploymentEngine.loadRepository(DeploymentEngine.java:152)
org.apache.axis2.deployment.WarBasedAxisConfigurator.getAxisConfiguration(WarBasedAxisConfigurator.java:233)
org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:64)
org.apache.axis2.transport.http.AxisServlet.initConfigContext(AxisServlet.java:620)
org.apache.axis2.transport.http.AxisServlet.init(AxisServlet.java:471)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
java.lang.Thread.run(Thread.java:745)

有人可以帮忙吗?我在互联网上搜索,发现有一个文件httpcore-xx.jar必须放在apache tomcat lib目录中。我试过了,但它没有用。我使用的是ubuntu 14.04 LTS和eclipse。我还尝试清理我的项目并再次构建。它没有用。我面临的是页面正在加载到Web浏览器上,但是当我点击服务时,会出现上一个错误。我试图实施的教程是http://codeoncloud.blogspot.gr/2012/12/create-java-web-service-in-eclipse_3982.html

4 个答案:

答案 0 :(得分:26)

我遇到了同样的问题,并通过将xmlschema-core-*.jar表单axis2-*/lib/复制到my_project_root_directory/WebContent/WEB-INF/lib/成功解决了问题。

答案 1 :(得分:2)

我也试图创建一个简单的Web服务(配置为:动态Web模块2.5),使用: - Tomcat 8.0和 - Axis2 1.7.4(axis2-1.7.4-war)。

我收到以下错误:

[WARN] Web application uses org.apache.axis2.transport.http.AxisAdminServlet; please update web.xml to use org.apache.axis2.webapp.AxisAdminServlet instead
[INFO] Clustering has been disabled
[WARN] Unable to instantiate deployer org.apache.axis2.deployment.ServiceDeployer; see debug logs for more details
abr 13, 2017 9:03:35 PM org.apache.catalina.core.ApplicationContext log
GRAVE: StandardWrapper.Throwable
java.lang.NoClassDefFoundError: org/apache/ws/commons/schema/resolver/URIResolver
    at org.apache.axis2.deployment.ModuleDeployer.deploy(ModuleDeployer.java:128)   
    (...) 

Caused by: java.lang.ClassNotFoundException: org.apache.ws.commons.schema.resolver.URIResolver
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1332)
    ... 24 more

abr 13, 2017 9:03:35 PM org.apache.catalina.core.StandardContext loadOnStartup
GRAVE: Servlet [AxisAdminServlet] in web application [/AxisTestWebServer] threw load() exception
java.lang.ClassNotFoundException: org.apache.ws.commons.schema.resolver.URIResolver
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1332)
    (...)

第一个问题是[警告]:

&#34; [WARN] Web应用程序使用org.apache.axis2.transport.http.AxisAdminServlet; 请更新web.xml以使用org.apache.axis2.webapp.AxisAdminServlet而不是&#34;

解决方案: 我解决了根据需要更新web.xml的问题。

第二个问题是:

  • java.lang.NoClassDefFoundError:org / apache / ws / commons / schema / resolver / URIResolver
  • 引起:java.lang.ClassNotFoundException:org.apache.ws.commons.schema.resolver.URIResolver

出于某种原因,当我创建一个配置了Axis2的新动态Web项目时, xmlschema-core-2.2.1.jar(axis2 / WEB-INF / lib)未导入WebContent / WEB-INF / lib。

解决方案: 所以我不得不把它贴在那里。

之后,jstl的其他问题:

  • 当我尝试在WebService上以管理员身份登录时,出现了此问题
  

abr 13,2017 9:54:30 PM org.apache.catalina.core.ApplicationDispatcher   调用GRAVE:servlet jsp的Servlet.service()抛出异常   org.apache.jasper.JasperException:绝对的uri:   无法在web.xml中解析http://java.sun.com/jsp/jstl/core   或者使用此应用程序部署的jar文件(...)

解决方案:

我下载了这些罐子: - taglibs-standard-impl-1.2.5.jar和 - taglibs-standard-spec-1.2.5.jar

来自tomcat.apache.org/download-taglibs.cgi

所以我不得不将它们粘贴在WebContent / WEB-INF / lib中。

所有人。我希望它有所帮助。

答案 2 :(得分:0)

IT也为我工作。 axis2-1.7和axis2-1.6都适用于我,只是将xml-core复制到web / lib文件夹并构建路径并且工作正常。

答案 3 :(得分:0)

这对我有用:

https://yiingw.wordpress.com/2018/02/12/axis2-java-lang-noclassdeffounderror-org-apache-ws-commons-schema-utils-namespaceprefixlist/

  

原因::Axis2 1.7.x使用的XmlSchema 2.2.x与   Axis2 1.6.x和Eclipse不会将新版本的XmlSchema复制到   Web应用程序。

     

解决方案:从$ AXIS2_HOME / lib手动复制xmlschema-core-2.2.1.jar   到Eclipse项目目录WebContent / WEB-INF / lib,关闭并   生成Web服务客户端之前,请重新打开Eclipse。