我正在尝试在我的Web应用程序中配置“http://www.webservicex.net/CurrencyConvertor.asmx”Web服务。我使用Axis2提供的wsdl2java生成了java客户端类。 独立的java程序工作正常。
public double convertINRtoUSD(double inr) throws AxisFault, RemoteException{
//double inr = 10000;
// double rate = conversionRate( Currency.INR,Currency.USD);
CurrencyConvertorCurrencyConvertorSoapStub stub=
new CurrencyConvertorCurrencyConvertorSoapStub();
ConversionRate cr = new ConversionRate();
cr.setToCurrency(Currency.INR);
cr.setFromCurrency(Currency.USD);
ConversionRateResponse response =stub.conversionRate(cr);
double d= inr/response.getConversionRateResult();
System.out.printf( "USD for %f INR = %f\n", inr, d);
return d;
}
但是当我在Web应用程序中使用相同的代码时。它抛出Axisfault异常。 请建议。 这是例外:
SEVERE: Servlet.service() for servlet default threw exception
java.lang.ClassNotFoundException: org.apache.axis2.AxisFault
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1516)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1361)
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.getDeclaredMethod(Unknown Source)
at org.springframework.core.LocalVariableTableParameterNameDiscoverer$LocalVariableTableVisitor.resolveMember(LocalVariableTableParameterNameDiscoverer.java:236)
at org.springframework.core.LocalVariableTableParameterNameDiscoverer$LocalVariableTableVisitor.visitEnd(LocalVariableTableParameterNameDiscoverer.java:219)
at org.springframework.asm.ClassReader.accept(Unknown Source)
答案 0 :(得分:0)