Axis 2 web services in eclipse: Exception java.lang.NoClassDefFoundError: org/apache/http/HttpResponseFactory thrown when Services link clicked
I created the web service using axis2 and deploy through tomcat in eclipse following a Tutorial. Then axis2 homepage get displayed OK. But when the Services link clicked an exception page will get displayed as follows.
type Exception report
message
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.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
java.lang.Thread.run(Unknown Source)
root cause
java.lang.NoClassDefFoundError: org/apache/http/HttpResponseFactory
org.apache.axis2.transport.http.SimpleHTTPServer.init(SimpleHTTPServer.java:116)
org.apache.axis2.engine.ListenerManager.init(ListenerManager.java:74)
org.apache.axis2.transport.http.AxisServlet.init(AxisServlet.java:449)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
java.lang.Thread.run(Unknown Source)
SOLUTION
The reason here is that jar file related to class org.apache.http.HttpResponseFactory is missing to the project which is httpcore-x.jar. It is always not the case that eclipse automatically adds all required libraries. So we need to add this lib to the project. We can find httpcore-x.jar from your axis2 libraries (AXIS_HOME/libs). Go to project WebContent/WEB-INF/libs folder add the jar there.
Even you can copy the httpcore-x.jar and add it to tomcat libraries (CATALINA_HOME/lib). So that you do not need to add it all the time you create a new web service.
type Exception report
message
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.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
java.lang.Thread.run(Unknown Source)
root cause
java.lang.NoClassDefFoundError: org/apache/http/HttpResponseFactory
org.apache.axis2.transport.http.SimpleHTTPServer.init(SimpleHTTPServer.java:116)
org.apache.axis2.engine.ListenerManager.init(ListenerManager.java:74)
org.apache.axis2.transport.http.AxisServlet.init(AxisServlet.java:449)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
java.lang.Thread.run(Unknown Source)
SOLUTION
The reason here is that jar file related to class org.apache.http.HttpResponseFactory is missing to the project which is httpcore-x.jar. It is always not the case that eclipse automatically adds all required libraries. So we need to add this lib to the project. We can find httpcore-x.jar from your axis2 libraries (AXIS_HOME/libs). Go to project WebContent/WEB-INF/libs folder add the jar there.
Even you can copy the httpcore-x.jar and add it to tomcat libraries (CATALINA_HOME/lib). So that you do not need to add it all the time you create a new web service.
ReplyDeleteGet inspired by your blog. Keep doing like this....
Ethical Hacking Course in Chennai
Ethical hacking course in bangalore
Ethical hacking course in coimbatore
Hacking course in bangalore
Ethical hacking in bangalore
Ethical hacking training in bangalore
Ethical Hacking institute in Bangalore
Ethical hacking Training institute in bangalore
Tally Course in Bangalore
German Classes in Bangalore
this webservice page contains lot of useful infomation..i wish to share my friends also...
ReplyDeleteAngularJS training in chennai | AngularJS training in anna nagar | AngularJS training in omr | AngularJS training in porur | AngularJS training in tambaram | AngularJS training in velachery
Money Gadget
ReplyDeleteMoney Gadget
Money Gadget
Money Gadget
Money Gadget
Money Gadget
Money Gadget
Money Gadget
Money Gadget
ReplyDeleteMoney Gadget
Money Gadget
Money Gadget
Money Gadget
Money Gadget
Money Gadget
Money Gadget
Bandicam Crack is a usefull software to record any thing happening on your screen just a single click in any your desired formate. Bandicam Crack
ReplyDeleteGood Night Love Messages for Lover · Sweet dreams! · Go to bed, you sleepy head! · Sleep tight! · Time to ride the rainbow to dreamland! · Sleep well. · Have a good .I Love You Sister
ReplyDelete