|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Calling EJB from a Java Compute: ClassNotFoundException |
« View previous topic :: View next topic » |
Author |
Message
|
saviobarr |
Posted: Sat Aug 01, 2015 5:56 am Post subject: Calling EJB from a Java Compute: ClassNotFoundException |
|
|
Centurion
Joined: 21 Oct 2014 Posts: 100 Location: Sao Paulo, Brazil
|
Hi all,
I trying to call an EJB from a Java Compute Node, but I am getting the exception below:
javax.naming.NoInitialContextException: Cannot instantiate class: com.ibm.websphere.naming.WsnInitialContextFactory [Root exception is java.lang.ClassNotFoundException: com.ibm.websphere.naming.WsnInitialContextFactory]
I have the jars containing the com.ibm.websphere.naming.WsnInitialContextFactory in my java project classpath.
IIB version 9
The Java code is below
Code: |
private void doSomething(){
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory");
env.put(Context.PROVIDER_URL,"corbaloc::192.168.182.135:9104");
EjbSampleRemoteInterface ejbRemote = null;
Object obj;
try{
InitialContext ctx = new InitialContext(env);
obj = ctx.lookup("EjbSample");
if(obj instanceof EjbSampleRemoteInterface){
ejbRemote = (EjbSampleRemoteInterface) obj;
}
if(ejbRemote != null){
System.out.println(ejbRemote.doSomething());
}
}catch(NamingException ne){
System.err.println("Nao foi possivel lookup");
ne.printStackTrace();
}
} |
Many thanks
Savio |
|
Back to top |
|
 |
nelson |
Posted: Sat Aug 01, 2015 1:08 pm Post subject: |
|
|
 Partisan
Joined: 02 Oct 2012 Posts: 313
|
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Aug 03, 2015 4:31 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Thinking about the overall architecture...
Instead of reaching out to the EJB over RMI, should you maybe be trying to do the same over messaging and have the J2EE server call the EJB internally from messaging? (MDB to EJB?)  _________________ MQ & Broker admin |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Aug 03, 2015 4:49 am Post subject: Re: Calling EJB from a Java Compute: ClassNotFoundException |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
saviobarr wrote: |
I trying to call an EJB from a Java Compute Node |
Please don't do that. |
|
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
|
|
|
|