Reputation: 1807
I have a Maven JEE application running fine in TomEE. I created a SOAP Web Service in Netbeans: New - Web Service
, which creates a simple "hello" service. For some reason I get a message
The web server you have selected does not seem to support JSR 109 specification. To enable the web server to process annotated web services, the sun-jaxws.xml file should be created and servlets entries for web services need to be generated in web.xml file
I accept, clean, build... No matter what I do, I always get this message every single time I open Netbeans. Like the changes were not persistent.
Then the main problem is when I try to run the project. I get a long list of errors
In server log
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)
In the logs
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)
....
EDIT
I have added these dependencies but still getting the same errors when building/running
<!-- 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>
Besides the Maven dependencies, I have manually copied the files jaxrpc-api-1.1.jar
and tomcat-catalina-ws-7.0.5.jar
in the TomEE lib folder. The file wsdl4j-1.6.3.jar
already existed. I restarted Netbeans. Not sure these are the needed jars, but they do not solve the problem.
Upvotes: 5
Views: 5821
Reputation: 1807
I am not fully sure why this error happened... As Tim said, Tomcat might not be JSR-109 compliant out of the box (see his post) but since I am using TomEE, it should be OK. After many tests, I saw that using this nb-configuration.xml
file:
<?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>
Was helping [at least] to tell Netbeans not to raise the message (I believe). Then with usual Web Services annotation (@WebService(serviceName = "...")
, @WebMethod(operationName = "...")
, @WebResult(name = "...")
...) and after some server restarts and making sure the context.xml
was valid, the Web Services deployed. I hope it helps people with the same problem.
Upvotes: 0
Reputation: 520878
You are getting this error because Tomcat is not JSR-109 compliant out of the box. I discovered this in the Tomcat documentation which may help you:
Web Services support (JSR 109)
Tomcat provides factories for JSR 109 which may be used to resolve web services references. Place the generated catalina-ws.jar as well as jaxrpc.jar and wsdl4j.jar (or another implementation of JSR 109) in the Tomcat lib folder.
Users should be aware that wsdl4j.jar is licensed under CPL 1.0 and not the Apache License version 2.0.
Upvotes: 3