开发者

Context failed to start when deploy web-service in netbeans to tomcat-apache

开发者 https://www.devze.com 2023-03-21 20:52 出处:网络
I try to follow the Getting Started with JAX-WS Web Services tutorial on the ne开发者_运维问答tbeans site. I create the web-service-app (Java EE 6 Web, Tomcat 7.0), when I add a web-service class netb

I try to follow the Getting Started with JAX-WS Web Services tutorial on the ne开发者_运维问答tbeans site. I create the web-service-app (Java EE 6 Web, Tomcat 7.0), when I add a web-service class netbeans asks for me if I want to use METRO (because the server does't JSR-109), so I say yes and it adds some metro libraries.

Now the webservice is using the javax.ejb.Stateless as I selected the "Implement Web Service as a Stateless Session Bean" checkbox, but no Library containing this class is added and I get an error in Netbeans:

import javax.ejb.Stateless;
...
@WebService(serviceName = "WebServiceTest")
@Stateless()
public class WebServiceTest {...}

"cannot find symbol: class Stateless"

ofcourse it can't. When I add the "Java EE Web 6 API Library - javaee-web-api-6.0.jar" the error is solved, but when I deploy the project I get an error thats a whole lot more difficult, and that error is the actual problem...

Deployment is in progress...
deploy?config=file%3A%2FC%3A%2FUsers%2Ftjen%2FAppData%2FLocal%2FTemp%2Fcontext6376466830057976095.xml&path=/CalculatorWSApplication
FAIL - Deployed application at context path /CalculatorWSApplication but context failed to start
[here a direction to the line of error]
The module has not been deployed.
    at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:187)
    [...a whole lot of red-collored stack-trace stuff]
BUILD FAILED (total time: 1 second)

at the following line:

<nbdeploy clientUrlPart="${client.urlPart}" debugmode="false" forceRedeploy="${forceRedeploy}"/>

I put the arguments over different lines like this:

<nbdeploy 
clientUrlPart="${client.urlPart}" 
debugmode="false" 
forceRedeploy="${forceRedeploy}"
/>

Which didn't help me at all(but maybe it does help you), because the eror was at the line:

/>

Now if I comment out the Stateless usage, and remove the "Java EE Web 6 API Library - javaee-web-api-6.0.jar" library, there is no problem and it all works like a charm. (after a 'clean and build' otherwise it keeps going errored)

It doesn't matter which library i add, if I do, i get that same error. I can get the example working, but I would like to be able to add libraries without it crashing...

Hope to solve this mystery, Tjen

PS: some specs

  • Product Version: NetBeans IDE 7.0 (Build 201104080000)
  • Java: 1.6.0_21; Java HotSpot(TM) 64-Bit Server VM 17.0-b17
  • System: Windows 7 version 6.1 running on amd64;
  • Tomcat 7.0.11
  • I do have jaxb-api.jar and jaxws-api.jar endorsed in the JDK 1.6 platform


This can be achieved by adding metro libraries to tomcat. GlassFish has metro library inbuilt. In order to run web service on tomcat, Metro libraries have to be included.

please google how would you add library. best of luck


This is because you did not chose glassfish as web server, in creating the project you must chose glassfish as the web server and jdk 1.7 at least.


In my case I used glassfish from the start with jdk 1.7. I got the same error but then i changed my glassfish version to 3 instead of 3.1.2 in netbeans and it was fine.


It seems like it's a common issue between NetBeans and Tomcat. To get around it, you need to log into Manager GUI through http://localhost/manager Once you login, you will be able to deploy it using WAR file to deploy section where you can select it after you browse to it.

0

精彩评论

暂无评论...
验证码 换一张
取 消