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 EJB from a Java Compute: ClassNotFoundException

Post new topic  Reply to topic
 Calling EJB from a Java Compute: ClassNotFoundException « View previous topic :: View next topic » 
Author Message
saviobarr
PostPosted: Sat Aug 01, 2015 5:56 am    Post subject: Calling EJB from a Java Compute: ClassNotFoundException Reply with quote

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
View user's profile Send private message Send e-mail
nelson
PostPosted: Sat Aug 01, 2015 1:08 pm    Post subject: Reply with quote

Partisan

Joined: 02 Oct 2012
Posts: 313

Please check this:

http://www.mqseries.net/phpBB2/viewtopic.php?t=70654

And this:

https://www-01.ibm.com/support/knowledgecenter/SSMKHH_9.0.0/com.ibm.etools.mft.doc/ac30280_.htm%23ac30280_
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon Aug 03, 2015 4:31 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
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
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Mon Aug 03, 2015 4:49 am    Post subject: Re: Calling EJB from a Java Compute: ClassNotFoundException Reply with quote

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
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 EJB from a Java Compute: ClassNotFoundException
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.