Code Bye

ClassNotFoundException ParseException

webservice的stub类在main方法中测试正确,但是在servlet中调用失败!抛出异常:

2015-3-20 15:43:55 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet MobileServlet threw exception
java.lang.ClassNotFoundException: javax.mail.internet.ParseException
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
	at org.apache.axis2.util.XMLUtils.toOM(XMLUtils.java:590)
	at org.apache.axis2.util.XMLUtils.toOM(XMLUtils.java:575)
	at org.apache.axis2.deployment.DescriptionBuilder.buildOM(DescriptionBuilder.java:97)
	at org.apache.axis2.deployment.AxisConfigBuilder.populateConfig(AxisConfigBuilder.java:90)
	at org.apache.axis2.deployment.DeploymentEngine.populateAxisConfiguration(DeploymentEngine.java:857)
	at org.apache.axis2.deployment.FileSystemConfigurator.getAxisConfiguration(FileSystemConfigurator.java:116)
	at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:64)
	at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContextFromFileSystem(ConfigurationContextFactory.java:210)
	at org.apache.axis2.client.ServiceClient.configureServiceClient(ServiceClient.java:151)
	at org.apache.axis2.client.ServiceClient.<init>(ServiceClient.java:144)
	at com.ws.stub.MobileServiceStub.<init>(MobileServiceStub.java:90)
	at com.ws.stub.MobileServiceStub.<init>(MobileServiceStub.java:76)
	at com.ws.stub.MobileServiceStub.<init>(MobileServiceStub.java:125)
	at com.ws.stub.MobileServiceStub.<init>(MobileServiceStub.java:117)
	at com.ws.servlet.MobileServlet.doGet(MobileServlet.java:29)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
	at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:879)
	at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:617)
	at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1760)
	at java.lang.Thread.run(Thread.java:619)

求解,大谢!


5分
说找不到方法 如果你是在main 方法测试通过 只能说明是jar包冲突了 你部署到tomcat中 tomcat是自带了 javax 的包的 如果你自己也手动导入了相关的servlet jar 这样就会冲突
引用 1 楼 huangcan_liu 的回复:

说找不到方法 如果你是在main 方法测试通过 只能说明是jar包冲突了 你部署到tomcat中 tomcat是自带了 javax 的包的 如果你自己也手动导入了相关的servlet jar 这样就会冲突

我也觉得问题应该出在jar包上,但是我还没想到怎么去解决这个问题。。

MobileServiceStub stub = new MobileServiceStub();

刚执行到这块就抛异常。


30分
javax.mail.internet.ParseException,缺少了这个Jar
已解决!添加mail-1.4.jar包。很抱歉,是自己的考虑问题的方向出错了,之前遇到过类似的bug,其原因就是jar包之间的冲突,而这次在还没有看清异常的本质问题时就从上次的思路中去寻找解决办法,其实就是简简单单的没找到这个类,仅此而已。    送分从速。。
引用 5 楼 vtopqx 的回复:

javax.mail.internet.ParseException,缺少了这个Jar

谢谢,已解决!


CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明ClassNotFoundException ParseException