0 Replies Latest reply on Sep 5, 2005 12:26 PM by Lloyd Davies

    Error running JNDI client with IBM JVM

    Lloyd Davies Newbie

      Hi,

      I have an instance of JBoss 4.0.2 running with a Sun JDK 1.4.2. I have a message driven bean deployed and I have a standalone client which puts a message on the queue and is processed my the message driven bean.

      This all works perfectly when I use the Sun JVM to run the client, but it gives me a nasty stack trace (below) when I run it with a IBM 1.4.1 JVM. I have to run it with the IBM JVM as I will be using the client class as a Java UDF within DB2 (which utilizes the IBM JVM).

      Can anyone help?

      Thanks,
      Lloyd.

      Stack trace:

      Exception in thread "main" java.lang.NoClassDefFoundError: org/jboss/logging/Logger
      at org.jnp.interfaces.NamingContext.(NamingContext.java:143)
      at org.jnp.interfaces.NamingContextFactory.getInitialContext(NamingContextFactory.java:41)
      at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:674)
      at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:256)
      at javax.naming.InitialContext.init(InitialContext.java:232)
      at javax.naming.InitialContext.(InitialContext.java:208)
      at MobileUDF.message(MobileUDF.java:38)
      at MobileUDF.main(MobileUDF.java:66)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:41)
      at java.lang.reflect.Method.invoke(Method.java:386)
      at com.intellij.rt.execution.application.AppMain.main(AppMain.java:78)

      Client class:

      import gamesys.mobile.InboundSMSMessage;
      
      import javax.jms.*;
      import javax.naming.Context;
      import javax.naming.InitialContext;
      import java.util.Properties;
      
      public class MobileUDF {
       public static String message(String destination, String originator, String body, String messageReference,
       String sequence, String operator, String tariff, String encoding,
       String udh, String sessionId) {
      
       String response = "worked";
      
       InboundSMSMessage sms = new InboundSMSMessage(destination, originator, body, messageReference,
       sequence, operator, tariff, encoding,
       udh, sessionId);
      
       try {
       QueueConnectionFactory myQConnFactory;
       Queue myQueue;
      
       Properties properties = new Properties();
       properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
       properties.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
       properties.put(Context.PROVIDER_URL, "jnp://localhost:1099");
      
       Context ctx = new InitialContext(properties);
      
       myQConnFactory = (QueueConnectionFactory)ctx.lookup("ConnectionFactory");
       myQueue = (Queue)ctx.lookup("queue/SMSProcessing");
      
       QueueConnection con = myQConnFactory.createQueueConnection();
       QueueSession session = con.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
       ObjectMessage objectMessage = session.createObjectMessage(sms);
       QueueSender sender = session.createSender(myQueue);
      
       con.start();
       sender.send(objectMessage);
       con.close();
       ctx.close();
       } catch (Exception e) {
       Throwable cause = e;
       while (cause.getCause()!=null) {
       cause = cause.getCause();
       }
       response = cause.toString();
      
       e.printStackTrace();
       }
      
       return response;
       }
      
       public static void main(String[] args) {
       System.out.println(message("1","2","3","4","5","6","7","8","9","10"));
       }
      }