2 Replies Latest reply on Oct 26, 2005 4:00 AM by pranavakumar karuppiah

    MDB deployment problem

    pranavakumar karuppiah Newbie

      Hai every one,
      when i put MDB deployment jar file in JBOSS deploy folder i am getting
      these exception.

      11:10:46,765 WARN [JMSContainerInvoker] JMS provider failure detected:
      javax.jms.JMSException: Error creating the dlq connection: XAConnectionFactory not bound
      at org.jboss.ejb.plugins.jms.DLQHandler.createService(DLQHandler.java:171)
      at org.jboss.system.ServiceMBeanSupport.jbossInternalCreate(ServiceMBeanSupport.java:237)
      at org.jboss.system.ServiceMBeanSupport.create(ServiceMBeanSupport.java:164)
      at org.jboss.ejb.plugins.jms.JMSContainerInvoker.innerCreate(JMSContainerInvoker.java:542)
      at org.jboss.ejb.plugins.jms.JMSContainerInvoker.startService(JMSContainerInvoker.java:764)
      at org.jboss.ejb.plugins.jms.JMSContainerInvoker$ExceptionListenerImpl.onException(JMSContainerInvoker.java:1267)
      at org.jboss.ejb.plugins.jms.JMSContainerInvoker$1.run(JMSContainerInvoker.java:776)
      My code is

      package com.nabil.ejb;
      
      import javax.ejb.MessageDrivenBean;
      import javax.ejb.MessageDrivenContext;
      import javax.ejb.EJBException;
      import javax.jms.JMSException;
      import javax.jms.Message;
      import javax.jms.MessageListener;
      import javax.jms.Queue;
      import javax.jms.QueueConnection;
      import javax.jms.QueueConnectionFactory;
      import javax.jms.QueueSender;
      import javax.jms.QueueSession;
      import javax.jms.TextMessage;
      import javax.naming.InitialContext;
      import javax.naming.NamingException;
      
      
      public class MyMDB implements MessageDrivenBean, MessageListener {
       MessageDrivenContext context = null;
       QueueConnection connection;
       QueueSession session;
      
       public MyMDB() {
       System.out.println("Constructing MyMDB");
       }
      
       public void setMessageDrivenContext(MessageDrivenContext context) {
       this.context = context;
       System.out.println("setMessageDrivenContext");
       }
      
       public void ejbCreate() throws EJBException {
       System.out.println("ejbCreate");
       try {
       InitialContext initContext = new InitialContext();
       QueueConnectionFactory qcf = (QueueConnectionFactory)
       initContext.lookup("java:comp/env/jms/QCF");
       connection = qcf.createQueueConnection();
       session = connection.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
       connection.start();
       }
       catch(Exception e) {
       throw new EJBException("Failed to initialize MyMDB", e);
       }
       }
      
       public void ejbRemove() {
       System.out.println("ejbRemove");
       context = null;
       try {
       if( session != null )
       session.close();
       if( connection != null )
       connection.close();
       }
       catch(JMSException e) {
       e.printStackTrace();
       }
       }
      
       public void onMessage(Message msg) {
       System.out.println("onMessage");
       try {
       TextMessage message = (TextMessage) msg;
       Queue queue = (Queue) msg.getJMSReplyTo();
       QueueSender sender = session.createSender(queue);
       TextMessage message2 = session.createTextMessage(message.getText());
       sender.send(message2);
       sender.close();
       }
       catch(Exception e) {
       e.printStackTrace();
       }
       }
      }
      

      ejb-jar.XMl is
      <?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>MyMDB</ejb-name>
       <ejb-class>com.nabil.ejb.MyMDB</ejb-class>
       <transaction-type>Container</transaction-type>
       <acknowledge-mode>AUTO_ACKNOWLEDGE</acknowledge-mode>
       <message-driven-destination>
       <destination-type>javax.jms.Queue</destination-type>
       </message-driven-destination>
       <resource-ref>
       <res-ref-name>jms/QCF</res-ref-name>
       <res-type>javax.jms.QueueConnectionFactory</res-type>
       <res-auth>Container</res-auth>
       </resource-ref>
       </message-driven>
       </enterprise-beans>
      </ejb-jar>
      

      jboss.xml is
      <?xml version="1.0" encoding="UTF-8"?>
      <jboss>
       <enterprise-beans>
       <message-driven>
       <ejb-name>MyMDB</ejb-name>
       <destination-jndi-name>queue/MyQueue</destination-jndi-name>
       <resource-ref>
       <res-ref-name>jms/QCF</res-ref-name>
       <jndi-name>QueueConnectionFactory</jndi-name>
       </resource-ref>
       </message-driven>
       </enterprise-beans>
      </jboss>