ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Calling an EJB from with a custom developed Java node

Post new topic  Reply to topic
 Calling an EJB from with a custom developed Java node « View previous topic :: View next topic » 
Author Message
dspyrido
PostPosted: Sat Jul 06, 2002 5:30 pm    Post subject: Calling an EJB from with a custom developed Java node Reply with quote

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
View user's profile Send private message
udaybho
PostPosted: Mon Jul 08, 2002 12:13 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
dspyrido
PostPosted: Tue Jul 09, 2002 8:04 pm    Post subject: Code request Reply with quote

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
View user's profile Send private message
el_pollo_del_mar
PostPosted: Wed Jul 17, 2002 3:31 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Calling an EJB from with a custom developed Java node
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.