Hi,

 

I’m running Axis 1.3/Tomcat 5.5 and using servlet-api 2.4. Is it possible to access a Accessing Tomcat Webapp Servlet Context from my axis Webservice ?

 

I have a simple web service that when called needs to invoke on an object that is autostarted and running separately under tomcat as a webapp.

 

To test initially I just setup two tomcat webapps. App1 used setAttribute on its servlet context so it became available to other servlets e.g.

 

  public void init(ServletConfig sc) {

 

    context = sc.getServletContext();

    context.setAttribute("App1", this);

}

 

App2 then did a getAttributs on its context and invoked the required method on App1 e.g.

 

   App1 app = (App1) context.getAttribute("App1");

  app.getCalledCount();

 

 

This all worked Ok. When I try using various ways from my axis webservice I just get nullpointer.

 

e.g.

 

      HttpServlet servlet = (HttpServlet) messageContext

          .getProperty(HTTPConstants.MC_HTTP_SERVLET);

 

      ServletContext servletContext = (ServletContext) servlet

          .getServletContext();

 

      App1 app = (App) servletContext.getAttribute("App1");

 

      app.getCalledCount();

 

 

Does anyone know if it is possible from an axis webapp to invoke on a another tomcat servlet ? Can I not get access because classloaders are different perhaps ?

 

Note: I have loaded App1.jar into tomcat/commons/lib instead of webapps/App1/WEB-INF/lib so there is just the one copy available to tomcat.

 

 

Any help appreciated,

 

Regards,

 

Ciaran

 

 



This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.

Reply via email to