Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I'm trying to create a simple "Hello" web service and I'm getting the following error:

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)

Can somebody help? I searched on the Internet and I found that there is a file httpcore-xx.jar that must be placed in apache tomcat lib directory. I tried that but it didn't work. I'm using ubuntu 14.04 LTS and eclipse. I also tried to clean my Project and build again. It didn't work. What I'm facing is that the page is loading on the web Browser but when I click on services the previous error comes up. The tutorial I'm trying to implement is http://codeoncloud.blogspot.gr/2012/12/create-java-web-service-in-eclipse_3982.html

like image 653
George Melidis Avatar asked Feb 03 '16 21:02

George Melidis


2 Answers

I had the same problem and successfully resolved it by copying xmlschema-core-*.jar form axis2-*/lib/ to my_project_root_directory/WebContent/WEB-INF/lib/.

like image 184
liqing Avatar answered Oct 22 '22 02:10

liqing


I'm trying to create a simple web service too (configured: Dynamic Web Module 2.5), using: - Tomcat 8.0 and - Axis2 1.7.4 (axis2-1.7.4-war).

I'm getting the following errors:

[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)
    (...)

The first problem was a [WARN]:

"[WARN] Web application uses org.apache.axis2.transport.http.AxisAdminServlet; please update web.xml to use org.apache.axis2.webapp.AxisAdminServlet instead"

Solution: I solved it updating web.xml as required.


The second problem was :

  • java.lang.NoClassDefFoundError: org/apache/ws/commons/schema/resolver/URIResolver
  • Caused by: java.lang.ClassNotFoundException: org.apache.ws.commons.schema.resolver.URIResolver

For some reason, when I created a new Dynamic Web Project configured with Axis2, the xmlschema-core-2.2.1.jar (axis2/WEB-INF/lib) was not imported to WebContent/WEB-INF/lib.

Solution: So I had to paste it there.


After that, other problem with jstl:

  • This problem came up when I tried to login as a Admin on the WebService

abr 13, 2017 9:54:30 PM org.apache.catalina.core.ApplicationDispatcher invoke GRAVE: Servlet.service() for servlet jsp threw exception org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application (...)

Solution:

I downloaded these jars: - taglibs-standard-impl-1.2.5.jar and - taglibs-standard-spec-1.2.5.jar

from tomcat.apache.org/download-taglibs.cgi

So I had to pasted them in the WebContent/WEB-INF/lib too.

that's all folks. I hope it help.

like image 31
Davijr Avatar answered Oct 22 '22 02:10

Davijr