You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by April Easton <AE...@shawneecourt.org> on 2011/06/08 00:11:45 UTC

[Axis2] - Migrating axis to axis2 and lost servletContext

Good day,
     I have almost successfully converted our axis service to an axis2 service.  It all works, except stopping the threads that are created by this service.  With axis, we used the ServletContextListener destroy method to access the ServletContext.getAttribute("AxisServiceInstance") that was written in AxisService and then call the stopThread() method.  I have been having great difficulties in converting this small piece of the project.  I have tried to get the MessageContext in AxisService and write the ServletContext.setAttribute("AxisServiceInstance").  The MessageContext is always null.  I have placed this Listener in axis2/WEB-INF/lib.  The posts that I've been reading make this look so easy.  What am I overlooking?  Here is a snapshot of my code.

public class AxisListener implements ServletContextListener {

      public void contextInitialized(ServletContextEvent event){
            System.out.println(this.getClass().getName() + ":contextInitialized:context is " + event.getServletContext().getRealPath(""));
      }//contextInitialized()


      public void contextDestroyed(ServletContextEvent event) {
            System.out.println(this.getClass().getName() + ":contextDestroyed:before destroyThread.");

            AxisService axisService = (AxisService) event.getServletContext().getAttribute("AxisServiceInstance");
            axisService.stopThread();
      }//contextDestroyed()
}     //ServletContextListener


public class AxisService {

      public AxisService() {
            this.init();
      }//Constructor

      private void init(){
            .
            .
            .
            //This is the best that I've found using the posts to date:
            //set Attributes to be used by AxisListener#contextDestroyed(ServletContextEvent event)
MessageContext msgContext = MessageContext.getCurrentMessageContext();
            log.debug(this.getClass().getName() + ":init:messageContext:" + msgContext);      //This is Always null
            //((ServletContext)msgContext.getProperty(HTTPConstants.MC_HTTP_SERVLETCONTEXT)).setAttribute("AxisServiceInstance", axisService);

            //Here is what it was:
            //set Attributes to be used by AxisListener#contextDestroyed(ServletContextEvent event)
            MessageContext msgContext= MessageContext.getCurrentContext();
            (((HttpServlet)msgContext.getProperty(HTTPConstants.MC_HTTP_SERVLET)).getServletContext()).setAttribute("AxisServiceInstance",axisService);
      }//init()

Thank you,
April


RE: AW: [Axis2] - Migrating axis to axis2 and lost servletContext

Posted by April Easton <AE...@shawneecourt.org>.
I have updated my service to implement LifeCycle.  I can now see in my logs where the init(serviceContext) and destroy(serviceContext) is being called. I will continue from here to stop my threads.  Thank you for the good reading material.

Deepal - The "Axis2 Deployment model" article did not come up when I clicked on it, instead I got the website's main page, just thought I'd let you know.

April

-----Original Message-----
From: April Easton [mailto:AEaston@shawneecourt.org] 
Sent: Thursday, June 09, 2011 11:02 AM
To: java-user@axis.apache.org
Subject: RE: AW: [Axis2] - Migrating axis to axis2 and lost servletContext

My service is POJO and it does not extend anything.  The init() method is called from the instantiation of the class. Our service scope is application because we need these threads to start when axis2 starts up and die when axis2 dies. 

I've read many of the links that Depal gave to me.  I learned several things.  I have downloaded and am testing with YourKit to see what I can learn from that application. 

What is a good way to stop these threads in axis2?  It seems that how we were doing it in axis, does not work now.


Thanks,
April

From: Tony HEDOUX [mailto:hedouxt@hotmail.com] 
Sent: Thursday, June 09, 2011 6:38 AM
To: java-user@axis.apache.org
Subject: RE: AW: [Axis2] - Migrating axis to axis2 and lost servletContext

Hi,

I don't understand all your issue, but about the message context null, there is an easy way to get access to Servlet context of Axis2 :

In your AxisService class, in 

init(ServiceContext sc){
ServletContext sc = (ServletContext) sc.getConfigurationContext().getProperty("transport.http.servletContext");
}

Then, you should be able to store/read your thread in this context and stop it if necessary.

Tony.
________________________________________
Subject: AW: [Axis2] - Migrating axis to axis2 and lost servletContext
Date: Thu, 9 Jun 2011 11:19:32 +0200
From: josef.stadelmann@axa-winterthur.ch
To: java-user@axis.apache.org
But in scope="soapsession" I have to define a time-out to get long-lasting-sessions and a state-full-object. If the time-out hits before the next request is made by the session-thread, my service-object (instance-of-the-service-class) (addressed by the servicegroupId), does no longer exists. And as we have our time-out set to about 8hours, real long lasting sessions, the time-out is only hit after 8h. Hence the destroy() method called when the same service-class gets a request then triggers only the destroy-method after 8h, when the service-object timed-out for this-service-object is occurred. We do normally not see the destroy() method being called. This time-out is a very annoying issue in fact! If we would be able to set this time-out programmatically by something like a prepare-to-stop-call(), to let's say 5 seconds, then we could observe how our destroy() method gets called. So initiating threads in the init() method is OK. Keeping threads for a long time is a different issue in scope="soapsession", and the time-out-facility makes the thing not better. Or does somebody know a way how I can call to destruct my service-providing-object, and prove that the destroy() method is then called?
 
Josef
 
Von: Deepal Jayasinghe [mailto:deepal@opensource.lk] 
Gesendet: Mittwoch, 8. Juni 2011 01:23
An: java-user@axis.apache.org
Betreff: Re: [Axis2] - Migrating axis to axis2 and lost servletContext
 
In Axis2 it has four different type of sessions and transport session is one of them. So, you have access to the serveltContext only if you use the transport session.

You can deploy the service in any scope and create the threads inside the init method and write the code to stop them inside the destroy method. When the session complete, Axis2 automatically calls the destroy method and invoke your code. One thing you need to keep in mind is the number of services instances, in Axis2 for each new session it creates a new service impl class. And also use the following reference:

http://www.developer.com/db/article.php/3735771/Exposing-a-Database-as-a-Web-Service.htm
http://blogs.deepal.org/2009/06/axis2-tutorials-and-articles.html

Deepal

On 6/7/2011 6:11 PM, April Easton wrote: 
Good day,
     I have almost successfully converted our axis service to an axis2 service.  It all works, except stopping the threads that are created by this service.  With axis, we used the ServletContextListener destroy method to access the ServletContext.getAttribute("AxisServiceInstance") that was written in AxisService and then call the stopThread() method.  I have been having great difficulties in converting this small piece of the project.  I have tried to get the MessageContext in AxisService and write the ServletContext.setAttribute("AxisServiceInstance").  The MessageContext is always null.  I have placed this Listener in axis2/WEB-INF/lib.  The posts that I've been reading make this look so easy.  What am I overlooking?  Here is a snapshot of my code.
 
public class AxisListener implements ServletContextListener {
      
      public void contextInitialized(ServletContextEvent event){
            System.out.println(this.getClass().getName() + ":contextInitialized:context is " + event.getServletContext().getRealPath(""));
      }//contextInitialized()
      
      
      public void contextDestroyed(ServletContextEvent event) {
            System.out.println(this.getClass().getName() + ":contextDestroyed:before destroyThread.");
            
            AxisService axisService = (AxisService) event.getServletContext().getAttribute("AxisServiceInstance");
            axisService.stopThread();
      }//contextDestroyed() 
}     //ServletContextListener
 
 
public class AxisService {    
                  
      public AxisService() {
            this.init();
      }//Constructor
 
      private void init(){
            .
            .
            .     
            //This is the best that I've found using the posts to date: 
            //set Attributes to be used by AxisListener#contextDestroyed(ServletContextEvent event)
       MessageContext msgContext = MessageContext.getCurrentMessageContext();
            log.debug(this.getClass().getName() + ":init:messageContext:" + msgContext);      //This is Always null   
            //((ServletContext)msgContext.getProperty(HTTPConstants.MC_HTTP_SERVLETCONTEXT)).setAttribute("AxisServiceInstance", axisService);
 
            //Here is what it was:
            //set Attributes to be used by AxisListener#contextDestroyed(ServletContextEvent event)
            MessageContext msgContext= MessageContext.getCurrentContext();
            (((HttpServlet)msgContext.getProperty(HTTPConstants.MC_HTTP_SERVLET)).getServletContext()).setAttribute("AxisServiceInstance",axisService);
      }//init()
 
Thank you,
April
 

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org


RE: AW: [Axis2] - Migrating axis to axis2 and lost servletContext

Posted by April Easton <AE...@shawneecourt.org>.
My service is POJO and it does not extend anything.  The init() method is called from the instantiation of the class. Our service scope is application because we need these threads to start when axis2 starts up and die when axis2 dies. 

I've read many of the links that Depal gave to me.  I learned several things.  I have downloaded and am testing with YourKit to see what I can learn from that application. 

What is a good way to stop these threads in axis2?  It seems that how we were doing it in axis, does not work now.


Thanks,
April

From: Tony HEDOUX [mailto:hedouxt@hotmail.com] 
Sent: Thursday, June 09, 2011 6:38 AM
To: java-user@axis.apache.org
Subject: RE: AW: [Axis2] - Migrating axis to axis2 and lost servletContext

Hi,

I don't understand all your issue, but about the message context null, there is an easy way to get access to Servlet context of Axis2 :

In your AxisService class, in 

init(ServiceContext sc){
ServletContext sc = (ServletContext) sc.getConfigurationContext().getProperty("transport.http.servletContext");
}

Then, you should be able to store/read your thread in this context and stop it if necessary.

Tony.
________________________________________
Subject: AW: [Axis2] - Migrating axis to axis2 and lost servletContext
Date: Thu, 9 Jun 2011 11:19:32 +0200
From: josef.stadelmann@axa-winterthur.ch
To: java-user@axis.apache.org
But in scope="soapsession" I have to define a time-out to get long-lasting-sessions and a state-full-object. If the time-out hits before the next request is made by the session-thread, my service-object (instance-of-the-service-class) (addressed by the servicegroupId), does no longer exists. And as we have our time-out set to about 8hours, real long lasting sessions, the time-out is only hit after 8h. Hence the destroy() method called when the same service-class gets a request then triggers only the destroy-method after 8h, when the service-object timed-out for this-service-object is occurred. We do normally not see the destroy() method being called. This time-out is a very annoying issue in fact! If we would be able to set this time-out programmatically by something like a prepare-to-stop-call(), to let's say 5 seconds, then we could observe how our destroy() method gets called. So initiating threads in the init() method is OK. Keeping threads for a long time is a different issue in scope="soapsession", and the time-out-facility makes the thing not better. Or does somebody know a way how I can call to destruct my service-providing-object, and prove that the destroy() method is then called?
 
Josef
 
Von: Deepal Jayasinghe [mailto:deepal@opensource.lk] 
Gesendet: Mittwoch, 8. Juni 2011 01:23
An: java-user@axis.apache.org
Betreff: Re: [Axis2] - Migrating axis to axis2 and lost servletContext
 
In Axis2 it has four different type of sessions and transport session is one of them. So, you have access to the serveltContext only if you use the transport session.

You can deploy the service in any scope and create the threads inside the init method and write the code to stop them inside the destroy method. When the session complete, Axis2 automatically calls the destroy method and invoke your code. One thing you need to keep in mind is the number of services instances, in Axis2 for each new session it creates a new service impl class. And also use the following reference:

http://www.developer.com/db/article.php/3735771/Exposing-a-Database-as-a-Web-Service.htm
http://blogs.deepal.org/2009/06/axis2-tutorials-and-articles.html

Deepal

On 6/7/2011 6:11 PM, April Easton wrote: 
Good day,
     I have almost successfully converted our axis service to an axis2 service.  It all works, except stopping the threads that are created by this service.  With axis, we used the ServletContextListener destroy method to access the ServletContext.getAttribute("AxisServiceInstance") that was written in AxisService and then call the stopThread() method.  I have been having great difficulties in converting this small piece of the project.  I have tried to get the MessageContext in AxisService and write the ServletContext.setAttribute("AxisServiceInstance").  The MessageContext is always null.  I have placed this Listener in axis2/WEB-INF/lib.  The posts that I've been reading make this look so easy.  What am I overlooking?  Here is a snapshot of my code.
 
public class AxisListener implements ServletContextListener {
      
      public void contextInitialized(ServletContextEvent event){
            System.out.println(this.getClass().getName() + ":contextInitialized:context is " + event.getServletContext().getRealPath(""));
      }//contextInitialized()
      
      
      public void contextDestroyed(ServletContextEvent event) {
            System.out.println(this.getClass().getName() + ":contextDestroyed:before destroyThread.");
            
            AxisService axisService = (AxisService) event.getServletContext().getAttribute("AxisServiceInstance");
            axisService.stopThread();
      }//contextDestroyed() 
}     //ServletContextListener
 
 
public class AxisService {    
                  
      public AxisService() {
            this.init();
      }//Constructor
 
      private void init(){
            .
            .
            .     
            //This is the best that I've found using the posts to date: 
            //set Attributes to be used by AxisListener#contextDestroyed(ServletContextEvent event)
       MessageContext msgContext = MessageContext.getCurrentMessageContext();
            log.debug(this.getClass().getName() + ":init:messageContext:" + msgContext);      //This is Always null   
            //((ServletContext)msgContext.getProperty(HTTPConstants.MC_HTTP_SERVLETCONTEXT)).setAttribute("AxisServiceInstance", axisService);
 
            //Here is what it was:
            //set Attributes to be used by AxisListener#contextDestroyed(ServletContextEvent event)
            MessageContext msgContext= MessageContext.getCurrentContext();
            (((HttpServlet)msgContext.getProperty(HTTPConstants.MC_HTTP_SERVLET)).getServletContext()).setAttribute("AxisServiceInstance",axisService);
      }//init()
 
Thank you,
April
 

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org


RE: AW: [Axis2] - Migrating axis to axis2 and lost servletContext

Posted by Tony HEDOUX <he...@hotmail.com>.
Hi,

I don't understand all your issue, but about the message context null, there is an easy way to get access to Servlet context of Axis2 :

In your AxisService class, in 

init(ServiceContext sc){
ServletContext sc = (ServletContext) sc.getConfigurationContext().getProperty("transport.http.servletContext");
}

Then, you should be able to store/read your thread in this context and stop it if necessary.

Tony.

Subject: AW: [Axis2] - Migrating axis to axis2 and lost servletContext
Date: Thu, 9 Jun 2011 11:19:32 +0200
From: josef.stadelmann@axa-winterthur.ch
To: java-user@axis.apache.org



But in scope="soapsession" I have to define a time-out to get long-lasting-sessions and a state-full-object. If the time-out hits before the next request is made by the session-thread, my service-object (instance-of-the-service-class) (addressed by the servicegroupId), does no longer exists. And as we have our time-out set to about 8hours, real long lasting sessions, the time-out is only hit after 8h. Hence the destroy() method called when the same service-class gets a request then triggers only the destroy-method after 8h, when the service-object timed-out for this-service-object is occurred. We do normally not see the destroy() method being called. This time-out is a very annoying issue in fact! If we would be able to set this time-out programmatically by something like a prepare-to-stop-call(), to let's say 5 seconds, then we could observe how our destroy() method gets called. So initiating threads in the init() method is OK. Keeping threads for a long time is a different issue in scope="soapsession", and the time-out-facility makes the thing not better. Or does somebody know a way how I can call to destruct my service-providing-object, and prove that the destroy() method is then called? Josef Von: Deepal Jayasinghe [mailto:deepal@opensource.lk] 
Gesendet: Mittwoch, 8. Juni 2011 01:23
An: java-user@axis.apache.org
Betreff: Re: [Axis2] - Migrating axis to axis2 and lost servletContext In Axis2 it has four different type of sessions and transport session is one of them. So, you have access to the serveltContext only if you use the transport session.

You can deploy the service in any scope and create the threads inside the init method and write the code to stop them inside the destroy method. When the session complete, Axis2 automatically calls the destroy method and invoke your code. One thing you need to keep in mind is the number of services instances, in Axis2 for each new session it creates a new service impl class. And also use the following reference:

http://www.developer.com/db/article.php/3735771/Exposing-a-Database-as-a-Web-Service.htm
http://blogs.deepal.org/2009/06/axis2-tutorials-and-articles.html

Deepal

On 6/7/2011 6:11 PM, April Easton wrote: Good day,     I have almost successfully converted our axis service to an axis2 service.  It all works, except stopping the threads that are created by this service.  With axis, we used the ServletContextListener destroy method to access the ServletContext.getAttribute(“AxisServiceInstance”) that was written in AxisService and then call the stopThread() method.  I have been having great difficulties in converting this small piece of the project.  I have tried to get the MessageContext in AxisService and write the ServletContext.setAttribute(“AxisServiceInstance”).  The MessageContext is always null.  I have placed this Listener in axis2/WEB-INF/lib.  The posts that I’ve been reading make this look so easy.  What am I overlooking?  Here is a snapshot of my code. public class AxisListener implements ServletContextListener {            public void contextInitialized(ServletContextEvent event){            System.out.println(this.getClass().getName() + ":contextInitialized:context is " + event.getServletContext().getRealPath(""));      }//contextInitialized()                  public void contextDestroyed(ServletContextEvent event) {            System.out.println(this.getClass().getName() + ":contextDestroyed:before destroyThread.");                        AxisService axisService = (AxisService) event.getServletContext().getAttribute("AxisServiceInstance");            axisService.stopThread();      }//contextDestroyed() }     //ServletContextListener  public class AxisService {                            public AxisService() {            this.init();      }//Constructor       private void init(){            .            .            .                 //This is the best that I’ve found using the posts to date:             //set Attributes to be used by AxisListener#contextDestroyed(ServletContextEvent event)MessageContext msgContext = MessageContext.getCurrentMessageContext();            log.debug(this.getClass().getName() + ":init:messageContext:" + msgContext);      //This is Always null               //((ServletContext)msgContext.getProperty(HTTPConstants.MC_HTTP_SERVLETCONTEXT)).setAttribute("AxisServiceInstance", axisService);             //Here is what it was:            //set Attributes to be used by AxisListener#contextDestroyed(ServletContextEvent event)            MessageContext msgContext= MessageContext.getCurrentContext();            (((HttpServlet)msgContext.getProperty(HTTPConstants.MC_HTTP_SERVLET)).getServletContext()).setAttribute("AxisServiceInstance",axisService);      }//init() Thank you,April  		 	   		  

AW: [Axis2] - Migrating axis to axis2 and lost servletContext

Posted by Stadelmann Josef <jo...@axa-winterthur.ch>.
But in scope="soapsession" I have to define a time-out to get
long-lasting-sessions and a state-full-object. If the time-out hits
before the next request is made by the session-thread, my service-object
(instance-of-the-service-class) (addressed by the servicegroupId), does
no longer exists. And as we have our time-out set to about 8hours, real
long lasting sessions, the time-out is only hit after 8h. Hence the
destroy() method called when the same service-class gets a request then
triggers only the destroy-method after 8h, when the service-object
timed-out for this-service-object is occurred. We do normally not see
the destroy() method being called. This time-out is a very annoying
issue in fact! If we would be able to set this time-out programmatically
by something like a prepare-to-stop-call(), to let's say 5 seconds, then
we could observe how our destroy() method gets called. So initiating
threads in the init() method is OK. Keeping threads for a long time is a
different issue in scope="soapsession", and the time-out-facility makes
the thing not better. Or does somebody know a way how I can call to
destruct my service-providing-object, and prove that the destroy()
method is then called?

 

Josef

 

Von: Deepal Jayasinghe [mailto:deepal@opensource.lk] 
Gesendet: Mittwoch, 8. Juni 2011 01:23
An: java-user@axis.apache.org
Betreff: Re: [Axis2] - Migrating axis to axis2 and lost servletContext

 

In Axis2 it has four different type of sessions and transport session is
one of them. So, you have access to the serveltContext only if you use
the transport session.

You can deploy the service in any scope and create the threads inside
the init method and write the code to stop them inside the destroy
method. When the session complete, Axis2 automatically calls the destroy
method and invoke your code. One thing you need to keep in mind is the
number of services instances, in Axis2 for each new session it creates a
new service impl class. And also use the following reference:

http://www.developer.com/db/article.php/3735771/Exposing-a-Database-as-a
-Web-Service.htm
http://blogs.deepal.org/2009/06/axis2-tutorials-and-articles.html

Deepal

On 6/7/2011 6:11 PM, April Easton wrote: 

Good day,

     I have almost successfully converted our axis service to an axis2
service.  It all works, except stopping the threads that are created by
this service.  With axis, we used the ServletContextListener destroy
method to access the ServletContext.getAttribute("AxisServiceInstance")
that was written in AxisService and then call the stopThread() method.
I have been having great difficulties in converting this small piece of
the project.  I have tried to get the MessageContext in AxisService and
write the ServletContext.setAttribute("AxisServiceInstance").  The
MessageContext is always null.  I have placed this Listener in
axis2/WEB-INF/lib.  The posts that I've been reading make this look so
easy.  What am I overlooking?  Here is a snapshot of my code.

 

public class AxisListener implements ServletContextListener {

      

      public void contextInitialized(ServletContextEvent event){

            System.out.println(this.getClass().getName() +
":contextInitialized:context is " +
event.getServletContext().getRealPath(""));

      }//contextInitialized()

      

      

      public void contextDestroyed(ServletContextEvent event) {

            System.out.println(this.getClass().getName() +
":contextDestroyed:before destroyThread.");

            

            AxisService axisService = (AxisService)
event.getServletContext().getAttribute("AxisServiceInstance");

            axisService.stopThread();

      }//contextDestroyed() 

}     //ServletContextListener

 

 

public class AxisService {    

                  

      public AxisService() {

            this.init();

      }//Constructor

 

      private void init(){

            .

            .

            .     

            //This is the best that I've found using the posts to date: 

            //set Attributes to be used by
AxisListener#contextDestroyed(ServletContextEvent event)

MessageContext msgContext = MessageContext.getCurrentMessageContext();

            log.debug(this.getClass().getName() +
":init:messageContext:" + msgContext);      //This is Always null   

 
//((ServletContext)msgContext.getProperty(HTTPConstants.MC_HTTP_SERVLETC
ONTEXT)).setAttribute("AxisServiceInstance", axisService);

 

            //Here is what it was:

            //set Attributes to be used by
AxisListener#contextDestroyed(ServletContextEvent event)

            MessageContext msgContext=
MessageContext.getCurrentContext();

 
(((HttpServlet)msgContext.getProperty(HTTPConstants.MC_HTTP_SERVLET)).ge
tServletContext()).setAttribute("AxisServiceInstance",axisService);

      }//init()

 

Thank you,

April

 


Re: [Axis2] - Migrating axis to axis2 and lost servletContext

Posted by Deepal Jayasinghe <de...@opensource.lk>.
In Axis2 it has four different type of sessions and transport session is
one of them. So, you have access to the serveltContext only if you use
the transport session.

You can deploy the service in any scope and create the threads inside
the init method and write the code to stop them inside the destroy
method. When the session complete, Axis2 automatically calls the destroy
method and invoke your code. One thing you need to keep in mind is the
number of services instances, in Axis2 for each new session it creates a
new service impl class. And also use the following reference:

http://www.developer.com/db/article.php/3735771/Exposing-a-Database-as-a-Web-Service.htm
http://blogs.deepal.org/2009/06/axis2-tutorials-and-articles.html

Deepal

On 6/7/2011 6:11 PM, April Easton wrote:
>
> Good day,
>
>      I have almost successfully converted our axis service to an axis2
> service.  It all works, except stopping the threads that are created
> by this service.  With axis, we used the ServletContextListener
> destroy method to access the
> ServletContext.getAttribute("AxisServiceInstance") that was written in
> AxisService and then call the stopThread() method.  I have been having
> great difficulties in converting this small piece of the project.  I
> have tried to get the MessageContext in AxisService and write the
> ServletContext.setAttribute("AxisServiceInstance").  The
> MessageContext is always null.  I have placed this Listener in
> axis2/WEB-INF/lib.  The posts that I've been reading make this look so
> easy.  What am I overlooking?  Here is a snapshot of my code.
>
>  
>
> *public**class*AxisListener *implements*ServletContextListener {
>
>      
>
>       *public**void*contextInitialized(ServletContextEvent event){
>
>             System./out/.println(*this*.getClass().getName() +
> ":contextInitialized:context is "+
> event.getServletContext().getRealPath(""));
>
>       }//contextInitialized()
>
>      
>
>      
>
>       *public**void*contextDestroyed(ServletContextEvent event) {
>
>             System./out/.println(*this*.getClass().getName() +
> ":contextDestroyed:before destroyThread.");
>
>            
>
>             AxisService axisService = (AxisService)
> event.getServletContext().getAttribute("AxisServiceInstance");
>
>             axisService.stopThread();
>
>       }//contextDestroyed()
>
> }     //ServletContextListener
>
>  
>
>  
>
> *public**class*AxisService {   
>
>                  
>
>       *public*AxisService() {
>
>             *this*.init();
>
>       }//Constructor
>
>  
>
>       *private**void*init(){
>
>             .
>
>             .
>
>             .    
>
>             //This is the best that I've found using the posts to date:
>
>             //set Attributes to be used by
> AxisListener#contextDestroyed(ServletContextEvent event)
>
> MessageContext msgContext = MessageContext./getCurrentMessageContext/();
>
>             log.debug(*this*.getClass().getName() +
> ":init:messageContext:"+ msgContext);      //This is Always null  
>
>            
> //((ServletContext)msgContext.getProperty(HTTPConstants.MC_HTTP_SERVLETCONTEXT)).setAttribute("AxisServiceInstance",
> axisService);
>
>  
>
>             //Here is what it was:
>
>             //set Attributes to be used by
> AxisListener#contextDestroyed(ServletContextEvent event)
>
>             _MessageContext_ msgContext=
> _MessageContext_.getCurrentContext();
>
>            
> (((HttpServlet)msgContext.getProperty(_HTTPConstants_.MC_HTTP_SERVLET)).getServletContext()).setAttribute("AxisServiceInstance",axisService);
>
>       }//init()
>
>  
>
> Thank you,
>
> April
>
>  
>