當我運行一個使用eclipse,j2sdk1.4.2_13,axis1.0和WSDL文件創建的webservice客戶端時,出現以下錯誤。運行webservice客戶端時發生java.lang.NoClassDefFoundError
java.lang.NoClassDefFoundError: javax/servlet/ServletContext
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:1655)
at java.lang.Class.getDeclaredMethod(Class.java:1262)
at org.apache.commons.discovery.tools.ClassUtils.findPublicStaticMethod(ClassUtils.java:116)
at org.apache.axis.configuration.EngineConfigurationFactoryFinder.newFactory(EngineConfigurationFactoryFinder.java:214)
at org.apache.axis.configuration.EngineConfigurationFactoryFinder.access$300(EngineConfigurationFactoryFinder.java:92)
at org.apache.axis.configuration.EngineConfigurationFactoryFinder$1.run(EngineConfigurationFactoryFinder.java:179)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.axis.configuration.EngineConfigurationFactoryFinder.newFactory(EngineConfigurationFactoryFinder.java:148)
at org.apache.axis.configuration.EngineConfigurationFactoryFinder.newFactory(EngineConfigurationFactoryFinder.java:204)
at org.apache.axis.client.Service.<init>(Service.java:111)
at com.example.xmlns.SOAPEventSourceBindingStub.<init>(SOAPEventSourceBindingStub.java:27)
at com.example.xmlns.SOAPEventSourceBindingStub.<init>(SOAPEventSourceBindingStub.java:17)
at com.example.xmlns.Cliente.main(Cliente.java:16)
Exception in thread "main"
客戶是這樣做的:
SOAPEventSourceBindingStub stub = new SOAPEventSourceBindingStub();
public SOAPEventSourceBindingStub() throws org.apache.axis.AxisFault {
this(null); (this is line 17)
}
public SOAPEventSourceBindingStub(java.net.URL endpointURL, javax.xml.rpc.Service service) throws org.apache.axis.AxisFault {
this(service);
super.cachedEndpoint = endpointURL;
}
public SOAPEventSourceBindingStub(javax.xml.rpc.Service service) throws org.apache.axis.AxisFault {
if (service == null) {
super.service = new org.apache.axis.client.Service(); (this is line 27)
} else {
super.service = service;
}
...
你確定你沒有錯過一個圖書館嗎?確保所有的庫都在你的類路徑中。 – 2010-09-02 14:19:30