I am lost in an example in O'Reilly's Enterprise Beans text (In JMS messages).

I wrote a simple java remote client tofigure out how to publish a message to a 
Topic.  The code and its output are posted below.

Can anyone help me with 2 questions? (other gratuitous pointers are also most 
welcome):

1.  The text uses refers to a TopicConnectionFactory, but I don't have one in 
my jboss 3.2.6 remote server, but I thought I read in this forum that I need to 
use a UIL2ConnectionFactory for remote connections anyway.
True? -- see 2.
False? do I need to code an MBean in an (?).xml deployment file to get one.

2. If I use UIL2ConnectionFactory, where do I look for the API for   
org.jboss.mq.SpyConnectionFactory?  (I am guessing I need to give the factory 
some set of user id/password parameters.   But without the API I am not even 
sure it can create a TopicConnection.)

My Local CLient Code:
import javax.naming.*;
  | import java.util.*;
  | import javax.jms.*;
  | import org.jboss.mq.*;
  | 
  | public class JmsSend {
  | 
  |   public static void main (String[] args) {
  |     JmsSend send = new JmsSend ();
  |     Context jndiContext=null;
  |     try {
  |       System.out.print ("Gettng Initial Context: ");
  |       jndiContext = send.getInitialContext ();
  |       System.out.println ("OK");
  | 
  |       System.out.print ("\nLook up TopicConnectionFactory: ");
  |       Object obj = jndiContext.lookup 
("java:comp/env/jms/TopicConnectionFactory");
  |       System.out.println ("OK");
  |     } catch (NamingException ne) {
  |       System.out.println ("Failed \n     NamingException: " + ne.getMessage 
());
  |     }
  |     try {
  |       System.out.print ("\nLook up UIL2ConnectionFactory: ");
  |       SpyConnectionFactory factory = (SpyConnectionFactory) 
jndiContext.lookup ("UIL2ConnectionFactory");
  |       System.out.println ("OK\n     class = " + factory.getClass ());
  | 
  |       System.out.print ("\nCreate Connection:");
  |       Object obj = factory.createTopicConnection ();
  | 
  |     } catch (NamingException ne) {
  |       System.out.println ("Failed \nNamingException: " + ne.getMessage ());
  |     } catch (JMSException je) {
  |       System.out.println ("Failed \nJMSException: " + je.getMessage ());
  |     }
  |   }
  | 
  |   public Context getInitialContext() throws NamingException {
  |     Properties p = new Properties();
  |     p.put(
  |       Context.INITIAL_CONTEXT_FACTORY,
  |       "org.jboss.naming.HttpNamingContextFactory");
  |     p.put(
  |       Context.PROVIDER_URL,
  |       "jnp://America-3.org/invoker/JNDIFactory");
  | 
  |     return new InitialContext(p);
  |   }
  | }The outputGettng Initial Context: OK
  | 
  | Look up TopicConnectionFactory: Failed
  |      NamingException: comp not bound
  | 
  | Look up UIL2ConnectionFactory: OK
  |      class = class org.jboss.mq.SpyConnectionFactory
  | 
  | Create Connection:Failed
  | JMSException: Cannot authenticate user; - nested throwable: 
(java.net.ConnectException: Connection refused: connect)
  | Press any key to continue . . .

Thanks,
George

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

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


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to