Author |
Message
|
mailtosathiyan@gmail.com |
Posted: Tue Aug 02, 2005 7:59 pm Post subject: help me to run my first program in MQ |
|
|
Novice
Joined: 02 Aug 2005 Posts: 13
|
Hi
I m very new to MQ, this is my first program,
And I m using
IDE -rational application architect
app. server - was6 -express
MQ- version 6
and my Queue Manger name -QM1
Queue name is - Q1
hostname -sathya
//////////////////////////////////////////////////code here/////////////
package test;
import com.ibm.mq.MQC;
import com.ibm.mq.MQEnvironment;
import com.ibm.mq.MQException;
import com.ibm.mq.MQMessage;
import com.ibm.mq.MQPutMessageOptions;
import com.ibm.mq.MQQueue;
import com.ibm.mq.MQQueueManager;
public class test1
{
private String qManager = "QM1";
private MQQueueManager qMgr;
public static void main(String args[]) {
new test1();
}
public test1() {
try {
java.util.Hashtable properties;
MQEnvironment.hostname = "sathya";
MQEnvironment.channel = "SYSTEM.DEF.SVRCONN";
MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY,MQC.TRANSPORT_MQSERIES_BINDINGS);
qMgr = new MQQueueManager(qManager);
System.out.println("Connection with "+ qManager + "is opened !");
int openOptions = MQC.MQOO_INPUT_AS_Q_DEF |
MQC.MQOO_OUTPUT;
MQQueue ql_test =
qMgr.accessQueue("Q1",openOptions,null,null,null);
MQMessage hello_world = new MQMessage();
hello_world.writeUTF("Hello World !!!");
MQPutMessageOptions pmo = new
MQPutMessageOptions();
ql_test.put(hello_world,pmo);
int Key;
System.out.println("Press Enter !!!");
Key = System.in.read();
ql_test.close();
qMgr.disconnect();
System.out.println("Disconnected !");
}
catch (MQException ex) {
System.out.println("CC: " + ex.completionCode + "RC: "+ ex.reasonCode);
}
catch (java.io.IOException ex) {
System.out.println("IO Error: "+ex);
}
}
}
//code end//////////////////////
**********error displayed********
Exception in thread "main" java.lang.NoSuchFieldError: msgToken
at com.ibm.mq.server.MQSESSION.init_conversion(Native Method)
at com.ibm.mq.server.MQSESSION.<clinit>(MQSESSION.java:254)
at com.ibm.mq.MQSESSIONServer.getMQSESSION(MQSESSIONServer.java:6
at com.ibm.mq.MQSESSION.getSession(MQSESSION.java:493)
at com.ibm.mq.MQManagedConnectionJ11.<init>(MQManagedConnectionJ11.java:155)
at com.ibm.mq.MQBindingsManagedConnectionFactoryJ11._createManagedConnection(MQBindingsManagedConnectionFactoryJ11.java:153)
at com.ibm.mq.MQBindingsManagedConnectionFactoryJ11.createManagedConnection(MQBindingsManagedConnectionFactoryJ11.java:189)
at com.ibm.mq.StoredManagedConnection.<init>(StoredManagedConnection.java:80)
at com.ibm.mq.MQSimpleConnectionManager.allocateConnection(MQSimpleConnectionManager.java:171)
at com.ibm.mq.MQQueueManager.obtainBaseMQQueueManager(MQQueueManager.java:754)
at com.ibm.mq.MQQueueManager.construct(MQQueueManager.java:688)
at com.ibm.mq.MQQueueManager.<init>(MQQueueManager.java:417)
at test.test1.<init>(test1.java:30)
at test.test1.main(test1.java:21)
i m getting the same error for all the application related to MQ series . can any one tell what’s this problem.
Is it any problem with configuration?
Is it because embedded messaging?
Can any one help me please?!
Thanks |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Aug 03, 2005 11:47 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
If you are using WAS6 is there any specific reason you are not using the message bus or JMS ? They would be more appropriate for your environment.
 |
|
Back to top |
|
 |
mailtosathiyan@gmail.com |
Posted: Wed Aug 03, 2005 8:42 pm Post subject: problem solved |
|
|
Novice
Joined: 02 Aug 2005 Posts: 13
|
hi
i have to refer mq, mqjms and jms jar on MQ6 only not with WAS6
that's it all works fine
thanks and regards
sathiya  |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Aug 04, 2005 2:30 am Post subject: Re: problem solved |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
mailtosathiyan@gmail.com wrote: |
hi
i have to refer mq, mqjms and jms jar on MQ6 only not with WAS6
that's it all works fine
thanks and regards
sathiya  |
It still does not answer my question ....  |
|
Back to top |
|
 |
mailtosathiyan@gmail.com |
Posted: Thu Aug 04, 2005 3:33 am Post subject: i m not getting it -since i m very new to MQ |
|
|
Novice
Joined: 02 Aug 2005 Posts: 13
|
can u explain me messgae bus and etc in detail, i very keen to know about all.
please give me details about how to use those?
thanks and regards
sathiya |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Aug 04, 2005 11:51 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Check out the documentation in WAS 6.0 (IBM Redbooks)
As well check out the sun website for keyword JMS.
http://java.sun.com
Enjoy  |
|
Back to top |
|
 |
mailtosathiyan@gmail.com |
Posted: Thu Aug 04, 2005 10:01 pm Post subject: |
|
|
Novice
Joined: 02 Aug 2005 Posts: 13
|
Hi
Currently I m practicing with windows environment with mq and jms
but in my real work
we have to send the data using mqclient from windows machine to the as400/iseries to interact with Cobol programs
is still possible without mqseries?
Please guide me
Thanks and regards
sathiya
 |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Aug 05, 2005 4:07 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
If you're trying to talk to a non-java destination, then using JMS or the WAS6 message bus is not the right choice.
So use MQ the way you have been. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Aug 05, 2005 11:12 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
jeff,
We use JMS all the time. We just specify
"queue:///myqueue?targetClient=1" when we define the queues...
or targetclient=MQ in jndi...
Works fine for us.
Thanks  |
|
Back to top |
|
 |
vennela |
Posted: Fri Aug 05, 2005 11:34 am Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
There are quite a few changes in the MQ Java implementation in MQv6.
For example MQMessage class.
Previously MQMessage.messageId() is now MQMD.messageId()
I think he is getting one of those problems. |
|
Back to top |
|
 |
mailtosathiyan@gmail.com |
Posted: Thu Aug 18, 2005 2:52 am Post subject: problem with jndi options with sample application |
|
|
Novice
Joined: 02 Aug 2005 Posts: 13
|
hi all
when i run the sample( PTPSample01.java) with the following options
(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");
(Context.PROVIDER_URL, "iiop://localhost:2809");
getting the error like this
Exception in thread "main" java.lang.NoClassDefFoundError
at com.ibm.ejs.oa.EJSORBImpl.class$(EJSORBImpl.java:171)
at com.ibm.ejs.oa.EJSORBImpl.initializeORB(EJSORBImpl.java:171)
at com.ibm.ejs.oa.EJSClientORBImpl.<init>(EJSClientORBImpl.java:97)
at com.ibm.ejs.oa.EJSClientORBImpl.<init>(EJSClientORBImpl.java:73)
at com.ibm.ejs.oa.EJSORB.init(EJSORB.java:386)
at com.ibm.ws.naming.util.Helpers.getOrb(Helpers.java:285)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContextInternal(WsnInitCtxFactory.java:373)
at com.ibm.ws.naming.util.WsnInitCtx.getContext(WsnInitCtx.java:112)
at com.ibm.ws.naming.util.WsnInitCtx.getContextIfNull(WsnInitCtx.java:422)
at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:143)
at javax.naming.InitialContext.lookup(InitialContext.java:361)
at test1.PTPSample01.getConnectionFactoryFromJNDI(PTPSample01.java:385)
at test1.PTPSample01.main(PTPSample01.java:170)
Caused by: java.lang.ClassNotFoundException: com.ibm.ws.orb.GlobalORBFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:375)
at java.lang.ClassLoader.loadClass(ClassLoader.java:562)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:442)
at java.lang.ClassLoader.loadClass(ClassLoader.java:494)
at java.lang.Class.forName1(Native Method)
at java.lang.Class.forName(Class.java:180)
... 13 more
and i have added following jars
com.ibm.mqjms.jar
com.ibm.mq.jar
jms.jar
namingclient.jar
naming.jar
ecutils.jar
wssec.jar
sas.jar
lmproxy.jar
ras.jar
emf.jar
namingserver.jar
bootstarp.jar
wsexception.jar
can one please tell me what r other things to be done? |
|
Back to top |
|
 |
vennela |
Posted: Thu Aug 18, 2005 8:26 am Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
Why do you want to store JNDI definitions in WAS to run a standalone java program?
Use FSContext or LDAP instead. |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Aug 18, 2005 8:30 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
It sounds like you probably need to install the WAS J2EE client, and run your code in that. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
mailtosathiyan@gmail.com |
Posted: Thu Aug 18, 2005 9:47 pm Post subject: tell me how to run code with JNDI? |
|
|
Novice
Joined: 02 Aug 2005 Posts: 13
|
hi
i want to run the code using jndi and not with LDAP or etc
i m going to use WAS 6 and AS400 and MQ6(client)
currently i m working on windows version (just for practice)
can any one please tell me how to use this option
Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");
(Context.PROVIDER_URL, "iiop://localhost:2809");
regards
sathiya |
|
Back to top |
|
 |
mailtosathiyan@gmail.com |
Posted: Thu Aug 18, 2005 9:55 pm Post subject: any tell me how to create QCF and Queue? |
|
|
Novice
Joined: 02 Aug 2005 Posts: 13
|
in this line i m getting error whether it's LDAP or JNDI or etc.
i think this is the only problem
factory = (QueueConnectionFactory)ctx.lookup( name );
how to create this QCF and Q?
regards
sathiya
 |
|
Back to top |
|
 |
|