my dog learned polymorphism*
The moose likes Web Services and the fly likes jax-ws in glassfish server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "jax-ws in glassfish server" Watch "jax-ws in glassfish server" New topic
Author

jax-ws in glassfish server

aruna sydu
Ranch Hand

Joined: Jan 21, 2008
Posts: 98

Hi ,

I am new to webservices, trying to deploy Calculator webservice in Glassfish.But getting exceptions.

1.Wrote the implementation bean with annotations..

2.Compiled the implementation Class
3.Used wsgen command to generate Artifacts.
Add.java
AddResponse.java
4.In web.xml created the impl class as an servlet

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:j2ee="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.5"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

<description>WebTier for the Calculator Service</description>
<display-name>CalculatorWAR</display-name>

<servlet>
<description>Endpoint for Calculator Web Service</description>
<display-name>CalculatorWebService</display-name>
<servlet-name>Calculator</servlet-name>
<servlet-class>endpoint.Calculator</servlet-class>
<load-on-startup>0</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>Calculator</servlet-name>
<url-pattern>/CalculatorService</url-pattern>
</servlet-mapping>

<session-config>
<session-timeout>54</session-timeout>
</session-config>

</web-app>
5.packaged into a war file.
WEB-INF/classes/endpoint.Calculator
WEB-INF/classes/endpoint.jaxws.Add
WEB-INF/classes/endpoint.jaxws.AddResponse
WEB-INF/web.xml
WEB-INF/lib/activation.jar
WEB-INF/lib/jaxb.jar
WEB-INF/lib/webservices-rt.jar
WEB-INF/lib/webservices-tools.jar
WEB-INF/lib/webservices.jar


6.deployed into the glassfish as a war file from admin console.


Now after deploying i see the following exception

Exception while deploying the app :
java.lang.Exception: java.lang.IllegalStateException: ContainerBase.addChild: start: LifecycleException: java.lang.ClassCastException: endpoint.Calculator

Did i miss anything during the deployment...
Please let me know.

Thanks in Advance.

-Aruna



Attitude Determines Altitude

SCJP4/SCWCD4/SCDJWS5/Preparing SCEA Part I
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
I see some errors in the procedure you described, so I suggest you to follow a tutorial, at least until you familiarized yourself with the basic process of developing web services. Take a look at: http://www.netbeans.org/kb/docs/websvc/jax-ws.html
Best wishes!
aruna sydu
Ranch Hand

Joined: Jan 21, 2008
Posts: 98

Hi Ivan,

Does declared in the web.xml have any impact ...!

When i remove that from the deployment descriptor it is not throwing any error..
However i am not able to see the WSDL in the browser...
when i say http://localhost:8080/CalculatorService/CalculatorService?WSDL...

ALSO i am using eclipse ide for webservices and not netbeans.
Can you please point me an example that is developed and deployed using eclipse if you can.

Thanks for the support.
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
If you are developing JAX-WS on GlassFish, there is no need whatsoever to use a web.xml deployment descriptor file, GlassFish will automatically generate this for you when you deploy your web service.
Take a look at my SCDJWS 5 notes - there are a lot of code examples in there and everything was developed using Eclipse and GlassFish.
http://faq.javaranch.com/content/Exam-Objectives-5.pdf
Best wishes!
aruna sydu
Ranch Hand

Joined: Jan 21, 2008
Posts: 98

Hi Ivan,

Thanks for the prompt reply and support.
I was able to deploy the sample application.

Regards,
Aruna.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jax-ws in glassfish server