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 » WSAD 5.0, MQ 5.3, and JMS

Post new topic  Reply to topic
 WSAD 5.0, MQ 5.3, and JMS « View previous topic :: View next topic » 
Author Message
dotjas
PostPosted: Mon Apr 07, 2003 6:46 am    Post subject: WSAD 5.0, MQ 5.3, and JMS Reply with quote

Novice

Joined: 28 Apr 2002
Posts: 14
Location: Madison, WI

I'm trying to get a simple Java/JMS application to communicate with WebSphere MQ 5.3 via JMS. I'm wondering if anyone has successfully been able to do this. It all seems straightforward, but I keep getting the following problem:

JMSQueueConnection::connect failed naming exception:jms/MyQCF2
JMSQueueConnection::publish failed: No session/sender/msg

I've got the following items setup:
WAS Server 5.0 config - I've got QCF's and Queues defined at the Node, Cell, and Server Level (all with different names)

WAS Administrative Console - I've got the corresponding QCF's, Queues defined against my MQ Queue Manager and Queue (under Resources, WebSphere MQ Provider).

I'm using, com.sun.jndi.fscontext.RefFSContextFactory to build my QCF. Whenever I use, com.ibm.websphere.naming.WsnInitialContextFactory it is not found and when I do add it, it fails with ":connect failed naming exception:Could not create an instance of the class null"

Is there more setup that I am missing?? Any help would be appreciated!
_________________
Jim Schuchardt
Principal Consultant
MQ Certified Specialist
Back to top
View user's profile Send private message Send e-mail
dletien
PostPosted: Sun Apr 13, 2003 3:22 pm    Post subject: Re: WSAD 5.0, MQ 5.3, and JMS Reply with quote

Newbie

Joined: 30 Aug 2002
Posts: 9
Location: Chicago

Hi,

I'm using the same configuration and its working fine for me. Could you drop more details like sample code?

Didier
Back to top
View user's profile Send private message MSN Messenger
dotjas
PostPosted: Mon Apr 21, 2003 5:53 am    Post subject: WSAD 5.0, MQ 5.3, and JMS Reply with quote

Novice

Joined: 28 Apr 2002
Posts: 14
Location: Madison, WI

Hi,

I've included the code you requested below. My main problem is that I'm not finding the server to set the JMS Context. There seems to be something missing that tells the application where to look. I've been looking at "Root Context's" and the "Initial Reference Key" associated with the "corbaloc". This seems to be a step in the right direction, but there is still a way to go (You will see from my code that I have tried the IIOP thing). Just so you know, the areas that I've setup are as follows:

WebSphere Server Configuration - have setup the JMS and MQ correlations. This is a v5.0 server
Universal Test Client - have verified the setup to the server config.
WebSphere MQ - Have a QM and Queue defined that are consistent with what was setup in the WebSphere Server.

/**
* @author DOTJAS
*
* To change this generated comment edit the template variable "typecomment":
* Window>Preferences>Java>Templates.
* To enable and disable the creation of type comments go to
* Window>Preferences>Java>Code Generation.
*/
import java.util.Properties;

import javax.jms.QueueConnectionFactory;
import javax.jms.QueueReceiver;
import javax.jms.QueueSession;
import javax.jms.Session;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import javax.naming.*;
import javax.naming.NamingException;
import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.InitialContext;
import com.ibm.websphere.naming.PROPS;
import javax.jms.Queue;


public class MyTryAtName {

/**
* Entry Point to this Application
*/
public static void main( String[] args ) {
javax.jms.QueueConnection qConnection = null;
QueueSession qSession = null;
QueueReceiver queueReceiver = null;

try {
// Create the Initial Context
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");
env.put(Context.PROVIDER_URL, "corbaloc:iiop:localhost:2809/NameServiceNodeRoot");
// env.put(Context.PROVIDER_URL, "iiop://localhost:2809/");
Context initialContext = new InitialContext(env);

System.out.println("Look up jms/MyQCF1");
QueueConnectionFactory factory = (QueueConnectionFactory) initialContext.lookup("jms/MyQCF1");

System.out.println("Look up jms/Q2");
Queue ioQueue = (Queue) initialContext.lookup("jms/rms/Q1");

System.out.println("Create a qConnection");
qConnection = factory.createQueueConnection();

System.out.println("Start the qConnection");
qConnection.start();

System.out.println("Create a Session");
qSession = qConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);

System.out.println("Create the receiver");
queueReceiver = qSession.createReceiver(ioQueue);
}

catch (NamingException exception) {
System.out.println ("Naming Exception");
exception.printStackTrace ();

}
catch ( Exception exception ) {
System.out.println ("Other Exception");
exception.printStackTrace ();
}

}
}
_________________
Jim Schuchardt
Principal Consultant
MQ Certified Specialist
Back to top
View user's profile Send private message Send e-mail
dotjas
PostPosted: Fri May 16, 2003 4:23 am    Post subject: WSAD 5.0, MQ 5.3, and JMS Reply with quote

Novice

Joined: 28 Apr 2002
Posts: 14
Location: Madison, WI

Sometimes you are fortunate enough to post your own solution


1. JRE Setup
· Select Windows -> Preferences
· Expand 'Java' and select 'Installed JREs'
· Select 'Add' and create a JRE called 'WebSphere v5 JRE'
· Load the following JAR files:
i. 'JRE home directory' path is, 'C:\Program Files\IBM\WebSphere Studio\runtimes\base_v5\java\jre'.
ii. 'Add External JARs…' and add 'C:/Program Files/IBM/WebSphere Studio/base_v5/java/jre/lib/rt.jar'.


2. Java Build Path Setup – This is the classpath setup that WSAD will use to compile your java application. The order of the JAR files should be the same as below. To navigate to it, right-click on your Project -> Properties -> Java Build Path.

Add the following External JARs (Add External JARs..):
· C:\WSMQ\Java\lib\jms.jar
· C:\Program Files\IBM\WebSphere Studio\runtimes\base_v5\java\jre\lib\rt.jar


3. Launch Configuration (two screens)Classpath Setup – Make sure that your classpath is described below: To navigate to it, select the Java Perspective -> Select 'Run' on the Menu bar -> Run -> Select the application you are going to run. The order of the JAR files should be the same as below. Note, the Launch Configuration – Classpath Setup must be setup for each application that will be using WebSphere MQ.

Add the following External JARS (Add External JARs):
· C:/Program Files/IBM/WebSphere Studio/runtimes/base_v5/lib/messagingClient.jar
· C:/Program Files/IBM/WebSphere Studio/runtimes/base_v5/lib/namingserver.jar
· C:/WSMQ/Java/lib/com.ibm.mq.jar
· C:/WSMQ/Java/lib/com.ibm.mqjms.jar
· C:/Program Files/IBM/WebSphere Studio/wstools/eclipse/plugins/com.ibm.websphere.v5_5.0.2/implfactory.jar

JRE Setup - The JRE defined in Step 1 must be selected in the Launch Configuration panel. To navigate to it, just select the 'JRE' tab.

4. Server Configuration Setup· Navigate to the Server Perspective and open the Server Configuration that is going to be used.
· Select the 'Configuration' tab and select 'Enable administration console'.

5. Administrative Console Setup· Bring the up the Administrative Console by right clicking on your running Server and selecting run Administrative Console.
· Signon using your DOT Userid.
· Expand the 'Resources' tab in the Navigation menu (on the left).
· Select the 'WebSphere MQ JMS Provider'. This will bring up the entry screen.
· For the Scope of the configuration, select the 'Server' and hit 'Apply'.
· Scroll down to find 'WebSphere MQ Queue Connection Factories' and select it.
· Select 'New' to add and define a 'WebSphere MQ Queue Connection Factories'.
· There are only three fields required on this screen, these are as follows:
i. Name – enter a meaningful name for this Queue Connection Factory.
ii. JNDI Name – enter the name of the JNDI Resource including the path.
iii. Queue Manager – enter the name of the WebSphere MQ Queue Manager.
iv. Scroll down and hit 'Apply'
v. Repeat for other Queue Connection Factories as needed.

· Re-select the 'WebSphere MQ JMS Provider' (on the left). This will bring up the entry screen.
· Scroll down to find 'WebSphere MQ Queue Destinations' and select it.
· Select 'New' to add and define a 'WebSphere MQ Queue Destination'.
· There are four fields that are required on this screen, these are as follows:
i. Name – enter a meaningful name for this Queue.
ii. JNDI Name – enter the name of the JNDI Resource including the path.
iii. Base Queue Name – enter the name of the WebSphere MQ Queue.
iv. Base Queue Manager Name – enter the name of the WebSphere MQ Queue Manager.
v. Scroll down and hit 'Apply'.
vi. Repeat for all Queues.
· Click on 'Save' which is on the upper navigation bar.
· Confirm the 'Save'.
· Done with Administrative Console setup.
_________________
Jim Schuchardt
Principal Consultant
MQ Certified Specialist
Back to top
View user's profile Send private message Send e-mail
tlinus2
PostPosted: Wed Aug 20, 2003 1:29 pm    Post subject: WSAS, JMS, MQ Reply with quote

Novice

Joined: 20 Aug 2003
Posts: 12
Location: Wash DC

Hi,

Wondering if you could shed some light on why my WSAD and MQ (both on same box), but my WSAS and MQ (on diff boxes) will not work.

The documentation seems to indicate that MQ needs to be on the same box, but that doesn't seem totally quite right.

My error is that my application isn't picking up the JNDI for the qcf using the Websphere MQ JMS Provider (not the Websphere JMS Provider).

Thanks, Linus
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 » WSAD 5.0, MQ 5.3, and JMS
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.