Hi,
 
The Axis jars are in the lib directory of the axis2 project and the ejb
jar definition has a class path property in the manifest.mf to load them
from <axis2_home>/lib directory.
 
The call to the ejb is from the same JVM as the web service so the calls
are all 'ejb local'. 
 
I have followed the steps documented in the guide
http://ws.apache.org/axis2/1_2/ejb-provider.html and I have reproduced
the problem on this example. All I did was to add the messagecontext
call to the HelloBean.java sayHello method :
 
    MessageContext msgCtx = MessageContext.getCurrentMessageContext();
    System.err.print(msgCtx);
 
Then I modified the HelloBean's ejb manifest.mf to include a class path
for axis2-kernel-1.3.jar and  axiom-api-1.2.5.jar and deployed this bean
in JBOSS.
 
When I execute this service the print from STDOUT reports the msgCtx as
null. 
 
It's getting a bit frustrating now.
 
 
Adam
 

  _____  

From: Andreas Veithen [mailto:[EMAIL PROTECTED] 
Sent: 21 January 2008 21:49
To: [email protected]
Subject: Re: getCurrentMessageContext() returns null when invoked from
an EJB?


Hi,

MessageContext stores the current message context in a ThreadLocal. To
be able to retrieve it, two conditions must be met:

1) The Axis JARs must be loaded from the same class loader.
2) MessageContext#getCurrentMessageContext must be called from within
the thread that received the request.

For point 1: Where did you put the Axis JARs?
For point 2: I'm not very familiar with EJBs, but it might be that this
is the case only if the EJB is called through its local interface.

Regards,

Andreas

On 21 Jan 2008, at 15:39, Etches, Adam (GE Infra, Energy) wrote:


        Hi all first time posting... 
        I have been looking at implementing web services in axis2-1.3
with EJB 2.1. I need to get a handle on the message from with in the
service implementation.  I believe the correct approach for this is to
invoke the method getCurrentMessageContext() on MessageContext from with
in the service.

         

        I have tried this in a test pojo service which correctly returns
the message context but when called *BUT* when invoking this method from
an EJB null is returned.
        Does anyone know why the getCurrentMessageContext()  returns
null when invoked from an EJB?   

         

        thanks
        Adam
         


Reply via email to