-
15. Re: Simple MDB example fails silently
joelvogt Jul 10, 2002 10:56 PM (in response to salkin)ahh, the old transacted=true trick. That was my next guess... ;)
-
16. Re: Simple MDB example fails silently
ecowalker Jul 11, 2002 1:29 AM (in response to salkin)Hello,
I also created an simple MDB example as what salkin does.
But when the client program(an java app) send out the message to the queue. It throws an exception in client application.
java.lang.UnsupportedOperationException: Not constructed with identifyed queue. Usage of method not allowed
at org.jboss.mq.SpyQueueSender.send(SpyQueueSender.java:66)
and at the server console it throw out an exception:
12:32:03,111 WARN [OILServerILService] Connection failure (1).
java.net.SocketException: Connection reset by peer: JVM_recv in socket input str
eam 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:1550)
at java.io.ObjectInputStream.refill(ObjectInputStream.java:1684)
at java.io.ObjectInputStream.read(ObjectInputStream.java:1660)
at java.io.ObjectInputStream.readByte(ObjectInputStream.java:1906)
at org.jboss.mq.il.oil.OILServerILService$Client.run(OILServerILService.
java:190)
at java.lang.Thread.run(Thread.java:484)
This is the part of the client code --
queueConnectionFactory =
(QueueConnectionFactory)PortableRemoteObject.narrow( jndiContext.lookup("ConnectionFactory"),QueueConnectionFactory.class);
System.out.println("pass1");
Queue objqueue =
(Queue)PortableRemoteObject.narrow(jndiContext.lookup(queueName),Queue.class);
System.out.println("pass2");
queueConnection = queueConnectionFactory.createQueueConnection();
queueSession = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
queueSender = queueSession.createSender(queue);
message = queueSession.createTextMessage();
for (int i = 0; i < NUM_MSGS; i++) {
message.setText("This is message " + (i + 1));
System.out.println("Sending message: " +
message.getText());
queueSender.send(message); // <---Exception throw here
}
How could I solve the issue?
Thank you very much.
ecowalker -
17. Re: Simple MDB example fails silently
ecowalker Jul 11, 2002 3:44 AM (in response to salkin)Thx for everyone.
The client side exception has been fixed. It's my stupid and careless mistake to pass anther queue object (which is null) into createSender and throw the UnsupportedOperationException.
The client is run without any exception now, but the server side still has the exception msg
14:37:07,383 WARN [OILServerILService] Connection failure (1).
java.net.SocketException: Connection reset by peer: JVM_recv in socket input str
eam 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:1550)
at java.io.ObjectInputStream.refill(ObjectInputStream.java:1684)
at java.io.ObjectInputStream.read(ObjectInputStream.java:1660)
at java.io.ObjectInputStream.readByte(ObjectInputStream.java:1906)
at org.jboss.mq.il.oil.OILServerILService$Client.run(OILServerILService.
java:190)
at java.lang.Thread.run(Thread.java:484)
And the MDB is never triggered. I've follow the recommendation in this thread but still doesn't fix the problem
Any suggestion on the problem?
Thank you very much. -
18. Re: Simple MDB example fails silently
salkin Jul 11, 2002 4:07 AM (in response to salkin)Well, if you have a client that is a stand-alone app outside the container, are you doing this anywhere:
catch (SomeException e) {}
Because if you are, you may be getting an AccessControlException. I had to make my own SecurityManager subclass that allows everything and install it at the start of the client program or I couldn't use the JMS queue. When I just used the RmiSecurityManager I had permission problems with sockets, and I think what the server showed is like what you are seeing now. So try making a securitymanager that has for each of the check methods
void checkXXX(whatever needs to be here) {}
and set it in your client before doing the jms stuff. -
19. Re: Simple MDB example fails silently
ecowalker Jul 11, 2002 6:16 AM (in response to salkin)Thx for help.
I figure out the Socket Reset by peer is caused by my client program do not closed the queue connection explicitly. I've added the close statement and the warning disappear.
I've try to run the client as standalone app and servlet
The client run as servlet works great without problem.
The standalone one runs without exception (both on client and server side), however the "Silent Sydrome" appears. The System.out.println in the MDB methods never appear on the console when the ClientApp is called.
Any tips on solving the issue?
Thz -
20. Re: Simple MDB example fails silently
jsvazic Jul 11, 2002 3:27 PM (in response to salkin)LOL! It's an easy one to overlook. It depends which tutorial you review. The JMS tutorial from Sun says to set the transaction flag to true, even though they say that not everyone will actually do something with that flag, etc., etc., etc. Oh well, life goes on. :-)
-
21. Re: Simple MDB example fails silently
jsvazic Jul 11, 2002 3:30 PM (in response to salkin)Did you make sure to set the transaction to false when you create the Session object? If the flag is set to "true", then you will get the problem that you are experiencing.