Return-Path: Delivered-To: apmail-activemq-users-archive@www.apache.org Received: (qmail 80063 invoked from network); 5 Mar 2010 01:36:22 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 5 Mar 2010 01:36:22 -0000 Received: (qmail 21733 invoked by uid 500); 5 Mar 2010 01:36:10 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 21650 invoked by uid 500); 5 Mar 2010 01:36:10 -0000 Mailing-List: contact users-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@activemq.apache.org Delivered-To: mailing list users@activemq.apache.org Received: (qmail 21642 invoked by uid 99); 5 Mar 2010 01:36:10 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Mar 2010 01:36:10 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of lists@nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Mar 2010 01:36:01 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1NnMS4-0006uj-9W for users@activemq.apache.org; Thu, 04 Mar 2010 17:35:40 -0800 Message-ID: <27788969.post@talk.nabble.com> Date: Thu, 4 Mar 2010 17:35:40 -0800 (PST) From: stevegula To: users@activemq.apache.org Subject: tomcat+jndi+activemq namingexception cannot create resource instance MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: steve@stevegula.net X-Virus-Checked: Checked by ClamAV on apache.org tomcat 6.0.20 activemq 5.3.0 the following are in tomcat/lib : activemq-all geronimo j2ee management 1.0 geronimo jms 1.1 geronimo jta 1.0.1B commons httpclient 3.1 this is in a portlet running in openportal within tomcat web.xml ---------- jms/ConnectionFactory org.apache.activemq.ActiveMQConnectionFactory Container jms/MyAppQueue org.apache.activemq.command.ActiveMQQueue Container context.xml ---------- the code ------ public void sendMessageToQueue(String submitId, String capabilitiesURL) { logger.debug("sendMessageToQueue start"); Context jndiContext = null; ConnectionFactory connectionFactory = null; Connection connection = null; Session session = null; Destination destination = null; MessageProducer producer = null; String destinationName = "MyApp"; TextMessage message = null; try { Context initCtx = new InitialContext(); jndiContext = (Context) initCtx.lookup("java:comp/env"); connectionFactory = (ConnectionFactory) jndiContext.lookup("jms/ConnectionFactory"); destination = (Destination) jndiContext.lookup("jms/MyAppQueue"); connection = connectionFactory.createConnection(); session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); producer = session.createProducer(destination); message = session.createTextMessage(); // message.setText(submitId+"|"+capabilitiesURL); message.setStringProperty("submitId", submitId); message.setStringProperty("capabilitiesURL", capabilitiesURL); logger.debug("Message for queue : "+message.getText()); producer.send(message); } catch(NamingException e) { logger.debug("Naming exception : ",e); } catch(JMSException e) { logger.debug("Message exception : ",e); } finally { if(connection != null) { try { logger.debug("connection.toString() - "+connection.toString()); connection.close(); } catch(JMSException e) { logger.debug("Failed to close - ",e); } } } logger.debug("sendMessageToQueue end"); } the problem - the line -> connectionFactory = (ConnectionFactory) jndiContext.lookup("jms/ConnectionFactory"); is causing javax.naming.NamingException: Cannot create resource instance at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceF actory.java:143) I have spent roughly 10 hours on this now. I have searched all of Google, Nabble, activemq/tomcat.apache.org ... all I can find is people more or less asking "what have I done wrong" but I have not found anyone offering a solution. The best documentation I can find on apache.org contains the phrase "This is completely untested but should work" ... and it does not. At one point I thought I was nearing success by doing the "Look Inside this Book" on Amazon.com looking at "Tomcat: The Definitive Guide (Paperback)" but ultimately that did not work either. My Junit tests (in Eclipse using jndi.properties) all work with no problem. When I try doing this within tomcat w/ web.xml and context.xml it fails horribly. Any input would be desperately appreciated. -- View this message in context: http://old.nabble.com/tomcat%2Bjndi%2Bactivemq--namingexception-cannot-create-resource-instance-tp27788969p27788969.html Sent from the ActiveMQ - User mailing list archive at Nabble.com.