The Source for Java Technology Collaboration
User: Password:



Arun Gupta

Arun Gupta's Blog

Tango on Jetty

Posted by arungupta on May 23, 2007 at 03:50 PM | Comments (12)

Web Services Interoperability Technology (WSIT, aka Project Tango), integrated in GlassFish V2 builds, provides a implementation of key enterprise Web services specifications and enables first-class interoperability with .NET 3.0 framework. However if you download stand-alone WSIT builds, then you can also install similar bits on Tomcat 5.5.17. In this entry, I provide a script that allows you to install the same bits on Jetty 6.1.0.

 

  1. Download WSIT Milestone 4 and J2SE 5.0 U2 or later.
  2. Install (detailed instructions) the bundle by giving the following command:

    java -jar wsit-1_0-fcs-bin-b14-09_apr_2007.jar
  3. Copy the script below in 'jax-ws-latest-wsit' directory and name it as 'wsit-on-jetty.xml':

    <?xml version="1.0"?>

    <project name="WSIT 1.0 Beta On Jetty" default="help" basedir=".">
      <property environment="env"/>
      <property name="jetty.home" value="${env.JETTY_HOME}"/>
      <property name="jetty.lib.home" value="${jetty.home}/lib"/>
      <property name="java.home" value="${env.JAVA_HOME}"/>
      <patternset id="wsit-jars">
        <include name="webservices-rt.jar"/>
        <include name="webservices-tools.jar"/>
        <include name="webservices-extra.jar"/>
        <include name="webservices-extra-api.jar"/>
        <include name="webservices-api.jar"/>
      </patternset>

      <target name="install" description="Install latest WSIT jars on Jetty 6.1.x">
        <echo message="Installing WSIT 1.0 Beta on ${jetty.home} ..."/>

        <copy toDir="${jetty.lib.home}" overwrite="true">
          <fileset dir="lib">
            <patternset refid="wsit-jars"/>
          </fileset>
        </copy>
        <echo message="... installation complete."/>
      </target>

      <target name="uninstall" description="Install latest WSIT jars on Jetty 6.1.x">
        <delete>
          <fileset dir="${jetty.lib.home}">
            <patternset refid="wsit-jars"/>
          </fileset>
        </delete>
      </target>

      <target name="help">
        <echo message="install :"/>
        <echo message=" Installs WSIT 1.0 Beta on Jetty 6.1.x"/>
        <echo/>
        <echo message="uninstall: "/>
        <echo message=" Uninstalls WSIT 1.0 Beta from Jetty 6.1.x"/>
        <echo/>
        <echo message="$JETTY_HOME must be set to the installation directory of Jetty 6.1.x."/>
        <echo/>
        <echo message="Usage:"/>
        <echo message=" ant -f wsit-on-jetty.xml {install,uninstall}"/>
      </target>
    </project>
  4. Download and install (basically unzip the downloaded file) Jetty 6.1.0. Set an environment variable JETTY_HOME pointing to the location of Jetty install directory.
  5. Invoke the command to install WSIT M4 bits on Jetty as:

    ant -f wsit-on-jetty.xml install
  6. Create a Reliable WSIT endpoint by choosing 'J2EE 1.4' as the 'Java EE version' and make sure 'Set Source Level to 1.4' is unchecked.
  7. Copy the WAR file from the 'dist' directory of your application such '\Users\Arun Gupta\WebApplication1\dist\WebApplication1.war' to 'JETTY_HOME/webapps'.
  8. Start Jetty instance using the following command:

    java -jar start.jar etc/jetty.xml

    It's weird that 'bin' directory contains only 'jetty.sh' (no .bat script) and the only way documented to run is using this command.
  9. The endpoint should now be available at: 'http://localhost:8080/<context-root>/<service-name>?WSDL', for example 'http://localhost:8080/WebApplication1/HelloService?WSDL'. Note, Jetty does not seem to support hot deployment. So if you drop a WAR file in 'webapps' directory then you need to re-start your Jetty instance.

  10. A Web service client to this endpoint can be easily generated following #ws2 screencast.

This is one trivial sample. If you try other interesting combinations and they don't work, please file an issue.

Technorati: wsit glassfish webservices jetty


Bookmark blog post: del.icio.us del.icio.us Digg Digg DZone DZone Furl Furl Reddit Reddit
Comments
Comments are listed in date ascending order (oldest first)

  • Hi Arun,

    I'm following your screencast and try this sample but with not success.

    I created a sample AddNumbersWS with netbeans and deploy it in Glassfish. All is ok and I can browse my wsdl at http://localhost:8080/WebWSServer/AddNumbersWSService?WSDL.

    I took the war file generated by NetBeans and put it in the webapps jetty folder. Restart jetty. the index.jsp file is correctly found, but the webservice is not well expose. I received a 404 error page. In jetty log file I have a 127.0.0.1 - - [30/05/2007:15:51:24 +0100] "GET /WebWSServer/AddNumbersWSService?WSDL HTTP/1.1" 404 1408

    Is it possible to add jvm properties to see more trace form WSIT? How can we be sure that WSIT is take in consideration by jetty?

    Thanks, Phil

    Posted by: pgodottemenos on May 30, 2007 at 07:04 AM

  • Hi Arun,

    By adding WSIT jar file to my WebApp lib dir under WEB-INF folder. WSIT seems be called but I have the folowing stack trace:

    2007-05-30 18:17:14.232::DEBUG: loaded class com.sun.xml.ws.util.localization.LocalizableImpl from ContextLoader@null([file:/C:/temp/Jetty_0_0_0_0_8192_WebApplication4.war__WebApplication4__vzlld5/webapp/WEB-INF/classes/, file:/C:/temp/Jetty_0_0_0_0_8192_WebApplication4.war__WebApplication4__vzlld5/webapp/WEB-INF/lib/webservices-api.jar, file:/C:/temp/Jetty_0_0_0_0_8192_WebApplication4.war__WebApplication4__vzlld5/webapp/WEB-INF/lib/webservices-extra-api.jar, file:/C:/temp/Jetty_0_0_0_0_8192_WebApplication4.war__WebApplication4__vzlld5/webapp/WEB-INF/lib/webservices-extra.jar, file:/C:/temp/Jetty_0_0_0_0_8192_WebApplication4.war__WebApplication4__vzlld5/webapp/WEB-INF/lib/webservices-rt.jar, file:/C:/temp/Jetty_0_0_0_0_8192_WebApplication4.war__WebApplication4__vzlld5/webapp/WEB-INF/lib/webservices-tools.jar]) / sun.misc.Launcher$AppClassLoader@198dfaf
    2007-05-30 18:17:14.232::WARN: Failed startup of context org.mortbay.jetty.webapp.WebAppContext@19b619e{/WebApplication4,jar:file:/H:/dev/p4/tocf/tag/1/dev/release/webapps/WebApplication4.war!/}
    com.sun.xml.ws.transport.http.servlet.WSServletException: WSSERVLET11: failed to parse runtime descriptor: java.lang.IllegalArgumentException: Prefix '' is already bound to ''
    at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.contextInitialized(WSServletContextListener.java:107)
    at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:530)
    at org.mortbay.jetty.servlet.Context.startContext(Context.java:135)
    at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1218)
    at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:500)
    at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
    at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:147)
    at org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:161)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
    at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:147)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
    at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:117)
    at org.mortbay.jetty.Server.doStart(Server.java:210)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
    at com.temenos.tag.bc.http.HttpComponentBC.start(HttpComponentBC.java:103)
    at org.apache.servicemix.jbi.framework.ComponentMBeanImpl.doStart(ComponentMBeanImpl.java:293)
    at org.apache.servicemix.jbi.framework.ComponentMBeanImpl.start(ComponentMBeanImpl.java:216)
    at org.apache.servicemix.jbi.container.JBIContainer.activateComponent(JBIContainer.java:1122)
    at org.apache.servicemix.jbi.container.JBIContainer.activateComponent(JBIContainer.java:1074)
    at org.apache.servicemix.jbi.container.JBIContainer.activateComponent(JBIContainer.java:1031)
    at org.apache.servicemix.jbi.container.JBIContainer.activateComponent(JBIContainer.java:1019)
    at com.temenos.tag.se.TAGAgent.setHardcodedHttpComponent(TAGAgent.java:1578)
    at com.temenos.tag.se.TAGAgent.setHardcodedComponent(TAGAgent.java:1644)
    at com.temenos.tag.se.TAGAgent.start(TAGAgent.java:1486)
    at com.temenos.tag.se.TAGAgent.process(TAGAgent.java:1298)
    at com.temenos.tag.se.TAGAgent.startAgent(TAGAgent.java:165)
    at com.temenos.tag.se.TAGAgent.main(TAGAgent.java:184)
    Caused by: java.lang.IllegalArgumentException: Prefix '' is already bound to ''
    at com.sun.xml.txw2.StartTag.addNamespaceDecl(StartTag.java:171)
    at com.sun.xml.txw2.ContainerElement._namespace(ContainerElement.java:313)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at com.sun.xml.txw2.ContainerElement.invoke(ContainerElement.java:114)
    at $Proxy92._namespace(Unknown Source)
    at com.sun.xml.ws.wsdl.writer.WSDLGenerator.generateDocument(WSDLGenerator.java:266)
    at com.sun.xml.ws.wsdl.writer.WSDLGenerator.doGeneration(WSDLGenerator.java:261)
    at com.sun.xml.ws.server.EndpointFactory.generateWSDL(EndpointFactory.java:413)
    at com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:182)
    at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:420)
    at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parseAdapters(DeploymentDescriptorParser.java:237)
    at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parse(DeploymentDescriptorParser.java:133)
    at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.contextInitialized(WSServletContextListener.java:97)
    ... 27 more
    2007-05-30 18:17:14.248::DEBUG: started org.mortbay.jetty.webapp.WebAppContext@19b619e{/WebApplication4,jar:file:/H:/dev/p4/tocf/tag/1/dev/release/webapps/WebApplication4.war!/}

    Does it make sens?

    Thanks,
    Phil

    Posted by: pgodottemenos on May 30, 2007 at 09:20 AM

  • Did you install WSIT using the instructions given in the blog ?

    Your comment seem to indicate that you are not using any WSIT capabilities and that this is a plain JAX-WS service, right ?

    Posted by: arungupta on May 30, 2007 at 09:24 AM

  • The interesting line in the stack is:

    2007-05-30 18:17:14.232::WARN: Failed startup of context org.mortbay.jetty.webapp.WebAppContext@19b619e{/WebApplication4,jar:file:/H:/dev/p4/tocf/tag/1/dev/release/webapps/WebApplication4.war!/} com.sun.xml.ws.transport.http.servlet.WSServletException: WSSERVLET11: failed to parse runtime descriptor: java.lang.IllegalArgumentException: Prefix '' is already bound to ''

    Posted by: pgodottemenos on May 30, 2007 at 09:29 AM

  • Did you try using the script instead of bundling all the JARs in WAR ?

    Posted by: arungupta on May 30, 2007 at 09:30 AM

  • Hi Arun,

    Thanks for your reply.

    Yes before added wsit jar files to my webapp, I deployed wsit jar file in lib dir of jetty. I tested on my project(emebeded jetty), clean jetty 1.6.3 installation and tomcat 5.5 (putting wsit jar file in shared/lib).

    All the same result.

    For tomcat 5.5, if I integrated wsit jar files to my webapp it's working (same war file than genrated stack trace with jetty).
    But I'm in a ESB context and prefer not deploy a tomcat instance. I need to embeded Servlet container.

    My test is very simple. Create echo WebService and just try to deploy it with WSIT library. I need WS-* feature very soon and found JWSDP/WSIT very exiting.

    Thanks,
    Phil

    Posted by: pgodottemenos on May 30, 2007 at 01:01 PM

  • Phil, I'll try your exact scenario and report back.

    Posted by: arungupta on May 30, 2007 at 01:15 PM

  • Phil, you mentioned Jetty 1.6.3. I don't that version available at: http://docs.codehaus.org/display/JETTY/Downloading+and+Installing#download. Which version of Jetty are you exactly using ?

    Posted by: arungupta on May 30, 2007 at 01:48 PM

  • Also, are you creating a plain JAX-WS endpoint or a Reliable endpoint ?

    Posted by: arungupta on May 30, 2007 at 01:51 PM

  • Arun, Jetty 6.1.3 downloadable at http://dist.codehaus.org/jetty/
    I have another problem with 6.1.1 (JSF) and found ticket saying upgrade to up than 6.1.1.

    Posted by: pgodottemenos on May 31, 2007 at 12:16 AM

  • In my first test, I want just publish a simple WS from annoted java class but the final features is to support WS-* behavior, then when my WS will be correctly deploy I will try Reliable endpoint like describe in your screencast.

    Posted by: pgodottemenos on May 31, 2007 at 12:19 AM

  • Very good. This saved me a bit of time

    Posted by: amarinis on July 31, 2007 at 05:09 AM





Powered by
Movable Type 3.01D
 Feed java.net RSS Feeds