我现在正在使用axis2和Eclipse生成一个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-->Other-->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.Classorg.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.发布于 2012-06-20 16:09:54
正如在上面的回答中所解释的,只有Axis2干线版本(1.7.0-快照)支持集合,如列表、地图。
除非您使用的是Axis2主干版本(1.7.0-快照),否则不能使用它们。您必须在其他版本的Axis2中使用数组。
感谢并致以问候
Harshana
发布于 2012-03-24 01:23:56
有人告诉我axis2不能处理返回类型是List还是
?
有人是对的。
您需要返回数组,或者在本例中返回数组的数组。
https://stackoverflow.com/questions/9842699
复制相似问题