Hi ObjectWeb (JOnAS) Team,
First thing, thank you for a nice product! JOnAS works fine.
(I work with jonas2.3)
Next, I am not sure whether this mail message is really for the JONAS or for
the JORAM team. Please forward to the relevant team's mailing list if you
belief this message is not for you.
Now what I want to accomplish:
I want an ordinary stateless session bean to send a message to a message
driven bean that implements the MessageDrivenBean and MessageListener
intefaces. The stateless session bean is located on host0, and the message
driven bean is located on host1. The JMS service should idealy run in the same
JVM as the container where the stateless session bean that sends the meassesge
is. So I will start the JMS service as a collocated to the EJB server, by
specifying jonas.jms.collocated true in the jonas.properties file of host0
where the stateless session bean runs. What I have tested is that this
scenario works fine on a single host, when the beans run in one container on one
host. Output for the EJB server (Note that I tweaked your code a little so I
got a lot more output):
[...]$ registry &
[1] 14861
[...]$ Jeremie Registry started
./ejb_start.sh
JOnAS Server, version 2.3, running on Jeremie.
Mapping ConnectionManager jdbc:postgresql://javasrv:5431/instore on jdbc_2
JmsAdminForJoram startMOM
Supplied URL == null //** Property jonas.jms.url in the jonas.properties file
//** commented out. Running in same JVM as server.
JmsAdminForJoram init
JmsManager: init MOM in same JVM
JMSServerThread-1/0 waiting....
JmsThreadPool: nextRunnable
JMSServerThread-1/1 waiting....
JmsThreadPool: nextRunnable
JMSServerThread-1/2 waiting....
JmsThreadPool: nextRunnable
JMSServerThread-1/3 waiting....
JmsThreadPool: nextRunnable
JMSServerThread-1/4 waiting....
JmsThreadPool: nextRunnable
JMSServerThread-1/5 waiting....
JmsThreadPool: nextRunnable
JMSServerThread-1/6 waiting....
JmsThreadPool: nextRunnable
JMSServerThread-1/7 waiting....
JmsThreadPool: nextRunnable
JMSServerThread-1/8 waiting....
JmsThreadPool: nextRunnable
JmsAdminForJoram createQueueConnectionFactory QCF1
createQueueConnectionFactory QCF1 not found
JMSServerThread-1/9 waiting....
JmsThreadPool: nextRunnable
JMS QueueConnectionFactory: getReference
JmsAdminForJoram createTopicConnectionFactory TCF1
createTopicConnectionFactory TCF1 not found
JMS TopicConnectionFactory: getReference
JmsAdminForJoram createQueue "java:comp/env/jms/tstQueue"
JmsAdminForJoram Queue created joram://host0:16010/#0.0.1028
JmsAdminForJoram createQueue "java:comp/env/jms/msgQueue"
JmsAdminForJoram Queue created joram://host0:16010/#0.0.1029
JmsAdminForJoram createTopic sampleTopic
JmsAdminForJoram Topic created joram://host0:16010/#0.0.1030
//** Note that the Queue and Topic was created correctly on host0.
EJB container : MessageSenderSession available
JmsAdminForJoram createQueue 'java:comp/env/jms/msgQueue'
createQueue 'java:comp/env/jms/msgQueue' already found
ServerSessionPool : initInfoMdb istopic =false isBeanMan =false isrequired =true
EJB container : MessageListener available
EJBServer is ready
//** Now I run a seperate app in a seperate JVM that envoke the stateless
//** session bean which in turn sends the message to the message driven bean.
0 [ p0.3] DEBUG ystem.SessionAdapter - setSessionContext
24 [ p0.3] DEBUG ageSenderSessionBean - ejbCreate() called
ServerSessionPool : getServerSession
ServerSessionPool : EmptyStack
ServerSessionPool : createServerSession
ServerSession()
ServerSession.getSession
ServerSession start()
JmsThreadPool : add
JmsThreadPool : runnablepool size = 1
JmsThreadPool: runnablepool size = 0
JMSServerThread-1/0 working....
ServerSession run()
1038 [erverThread-1/0] DEBUG .MessageListenerBean -
setMessageDrivenContext(MessageDrivenContext mdc) called
1039 [erverThread-1/0] DEBUG .MessageListenerBean - ejbCreate() called
//** Now the message is delivered. SUCCESS!!!!
1041 [erverThread-1/0] DEBUG .MessageListenerBean - Message received:ObjectWeb
rocks!
ServerSessionPool : toTheSessionPool pool size 1
JMSServerThread-1/0 waiting....
JmsThreadPool: nextRunnable
41646 [ p0.2] DEBUG ageSenderSessionBean - ejbRemove() called
42041 [ p0.2] DEBUG .MessageListenerBean - ejbRemove() called
JMSServerThread-1/0 ending....
JMSServerThread-1/9 ending....
JMSServerThread-1/8 ending....
JMSServerThread-1/7 ending....
JMSServerThread-1/6 ending....
JMSServerThread-1/5 ending....
JMSServerThread-1/4 ending....
JMSServerThread-1/3 ending....
JMSServerThread-1/2 ending....
JMSServerThread-1/1 ending....
JmsAdminForJoram close
JmsAdminForJoram close unbind : XAQCF1
JmsAdminForJoram close unbind : QCF1
JmsAdminForJoram close unbind : XATCF1
JmsAdminForJoram close unbind : TCF1
JmsAdminForJoram close unbind : "java:comp/env/jms/tstQueue"
JmsAdminForJoram close unbind : "java:comp/env/jms/msgQueue"
JmsAdminForJoram close unbind : sampleTopic
JmsAdminForJoram close : AgentServer stopped
[...]$
Cool. JMS works well with EJB for JOnAS in one container. I was even able to
send a message from another app using JMS in another JVM to the message driven
bean, while on one host alone.
The following is the status of the two ports on the machine that are used by
the container and the JMS service. Note that I changed the IP address to some
imaginary IP address (12.34.56.78) for illustrative purposes. Using command
netstat -an | grep 12340 for the container I got:
tcp 0 0 12.34.56.78:12340 12.34.56.78:4367 ESTABLISHED
tcp 0 0 12.34.56.78:4367 12.34.56.78:12340 ESTABLISHED
tcp 0 0 12.34.56.78:12340 0.0.0.0:* LISTEN
Using command netstat -an | grep 16010 for the jms system I got:
tcp 0 0 12.34.56.78:16010 12.34.56.78:4373 ESTABLISHED
tcp 0 0 12.34.56.78:4373 12.34.56.78:16010 ESTABLISHED
tcp 0 0 0.0.0.0:16010 0.0.0.0:* LISTEN
Even though the jms system work in the case of one host, the last output of the
16010 port seems not be correct.
Next phase of testing required the two beans to split up, and run in two
containers on two seperate hosts. After adjusting both the jonas.properties and
../jonas/config/a3servers.xml files on both the servers, the EJB containers
started up normally on both the hosts. Now the problem was that the message
was not getting delivered to the message driven bean. The stateless session
bean was set up to run on host0 (12.34.56.78), and the message driven bean was
set up to run on host1 (12.34.56.79).
First I give you the port status for host0. Using command
netstat -an | grep 12340 for the container I got:
tcp 0 0 12.34.56.78:12340 12.34.56.78:2203 ESTABLISHED
tcp 0 0 12.34.56.78:2203 12.34.56.78:12340 ESTABLISHED
tcp 0 0 12.34.56.78:12340 0.0.0.0:* LISTEN
Using command netstat -an | grep 16010 for the jms system I got:
tcp 0 0 12.34.56.78:16010 12.34.56.78:2212 ESTABLISHED
tcp 0 0 12.34.56.78:2212 12.34.56.78:16010 ESTABLISHED
tcp 0 0 12.34.56.78:16010 12.34.56.79:4445 ESTABLISHED
tcp 0 0 0.0.0.0:16010 0.0.0.0:* LISTEN
Note that (tcp 0 0 0.0.0.0:16010 0.0.0.0:* LISTEN)
has 0.0.0.0 for an IP address where I think there should have been
( tcp 0 0 12.34.56.78:16010 0.0.0.0:* LISTEN )
As we can see the JMS service started correctly collocated with the EJB server
that contains the stateless session bean. Also we have a connection established
between host0 (12.34.56.78) and host1 (12.34.56.79) as we can see from the line
tcp 0 0 12.34.56.78:16010 12.34.56.79:4445 ESTABLISHED
Now the port status for host1. Using command
netstat -an | grep 12340 for the container I got:
tcp 0 0 12.34.56.79:12340 12.34.56.79:4440 ESTABLISHED
tcp 0 0 12.34.56.79:4440 12.34.56.79:12340 ESTABLISHED
tcp 0 0 12.34.56.79:12340 0.0.0.0:* LISTEN
Using command netstat -an | grep 16010 for the jms system I got:
tcp 0 0 12.34.56.79:4445 12.34.56.78:16010 ESTABLISHED
Again we can see the established connection from host0 (12.34.56.78) to
host1(12.34.56.79) from the line above.
I show the output of host1 where the message driven bean is located, to
confirm the connection to host0:
...
...
JmsAdminForJoram createQueueConnectionFactory QCF1
createQueueConnectionFactory QCF1 not found
JMSServerThread-1/9 waiting....
JmsThreadPool: nextRunnable
JMS QueueConnectionFactory: getReference
JmsAdminForJoram createTopicConnectionFactory TCF1
createTopicConnectionFactory TCF1 not found
JMS TopicConnectionFactory: getReference
JmsAdminForJoram createQueue sampleQueue
JmsAdminForJoram Queue created joram://host0:16010/#0.0.1033
JmsAdminForJoram createTopic sampleTopic
JmsAdminForJoram Topic created joram://host0:16010/#0.0.1034
JmsAdminForJoram createQueue 'java:comp/env/jms/msgQueue'
JmsAdminForJoram Queue created joram://host0:16010/#0.0.1035
ServerSessionPool : initInfoMdb istopic =false isBeanMan =false isrequired =true
EJB container : MessageListener available
EJBServer is ready
Note that the line:
createQueue 'java:comp/env/jms/msgQueue' already found
is missing from the output above of host1, because the message driven bean is
creating its own queue since it could not find any queue with a similar name on
the connection that was established with host0. The line should have been there.
I also tried to use JmsServer with the jms service running in a
seperate JVM (jonas.jms.collocated set to false in the jonas.properties file)
The same results was obtained as above. Running both beans in one container on
one host produced successful results. Splitting the beans onto two hosts with
two containers produced the same problem and the same netstat output.
Lastly I included the configuration files for both the hosts in conf.tar.gzip
(So sorry to those who were interested to view it, but this message is very long
already. Unfortunately it is a problem which needs to be well explained.)
The files for host0 are host0-jonas.properties, host0-a3servers.xml,
host0-jndi.properties.
The files for host1 are host1-jonas.properties, host1-a3servers.xml,
host1-jndi.properties.
To extract files use command tar -zxvf conf.tar.gzip
I can supply you with my sample app that I wrote, but will do so only on
request.
Possible problems that I can see:
I am not sure, but the problem seems to be with the JORAM configuration or the
way JOnAS is configuring JORAM. It may very well be that some jndi
stuff is missing. Perhaps I missed some configuration file that I needed to set
up. Hopefully, I gave you enough info to help me with this problem (bug?).
Regards,
Gert Nel (UCS)
[EMAIL PROTECTED]
conf.tar.gzip