Skip to main content

Basic JAX-WS RI webservice deployed in GlassFish does not work

4 replies [Last post]
vedarajan
Offline
Joined: 2007-12-06

Hi,

I have very simple web service, as below.

package project3;

import javax.jws.WebMethod;
import javax.jws.WebService;

@WebService(name = "MyWebService1", serviceName = "MyWebService1", portName = "MyWebService1SoapHttpPort")
public class Class1
{
@WebMethod
public int getint(int f)
{
return f;
}
}

Then I created a web.xml file, as below:

<?xml version = '1.0' encoding = 'windows-1252'?>

Empty web.xml file for Web Application

com.sun.xml.ws.transport.http.servlet.WSServletContextListener

MyWebService1SoapHttpPort
com.sun.xml.ws.transport.http.servlet.WSServlet
1

MyWebService1SoapHttpPort
/mywebservice1soaphttpport

35

html
text/html

txt
text/plain

Also I have the sun-jaxws.xml file as below:

I created a deployment WAR file which contains the Class1.class, web.xml and sun-jaxws.xml.

When I try to deploy this WAR file in Sun Java System Application Server 9.1 I get the following exceptions. What am I doing wrong? I am not using NetBeans and trying to get some proof of concept working with JAX-WS RI. It is very frustrating.

deployed with moduleid = WebServices
WSSERVLET12: JAX-WS context listener initializing
WSSERVLET11: failed to parse runtime descriptor: runtime modeler error: Wrapper class project3.jaxws.Getint is not found. Have you run APT to generate them?
com.sun.xml.ws.model.RuntimeModelerException: runtime modeler error: Wrapper class project3.jaxws.Getint is not found. Have you run APT to generate them?
at com.sun.xml.ws.model.RuntimeModeler.getClass(RuntimeModeler.java:285)
............
...........
WebModule[/WebServices]PWC1275: Exception sending context initialized event to listener instance of class com.sun.xml.ws.transport.http.servlet.WSServletContextListener
com.sun.xml.ws.transport.http.servlet.WSServletException: WSSERVLET11: failed to parse runtime descriptor: runtime modeler error: Wrapper class project3.jaxws.Getint is not found. Have you run APT to generate them?
at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.contextInitialized(WSServletContextListener.java:118)
.........
........
.......
Caused by: com.sun.xml.ws.model.RuntimeModelerException: runtime modeler error: Wrapper class project3.jaxws.Getint is not found. Have you run APT to generate them?
at com.sun.xml.ws.model.RuntimeModeler.getClass(RuntimeModeler.java:285)
at com.sun.xml.ws.model.RuntimeModeler.processDocWrappedMethod(RuntimeModeler.java:596)
......
......

Very much appreciate your help on this.

Thanks.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
nanadev
Offline
Joined: 2009-05-13

set class path for wsimport

ramapulavarthi
Offline
Joined: 2004-06-01

JAX-WS runtime needs some classes (RequestWrappers and ResponseWrappers as shown in the exception) and these can be generated by running wsgen on your implementation class or run apt on your sources and bundle them in the war.
See fromjava sample in the Metro bundle.

If you are using Glassfish, you change the web.xml to use 2.5 and it generates all the required classes for you during deployment. Then you don't have to even put sun-jaxws.xml etc.

vedarajan
Offline
Joined: 2007-12-06

Thanks very much for clarifying this.

Basically I have two separate tasks. The first one is to create a deployable WAR for JAX-WS RI so that the service can be deployed on any JAX-WS RI container. The next task is to deploy the service onto Glassfish.

So, for JAX-WS RI - I need to run 'wsgen' on the impl class or 'apt' on the source files. Then bundle the implementation classes, wrappers, web.xml and sun-jaxws.xml into a WAR.

To deploy onto Glassfish - are you saying that I can simple create a WAR file with all the service implementation classes and the correct web.xml and the Glassfish deployer will take care of generating and deploying all the wrappers and I don't need to run the 'wsgen' or 'apt' tools mentioned above?

Please excuse my ignorance on this as we use a custom IDE for development and generate deployable targets for different platforms.

Thanks.

ramapulavarthi
Offline
Joined: 2004-06-01

Yes, that right.
When you deploy on to glassfish, and using web.xml with version "2.5", you don't have to run wsgen or sun-jaxws.xml.
But if you want the same app to be deployed on multiple containers (Tomcat), then you may want to run wsgen and package everything so that it works on all containers.