[jboss-user] [JBoss Messaging] - Re: I need help about Messaging!
catania
do-not-reply at jboss.com
Tue Sep 18 23:22:51 EDT 2007
Hi !
I edited my MDB, and it's Ok. My jbossmq-myqueues-service.xml is look like:
<mbean code="org.jboss.mq.server.jmx.Queue"
| name="jboss.mq.destination:service=Queue,name=myQueue">
| <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
| </mbean>
And I put it inside /deploy --> all things are Ok. but when I write a client that send some TextMessage :
InitialContext jndiContext = getInitialContext( );
| try {
| ConnectionFactory factory = (ConnectionFactory)jndiContext.lookup("ConnectionFactory");
| Queue queueTmp= (Queue)jndiContext.lookup("queue/producerQueue");
| Connection connect = factory.createConnection( );
| Session session = connect.createSession(false,Session.AUTO_ACKNOWLEDGE);
| MessageProducer sender = session.createProducer(queueTmp);
| for(int i=0; i<10; i++){
| TextMessage t = session.createTextMessage();
| t.setText(new Timestamp(System.currentTimeMillis())+" JmsClientProducer Message "+i);
| sender.send(t);
| Thread.sleep(1000);
| }
| connect.close();
| } catch (NamingException e) {
| ......
| }
And my jndi.properties is look like:
anonymous wrote : java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
| java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
| java.naming.provider.url=localhost:1099
When I run client, I received some errors:
javax.naming.CommunicationException [Root exception is java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
| java.lang.ClassNotFoundException: org.jboss.mq.referenceable.ObjectRefAddr (no security manager: RMI class loader disabled)]
| at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:722)
| at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
| at javax.naming.InitialContext.lookup(Unknown Source)
| at thai.jms.client.JmsClient.main(JmsClient.java:33)
| Caused by: java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
| java.lang.ClassNotFoundException: org.jboss.mq.referenceable.ObjectRefAddr (no security manager: RMI class loader disabled)
| 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:625)
| ... 3 more ---> and error at line:
ConnectionFactory factory = (ConnectionFactory)jndiContext.lookup("ConnectionFactory");
But inside my MDB, I were declared:
@Resource(mappedName="ConnectionFactory")
| private ConnectionFactory connectionFactory;
I understand your suggestions.And althought, I posted my article not correct but I recognized your helps and can you continue guide some my remain problems ?
Thanks.
Catania.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4085827#4085827
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4085827
More information about the jboss-user
mailing list