still not working !!
here is the report

  | 
  | java -classpath .;e:\j2ee.jar;c:\jboss\client\jbossall-client.jar
  | QueueSend
  | javax.naming.NameNotFoundException: queue1 not bound
  |         at org.jnp.server.NamingServer.getBinding(NamingServer.java:491)
  |         at org.jnp.server.NamingServer.getBinding(NamingServer.java:499)
  |         at org.jnp.server.NamingServer.getObject(NamingServer.java:505)
  |         at org.jnp.server.NamingServer.lookup(NamingServer.java:278)
  |         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  |         at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
  | java:39)
  |         at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
  | sorImpl.java:25)
  |         at java.lang.reflect.Method.invoke(Method.java:324)
  |         at 
sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
  |         at sun.rmi.transport.Transport$1.run(Transport.java:148)
  |         at java.security.AccessController.doPrivileged(Native Method)
  |         at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
  |         at 
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:4
  | 60)
  |         at 
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport
  | .java:701)
  |         at java.lang.Thread.run(Thread.java:534)
  |         at 
sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknow
  | n Source)
  |         at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
  |         at sun.rmi.server.UnicastRef.invoke(Unknown Source)
  |         at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
  |         at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:610)
  |         at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
  |         at javax.naming.InitialContext.lookup(Unknown Source)
  |         at QueueSend.main(QueueSend.java:39)
  | 

and here is the latest code

  | import java.util.Hashtable;
  | 
  | import javax.jms.JMSException;
  | import javax.jms.Queue;
  | import javax.jms.QueueConnection;
  | import javax.jms.QueueConnectionFactory;
  | import javax.jms.QueueSender;
  | import javax.jms.QueueSession;
  | import javax.jms.Session;
  | import javax.jms.TextMessage;
  | import javax.naming.Context;
  | import javax.naming.InitialContext;
  | import javax.naming.NamingException;
  | 
  | public class QueueSend
  | {
  |     public static void main(String[] args)
  |     {
  |             try
  |             {
  |                     // create a JNDI context
  |                     Hashtable env = new Hashtable();
  |                     env.put(Context.INITIAL_CONTEXT_FACTORY, 
"org.jnp.interfaces.NamingContextFactory");
  |                     env.put(Context.PROVIDER_URL, "jnp://localhost:1099");
  |                     env.put(Context.URL_PKG_PREFIXES, 
"org.jboss.naming:org.jnp.interfaces");
  |                     Context context = new InitialContext(env);
  |     
  |                     
  |                     // retrieve queue connection factory
  |                     QueueConnectionFactory queueConnectionFactory = 
(QueueConnectionFactory)context.lookup("ConnectionFactory");    
  |                     // create a queue connection
  |                     QueueConnection queueConnection = 
queueConnectionFactory.createQueueConnection();
  |                     
  |                     // create a queue session
  |                     // set transactions to false and set auto 
acknowledgement of receipt of messages
  |                     QueueSession queueSession = 
queueConnection.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);
  |                     
  |                     // retrieve queue
  |                     Queue queue = (Queue)context.lookup("queue1");
  |                     
  |                     // create a queue sender and associate to the retrieved 
queue
  |                     QueueSender queueSender = 
queueSession.createSender(queue);
  |                     
  |                     // send a message to the queue 
  |                     TextMessage message = queueSession.createTextMessage();
  |                     message.setText("Hello there.");
  |                     queueSender.send(message);
  |                     
  |                     System.out.println("Sample application writing message 
to queue.");
  |                     
  |                     // clean up
  |                     queueSender.close();
  |                     queueSession.close();
  |                     queueConnection.close();
  |                                             
  |             }
  |             catch (NamingException e)
  |             {
  |                     e.printStackTrace();
  |             }
  |             catch (JMSException e)
  |             {
  |                     e.printStackTrace();
  |             }
  |             
  |                     
  |     }
  | }
  | 
  | 



whats wrong ?

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

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


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to