ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » Tomcat JNDI Trouble

Post new topic  Reply to topic
 Tomcat JNDI Trouble « View previous topic :: View next topic » 
Author Message
Male
PostPosted: Tue Feb 01, 2011 9:44 am    Post subject: Tomcat JNDI Trouble Reply with quote

Newbie

Joined: 01 Feb 2011
Posts: 3

Hi, I'm following http://wiki.apache.org/tomcat/HowTo#head-b45c4c0b8c57d9efa1e9c5342650d5e534f55cfa
but when this part of the code is reached qcf.createQueueConnection() the tomcat hangs up, don't throw an exception or send a time out, nothing

I have the following:

in my tomcat ..conf\context.xml
<?xml version='1.0' encoding='utf-8'?>
<Context>

<!-- Default set of monitored resources -->
<WatchedResource>WEB-INF/web.xml</WatchedResource>

<!-- Uncomment this to disable session persistence across Tomcat restarts -->
<Manager pathname="" />

<!-- Uncomment this to enable Comet connection tacking (provides events
on session expiration as well as webapp lifecycle) -->
<!--
<Valve className="org.apache.catalina.valves.CometConnectionManagerValve" />
-->

<Resource
name="jms/MyQCF"
auth="Container"
type="com.ibm.mq.jms.MQQueueConnectionFactory"
factory="com.ibm.mq.jms.MQQueueConnectionFactoryFactory"
description="JMS Queue Connection Factory for sending messages"
HOST="localhost"
PORT="1415"
CHAN="SYSTEM.DEF.SVRCONN"
TRAN="1"
QMGR="QM_APPLE"/>

<Resource
name="jms/MyQ"
auth="Container"
type="com.ibm.mq.jms.MQQueue"
factory="com.ibm.mq.jms.MQQueueFactory"
description="JMS Queue for receiving messages from Dialog"
QU="Q1"/>
</Context>

in my webapp ..WEB-INF\web.xml
<resource-env-ref>
<resource-env-ref-name>jms/MyQCF</resource-env-ref-name>
<resource-env-ref-type>javax.jms.QueueConnectionFactory</resource-env-ref-type>
</resource-env-ref>

<resource-env-ref>
<resource-env-ref-name>jms/MyQ</resource-env-ref-name>
<resource-env-ref-type>javax.jms.Queue</resource-env-ref-type>
</resource-env-ref>

I have in my webapp ..\WEB-INF\lib
- com.ibm.mq.jar
- com.ibm.mqjms.jar
- connector.jar
- dhbcore.jar
- geronimo-j2ee-management_1.0_spec-1.0.jar
- geronimo-jms_1.1_spec-1.0.jar

I'm running the code from the same machine where is installed de Websphere MQ, if a run a test class using ibm mq jars from the commnad line everithing is ok, but nothings happens with tomcat, could you please help me, thx in advance.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Tue Feb 01, 2011 10:01 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Define "nothing happens".

Does your code actually execute?

Does your code complete successfully? If so, how do you know?

Does it fail? If so, how do you know it fails? What, EXACTLY, tells you THAT it failed? And what, EXACTLY is the message associated with that failure?
Back to top
View user's profile Send private message
Male
PostPosted: Tue Feb 01, 2011 10:11 am    Post subject: Reply with quote

Newbie

Joined: 01 Feb 2011
Posts: 3

Thats my trouble I don't have an exception message in the tomcat console, I put a println in the code in order to follow the code executed in the tomcat console, when the code arrives to this part qcf.createQueueConnection() don't send to the console the next println, here is my code:

import javax.jms.JMSException;
import javax.jms.JMSSecurityException;
import javax.jms.Queue;
import javax.jms.QueueConnection;
import javax.jms.QueueConnectionFactory;
import javax.jms.QueueSender;
import javax.jms.QueueSession;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

public class HelloWorld {
public String sayHello(String name) {

Context ctx = null;
QueueConnectionFactory qcf = null;
QueueConnection qc = null;

try {
ctx = (Context) new InitialContext().lookup("java:comp/env");
System.out.println("Paso 1");

qcf = (QueueConnectionFactory) ctx.lookup("jms/MyQCF");
System.out.println(qcf.toString());

System.out.println("Step 3");
qc = qcf.createQueueConnection();
System.out.println("Step 3.1");

} catch (NamingException e) {
System.out.println(e.toString());
e.printStackTrace();
} catch (JMSException e) {
System.out.println(e.toString());
e.printStackTrace();
}
// Queue q = (Queue) ctx.lookup("jms/MyQ");
// QueueSession qs = qc.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
// TextMessage tm = qs.createTextMessage();
// tm.setText("Hi, there!");
// QueueSender sender = qs.createSender(q);
// sender.send(tm);
// sender.close();
// qs.close();
try {
qc.close();
} catch (JMSException e) {
System.out.println(e.toString());
e.printStackTrace();
}

return "hello " + name;
}
}


One thing I don't comment in the original post is that I'm running from the BlazeDS war. I hope I've benn more clear.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Tue Feb 01, 2011 11:02 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

So you don't see "Step 3.1" printed.

You also don't see a NamingException printed, nor a JMSException.

AND you also don't see "Hello" printed (with or without a valid name)?

AND you don't see an additional HTTP error page of any kind returned back?

I have no idea what BlazeDS war is.
Back to top
View user's profile Send private message
Male
PostPosted: Tue Feb 01, 2011 11:08 am    Post subject: Reply with quote

Newbie

Joined: 01 Feb 2011
Posts: 3

That's correct, I can't see any of the afirmations and questions that you say, nothing in the console. BlazeDS is a component from Flex technologies in order to execute remote access to java components.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Tue Feb 01, 2011 11:20 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Try catching a full plain Exception, not a specific JMSException or NamingException.

It's likely you're not getting a good response from JNDI.

I still don't know what blazeDS war is. HOWEVER, if you are trying to do anything to allow you to run JMS code from a machine that does not have any MQ components on it at all (mq client install or mq jars at a minimum), you will *always* fail. No shortcuts here, other than using the REST or HTTP bridges.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » Tomcat JNDI Trouble
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.