访问webservice时获取java.lang.reflect.InvocationTargetException

时间:2010-08-27 11:54:19

标签: web-services axis

我是Axis的新手。 Axis(1.4)已添加到我在JBoss上运行的webapp上。

在调用任何服务时,我收到错误:

[STDERR] AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode: 
 faultString: java.lang.reflect.InvocationTargetException
 faultActor: 
 faultNode: 
 faultDetail: 
    {http://xml.apache.org/axis/}

2 个答案:

答案 0 :(得分:1)

我也使用Axis,Eclipse和带有Beanstalk的Amazon Web Services来解决这个问题。引用包含静态初始化方法的数据模型类的任何Web服务方法都会生成此异常。 (WebServiceMethod - > WebServiceClass-> ClassWithStaticInitializer - > StaticInitialzerThatFails)

即使抓住并试图优雅地处理这个也行不通。修复程序是将mysql-connector-java-5.1.18-bin.jar驱动程序复制到WebContent \ WEB-INF \ lib

    static {
        try {
            Class.forName("com.mysql.jdbc.Driver").newInstance();            
        } 
        catch (Exception err)
 ...            

答案 1 :(得分:0)

有些人在类路径上有多个Ajax文件副本时报告过这种问题。例如,您的applciation服务器在其运行时提供Ajax类,您也可以将它们打包在WAR或EAR中。