eclipse axis2 web服务错误

时间:2012-03-23 16:14:51

标签: eclipse web-services axis2

我现在正在使用axis2并使用E​​clipse生成一个Web服务项目。现在我遇到了麻烦。

Java文件:

public class WebServiceServer{

public Map<String,String> getConfigInfo(List<Map<String,Object>> objectList){
    Map<String,String> returnMap = new HashMap<String, String>();

    try {
        //do something
    } catch (ConfigurationException e) {
        e.printStackTrace();
    } 
    return returnMap;
}

}

我现在正在使用Eclipse Java EE 3.6,我喜欢wtp插件。现在,我使用Eclipse并右键单击我的项目,然后单击New - &gt; Other - &gt; Web Service。

但是当我启动tomcat时,错误已经到来。

org.apache.axis2.deployment.DeploymentException: 
The following error occurred during schema generation: sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl cannot be cast to java.lang.Class
at org.apache.axis2.deployment.ServiceBuilder.populateService(ServiceBuilder.java:433)
at org.apache.axis2.deployment.repository.util.ArchiveReader.buildServiceGroup(ArchiveReader.java:101)
at org.apache.axis2.deployment.repository.util.ArchiveReader.processServiceGroup(ArchiveReader.java:178)
at org.apache.axis2.deployment.ServiceDeployer.deploy(ServiceDeployer.java:82)
at org.apache.axis2.deployment.repository.util.DeploymentFileData.deploy(DeploymentFileData.java:136)
at org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:813)
at org.apache.axis2.deployment.repository.util.WSInfoList.update(WSInfoList.java:144)
at org.apache.axis2.deployment.RepositoryListener.update(RepositoryListener.java:370)
at org.apache.axis2.deployment.RepositoryListener.checkServices(RepositoryListener.java:254)
at org.apache.axis2.deployment.DeploymentEngine.loadServices(DeploymentEngine.java:142)
at org.apache.axis2.deployment.WarBasedAxisConfigurator.loadServices(WarBasedAxisConfigurator.java:283)
at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:95)
at org.apache.axis2.transport.http.AxisServlet.initConfigContext(AxisServlet.java:584)
at org.apache.axis2.transport.http.AxisServlet.init(AxisServlet.java:454)
at org.apache.axis2.webapp.AxisAdminServlet.init(AxisAdminServlet.java:60)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1173)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4421)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4734)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)

Caused by: org.apache.axis2.deployment.DeploymentException: The following error occurred during schema generation: sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl cannot be cast to java.lang.Class
at org.apache.axis2.deployment.ServiceBuilder.populateService(ServiceBuilder.java:397)

Caused by: java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl cannot be cast to java.lang.Class

[ERROR] The WebServiceServer service, which is not valid, caused The following error occurred during schema generation: sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl cannot be cast to java.lang.Class

org.apache.axis2.deployment.DeploymentException:在模式生成期间发生以下错误:sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl无法强制转换为java.lang.Class

Caused by: org.apache.axis2.deployment.DeploymentException: The following error occurred during schema generation: sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl cannot be cast to java.lang.Class



 Someone told me that axis2 cannot deal with the return type is List or Map?
 Any replay is welcome. Thanks.

2 个答案:

答案 0 :(得分:2)

正如上面的答案中所解释的,只有Axis2 Trunk版本(1.7.0-SNAPSHOT)支持列表,地图等集合。

除非您使用的是Axis2 trunk版本(1.7.0-SNAPSHOT),否则无法使用它们。您必须将Arrays与其他版本的Axis2一起使用。

谢谢和问候,

Harshana

答案 1 :(得分:1)

  

有人告诉我,axis2无法处理返回类型是List还是   地图吗?

有人是对的。

您需要返回数组,或者在您的情况下,返回数组数组。