|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Calling an EJB from with a custom developed Java node |
« View previous topic :: View next topic » |
Author |
Message
|
dspyrido |
Posted: Sat Jul 06, 2002 5:30 pm Post subject: Calling an EJB from with a custom developed Java node |
|
|
Newbie
Joined: 11 Jun 2002 Posts: 8
|
Has anyone been sucessful in calling an EJB instance running on a local (i.e. same system) Websphere server from a custom developed Java node (i.e. not using the Java plugin)?
I have a simple command line client that calls the EJB without any problems but when I attempt to create an InitialContext() within my Java node I receive the following error:
HiEjb Runtime Error:
java.lang.NullPointerException
at com.ibm.ws.naming.util.Helpers$1.run(Helpers.java:935)
at java.security.AccessController.doPrivileged(Native Method)
at com.ibm.ws.naming.util.Helpers.mergeJndiProviderProperties(Helpers.java:931)
at com.ibm.websphere.naming.WsnInitialContextFactory.getInitialContext(WsnInitialContextFactory.java:71)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:669)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.<init>(InitialContext.java:199)
at com.glintech.wmqi.HiEjbNode.evaluate(HiEjbNode.java:71) |
|
Back to top |
|
 |
udaybho |
Posted: Mon Jul 08, 2002 12:13 pm Post subject: |
|
|
Voyager
Joined: 09 May 2002 Posts: 94 Location: Chicago
|
After some thoughts I would suggest that you must check the difference between environment variables set for standalone application and for your node.
If you have already done that, you can post snap of your code which may help us to have a closer look into your problem.
Uday Bhosle |
|
Back to top |
|
 |
dspyrido |
Posted: Tue Jul 09, 2002 8:04 pm Post subject: Code request |
|
|
Newbie
Joined: 11 Jun 2002 Posts: 8
|
Hi - I have checked the environment variables and am not receiving a class not found error so I believe it is a fundumental problem with WMQI and how it treats an InitialContext call. The call should not generate an null pointer exception. Also note that the websphere server is local to the system.
Here is the code:
package com.test.wmqi;
import com.ibm.broker.plugin.*;
import javax.ejb.*;
import java.util.*;
import javax.naming.*;
import java.rmi.*;
public class HiEjbNode extends MbNode implements MbNodeInterface
{
public HiEjbNode() throws MbException
{
createInputTerminal("in");
createOutputTerminal("out");
}
public static String getNodeName()
{
return "ComTestWmqiHiEjbNode";
}
public void evaluate(MbMessageAssembly assembly, MbInputTerminal in)
throws MbException
{
try {
Properties env = System.getProperties();
env.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");
env.put(javax.naming.Context.PROVIDER_URL, "iiop://localhost");
InitialContext ic = new InitialContext(env);
HelloHome home = (HelloHome) ic.lookup("HelloHome");
Hello bean = home.create();
String ret = bean.getTextMessage();
System.out.println("getTextMessage Returned Message: " + ret);
System.out.println("EMBED INTO XML MESSAGE");
MbMessage newMsg = new MbMessage(assembly.getMessage());
MbElement fstChild = newMsg.getRootElement().getFirstElementByPath("/XML/A");
fstChild.setValue(ret);
MbMessageAssembly outAssembly = new MbMessageAssembly(assembly, newMsg);
MbOutputTerminal out = getOutputTerminal("out");
out.propagate(outAssembly);
} catch (Exception ex) {
System.out.println("HiEjb Runtime Error:");
ex.printStackTrace();
}
}
} |
|
Back to top |
|
 |
el_pollo_del_mar |
Posted: Wed Jul 17, 2002 3:31 pm Post subject: |
|
|
Novice
Joined: 01 Jul 2002 Posts: 13
|
I'm experiencing a very similar problem to the one described by dspryido.
Whenever I try to implement a JNDI lookup within a custom Java node, it throws an InstantiationException when the InitialContext is instantiated. This is not a problem with the code: I'm using a standard InitialContextFactory call, and the InitialContext can be constructed in exactly the same way in a stand-alone program running on the same JRE as WMQI with no problems whatsoever.
It looks as though there is something within WMQI inhibiting the use of JNDI or J2EE extensions.
Has anyone else attempted this sort of thing before? Has anyone had any experience at all with J2EE within WMQI nodes? |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|