put your test code in a try...finally block.
in the finally, close the session, connection and queue so every thing is cleanup property.
I already had that prob and thats how I fixed it.
-----Original Message-----
From: prajapatib [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 18, 2001 11:22 AM
To: '[EMAIL PROTECTED]'
Subject: [JBoss-user] MDB listening to a queue not working?
Hi,
I am trying to send a message to a queue which a MDB is listening to,
however the onMessage() method never gets called, I just get a stacktrace
telling me that the peer has reset the connection.
( I am using a JUnit TestCase as the Client on NT4 sp 4 with JBoss 2.4 (with
tomcat running), JDK 1.3 )
I have provided bean and client code below, with the contents of the
relevant xml files.....
- The stacktrace is as follows:
New Client Connection accepted. Current Thread=Thread[OIL Worker,5,JBossMQ
Server Threads]
Client Connection set spyDistributedConnection, ClientID=ID2. Current
Thread=Thread[OIL Worker,5,JBossMQ Server Threads]
[java.net.SocketException: Connection reset by peer: JVM_recv in socket
input stream read
at java.net.SocketInputStream.socketRead(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:86)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:186)
at java.io.BufferedInputStream.read(BufferedInputStream.java:204)
at java.io.ObjectInputStream.peekCode(ObjectInputStream.java:1549)
at java.io.ObjectInputStream.refill(ObjectInputStream.java:1683)
at java.io.ObjectInputStream.read(ObjectInputStream.java:1659)
at java.io.ObjectInputStream.readByte(ObjectInputStream.java:1905)
at
org.jbossmq.distributed.server.DistributedJMSServerOIL.run(DistributedJMSSer
verOIL.java:79)
at java.lang.Thread.run(Thread.java:484)
- The bean code is very simple:
public class TaskProxy implements MessageListener, MessageDrivenBean
{
MessageDrivenContext ctx = null;
public TaskProxy(){}
public void setMessageDrivenContext(MessageDrivenContext ctx) throws
EJBException{ this.ctx = ctx; }
public void ejbRemove(){ctx=null;}
public void ejbCreate(){}
public void onMessage(Message m)
{
System.out.println("i have just received a message, and it
says...."+m.toString());
}
}
- The client code is:
private void sendTestQueueMessage()throws Exception
{
Properties props = new Properties();
props = new Properties();
props.put("java.naming.factory.initial","org.jnp.interfaces.NamingContextFac
tory");
props.put("java.naming.provider.url","localhost:1099");
props.put("java.naming.factory.url.pkgs","org.jboss.naming");
Context context = new InitialContext(props);
QueueConnectionFactory queueFactory =
(QueueConnectionFactory)context.lookup("QueueConnectionFactory");
QueueConnection connection = queueFactory.createQueueConnection();
QueueSession queueSession =
connection.createQueueSession(
false,
Session.AUTO_ACKNOWLEDGE);
Queue queue = (Queue)context.lookup("queue/testQueue");
QueueSender sender = queueSession.createSender(queue);
TextMessage message = queueSession.createTextMessage("hello this is
a message to a mdb");
System.out.println("HELLO");
sender.send(queue, message); //XXXXXXXXXXXX CRASHES HERE!!
System.out.println("GOODBYE");
}
- The jboss.xml has this in it:
<message-driven>
<ejb-name>uk.co.isesolutions.util.scheduler.biz.TaskProxy</ejb-name>
<configuration name>Standard Message Driven Bean</configuration-name>
<destination-jndi-name>queue/testQueue</destination-jndi-name>
<message-driven>
- The ejb-jar.xml has this in it:
<message-driven>
<ejb-name>uk.co.isesolutions.util.scheduler.biz.TaskProxy</ejb-name>
<ejb-class>uk.co.isesolutions.util.scheduler.biz.TaskProxy</ejb-class>
<message-selector></message-selector>
<transaction-type>Container</transaction-type>
<acknowledge-mode>Auto-acknowledge</acknowledge-mode>
<message-driven-destination>
<destination-type>javax.jms.Queue</destination-type>
</message-driven-destination>
</message-driven>
<container-transaction>
<method>
<ejb-name>uk.co.isesolutions.util.scheduler.biz.TaskProxy</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
- The jbossmq.xml has this:
<Queue>
<Name>testQueue</Name>
</Queue>
What is going on ?!?!
Many thanks in advance.
Disclaimer
This communication together with any attachments transmitted with it ('this E-mail') is intended only for the use of the addressee and may contain information which is privileged and confidential. If the reader of this E-mail is not the intended recipient or the employee or agent responsible for delivering it to the intended recipient you are notified that any use of this E-mail is prohibited. Addressees should check this E-mail for viruses. The Carphone Warehouse Group PLC makes no representations as regards the absence of viruses in this E-mail. If you have received this E-mail in error please notify our ISe Response Team immediately by telephone on + 44 (0)20 8896 5828 or via E-mail at [EMAIL PROTECTED] Please then immediately destroy this E-mail and any copies of it.
Please feel free to visit our website: http://www.phonehouse.com
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user
