Hi,
My friend added this line to the JMSChannel.onMessage() method and it
corrected the problem of context not knowing its client. Can this be added
as a fix for the earlier change in Client.java?

        context.setProperty("Destination", srcID);
        context.setXFire(((JMSClientTransport) getTransport()).getXFire());
        XMLStreamReader reader = STAXUtils.createXMLStreamReader(new
StringReader(text), context);
    InMessage in = new InMessage(reader, getUri());
        context.setClient((Client)this.getEndpoint());  // THIS LINE ADDED
    receive(context, in);
}
catch (JMSException e)
{
        log.error("Error receiving message " + message, e);
}


Thanks and Regards
Mayank
 
****************************************************************************
****************************
 This e-mail and attachments contain confidential information from HUAWEI,
which is intended only for the person or entity whose address is listed
above. Any use of the information contained herein in any way (including,
but not limited to, total or partial disclosure, reproduction, or
dissemination) by persons other than the intended recipient's) is
prohibited. If you receive this e-mail in error, please notify the sender by
phone or email immediately and delete it!


-----Original Message-----
From: Mayank Thakore [mailto:[EMAIL PROTECTED] 
Sent: Monday, July 30, 2007 10-26
To: [email protected]
Subject: [xfire-user] jms client exception

Hi,

I am using XFire 1.2.6. I got an exception in JMS client:

Exception in thread "main" org.codehaus.xfire.XFireRuntimeException: 
Could not invoke service.. Nested exception is 
org.codehaus.xfire.fault.XFireFault: Fault: java.lang.NullPointerException
org.codehaus.xfire.fault.XFireFault: Fault: java.lang.NullPointerException
    at org.codehaus.xfire.fault.XFireFault.createFault(XFireFault.java:89)
    at org.codehaus.xfire.client.Client.onReceive(Client.java:410)
    at 
org.codehaus.xfire.transport.AbstractChannel.receive(AbstractChannel.java:38
)
    at 
org.codehaus.xfire.transport.jms.JMSChannel.onMessage(JMSChannel.java:300)
    at 
org.exolab.jms.client.JmsMessageConsumer.onMessage(JmsMessageConsumer.java:2
56)
    at org.exolab.jms.client.JmsSession.onMessage(JmsSession.java:1009)
    at 
org.exolab.jms.client.net.JmsSessionStubImpl.onMessage(JmsSessionStubImpl.ja
va:478)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
    at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.exolab.jms.net.orb.DefaultORB$Handler.invoke(DefaultORB.java:572)
    at org.exolab.jms.net.orb.DefaultORB$1.run(DefaultORB.java:530)
    at 
EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.NullPointerException
    at org.codehaus.xfire.client.Client.onReceive(Client.java:401)
    ... 13 more
Received message
onMessage -> Source ID: null, Message ID: 
ID:5d4e95c4-c32d-1004-8755-638f44c7d7a3


In the method org.codehaus.xfire.client.Client.onReceive(MessageContext 
context, InMessage msg) the contextClient is null. This is the code from the
file:

            //the Client object in the context is not necessary "this" 
(client.onReceive())
            // we need to invoke the handlers from the client in the 
context not "this"
            // was creating issues when used in multi-threaded
            Client contextClient = context.getClient();
           
            HandlerPipeline inPipe = new 
HandlerPipeline(contextClient.getXFire().getInPhases());






 I checked the stack and don't see the client being set anywhere. So in
debug mode I replaced set the value of contextClient to this and it worked
beautifully! I think I might have missed something in the client code. This
is my 
client code:


    public static void main(String[] args) throws MalformedURLException, 
NamingException {
        XFire xfire = XFireFactory.newInstance().getXFire();
        
        // Register JMS transport
        xfire.getTransportManager().register(
                new JMSTransport(
                        xfire,
                        ConnectionFactoryMgr.create()));
        
        // Create a ServiceFactory to create the ServiceModel.
        // We need to add the JMSTransport to the list of bindings to 
create.
        ObjectServiceFactory sf = new 
ObjectServiceFactory(xfire.getTransportManager());
        sf.addSoap11Transport(JMSTransport.BINDING_ID);
        
        // Create the service model
        Service serviceModel = sf.create(Echo.class);
        
        // Create a proxy for the service
        XFireProxyFactory factory = new XFireProxyFactory(xfire);
        Echo echo = (Echo) factory.create(serviceModel, "jms://Echo");
        
        // Since JMS doesn't really have a concept of anonymous 
endpoints, we need
        // need to let xfire know what JMS endpoint we should use
        ((XFireProxy) 
Proxy.getInvocationHandler(echo)).getClient().setEndpointUri("jms://EchoClie
nt");
        
        // run the client!
        System.out.println(echo.echo("hello"));
    }


The server is working fine. Is there a way to get through this problem? 
Do I have to set the client with some code?
Please help !!!
Thanks in advance!

Regards
mayank

****************************************************************************
****************************
 This e-mail and attachments contain confidential information from HUAWEI,
which is intended only for the person or entity whose address is listed
above. Any use of the information contained herein in any way (including,
but not limited to, total or partial disclosure, reproduction, or
dissemination) by persons other than the intended recipient's) is
prohibited. If you receive this e-mail in error, please notify the sender by
phone or email immediately and delete it!



---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email




---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to