Tomcat中部署的两个相同JAXWS的不同行为

时间:2012-12-03 12:58:30

标签: tomcat jax-ws

我已经实现了两个完全相同的JAXWS。

Concat-WS将字符串连接起来。 Upshift-WS需要一个字符串并将其升级。

我在Tomcat中部署它们并使用wsimport工具创建了两个JAXWS客户端。

当我运行Concat客户端时它可以工作,但是使用Upshift客户端它会抛出:

javax.xml.ws.WebServiceException:标题中没有Content-type!

我已经阅读了一些关于此的帖子。所有这些似乎都与JBOSS有关,这不是我的情况,此外,两个确切的JAXWS如何有不同的行为?

修改

这是Upshift webservice

package upshift;

import javax.jws.WebService;

@WebService(endpointInterface = "upshift.Upshift")
public class UpshiftImpl implements Upshift {

    @Override
    public String upshift(String x) {

        return x.toUpperCase();

    }
}

这是Concat网络服务

package concat;

import javax.jws.WebService;

@WebService(endpointInterface = "concat.Concat")
public class ConcatImpl implements Concat {

    @Override
    public String concat(String x) {

        return x.concat("+concat");

    }
}

编辑II:

我发现第二个JAXWS在导出为WAR时出现问题。 每当我尝试将其导出为WAR时,我都会得到以下结果:

org.eclipse.core.commands.ExecutionException: Error exportingC:/Users/rmescalera/Desktop/WS-upshift.war
    at org.eclipse.jst.j2ee.internal.archive.operations.ComponentExportOperation.execute(ComponentExportOperation.java:150)
    at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl$1.run(DataModelPausibleOperationImpl.java:385)
    at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
    at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.runOperation(DataModelPausibleOperationImpl.java:410)
    at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.runOperation(DataModelPausibleOperationImpl.java:360)
    at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.doExecute(DataModelPausibleOperationImpl.java:247)
    at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.executeImpl(DataModelPausibleOperationImpl.java:219)
    at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.cacheThreadAndContinue(DataModelPausibleOperationImpl.java:89)
    at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.execute(DataModelPausibleOperationImpl.java:207)
    at org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizard$1CatchThrowableRunnableWithProgress.run(DataModelWizard.java:220)
    at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
Caused by: java.lang.NullPointerException
    at org.eclipse.jst.j2ee.internal.archive.operations.JavaEEComponentExportOperation.getModuleParticipants(JavaEEComponentExportOperation.java:75)
    at org.eclipse.jst.j2ee.internal.archive.operations.JavaEEComponentExportOperation.getParticipants(JavaEEComponentExportOperation.java:43)
    at org.eclipse.jst.j2ee.internal.archive.operations.JavaEEComponentExportOperation.createFlatComponentArchiver(JavaEEComponentExportOperation.java:91)
    at org.eclipse.jst.j2ee.internal.archive.operations.ComponentExportOperation.export(ComponentExportOperation.java:191)
    at org.eclipse.jst.j2ee.internal.archive.operations.ComponentExportOperation.execute(ComponentExportOperation.java:136)
    ... 10 more

仍然会生成WAR,但我猜它有错误,这就是我在消费时得到No-Content type in header的原因。所以现在,问题是,为什么在导出时会抛出此错误?再次,与其他Web服务完全相同。

编辑III:

我打开了一个跟随我进度的相关question。仍然不知道问题是什么,但正如我在评论中解释的那样,我怀疑它与认可的标准机制有关

0 个答案:

没有答案