• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

calling EJB from normal java program

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am calling ejb through my java program i am getting following error,help me for solving this. I imported all the jars i given jndi name correctly, i am trying this through IBM wsad.

My JNDI name ejb/example/SampleHome

i am getting error for this line

Object ref = ctx.lookup("ejb/example/SampleHome");


javax.naming.NamingException: The JNDI operation "lookup"on the context "localhost/nodes/localhost/servers/server1" with the name "ejb/example/SampleHome" failed. Please get the root cause Throwable contained in this NamingException for more information. Root exception is java.lang.NoClassDefFoundError: com/ibm/ejs/jts/jts/CurrentFactory
 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This looks like your classpath is not setup correctly. Try to include the jar where the missing class "com/ibm/ejs/jts/jts/CurrentFactory" is located in the classpath.
 
Yog Ananth
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please clarify my doubt is it possible to call an ejb from normal java program, i am using simple java program in main i am calling ejb, i am having ejb references.
 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Yes, you can call EJBs from a plain and simple java program, whether is is on the same machine, or a different one.
 
author
Posts: 3899
10
Redhat Quarkus Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, it's possible to call EJB's from Java program, that's true, but whether or not the resulting program is "normal" is a different story... In order to use an EJB client you have to have a fairly large number of WebSphere JAR files on your classpath. Go to the WebSphere InfoCenter and look for "thin client" to find out more about this -- or alternatively go search the posts in the WebSphere Section on what JAR files you need to invoke an EJB -- it's a common question...

Kyle
 
Yog Ananth
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Thank for your helpful tips , in client i am using the same machine, i am trying to connect EJB also in the same machine. I am able to call from servlet to EJB but i am unable to do in normal java program.
 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to do the exact same thing Using WSAD 5.1 on my wintel thinkpad. I created a simple stateless session bean with remote and local interfaces. I am able to use the UTC to test the SLSB perfectly, but trying to create a normal java prgram to call it is proving to be very tough, even though posts indicate this should not be. Are you using the Sun JRE to run your client against the WSAD (IBM jre)?
reply
    Bookmark Topic Watch Topic
  • New Topic