Dear Axis-Users and -Developers,

I have installed Axis 1.4 over Tomcat 5.5.17 over Java 1.5 and have one 
question and one problem:
My question is: I have two WebServices deployed in the same container which 
want to share the same data (e.g. one instance of my class FileResourceHome). I 
figured out that this data can be stored in a property (e.g. 
"TextGrid.FileResourceHome") of the ServletContext which I can access out of 
any WebService deployed in the same container, right or wrong?
Here is is the code I am using so far for this scenario:

import org.apache.axis.MessageContext;
import org.apache.axis.transport.http.HTTPConstants;
import javax.servlet.http.HttpServlet;
import javax.servlet.ServletContext;
...
private static final String fileResourceHomeName = "TextGrid.FileResourceHome";
public static FileResourceHome getInstance()
{
  MessageContext messageContext = MessageContext.getCurrentContext();
  HttpServlet httpServlet = 
(HttpServlet)messageContext.getProperty(HTTPConstants.MC_HTTP_SERVLET);
  ServletContext servletContext = httpServlet.getServletContext();

  FileResourceHome fileResourceHome = 
(FileResourceHome)servletContext.getAttribute(fileResourceHomeName);
  if(fileResourceHome == null)
  {
    fileResourceHome = new FileResourceHome();
    servletContext.setAttribute(fileResourceHomeName, fileResourceHome);
  }
        
  return fileResourceHome;
}

My problem is: This code does compile, but doesn't execute, because the line
MessageContext messageContext = MessageContext.getCurrentContext();
from above results in a java.lang.reflect.InvocationTargetException. I don't 
understand this, because the class MessageContext is in the file axis.jar which 
is stored in the webapps/axis/WEB-INF/lib directory of my tomcat-installation.

What did I do wrong? Can someone help me, please?

Cheers
Frank

_______________________________________________________________________
Viren-Scan für Ihren PC! Jetzt für jeden. Sofort, online und kostenlos.
Gleich testen! http://www.pc-sicherheit.web.de/freescan/?mc=022222


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to