0

我目前正在开始开发 Web 服务,在本地 tomcat 7.0 服务器上使用 eclipse IDE 和轴 2。

当我尝试部署服务时,我得到:

[ERROR] The encoSendInterface service, which is not valid, caused The following error occurred during schema generation: null org.apache.axis2.deployment.DeploymentException: The following error occurred during schema generation: null
at  org.apache.axis2.deployment.ServiceBuilder.populateService(ServiceBuilder.java:432)
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:377)
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.initServlet(StandardWrapper.java:1266)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1185)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1080)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5015)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5302)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1566)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1556)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
 Caused by: org.apache.axis2.deployment.DeploymentException: The following error occurred during schema generation: null
at org.apache.axis2.deployment.ServiceBuilder.populateService(ServiceBuilder.java:396)
... 27 more
Caused by: java.lang.NullPointerException
at org.apache.axis2.description.java2wsdl.DefaultSchemaGenerator.generateSchema(DefaultSchemaGenerator.java:606)
at org.apache.axis2.description.java2wsdl.DefaultSchemaGenerator.generateSchemaTypeforNameCommon(DefaultSchemaGenerator.java:1092)
at org.apache.axis2.description.java2wsdl.DefaultSchemaGenerator.generateSchemaForType(DefaultSchemaGenerator.java:996)
at org.apache.axis2.description.java2wsdl.DefaultSchemaGenerator.processMethods(DefaultSchemaGenerator.java:385)
at org.apache.axis2.description.java2wsdl.DefaultSchemaGenerator.generateSchema(DefaultSchemaGenerator.java:273)
at org.apache.axis2.deployment.util.Utils.fillAxisService(Utils.java:468)
at org.apache.axis2.deployment.ServiceBuilder.populateService(ServiceBuilder.java:388)
... 27 more
[INFO] org.apache.axis2.deployment.DeploymentException: The following error occurred during schema generation: null

有没有办法找出导致此异常的原因?

我的 WS 的当前版本不读取任何配置文件。在构建 Web 服务时,是否有任何我不能使用的库,这可能会导致整个节目崩溃?

问候, 路易吉

4

3 回答 3

2

@WebMethod(exclude = true)如果这对任何人都有帮助,我通过添加我在服务类上的一些设置器(用于依赖注入)来解决这个问题。

根据JAX-WS 指南

如果未指定 @WebMethod 注释,则公开所有公共方法,包括继承的方法,但从 java.lang.Object 继承的方法除外。@WebMethod 注解的 exclude 参数可用于控制公开哪些方法。

于 2013-09-27T22:20:51.547 回答
0

我已经解决了这个问题。Ws 的公共方法之一有一个参数,其名称与类属性之一完全相同。虽然这适用于常规(javaSE)开发,但它似乎确实会在 Web 服务中造成麻烦。

于 2013-01-22T10:34:15.847 回答
0

从axis2 1.5.1升级到1.6.2后,我遇到了相同(或非常相似)的问题。

将 '@WebMethod(exclude = true)' 添加到非 webmethod 公共方法为我修复了它。

于 2017-05-19T10:02:34.777 回答