• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1089
  • Last Modified:

MDB test client failing

Experts,
   I have one mdb up and running in WSAD test environment server 5.1. To test it I have also created one test client given below. When I run the client I am getting some exception, which I have enclosed it at the last. Please let me know the potential bug causing the client to fail. Thanks in Advance.

import java.util.Hashtable;
import javax.jms.Queue;
import javax.jms.QueueConnection;
import javax.jms.QueueConnectionFactory;
import javax.jms.QueueSender;
import javax.jms.QueueSession;
import javax.jms.TextMessage;
import javax.naming.Context;
import javax.naming.InitialContext;

public class TestClient
{
      public static void main(String[] args) throws Exception
    {
          QueueConnection cnn = null;
          QueueSender  sender = null;
          QueueSession session = null;
                  String icf = "com.ibm.websphere.naming.WsnInitialContextFactory";  
                  String url="iiop://localhost:2809";
                      
            Hashtable env = new Hashtable();
            env.put( Context.INITIAL_CONTEXT_FACTORY, icf );
            env.put( Context.PROVIDER_URL, url );

          InitialContext ctx = new InitialContext();
              Queue queue = null;
          try
          {
                queue = (Queue) ctx.lookup("jms/TestMDBQueue");
          }
          catch(Exception e)
          {
                e.printStackTrace();
          }
         
          QueueConnectionFactory factory = (QueueConnectionFactory) ctx.lookup("jms/TestConnectionFactory");
          cnn = factory.createQueueConnection();
          session = cnn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
   
          TextMessage msg = session.createTextMessage("Testing...");
   
          sender = session.createSender(queue);
          sender.send(msg);
          System.out.println("Done...");
    }
}

Exception:
javax.naming.NamingException: The JNDI operation "lookup"on the context "localhost/nodes/localhost/servers/server1" with the name "jms/TestMDBQueue" 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:360)
      at com.accenture.TestClient.main(TestClient.java:46)
Exception in thread "P=536011:O=0:CT" javax.naming.NamingException: The JNDI operation "lookup"on the context "localhost/nodes/localhost/servers/server1" with the name "jms/TestConnectionFactory" 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:360)
      at com.accenture.TestClient.main(TestClient.java:53)
Regards,
Ganesh CN
0
ganesh_cn
Asked:
ganesh_cn
  • 2
  • 2
2 Solutions
 
avinthmCommented:
Its not able to find com.ibm.ejs.jts.jts.CurrentFactory
This class is in "tx.jar".
So, include "tx.jar" in your runtime classpath.
0
 
rama_krishna580Commented:
Hi,

WebSphere JNDI Standalone client will only work with the IBM JRE.

And IBM does not ship their JRE standalone. (atleast their 1.4 JRE)

R.K
0
 
ganesh_cnAuthor Commented:
Thanks for your comments.
Avinthm
tx.jar has different CurrentFactory class and not com.ibm.ejs.jts.jts.CurrentFactory.

R.k
I dont have permission to install other JRE. Is there any alternative solution for this?

Cheers,
Ganesh CN
0
 
avinthmCommented:
> tx.jar has different CurrentFactory class and not com.ibm.ejs.jts.jts.CurrentFactory
which version of WAS do u have ?
I have WAS 5.0 installed and i can see com.ibm.ejs.jts.jts.CurrentFactory in tx.jar

When you are running your test client make sure that the selected JRE for your test client is WAS.
You can do this by
Run -> Run -> JRE (tab)

There select the WAS JRE. If its not displayed in the dropdown list of "Alternate JRE" then click on "Installed JREs..."
Now u can select the path of WAS jre.

you dont have to installed other JRE.
0
 
ganesh_cnAuthor Commented:
I have tried many options in WSAD to no avail. Atlast I resolved it by creating test webapp application and ran it same JVM of MDB.
Anyways thanks for all your informations. I would split up point and give it you both after this..
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now