使用Maven构建/部署时Web服务的WebSphere问题

时间:2013-04-01 16:11:34

标签: web-services maven websphere websphere-7

我正在迁移使用Maven构建和部署的应用程序。它部署在WebSphere 7上。我已经设法使这个应用程序的一部分(HTML UI等)正常工作,但Web服务出现问题。

当我尝试访问Web服务的URL(例如localhost:9000/MyApplication/MyWebServiceProject/MyService)时,我希望看到一个页面上写着“Hello,这是一个Web服务!”。

相反,我看到了这个例外:

[4/1/13 11:49:37:484 EDT] 0000001d WASAxis2Servl E   The following exception was encountered while attempting to load the ConfigurationContext for the servlet:  com.ibm.ws.websvcs.exception.ConfigurationException: Could not retrieve server module metadata in Axis servlet for module: MyWebServiceProject
com.ibm.ws.websvcs.exception.ConfigurationException: Could not retrieve server module metadata in Axis servlet for module: MyWebServiceProject
    at com.ibm.ws.websvcs.transport.http.WASAxis2Servlet.init(WASAxis2Servlet.java:290)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:358)
    at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.init(ServletWrapperImpl.java:171)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:739)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:502)
    at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:181)
    at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3935)
    at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:276)
    at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:931)
    at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1592)
    at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:186)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:452)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:511)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:305)
    at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:83)
    at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
    at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
    at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
    at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
    at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
    at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
    at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1613)

我猜测通过Maven部署Web服务需要一些特定于IBM的配置,但我不确定它是什么。

来自POM的EAR项目的相关部分:

<plugin>
<artifactId>maven-ear-plugin</artifactId>
<version>2.7</version>
<configuration>

  <applicationName>PolicyGatewayEAR</applicationName>

      <defaultLibBundleDir>lib/</defaultLibBundleDir>
</configuration>
</plugin>
<plugin>
    <groupId>org.codehaus.mojo</groupId>
<artifactId>was6-maven-plugin</artifactId>
<version>1.2</version>
<executions>
    <execution>
    <phase>integration-test</phase>
    <id>uninstall</id>
    <goals>
        <goal>wsUninstallApp</goal>
    </goals>
    <configuration>
        <wasHome>${was7Home}</wasHome>
        <verbose>false</verbose>
        <failOnError>false</failOnError>
        <profileName>was70profile1</profileName>
        <workingDirectory>${project.build.directory}/was6-maven-plugin</workingDirectory>
            <applicationName>MyApplication</applicationName>
    </configuration>
</execution>
<execution>
    <phase>integration-test</phase>
    <id>installation</id>
    <goals>
    <goal>installApp</goal>
    </goals>
    <configuration>
    <wasHome>${was7Home}</wasHome>
    <verbose>false</verbose>
    <failOnError>true</failOnError>
    <updateExisting>false</updateExisting>
    <profileName>was70profile1</profileName>
    <workingDirectory>${project.build.directory}/was6-maven-plugin</workingDirectory>
        <applicationName>MyApplication</applicationName>
   </configuration>
</execution>
</executions>
</plugin>

网络服务子项目的POM代码段:

        <plugin>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.2</version>
            <configuration>
                <warSourceDirectory>WebContent</warSourceDirectory>
                <failOnMissingWebXml>true</failOnMissingWebXml>
                <warSourceDirectory>WebContent</warSourceDirectory>
                <packagingExcludes>WEB-INF/lib/*.jar</packagingExcludes>
                <archive>
                <manifest>
                  <addClasspath>true</addClasspath>
                  <classpathPrefix>lib/</classpathPrefix>
                </manifest>
              </archive>
            </configuration>
        </plugin>

当我使用RAD(v8.5)部署到WAS时,这不是问题 - 它只是在我尝试使用Maven构建和部署应用程序之后才开始。有谁知道如何解决这个错误?

1 个答案:

答案 0 :(得分:1)

事实证明,我必须使用与此处描述的相同的解决方案:

Deployed webservice schema does not match what's in workspace

出于某种原因,当在Maven-build项目中未提供WSDL和模式文件时,WebSphere无法从代码生成WSDL。我报告的错误消息类似于我在运行测试时看到的错误消息,包括EJB项目中的WSDL和模式。