Hi Eric
I've CC'd the user list in case anyone else has similar problems.
Incidentally the j2ee SDK server comes with Tomcat included internally, have you tried
using that Tomcat, rather than another one? I'm not an expert at setting up a remote
Tomcat installation to use the j2ee SDK for its JNDI provider, thats more of a
tomcat-user question.
Another thing to watch is the JNDI name; you may need to use
java:comp/env/TopicConnectionFactory as your JNDI name to lookup objects, depending on
if you are inside or outside of a J2ee app server.
I hope that helps. Let me know how you get on.
James
----- Original Message -----
From: Eric Hansen
To: [EMAIL PROTECTED]
Sent: Monday, June 24, 2002 11:42 PM
Subject: Messenger help... please!
Hello James,
I tried a few weeks ago to get JMS working in my Web application and had to move
on... but now I really need it and I have over 3 days invested so far.... so any help
you can provide would be MUCH MUCH appreciated. I would even like volunteer to
document the solution (for the Messenger project and/or mail archives) so others will
benefit.
So... I was hoping you could quickly spot my error(s) and lead me in the right
direction.
I'm using Tomcat 4.0 and J2EE 1.3.1. and messenger.jar from 6/23/02.
j2eeadmin -listJmsDestination includes a topic I named eDest.
j2eeadmin -listJmsFactory includes TopicConnectionFactory.
(I'm using JMS to communicate between the Web-server and other applications that
control device hardware - ie. there will be a relatively small number of messages
compared to a huge web-services application. Anyway, I thought the j2ee reference
implentation would be adequate as I do not need scaleability and load balancing, etc.)
Tomcat setup:
Messenger.xml (without changes) in the WEB-INF folder
commons-messenger.jar in the lib folder
I added the following to the web.xml file:
<servlet>
<servlet-name>InitMessenger</servlet-name>
<servlet-class>org.apache.commons.messenger.InitMessengerServlet</servlet-class>
- <init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/Messenger.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
I start j2ee -verbose
I then start Tomcat (There are no errors upon Tomcat startup... so the
MessengerManager seems to be initializing just fine.)
Then I access a .jsp page that I have pasted the code from the messenger
page....(with the needed import statements at the top of the page)
<%
// get a Messenger and Destination
Messenger messenger = MessengerManager.get( "topic" );
Destination destination = messenger.getDestination( "eDest" );
// now lets send a message
TextMessage message = messenger.createTextMessage( "this is some text" );
messenger.send( destination, message );
%>
This is where I get the following JNDI error.
javax.servlet.ServletException: Failed to lookup: TopicConnectionFactory using JNDI.
javax.naming.NameNotFoundException: Name TopicConnectionFactory is not bound in this
Context.
I have been unable to find any help online for this. It seems there is a problem
with accessing the j2ee jndi context from within Tomcat. I've considered learning how
to deploy my web application directly in j2ee... but I've been using Tomcat for awhile
now and want to stay with it.
I tried to create an InitialContext from scratch and get a connection directly from
InitialContext.lookup() but I got exactly the same results. I searched the web for
some indication of the PROVIDER_URL for the initial context for the j2ee reference
implementation but could not find any.
Please help!
Thank you!
Eric Hansen