HTTP Status 500 - Servlet.init() for servlet cxf threw exception

4.4k Views Asked by At

I'm trying to Create RESTful web service using WSO2 Developer studio, I'm new to this, So i used this tutorial http://codeoncloud.blogspot.com/2015/02/build-simple-java-jax-rs-restful-web.html.

When i did Deploy the web service in WSO2 Application server, then its work fine, but After clicking Find Services i can't see available RESTful services. I'm getting this error

    HTTP Status 500 - Servlet.init() for servlet cxf threw exception

type Exception report

message Servlet.init() for servlet cxf threw exception

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

exception

javax.servlet.ServletException: Servlet.init() for servlet cxf threw exception
    org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
    org.wso2.carbon.statistics.webapp.RequestIntercepterValve.invoke(RequestIntercepterValve.java:43)
    org.wso2.carbon.bam.webapp.stat.publisher.WebAppStatisticPublisherValve.invoke(WebAppStatisticPublisherValve.java:104)
    org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:178)
    org.wso2.carbon.tomcat.ext.valves.CarbonTomcatValve$1.invoke(CarbonTomcatValve.java:47)
    org.wso2.carbon.webapp.mgt.TenantLazyLoaderValve.invoke(TenantLazyLoaderValve.java:56)
    org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:47)
    org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:141)
    org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:156)
    org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
    org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:52)
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
    org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
    org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1653)
    java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    java.lang.Thread.run(Thread.java:745)
2

There are 2 best solutions below

0
On

This error is telling you that your class name is incorrect somewhere.

Quick Tip! - Scroll down and read the portion right below the error message that says "Caused by:". It will give you more insight.

Check your cxf-servlet.xml file to make sure the fully qualified class name actually exists in the specified package.

Also, check your classes that are annotated with @WebService to make sure that your endpointInterface parameter is correct.

Hope this helps.

0
On

This error can happen when you are using invalid class in cxf-servlet.xml. So make sure that the value for class is correct in the cxf-servlet.xml. You can find this file inside src>>main>>webapp>>WEB-INF directory.