Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJB application runs as WebSphere Application client, fails as JavaApplication

 
Sandeep Murthy
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have developed a TestClient and an EJB module in WSAD 5.1(web sphere studio application developer).
( The ejb module has only stateless session beans. I'm accessing DB2 8.1 database from the session bean using type-4 jdbc driver)

It runs fine when i run the testclient as "Websphere v5.1 Application Client".
But when i run it as "Java Application", i'm getting a NamingException.
This same exception occurs when i generate an ear, deploy it on WebSphere and run the application.

The error stack-trace is as follows :

javax.naming.NamingException: The JNDI operation "lookup"on the context "localhost/nodes/localhost/servers/server1" with the name "ejb/com/thbs/PiggyBank/session/BankSessionHome" 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
at com.ibm.ws.naming.jndicos.CNContextImpl.suspendTransaction(CNContextImpl.java:4064)
at com.ibm.ws.naming.jndicos.CNContextImpl.cosResolve(CNContextImpl.java:3521)
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1565)
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1525)
at com.ibm.ws.naming.jndicos.CNContextImpl.lookup(CNContextImpl.java:1225)
at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:132)
at javax.naming.InitialContext.lookup(InitialContext.java:359)
at com.thbs.PiggyBank.TestClient.getReferences(TestClient.java:61)
at com.thbs.PiggyBank.TestClient.main(TestClient.java:628)

Observe one thing here :
it's trying to lookup on server1 while i'm running my application on other server with different ports(http,bootstrap,etc all dirrerent ports).
Server1 is another server running on Websphere in my system, while i'm trying to run my application in another server in WebSphere Studio, with different ports.
But this doesn't seem to be important, because i tried running the application after stopping the WebSphere srever, with same error.

What seems to be the problem ? How to fix it ?
 
Senthil Somasundaram
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sandeep,

use InitialContext with the proper input parameters (provider URL, Initialcontext factory) to lookup EJB in your java client.

There are lot of examples available in the sun site.



Senthil
 
Jesus Angeles
Ranch Hand
Posts: 2068
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
senthil, can you give the url where in sun site(examples)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic