WAR无法部署

时间:2016-06-22 10:35:26

标签: java web-services maven netbeans

我在TomEE中运行Maven JEE应用程序正常运行。我在Netbeans中创建了一个SOAP Web服务:<input type="text" value="NOTBound" class="NOTBound" /> <input type="text" value="Bound value 1" class="Bound" /> <input type="text" value="NOTBound" class="NOTBound" /> <input type="text" value="Bound value 2" class="Bound" />,它创建了一个简单的&#34;你好&#34;服务。出于某种原因,我收到了一条消息

enter image description here

  

您选择的Web服务器似乎不支持JSR 109   规格。使Web服务器能够处理带注释的Web   服务,应该创建sun-jaxws.xml文件和servlet   需要在web.xml文件中生成Web服务的条目

我接受,清洁,构建......无论我做什么,每次打开Netbeans时,我总会收到这条消息。就像这些变化并不持久。

然后主要问题是当我尝试运行项目时。我得到一长串错误

在服务器日志中

New - Web Service

在日志中

SEVERE: Exception sending context initialized event to listener instance of class com.sun.faces.config.ConfigureListener
java.lang.RuntimeException: com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! org.apache.catalina.core.DefaultInstanceManager cannot be cast to org.apache.tomee.catalina.JavaeeInstanceManager
    at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:292)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5066)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5584)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)

修改

我添加了这些依赖项,但在构建/运行时仍然遇到相同的错误

SEVERE: Unable to deploy collapsed ear in war StandardEngine[Catalina].StandardHost[localhost].StandardContext[/WebServiceTest]
org.apache.openejb.OpenEJBException: Unable to load servlet class: com.sun.xml.ws.tx.coord.v11.endpoint.RegistrationRequesterPortImpl: null
    at org.apache.openejb.config.WsDeployer.processPorts(WsDeployer.java:234)
....
Caused by: java.lang.NullPointerException
    at org.apache.openejb.config.WsDeployer.readWsdl(WsDeployer.java:451)

SEVERE: ContainerBase.removeChild: destroy: 
org.apache.catalina.LifecycleException: An invalid Lifecycle transition was attempted ([before_destroy]) for component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/WebServiceTest]] in state [STARTING_PREP]
    at org.apache.catalina.util.LifecycleBase.invalidTransition(LifecycleBase.java:401)
    at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:291)
....
SEVERE: ContainerBase.addChild: start: 
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/WebServiceTest]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:153)
....
Caused by: org.apache.tomee.catalina.TomEERuntimeException: org.apache.openejb.OpenEJBException: Unable to load servlet class: com.sun.xml.ws.tx.coord.v11.endpoint.RegistrationRequesterPortImpl: null
    at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1270)
....
Caused by: org.apache.openejb.OpenEJBException: Unable to load servlet class: com.sun.xml.ws.tx.coord.v11.endpoint.RegistrationRequesterPortImpl: null
    at org.apache.openejb.config.WsDeployer.processPorts(WsDeployer.java:234)
....
Caused by: java.lang.NullPointerException
    at org.apache.openejb.config.WsDeployer.readWsdl(WsDeployer.java:451)
....
SEVERE: Error deploying configuration descriptor C:\Program Files\Apache-Tomee-jaxrs-1.7.4\conf\Catalina\localhost\WebServiceTest.xml
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/WebServiceTest]]
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:903)
....

除了Maven依赖项之外,我还手动复制了TomEE lib文件夹中的文件<!-- https://mvnrepository.com/artifact/org.apache.tomcat/tomcat-catalina-ws --> <dependency> <groupId>org.apache.tomcat</groupId> <artifactId>tomcat-catalina-ws</artifactId> <version>7.0.5</version> </dependency> <!-- https://mvnrepository.com/artifact/javax.xml/jaxrpc-api --> <dependency> <groupId>javax.xml</groupId> <artifactId>jaxrpc-api</artifactId> <version>1.1</version> </dependency> <!-- https://mvnrepository.com/artifact/wsdl4j/wsdl4j --> <dependency> <groupId>wsdl4j</groupId> <artifactId>wsdl4j</artifactId> <version>1.6.2</version> </dependency> jaxrpc-api-1.1.jar。文件tomcat-catalina-ws-7.0.5.jar已存在。我重新启动了Netbeans。不确定这些是否是必需的罐子,但它们无法解决问题。

2 个答案:

答案 0 :(得分:2)

您收到此错误是因为Tomcat不符合JSR-109标准。我在Tomcat documentation中发现了这一点,它可以帮助你:

  

Web服务支持(JSR 109)

     

Tomcat为JSR 109提供工厂,可用于解析Web服务引用。将生成的catalina-ws.jar以及jaxrpc.jar和wsdl4j.jar(或JSR 109的另一个实现)放在Tomcat lib文件夹中。

     

用户应该知道wsdl4j.jar是根据CPL 1.0而不是Apache许可证版本2.0获得许可的。

答案 1 :(得分:0)

我不完全确定为什么会发生这样的错误......正如蒂姆所说,Tomcat可能不符合JSR-109标准(见他的帖子)但是因为我使用的是TomEE,所以应该没问题。经过多次测试后,我看到了使用这个nb-configuration.xml文件:

<?xml version="1.0" encoding="UTF-8"?>
<project-shared-configuration>
    <!--
    This file contains additional configuration written by modules in the NetBeans IDE.
    The configuration is intended to be shared among all the users of project and
    therefore it is assumed to be part of version control checkout.
    Without this configuration present, some functionality in the IDE may be limited or fail altogether.
    -->
    <properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
        <!--
        Properties that influence various parts of the IDE, especially code formatting and the like. 
        You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
        That way multiple projects can share the same settings (useful for formatting rules for example).
        Any value defined here will override the pom.xml file value but is only applicable to the current project.
        -->
        <org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>1.7-web</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>
        <org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>Tomcat</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>
        <org-netbeans-modules-maven-jaxws.generate_5f_nonjsr109>false</org-netbeans-modules-maven-jaxws.generate_5f_nonjsr109>
        <netbeans.hint.jdkPlatform>JDK_1.8</netbeans.hint.jdkPlatform>
    </properties>
</project-shared-configuration>

正在帮助[至少]告诉Netbeans不要提出这个消息(我相信)。然后使用通常的Web服务注释(@WebService(serviceName = "...")@WebMethod(operationName = "...")@WebResult(name = "...") ...),并在一些服务器重新启动并确保context.xml有效后,部署Web服务。我希望它可以帮助人们解决同样的问题。