• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Probelem with MDB l(on weblogic 7.0) listening to MQ (Start-up class issue )

 
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello ,
I am supposed to write a Message driven bean that would reside on Weblogic7.0 and listen to a particular queue of IBM MQ.
I understand that we need to write a Start-up class for this. I have written the start-up class but I am getting the following error:
<Apr 16, 2003 3:17:14 PM EDT> <Warning> <EJB> <010061> <The Message-Driven EJB: SimpleMDB is unable
to connect to the JMS destination: ivtQ. The EJB container will automatically attempt to re-establis
h the connection with the JMS server. This warning may occur during WebLogic Cluster start-up if the
JMS destination is located on another server. When the JMS server connection is re-established, the
Message-Driven EJB will again receive JMS messages.
The Error was:
The JMS destination with the JNDI name: ivtQ could not be found. Please ensure that the JNDI name in
the weblogic-ejb-jar.xml is correct, and the JMS destination has been deployed.>
I understand that there are some configuration issues:
Can you please guide where am I going wrong:
1.What should be the value of the <destination-jndi-name> in the Weblogic-ejb-jar. I have not passed any Queue name through the start-up class …Is it ok?
2.Then what queue name should I specify. (ofcousrse it should be the MQ queue name but do I need to add that in the JNDI or in the weblogic console…?
3.Please confirm that the <connection-factory-jndi-name> mentioned in the weblogic-ejb-jar.xml should be the same as what I am passing as JNDIName (through weblogic console).
4.Kindly advice if I am missing anything (especially in my start-ip class)
Here are my Deployemnt descriptors:
weblogic-ejb-jar
<?xml version="1.0"?>
<!DOCTYPE weblogic-ejb-jar PUBLIC "-//BEA Systems, Inc.//DTD WebLogic 7.0.0 EJB//EN" "http://www.bea.com/servers/wls700/dtd/weblogic-ejb-jar.dtd">
<weblogic-ejb-jar>
<weblogic-enterprise-bean>
<ejb-name>SimpleMDB</ejb-name>
<message-driven-descriptor>
<pool>
<max-beans-in-free-pool>8</max-beans-in-free-pool>
<initial-beans-in-free-pool>1</initial-beans-in-free-pool>
</pool>
<destination-jndi-name>ivtQ</destination-jndi-name>
<initial-context-factory>
com.sun.jndi.fscontext.RefFSContextFactory
</initial-context-factory>
<provider-url>
file:/D:/JNDI/
</provider-url>
<connection-factory-jndi-name>
MyQCF
</connection-factory-jndi-name>
</message-driven-descriptor>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>
ejb-jar.xml
<?xml version="1.0"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar>
<enterprise-beans>
<message-driven>
<ejb-name>SimpleMDB</ejb-name>
<ejb-class>weblogic.jms.whitepaper.SimpleMDB</ejb-class>
<transaction-type>Container</transaction-type>
<message-driven-destination>
<!-- In WebLogic Server 6.0, this next parameter is named "jms-destination-type" -->
<destination-type>javax.jms.Queue</destination-type>
</message-driven-destination>
</message-driven>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>SimpleMDB</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>

My Start-up class is as follows:
import com.ibm.mq.jms.*;
import java.util.*;
import javax.jms.*;
import javax.naming.*;
import weblogic.common.*;

public class MQJMSStartup implements T3StartupDef
{
/** * The name of the queue manager to connect to. The startup class * will throw an exception if this parameter is not set. */
public final static String QM_NAME_PROPERTY = "QManager";

/** * The host name where the queue manager runs. If not set, the * startup class will create a "bindings mode" connection to a * queue manager on the local host. */
public final static String QM_HOST_PROPERTY = "QManagerHost";

/** * The port number where the queue manager listens. If not set, this * defaults to 1414, the default MQSeries port */
public final static String QM_PORT_PROPERTY = "QManagerPort";

/** * The name in JNDI to store this queue manager object under. * If not set, the startup class will throw an exception. */
public static final String JNDI_NAME_PROPERTY = "JNDIName";
// Required
public MQJMSStartup()
{
}
// Required, but not needed
public void setServices(T3ServicesDef services)
{
}
public String startup(String name, Hashtable args) throws Exception
{
String qmName = (String)args.get(QM_NAME_PROPERTY);
System.out.println("*****The qmName is "+qmName);
if (qmName == null)
{
throw new Exception("Startup parameter " + QM_NAME_PROPERTY + " must be set");
}
String jndiName = (String)args.get(JNDI_NAME_PROPERTY);
System.out.println("***The JNDI Nname is "+jndiName);
if (jndiName == null)
{
throw new Exception("Startup parameter " + JNDI_NAME_PROPERTY + " must be set");
}
String qmHost = (String)args.get(QM_HOST_PROPERTY);
System.out.println("*****The qmHost is "+qmHost);
String qmPort = (String)args.get(QM_PORT_PROPERTY);
System.out.println("*****The qmPort is "+qmPort);
MQQueueConnectionFactory factory = new MQQueueConnectionFactory();
factory.setQueueManager(qmName);
if (qmHost == null)
{
factory.setTransportType(JMSC.MQJMS_TP_BINDINGS_MQ);
factory.setHostName(qmHost);
if (qmPort != null)
{
try
{
int portNum = Integer.parseInt(qmPort);
factory.setPort(portNum);
}
catch (NumberFormatException ignore)
{
}
}
}
else
{
factory.setTransportType(JMSC.MQJMS_TP_CLIENT_MQ_TCPIP);
}
InitialContext context = new InitialContext();
context.bind(jndiName, factory);
context.close();
StringBuffer buf = new StringBuffer();
buf.append( "A connection factory was created for the MQ Queue Manager ");
buf.append(qmName);
buf.append(" and stored in JNDI at ");
buf.append(jndiName);
System.out.println("*****The mqstartup is executed succesfully"+buf.toString());
return buf.toString();
}
}

The args that I pass through the weblogic console is as follows:
QManager=QM_mphasis_eight, JNDIName=MyQCF

Thanks and regards,
Milan Doshi
 
Doshi Milan
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello friends,
Can someone guide me how to register the queue in Weblogic JNDI. (this is with reference to my above probelem),
Thanks in advance,
Milan Doshi
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are details on Bea's website at ftp://edownload:BUY_ME@ftpna2.bea.com/pub/downloads/jmsproviders.pdf with details on how to integrate a WLS MDB with a foreign JMS provider which might give you some tips.
Ramdas
 
reply
    Bookmark Topic Watch Topic
  • New Topic