3 Replies Latest reply on Oct 10, 2008 5:58 AM by ropalka

    Use "context listener" in Web Service as "ServletContextList

    tao_dl

      Dear forum,

      Currently I am working on a J2EE/JBoss web service project. I'd like to use a simillar "context listener" in a web service project, just as the "ServletContextListener " has done in a web GUI application (WAR). The package structure of a web service project is different from a web application project. E.g. there is neither "web.xml" file nor "WEB-INF" folder in a web serivce project package.

      I am new in JBoss web service, any help and response will be very appreciated!

      Thanks in advance,

      Tao

        • 1. Re: Use
          ropalka

          Hi pandatao,

          you have to specify the following context param in your webservice web.xml:

          <context-param>
           <param-name>org.jboss.ws.webapp.ServletContextListener</param-name>
           <param-value>mycompany.ServletContextListenerImpl</param-value>
          </context-param>


          It is supported on each AS 4.2.x and above.

          • 2. Re: Use
            tao_dl

            Hi Richard,
            Thank you for your reply!
            I have two more questions:

            1. In my current project package there is no "web.xml". Where should I put a new web.xml? The following is the structure of my ear file. I have tried to put the "WEB-INF/web.xml" on the same level of the two "META-INF" folders, but it does not work.

            App.ear
             - META-INF/
             -application.xml
             - AppClient.jar
             - App.jar
             - META-INF/
             - wsdl/
             - App.wsdl
             - webservice.xml
             - mapping.xml
             - jboss.xml
             - ejb-jar.xml
             - classes/
             - saaj-impl.jar
             - jaxrpc-spi.jar
             - jaxrpc-impl.jar
            



            2. Currently I am using the JBoss version 4.0.2 (with Patch 10). Due to several reasons I can't upgrade the JBoss server to version 4.2.x. Do you think the "context-param" will work in the verson 4.0.2? I tried the "ServletContextListener" in a WAR application in 4.0.2 und it works.




            • 3. Re: Use
              ropalka

              Hi pandatao,

              1.) You can use ServletContextListeners for JaxWS POJO endpoints (no EJB3). I see you're using ejb's. It will not work there.
              2.) AFAIK JBossAS 4.0.2 webservice module is AXIS based. I have no idea, if it's supported there :(