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 » Running PCF Sampl code from a Servlet

Post new topic  Reply to topic
 Running PCF Sampl code from a Servlet « View previous topic :: View next topic » 
Author Message
jigjim
PostPosted: Tue Mar 30, 2004 11:42 am    Post subject: Running PCF Sampl code from a Servlet Reply with quote

Apprentice

Joined: 30 Mar 2004
Posts: 41

Hi,

I tried to run the IBM sample code ListQManagerAttrs (PCF Commands) in WebSphere. As an application it runs as expected.

But when i try to run the same code from a servlet in WebSphere, I get an exception thrown when I try to set the attributes in a message using the following code sample:

System.out.println("testing 1");
// MQCFH.write (message, CMQCFC.MQCMD_INQUIRE_Q, 3); // 3 parameters follow
System.out.println("testing 2");
MQCFST.write (message, CMQC.MQCA_Q_NAME, "*");
System.out.println("testing 3");
MQCFIN.write (message, CMQC.MQIA_Q_TYPE, CMQC.MQQT_ALL);
System.out.println("testing 4");
MQCFIL.write (message, CMQCFC.MQIACF_Q_ATTRS, attrs);

It throws the following error messages:

[3/30/04 13:39:01:107 EST] 5fed0ff4 WebGroup E SRVE0026E: [Servlet Error]-[com/ibm/mq/MQException]: java.lang.NoClassDefFoundError: com/ibm/mq/MQException
at PCFAccessNoAgent.getQAttr(PCFAccessNoAgent.java:74)
at Controller.doPost(Controller.java:49)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:948)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:530)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:176)
at com.ibm.ws.webcontainer.servlet.InvokerServlet.service(InvokerServlet.java:255)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:948)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:530)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:176)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:79)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:201)
at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182)
at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:610)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:431)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:593)
Back to top
View user's profile Send private message
vennela
PostPosted: Tue Mar 30, 2004 12:36 pm    Post subject: Reply with quote

Jedi Knight

Joined: 11 Aug 2002
Posts: 4055
Location: Hyderabad, India

Make sure you have the appropriate JAR files (like com.ibm.mq.jar) are in the CLASSPATH of WAS
Back to top
View user's profile Send private message Send e-mail Visit poster's website
jigjim
PostPosted: Tue Mar 30, 2004 1:04 pm    Post subject: Reply with quote

Apprentice

Joined: 30 Mar 2004
Posts: 41

Yes I do have it.

It compiles correctly in the Project setup i have in WebSphere.
I have added the required mq (mq.jar, mq.pcf, ..) files in the web-inf/lic directory. Its only at runtime i ma having this problem

Thanks for the reminder,

jigs
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Mar 30, 2004 1:18 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

jigjim wrote:
Its only at runtime i ma having this problem


Then, at runtime, you don't have your CLASSPATH setup correctly.

Which means your Websphere Application Server's CLASSPATH is not correct.

What is the value of MQ_INSTALL_ROOT in the Server Variables in the Websphere Administration Console?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
jigjim
PostPosted: Tue Mar 30, 2004 2:48 pm    Post subject: Reply with quote

Apprentice

Joined: 30 Mar 2004
Posts: 41

This is the classpath setting for my Workspace directory. When I run it in debug mode, It throws this error line "Source not found for com.ibm.oti.vm.BootstrapClassLoader.loadClass(String) line: 65" at the following line in the code:

PCFParameter [] parameters = {
new MQCFST (CMQC.MQCA_Q_NAME, "MQ02LDG.QL.REPLY"),
new MQCFIN (CMQC.MQIA_Q_TYPE, CMQC.MQQT_ALL),
new MQCFIL (CMQCFC.MQIACF_Q_ATTRS, attrs)
};

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry exported="true" kind="var"
path="SERVERJDK_50_PLUGINDIR/jre/lib/rt.jar" sourcepath="SERVERJDK_50_PLUGINDIR/src.jar"/>
<classpathentry kind="src" path="JavaSource"/>
<classpathentry exported="true" kind="var" path="WAS_50_PLUGINDIR/lib/j2ee.jar"/>
<classpathentry exported="true" kind="var" path="WAS_50_PLUGINDIR/lib/servletevent.jar"/>
<classpathentry exported="true" kind="var" path="WAS_50_PLUGINDIR/lib/ivjejb35.jar"/>
<classpathentry exported="true" kind="var" path="WAS_50_PLUGINDIR/lib/runtime.jar"/>
<classpathentry exported="true" kind="lib" path="WebContent/WEB-INF/lib/com.ibm.mq.pcf.jar"/>
<classpathentry exported="true" kind="lib" path="WebContent/WEB-INF/lib/com.ibm.mq.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/connector.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/providerutil.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/ldap.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/jndi.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/com.ibm.mqbind.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/jta.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/com.ibm.mqjms.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/fscontext.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/jms.jar"/>
<classpathentry kind="output" path="WebContent/WEB-INF/classes"/>
</classpath>
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Mar 30, 2004 6:25 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

jigjim wrote:
This is the classpath setting for my Workspace directory.


Why would the classpath for your workspace affect the classpath for your WAS server?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
jigjim
PostPosted: Wed Mar 31, 2004 6:49 am    Post subject: Reply with quote

Apprentice

Joined: 30 Mar 2004
Posts: 41

I am new to using MQ series on WebSphere. Can you please tell me how do I verify the MQ_INSTALL_ROOT Server variable value.

Thanks

Jigs
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Mar 31, 2004 8:02 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

You use the Administration Console for WAS, and choose "Manage WebSphere Variables" from the Environment submenu.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
jigjim
PostPosted: Thu Apr 01, 2004 7:26 am    Post subject: Reply with quote

Apprentice

Joined: 30 Mar 2004
Posts: 41

Hi,

I got it working now. I had to add the com.ibm.mq and com.ibm.mq.pcf jar files in the server classpath.

Thanks

Jigs
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Thu Apr 01, 2004 7:55 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

jigjim wrote:
I got it working now. I had to add the com.ibm.mq and com.ibm.mq.pcf jar files in the server classpath.

So, then, in
vennela wrote:
the CLASSPATH of WAS

_________________
I am *not* the model of the modern major general.
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 » Running PCF Sampl code from a Servlet
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.