Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JMS client on WAS V6.1

 
Morsi Jallouli
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm trying to execute my jms client to send message to the queue on WAS V6.1.

this is my jms client :

import java.util.Hashtable;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.jms.TextMessage;

import javax.naming.Context;

import javax.naming.InitialContext;

public class Main {

public static void main(String[] args) throws JMSException, Exception

{

// String messageID = null;

// String outString = null;

String cfName = "jms/TheConnectionFactory";

//String cfName = "jms/fact";

// String qnameIn = "java:comp/env/jms/Q1";

String qnameOut = "jms/PackageReceivedQueue";

//String qnameOut = "queue/testQueue";

// boolean verbose = false;

Session session = null;

Connection connection = null;

ConnectionFactory cf = null;

MessageProducer mp = null;

Destination destination = null;
try {
Hashtable env = new Hashtable();

env.put(Context.PROVIDER_URL, "iiop://10.0.0.98:2809");

env.put(Context.INITIAL_CONTEXT_FACTORY,

"com.ibm.websphere.naming.WsnInitialContextFactory");

//env.put("java.naming.corba.orb", org.omg.CORBA.ORB.init(

//(String[]) null, null));

InitialContext initialContext = new InitialContext(env);

System.out.println("Getting Queue factory");

cf = (ConnectionFactory) initialContext.lookup(cfName);

System.out.println("Getting Queue");

destination = (Destination) initialContext.lookup(qnameOut);

System.out.println("Getting Connection for Queue");

connection = cf.createConnection();

System.out.println("starting the connection");

connection.start();

System.out.println("creating session");

session = connection.createSession(false, 1);

System.out.println("creating messageProducer");

mp = session.createProducer(destination);

System.out.println("creating TextMessage");

TextMessage outMessage = session

.createTextMessage("this is test application");

System.out.println("sending Message" + outMessage);

mp.send(outMessage);

mp.close();

session.close();

connection.close();

} catch (Exception e) {

e.printStackTrace();

}

}

}

that's the stacktrace:

java Getting Queue factory
java 26 Jan 2010 17:03:38 com.ibm.ws.util.ImplFactory
java WARNING: WSVR0072W
java Getting Queue
java Getting Connection for Queue
java 26 Jan 2010 17:03:41 com.ibm.ws.channel.framework.impl.WSChannelFram
eworkImpl
java AUDIT: chain.started
java 26 Jan 2010 17:03:41 com.ibm.ws.sib.utils.ras.SibMessage
java INFO: SIB_MESSAGE

it's looping infinitely

You'll see on attachment the jars included to the classpath.

Please, i need help

Cheers,
Morsi
lib.JPG
my lib
[Thumbnail for lib.JPG]
 
Morsi Jallouli
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I included only sibc.jms.jar and sibc.jndi.jar after installing the JMS Client and it's work now

Cheers,
Morsi
 
Amirr Rafique
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
java Getting Queue factory
java 26 Jan 2010 17:03:38 com.ibm.ws.util.ImplFactory
java WARNING: WSVR0072W
java Getting Queue
java Getting Connection for Queue
java 26 Jan 2010 17:03:41 com.ibm.ws.channel.framework.impl.WSChannelFram
eworkImpl
java AUDIT: chain.started
java 26 Jan 2010 17:03:41 com.ibm.ws.sib.utils.ras.SibMessage
java INFO: SIB_MESSAGE


I am also getting the same problem. I am running the code you have provided and my classpath contains sibc.jms.jar and sibc.jndi.jar. I am trying to run your program from WID IDE.

Can you please tell me what steps are involved in installing the JMS Client. I didnot make the changes in custom.bat file at mentioned in jms client documentation.

Thanks in Advance
 
Morsi Jallouli
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm sending jms message with my own jms client using apache ant for building (i didn't use any IDE for that ...) .

here is my jms client http://www.hishare.eu/myjmsclient.zip

Cheers,
Morsi
 
Amirr Rafique
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Morsi thanks for you help.
The problem was resolved by removing the Websphere Runtime Libraries from my project.

So in nutshell you only need sibc.jms.jar and sibc.jindi.jar with JRE.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic