Hello folks,

My JBoss AS is running on JDK 1.4
I configured a JMS topic.

I have a Dynix JDK 1.2 client that needs to send messages to the app server.

I have the following jars in my client's classpath [set as Manfiest classpath 
attribute value pairs]:
concurrent.jar
javax.jms.jar (downloaded from Sun)
jboss-common-client.jar
jboss-system-client.jar
jbossmq-client.jar
jndi.jar (version 1.1.2) downloaded from Sun
jnp-client.jar
log4j-1.2.9.jar

This is the output I get:

Exception in thread "main"
java.lang.NoClassDefFoundError: java/net/SocketAddress
        at
org.jnp.interfaces.NamingContextFactory.getInitialContext(NamingContextFactory.java:40)
        at
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:771)
        at
javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:169)
        at
javax.naming.InitialContext.(InitialContext.java:146)
        at
infonet.jms.PublisherCommand.execute(PublisherCommand.java,CompiledCode)
        at
infonet.jms.PublisherCommand.main(PublisherCommand.java:143)

Does this mean, heaven's forbid, that JBoss clients, such as my legacy dynix 
system that wants to send a JMS message through it's 1.2 JDK can not do so, are 
required to be JDK 1.4 and above?

Below is my class file that sent the JMS messages:


  | package infonet.jms;
  | 
  | import javax.jms.JMSException;
  | import javax.jms.Topic;
  | import javax.jms.TopicConnection;
  | import javax.jms.TopicConnectionFactory;
  | import javax.jms.TopicPublisher;
  | import javax.jms.TopicSession;
  | import javax.jms.TextMessage;
  | import javax.naming.InitialContext;
  | import javax.naming.NamingException;
  | import javax.naming.Context;
  | import java.util.Hashtable;
  | 
  | 
  | /**
  |  * Publishes a text message to the given topic.
  |  */
  | public class PublisherCommand
  | {
  |     /** The initial context factory */
  |     private String ctxFactory = null;
  |     /** The provider url */
  |     private String providerUrl = null;
  |     /** topic JNDI Name */
  |     private String topicJndiName = null;
  |     /** The message text */
  |     private String text = null;
  |     /**
  |      * Retrieves the initial context factory
  |      * @return the initial context factory
  |      */
  |     public String getCtxFactory()
  |     {
  |             return ctxFactory;
  |     }
  |     /**
  |      * Sets the initial context factory
  |      * @param ctxFactory the initial context factory.
  |      */
  |     public void setCtxFactory(String ctxFactory)
  |     {
  |             this.ctxFactory = ctxFactory;
  |     }
  |     /**
  |      * Retrieves the provider url.
  |      * @return the provider url.
  |      */
  |     public String getProviderUrl()
  |     {
  |             return providerUrl;
  |     }
  |     /**
  |      * Sets the provider url.
  |      * @param providerUrl The provider url.
  |      */
  |     public void setProviderUrl(String providerUrl)
  |     {
  |             this.providerUrl = providerUrl;
  |     }
  | 
  |     /**
  |      * Retrieves the message text that will be sent.
  |      * @return the message.
  |      */
  |     public String getText()
  |     {
  |             return text;
  |     }
  |     /**
  |      * Sets the message to that will be sent.
  |      * @param text The message text to send.
  |      */
  |     public void setText(String text)
  |     {
  |             this.text = text;
  |     }
  |     /**
  |      * Retrieves the topic JNDI name.
  |      * @return the topic JNDI name.
  |      */
  |     public String getTopicJndiName()
  |     {
  |             return topicJndiName;
  |     }
  |     /**
  |      * Sets the topic JNDI name.
  |      * @param topicJndiName the topic JNDI name.
  |      */
  |     public void setTopicJndiName(String topicJndiName)
  |     {
  |             this.topicJndiName = topicJndiName;
  |     }
  | 
  |     /**
  |      * Publishes the text message to a topic.
  |      */
  |     public void execute() throws JMSException,NamingException
  |     {
  |             if (topicJndiName==null || text==null || ctxFactory==null || 
providerUrl==null)
  |                     throw new IllegalArgumentException("topic, text, 
ctxFactory, and providerUrl must be set");
  | 
  |             TopicConnection con = null;
  |             try
  |             {
  |                     Hashtable env = new Hashtable();
  |                     env.put(Context.INITIAL_CONTEXT_FACTORY,ctxFactory);
  |                     env.put(Context.PROVIDER_URL,providerUrl);
  |                     InitialContext ctx = new InitialContext(env);
  |                     TopicConnectionFactory tcf = (TopicConnectionFactory) 
ctx.lookup("ConnectionFactory");
  |                     con = tcf.createTopicConnection();
  |                     Topic topic = (Topic) ctx.lookup(topicJndiName);
  |                     TopicSession session = 
con.createTopicSession(false,TopicSession.AUTO_ACKNOWLEDGE);
  |                     con.start();
  |                     TopicPublisher publisher = 
session.createPublisher(topic);
  |                     TextMessage message = session.createTextMessage(text);
  |                     publisher.publish(message);
  |             }
  |             finally
  |             {
  |                     if (con!=null)
  |                             con.close();
  |             }
  |     }
  | 
  |     /**
  |      * Runs this command for test purposes
  |      * @param args none requred.
  |      * @throws Exception
  |      */
  |     public static void main(String args[]) throws Exception
  |     {
  |             System.out.println("Begin Publsher Command, now=" + 
System.currentTimeMillis());
  | 
  |             PublisherCommand publisher = new PublisherCommand();
  |             publisher.setTopicJndiName("topic/tmipMQ");
  |             
publisher.setCtxFactory("org.jnp.interfaces.NamingContextFactory");
  |             publisher.setProviderUrl("jnp://204.79.138.126:1099");
  |             publisher.setText("A text msg, now=" + 
System.currentTimeMillis());
  | 
  |             try
  |             {
  |                     publisher.execute();
  |             }
  |             catch (JMSException e)
  |             {
  |                     e.printStackTrace();
  |             }
  |             catch (NamingException e)
  |             {
  |                     e.printStackTrace();
  |             }
  | 
  |             System.out.println("End Publisher Command");
  |             System.exit(0);
  |     }
  | }
  | 
  | 

Thank you, any help is appreciated.

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3876852#3876852

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3876852


-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.
Get your fingers limbered up and give it your best shot. 4 great events, 4
opportunities to win big! Highest score wins.NEC IT Guy Games. Play to
win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to