MDB + Secure Queue

Hi
          I am having trouble getting the MDB to work with a secure Queue in weblogic. I set up the security using the WLS admin console and it has just a userid/password protection to all the Queue operations. I am not sure how to tell the container of the MDB to connect using that userid/password combination. What I have done is use the run-as identity in the deployment descriptors and thats not helping it to connect to the Queue.
          I am a bit lost on how to set up the MDB for the secure Queue - any pointers is really appreciated.
          thanks
          Anamitra

Hi
          I have already done that and I still get that error:
          <Sep 7, 2004 9:28:44 AM EDT> <Warning> <EJB> <BEA-010096> <The Message-Driven EJ
          B: JMSContQueueProcessor-1 is unable to connect to the JMS destination: jms/mro/
          int/queues/cqin. Connection failed after 2 attempts. The MDB will attempt to rec
          onnect every 10 seconds. This log message will repeat every 600 seconds until th
          e condition clears.>
          <Sep 7, 2004 9:28:45 AM EDT> <Warning> <EJB> <BEA-010061> <The Message-Driven EJ
          B: JMSContQueueProcessor-1 is unable to connect to the JMS destination: jms/mro/
          int/queues/cqin. The Error was:
          weblogic.jms.common.JMSSecurityException: Access denied to resource: type=<jms>,
          application=, destinationType=queue, resource=cq, action=receive
          weblogic.jms.common.JMSSecurityException: Access denied to resource: type=<jms>,
          application=, destinationType=queue, resource=cq, action=receive
          at weblogic.jms.JMSService.checkPermission(JMSService.java:1140)
          at weblogic.jms.JMSService.checkRecvPermission(JMSService.java:1157)
          at weblogic.jms.frontend.FESession.consumerCreate(FESession.java:1049)
          at weblogic.jms.frontend.FESession.invoke(FESession.java:2552)
          at weblogic.jms.dispatcher.Request.wrappedFiniteStateMachine(Request.jav
          a:621)
          at weblogic.jms.dispatcher.DispatcherImpl.dispatchSync(DispatcherImpl.ja
          va:153)
          at weblogic.jms.client.JMSSession.consumerCreate(JMSSession.java:1860)
          at weblogic.jms.client.JMSSession.createConsumer(JMSSession.java:1691)
          at weblogic.jms.client.JMSSession.createReceiver(JMSSession.java:1530)
          at weblogic.ejb20.internal.JMSConnectionPoller.setUpQueueSessions(JMSCon
          nectionPoller.java:1720)
          at weblogic.ejb20.internal.JMSConnectionPoller.createJMSConnection(JMSCo
          nnectionPoller.java:2012)
          at weblogic.ejb20.internal.JMSConnectionPoller.connectToJMS(JMSConnectio
          nPoller.java:1180)
          at weblogic.ejb20.internal.JMSConnectionPoller.trigger(JMSConnectionPoll
          er.java:978)
          at weblogic.time.common.internal.ScheduledTrigger.run(ScheduledTrigger.j
          ava:243)
          at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
          dSubject.java:321)
          at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
          118)
          at weblogic.time.common.internal.ScheduledTrigger.executeLocally(Schedul
          edTrigger.java:229)
          at weblogic.time.common.internal.ScheduledTrigger.execute(ScheduledTrigg
          er.java:223)
          at weblogic.time.server.ScheduledTrigger.execute(ScheduledTrigger.java:5
          0)
          at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
          at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
          I have attached my dd file below:
          <!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 id="ejb-jar_ID">
               <display-name>MEA JMS EJB Module</display-name>
          <enterprise-beans>
          <message-driven id="MessageDriven_JMSContQueueProcessor_1">
          <ejb-name>JMSContQueueProcessor-1</ejb-name>
          <ejb-class>psdi.iface.jms.JMSContQueueProcessor</ejb-class>
          <transaction-type>Container</transaction-type>
          <message-driven-destination>
          <destination-type>javax.jms.Queue</destination-type>
          </message-driven-destination>
          <env-entry>
          <env-entry-name>MESSAGEPROCESSOR</env-entry-name>
               <env-entry-type>java.lang.String </env-entry-type>
               <env-entry-value>psdi.iface.jms.QueueToMaximoProcessor</env-entry-value>
          </env-entry>
               <security-identity>
               <run-as>
                    <role-name>integrationuser</role-name>
               </run-as>
               </security-identity>
          </message-driven>
          </enterprise-beans>
          <assembly-descriptor>
                    <security-role>
                         <role-name>integrationuser</role-name>
                    </security-role>
          <container-transaction>
               <method>
               <ejb-name>JMSContQueueProcessor-1</ejb-name>
               <method-name>*</method-name>
               </method>
               <trans-attribute>Required</trans-attribute>
          </container-transaction>
          </assembly-descriptor>
          </ejb-jar>
          <?xml version="1.0"?>
          <!DOCTYPE weblogic-ejb-jar PUBLIC "-//BEA Systems, Inc.//DTD WebLogic 6.0.0 EJB//EN" "http://www.bea.com/servers/wls600/dtd/weblogic-ejb-jar.dtd">
          <!-- Sample MessageDriven bean Weblogic deployment descriptor -->
          <weblogic-ejb-jar>
          <weblogic-enterprise-bean>
          <ejb-name>JMSContQueueProcessor-1</ejb-name>
          <message-driven-descriptor>
          <pool>
          <max-beans-in-free-pool>1</max-beans-in-free-pool>
          <initial-beans-in-free-pool>0</initial-beans-in-free-pool>
          </pool>
          <destination-jndi-name>jms/mro/int/queues/cqin</destination-jndi-name>
          <connection-factory-jndi-name>jms/mro/int/qcf/intqcf</connection-factory-jndi-name>
          </message-driven-descriptor>
          <transaction-descriptor>
          <trans-timeout-seconds>600</trans-timeout-seconds>
          </transaction-descriptor>
          <jndi-name>JMSContQueueProcessor-1</jndi-name>
          </weblogic-enterprise-bean>
               <security-role-assignment>
               <role-name>integrationuser</role-name>
               <principal-name>new_user1</principal-name>
               </security-role-assignment>
          </weblogic-ejb-jar>
          Did I miss anything?
          thanks
          Anamitra

Similar Messages

  • JMS Wrappers can't cache JNDI lookups when using secured queues

    Hi All!
    We are working on a jms client, inside a webapp(servlets), using Weblogic 9.2 and Weblogic 10.3.
    As we want to use secured queues and keep being efficient we tryed to use Weblogic JMS Wrappers, that should work according to the docs:
    Enhanced Support for Using WebLogic JMS with EJBs and Servlets
    http://download.oracle.com/docs/cd/E12840_01/wls/docs103/jms/j2ee.html
    But we are facing a problem:
    When we define a JMS Wrapper and try to cache JNDI lookups for the QueueConnectionFactory and Queue, as the docs recommend for efficiency, the connection to the queue is ignoring the user/pwd.
    The JMS Wrapper is using <res-auth>Application</res-auth>.
    We are creating the connection using createQueueConnection(user, pwd) from QueueConnectionFactory and after several tests it seems that the user and password are ingored unless a jndi lookup is made in the same thread, as if when there are not any thread credentials present user and password are ignored for the connection...
    so the question is:
    That behaviour goes against Weblogic JMS Wrapper documentation, doesn't it?
    Is there then any other way to access efficiently secured queues using a servlet as a client? (iit's not an option for us to use mdbs, or ejbs).
    If it helps, this seems related to this still opened spring-weblogic issue: SPR-2941 --> http://jira.springframework.org/browse/SPR-2941 and SPR-4720 --> http://jira.springframework.org/browse/SPR-4720
    Thanxs
    And here goes our DDs and code to reproduce:
    First in pretty format:
    web.xml --> http://pastebin.com/f5f85e8d4
    weblogic.xml --> http://pastebin.com/f2fbe10cc
    Client code --> http://pastebin.com/f586d32d9
    And now emmebded in the msg:
    web.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <weblogic-web-app
      xmlns="http://www.bea.com/ns/weblogic/90"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.bea.com/ns/weblogic/90
      http://www.bea.com/ns/weblogic/90/weblogic-web-app.xsd">
        <description>WebLogic Descriptor</description>
        <resource-description>
            <res-ref-name>jms/QCF</res-ref-name>
            <jndi-name>weblogic.jms.ConnectionFactory</jndi-name>
        </resource-description>
    </weblogic-web-app>weblogic.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
          <display-name> QCFWrapperCredentialsTest </display-name>
          <description> QCFWrapperCredentialsTest  </description>
          <servlet id="Servlet_1">
             <servlet-name>QCFWrapperCredentialsTest</servlet-name>
             <servlet-class>QCFWrapperCredentialsTest</servlet-class>
             <load-on-startup>1</load-on-startup>
          </servlet>
          <servlet-mapping id="ServletMapping_1">
             <servlet-name>QCFWrapperCredentialsTest</servlet-name>
             <url-pattern>/Test</url-pattern>
          </servlet-mapping>
         <resource-ref>
            <res-ref-name>jms/QCF</res-ref-name>
            <res-type>javax.jms.QueueConnectionFactory</res-type>
            <res-auth>Application</res-auth>
            <res-sharing-scope>Shareable</res-sharing-scope>
        </resource-ref>
    </web-app>And our test client:
    import java.io.*;
    import java.util.Properties;
    import javax.jms.*;
    import javax.naming.*;
    import javax.servlet.http.*;
    public class QCFWrapperCredentialsTest extends HttpServlet {
        QueueConnectionFactory factory = null;
        Queue queue = null;
        String jndiName = "java:comp/env/jms/QCF";
        String queueName= "jms/ColaEntradaConsultas";
        String user = "usuarioColas";
        String pwd = "12345678";
        String userjndi = "usuarioColas";
        String pwdjndi = "12345678";
        String serverT3URL="t3://127.0.0.1:7007";
        public void init() {
            setupJNDIResources();
        private void setupJNDIResources(){
            try {
                Properties props = new Properties();
                props.put("java.naming.factory.initial",
                        "weblogic.jndi.WLInitialContextFactory");
                props.put("java.naming.provider.url",serverT3URL );
                props.put("java.naming.security.principal", userjndi);// usr
                props.put("java.naming.security.credentials", pwdjndi);// pwd
                InitialContext ic = new InitialContext(props);
                factory = (QueueConnectionFactory) ic.lookup(jndiName);
                queue = (Queue) ic.lookup(queueName);
            } catch (NamingException e) {
                e.printStackTrace();
        public void service(HttpServletRequest req, HttpServletResponse res) {
            res.setContentType("text/html");
            Writer wr = null;
            try {
                wr = res.getWriter();
                //Comment this out, do a lookup for each request and it will work
                //setupJNDIResources();
                String user = this.user;
                String pwd = this.pwd;
                //read users and passwords from the request in case they are present
                if (req.getParameter("user") != null) {
                    user = req.getParameter("user");
                if (req.getParameter("pwd") != null) {
                    pwd = req.getParameter("pwd");
                wr.write("JNDI  User: *" + userjndi + "* y pwd: *" + pwdjndi + "*<p>");
                wr.write("Queue User: *" + user + "* y pwd: *" + pwd + "*<p>");
                //Obtain a connection using user/pwd
                QueueConnection conn = factory.createQueueConnection(user, pwd);
                QueueSession ses = conn.createQueueSession(true,
                        Session.SESSION_TRANSACTED);
                QueueSender sender = ses.createSender(queue);
                TextMessage msg = ses.createTextMessage();
                msg.setText("Hi there!");
                conn.start();
                sender.send(msg);
                ses.commit();
                sender.close();
                ses.close();
                conn.close();
            } catch (Exception e) {
                e.printStackTrace();
                try {
                    wr.write(e.toString());
                } catch (Exception e2) {
                    e2.printStackTrace();
            finally{
                try {
                    wr.close();
                } catch (IOException e) {
                    e.printStackTrace();
    }Edited by: user2525402 on Feb 9, 2010 7:14 PM

    Thanks Tom,
    Quite a useful response .-)
    Leaving aside the fact that weblogic behaviour with jms wrappers and secured queues seems to not be working as the docs says...
    Talking about workarounds:
    Both workarounds you suggest works, but as you already noted, creating a new JNDI context just to inject credentials into the threads is overkill when high performance is needed.
    I also found more information about the same issue here: http://sleeplessinslc.blogspot.com/2009/04/weblogic-jms-standalone-multi-threaded.html
    And he suggest the same workaround, injecting credentials
    So I tried the second approach, successfully, injecting credentials into the thread using the security API.
    This way, using JMS wrappers and injecting credentials into the thread we get the best performance available, caching resource using wrappers and using credentials in a somewhat efficient way.
    Now the test snippet looks like this:
    import java.io.*;
    import java.security.PrivilegedAction;
    import java.util.Properties;
    import javax.jms.*;
    import javax.naming.*;
    import javax.security.auth.Subject;
    import javax.security.auth.login.LoginException;
    import javax.servlet.http.*;
    import weblogic.jndi.Environment;
    import weblogic.security.auth.Authenticate;
    public class JMSWrapperCredentialsTest extends HttpServlet {
        QueueConnectionFactory factory = null;
        Queue queue = null;
        String jndiName = "java:comp/env/jms/QCF";
        String queueName= "jms/ColaEntradaConsultas";
        String user = "usuarioColas";
        String pwd = "12345678";
        String userjndi = "usuarioColas";
        String pwdjndi = "12345678";
        String serverT3URL="t3://127.0.0.1:7007";
        public void init() {
            setupJNDIResources();
        private void setupJNDIResources(){
            try {
                Properties props = new Properties();
                props.put("java.naming.factory.initial",
                        "weblogic.jndi.WLInitialContextFactory");
                props.put("java.naming.provider.url",serverT3URL );
                props.put("java.naming.security.principal", userjndi);// usr
                props.put("java.naming.security.credentials", pwdjndi);// pwd
                InitialContext ic = new InitialContext(props);
                factory = (QueueConnectionFactory) ic.lookup(jndiName);
                queue = (Queue) ic.lookup(queueName);
            } catch (NamingException e) {
                e.printStackTrace();
        public void service(HttpServletRequest req, HttpServletResponse res) {
            final HttpServletRequest fReq=req;
            final HttpServletResponse fRes=res;
            PrivilegedAction action = new java.security.PrivilegedAction() {
                public java.lang.Object run() {
                    performRequest(fReq,fRes);
                    return null;
            try {
                Subject subject=createSingleSubject(serverT3URL,user,pwd);
                weblogic.security.Security.runAs(subject, action);
            } catch (Exception e) {
                e.printStackTrace();
        public void performRequest(HttpServletRequest req, HttpServletResponse res) {
            res.setContentType("text/html");
            Writer wr = null;
            try {
                wr = res.getWriter();
                //Comment this out, do a lookup for each request and it will work
                //setupJNDIResources();
                String user = this.user;
                String pwd = this.pwd;
                //read users and passwords from the request in case they are present
                if (req.getParameter("user") != null) {
                    user = req.getParameter("user");
                if (req.getParameter("pwd") != null) {
                    pwd = req.getParameter("pwd");
                wr.write("JNDI  User: *" + userjndi + "* y pwd: *" + pwdjndi + "*<p>");
                wr.write("Queue User: *" + user + "* y pwd: *" + pwd + "*<p>");
                //Obtain a connection using user/pwd
                QueueConnection conn = factory.createQueueConnection(user, pwd);
                QueueSession ses = conn.createQueueSession(true,
                        Session.SESSION_TRANSACTED);
                QueueSender sender = ses.createSender(queue);
                TextMessage msg = ses.createTextMessage();
                msg.setText("Hi there!");
                conn.start();
                sender.send(msg);
                ses.commit();
                sender.close();
                ses.close();
                conn.close();
            } catch (Exception e) {
                e.printStackTrace();
                try {
                    wr.write(e.toString());
                } catch (Exception e2) {
                    e2.printStackTrace();
            finally{
                try {
                    wr.close();
                } catch (IOException e) {
                    e.printStackTrace();
        private Subject createSingleSubject(String providerUrl, String userName, String password) {
            Subject subject = new Subject();
            // Weblogic env class
            Environment env = new Environment();
            if(providerUrl!=null)
                env.setProviderUrl(providerUrl);
            env.setSecurityPrincipal(userName);
            env.setSecurityCredentials(password);
            try {
              // Weblogic Authenticate class will populate and Seal the subject
              Authenticate.authenticate(env, subject);
              return subject;
            catch (LoginException e) {
              throw new RuntimeException("Unable to Authenticate User", e);
            catch (Exception e) {
              throw new RuntimeException("Error authenticating user", e);
    }Thanks a lot for the help

  • MDB acessing queue details

    Hi,
              I'm trying to find out if an MDB can obtain the name of the queue (and possibly other queue details) on which a JMS message has just been delivered. I can't find anything that says that it can and neither can I see a way of doing it. But wanted to see if anybody else had anybody ideas.
              Any help appreciated.
              Thanks,
              Aoife

    Yes. you can call getJMSDestination() on the message that you just received. Look at the javadoc for JMS and see what information you get out from the destination.

  • MDB security problem

    Hi,
    I get some problems with the following configuration.
    An JMS-Queue is located on a weblogic-server A. On another WL-Server B
    I deploy a MDB which connects to the queue on server A.
    As long as both servers have the same password for the system-user
    everthing works fine. Changing it on one side results in this
    exception on server A.
    java.lang.SecurityException: Authentication for user system denied in
    realm wl_realm
    I tried to use the run-as an run-as-identity-principal arguments in DD
    but to no effort. I always get this exception for the system-user.
    Can anyone help ?
    Markus
    Config: WLS 6.1 SP1 on NT

    As of now you need to have the same system password for both the servers,
    but I would suggest that you try this with 6.1 sp2 (Tentative release
    mid december ).
    yeshwant
    Markus Papenbrock wrote:
    Hi,
    I get some problems with the following configuration.
    An JMS-Queue is located on a weblogic-server A. On another WL-Server B
    I deploy a MDB which connects to the queue on server A.
    As long as both servers have the same password for the system-user
    everthing works fine. Changing it on one side results in this
    exception on server A.
    java.lang.SecurityException: Authentication for user system denied in
    realm wl_realm
    I tried to use the run-as an run-as-identity-principal arguments in DD
    but to no effort. I always get this exception for the system-user.
    Can anyone help ?
    Markus
    Config: WLS 6.1 SP1 on NT

  • Issue with MDB (jms Queue) in weblogic 8.1

              Hi all...
              I'm facing a strange kind of problem with MDB using weblogic 8.1.
              The code worked perfectly in weblogic 7.0.
              This is wht i'm trying to achieve..
              i'm having a MDB which implements a onMessage().
              I'm publishing message thru a standalone client. Publishing works fine..
              The problem is onMessage(javax.jms.Message msg) is never been called :-(.
              when i monitor it shows that messages are recieved..
              Am is missing something that is really important..
              here is my code
              package com.csxwt.zodiac.service.domain;
              import javax.ejb.*;
              import javax.jms.*;
              import javax.naming.*;
              import java.io.Serializable;
              //import com.csxwt.zodiac.service.domain.TestObject;
              public class MDBTestBean implements MessageDrivenBean, MessageListener {
              MessageDrivenContext messageDrivenContext;
              public void ejbCreate() throws CreateException {
              System.out.println("into the ejb create");
              /**@todo Complete this method*/
              public void ejbRemove() {
              /**@todo Complete this method*/
              public void onMessage(javax.jms.Message msg) {
              System.out.println("into the onMessage method 1 ");
              ObjectMessage objectMsg = null;
              String strObject = "Test";
              try
              System.out.println("into the onMessage method 2 ");
              if (msg instanceof ObjectMessage)
              System.out.println("into the onMessage method 3");
              objectMsg = (ObjectMessage) msg;
              Serializable serializableObj = objectMsg.getObject();
              String test = serializableObj.toString();
              System.out.println("value of the message sent " + test);
              TestObject test1 = null;
              if(serializableObj instanceof TestObject )
              test1 = (TestObject) serializableObj;
              System.out.println("after getting the test value ");
              System.out.println("getting the test object valuye " + test1.getName());
              else
              return;
              catch (Exception e)
              System.out.println("Message Bean:unexpected Exception thrown ");
              e.printStackTrace();
              public void setMessageDrivenContext(MessageDrivenContext messageDrivenContext)
              System.out.println("into MDB context");
              this.messageDrivenContext = messageDrivenContext;
              here are the 2 xml files....
              <ejb-jar>
              <enterprise-beans>
              <message-driven>
              <display-name>MDBTest</display-name>
              <ejb-name>MDBTest</ejb-name>
              <ejb-class>com.csxwt.zodiac.service.domain.MDBTestBean</ejb-class>
              <transaction-type>Container</transaction-type>
              <message-selector>GATE_LANE</message-selector>
              <message-driven-destination>
              <destination-type>javax.jms.Queue</destination-type>
              </message-driven-destination>
              </message-driven>
              </enterprise-beans>
              <assembly-descriptor>
              <container-transaction>
              <method>
              <ejb-name>MDBTest</ejb-name>
              <method-name>*</method-name>
              </method>
              <trans-attribute>Required</trans-attribute>
              </container-transaction>
              </assembly-descriptor>
              </ejb-jar>
              <weblogic-ejb-jar>
              <weblogic-enterprise-bean>
              <ejb-name>MDBTest</ejb-name>
              <message-driven-descriptor>
              <pool>
              <max-beans-in-free-pool>200</max-beans-in-free-pool>
              <initial-beans-in-free-pool>20</initial-beans-in-free-pool>
              </pool>
              <destination-jndi-name>zodiac.jms.queue.HardWareOutMessageQueue</destination-jndi-name>
              </message-driven-descriptor>
              </weblogic-enterprise-bean>
              </weblogic-ejb-jar>
              Am i missing something somewhere?????
              any help in this is highly appreciated..
              thanks in advance.
              r
              sasi
              

    Check your log for error and warning messages. If there
              are some, they should help trace down the problem. If there
              aren't any, try confirm that your MDB is deploying in
              the first place.
              The MDB below is a Q MDB, but you write below that your client
              is a "publisher". "Publisher" implies a topic producer, not
              a queue producer, and topic producer can't publish to queues.
              Tom
              T. Sasii Dharma wrote:
              > Hi all...
              >
              > I'm facing a strange kind of problem with MDB using weblogic 8.1.
              > The code worked perfectly in weblogic 7.0.
              > This is wht i'm trying to achieve..
              > i'm having a MDB which implements a onMessage().
              > I'm publishing message thru a standalone client. Publishing works fine..
              > The problem is onMessage(javax.jms.Message msg) is never been called :-(.
              > when i monitor it shows that messages are recieved..
              > Am is missing something that is really important..
              >
              > here is my code
              >
              > package com.csxwt.zodiac.service.domain;
              >
              > import javax.ejb.*;
              > import javax.jms.*;
              > import javax.naming.*;
              > import java.io.Serializable;
              > //import com.csxwt.zodiac.service.domain.TestObject;
              >
              > public class MDBTestBean implements MessageDrivenBean, MessageListener {
              > MessageDrivenContext messageDrivenContext;
              > public void ejbCreate() throws CreateException {
              > System.out.println("into the ejb create");
              > /**@todo Complete this method*/
              > }
              > public void ejbRemove() {
              > /**@todo Complete this method*/
              > }
              > public void onMessage(javax.jms.Message msg) {
              > System.out.println("into the onMessage method 1 ");
              > ObjectMessage objectMsg = null;
              > String strObject = "Test";
              > try
              > {
              > System.out.println("into the onMessage method 2 ");
              > if (msg instanceof ObjectMessage)
              > {
              > System.out.println("into the onMessage method 3");
              > objectMsg = (ObjectMessage) msg;
              > Serializable serializableObj = objectMsg.getObject();
              > String test = serializableObj.toString();
              > System.out.println("value of the message sent " + test);
              > TestObject test1 = null;
              > if(serializableObj instanceof TestObject )
              > {
              > test1 = (TestObject) serializableObj;
              > System.out.println("after getting the test value ");
              > System.out.println("getting the test object valuye " + test1.getName());
              > }
              >
              > }
              > else
              > {
              > return;
              > }
              >
              > }
              > catch (Exception e)
              > {
              > System.out.println("Message Bean:unexpected Exception thrown ");
              > e.printStackTrace();
              > }
              >
              > }
              > public void setMessageDrivenContext(MessageDrivenContext messageDrivenContext)
              > {
              > System.out.println("into MDB context");
              >
              > this.messageDrivenContext = messageDrivenContext;
              > }
              > }
              >
              >
              > here are the 2 xml files....
              >
              > <ejb-jar>
              > <enterprise-beans>
              > <message-driven>
              > <display-name>MDBTest</display-name>
              > <ejb-name>MDBTest</ejb-name>
              > <ejb-class>com.csxwt.zodiac.service.domain.MDBTestBean</ejb-class>
              > <transaction-type>Container</transaction-type>
              > <message-selector>GATE_LANE</message-selector>
              > <message-driven-destination>
              > <destination-type>javax.jms.Queue</destination-type>
              > </message-driven-destination>
              > </message-driven>
              > </enterprise-beans>
              > <assembly-descriptor>
              > <container-transaction>
              > <method>
              > <ejb-name>MDBTest</ejb-name>
              > <method-name>*</method-name>
              > </method>
              > <trans-attribute>Required</trans-attribute>
              > </container-transaction>
              > </assembly-descriptor>
              > </ejb-jar>
              >
              > <weblogic-ejb-jar>
              > <weblogic-enterprise-bean>
              > <ejb-name>MDBTest</ejb-name>
              > <message-driven-descriptor>
              > <pool>
              > <max-beans-in-free-pool>200</max-beans-in-free-pool>
              > <initial-beans-in-free-pool>20</initial-beans-in-free-pool>
              > </pool>
              > <destination-jndi-name>zodiac.jms.queue.HardWareOutMessageQueue</destination-jndi-name>
              > </message-driven-descriptor>
              > </weblogic-enterprise-bean>
              > </weblogic-ejb-jar>
              >
              > Am i missing something somewhere?????
              > any help in this is highly appreciated..
              >
              > thanks in advance.
              >
              > r
              > sasi
              

  • Two MDB can look one Queue?-help

    Hello All,
    i have one promblem regarding implementing MDB with Queue,
    My module flow like this
    EAI send one Request messge to My queue, i have one MDB with msg selector is 'Verify' , pick up the message and process it and put it n same queue. after that EAI send one acknowledgement msg to same queue, i have one session bean , that bean waiting for the ack. msg and pick up the message and again process and put it n same queue with n 30 seconds. if i fail to put the message with n 30 seconds, EAI Send one cancelation msg to that queue.
    so my problem is
    how can i pick up the cancelation msg without using Session bean.?
    can i use one more MDB to Pick up the cancelation msg?
    can i use two MDB with Msg selector looking for one queue?
    or any other way to solve the prblm?
    thanx n advance
    muruganandam

    hi
    no session bean not register with queue
    basically one helper class (msgReceiver ) receive the msg and handover to session bean,
    so no listener n session bean

  • MDB QUeue example

    I looking for a example of a queue in OC4J. AT least I need the configuration for defining the QueueConnectionFactory (there's no example as a queue)

    Here's an example of a jms.xml file we use which works with queues. One of them is persistent while the other one is not.
    Apart from this file (jms.xml) the rest of the stuff is very similar to the topic example given by Oracle.
    A few points to note. Generally just change Topic for Queue in the sample code + don't forget the start the queue with the start() method.
    Hope this helps
    <?xml version="1.0"?>
    <!DOCTYPE jms-server PUBLIC "Orion JMS server" "http://xmlns.oracle.com/ias/dtds/jms-server.dtd">
    <jms-server port="9127" host="127.0.0.1">
         <!--Queue bindings, these queues will be bound to their respective JNDI path for later retrieval -->
         <queue-connection-factory location="jms/appointmentQCF" password="admin" port="9127" username="admin">
         </queue-connection-factory>
         <queue-connection-factory location="jms/objectMessageQCF" password="admin" port="9127" username="admin">
         </queue-connection-factory>      
         <queue-connection-factory location="jms/d0012QCF" password="admin" port="9127" username="admin">
         </queue-connection-factory>
         <!-- path to the log-file where JMS-events/errors are stored-->
         <!-- log>
              <file path="../log/jms.log" />
         </log -->
         <queue name="Appointment Queue" location="jms/appointmentQ" persistence-file="../persistence/MDB/appointment.queue" >
              <description>Appointment Queue</description>
         </queue>
         <queue name="Object Message Queue" location="jms/objectMessageQ" >
              <description>Object Message Queue</description>
         </queue>     
         <queue name="D0012 Queue" location="jms/d0012Q" persistence-file="../persistence/MDB/d012.queue" >
              <description>D012 queue</description>
         </queue>
    </jms-server>

  • Error listening to Queue carnot Queue

    I get the following error in my application.log and do not really know, what to do with it:
    java.lang.InstantiationException: Error: com.evermind.server.jms.EvermindQueueSession
         at com.evermind.server.jms.OrionServerSessionPool.getServerSessionFull(OrionServerSessionPool.java:377)
         at com.evermind.server.ejb.MessageDrivenHome.run(MessageDrivenHome.java:769)
         at com.evermind.util.ThreadPoolThread.run(ThreadPoolThread.java:66)
    my jms.xml looks as follows:
    <?xml version="1.0"?>
    <!DOCTYPE jms-server PUBLIC "Orion JMS server" "http://xmlns.oracle.com/ias/dtds/jms-server.dtd">
    <jms-server port="9127" host="127.0.0.1">
    <!--Queue bindings, these queues will be bound to their respective JNDI path for later retrieval -->
    <queue-connection-factory location="jms/carnotQCF" password="carnot" port="9127" username="admin">
    </queue-connection-factory>
    <queue-connection-factory location="jms/appointmentQCF" password="carnot" port="9127" username="admin">
    </queue-connection-factory>
    <queue-connection-factory location="jms/objectMessageQCF" password="carnot" port="9127" username="admin">
    </queue-connection-factory>
    <queue-connection-factory location="jms/d0012QCF" password="carnot" port="9127" username="admin">
    </queue-connection-factory>
    <!-- path to the log-file where JMS-events/errors are stored-->
    <!-- log>
    <file path="../log/jms.log" />
    </log -->
    <queue name="carnot Queue" location="jms/carnotqueue" persistence-file="../persistence/MDB/carnot.queue" >
    <description>Appointment Queue</description>
    </queue>
    <queue name="Appointment Queue" location="jms/appointmentQ" persistence-file="../persistence/MDB/appointment.queue" >
    <description>Appointment Queue</description>
    </queue>
    <queue name="Object Message Queue" location="jms/objectMessageQ" >
    <description>Object Message Queue</description>
    </queue>
    <queue name="D0012 Queue" location="jms/d0012Q" persistence-file="../persistence/MDB/d012.queue" >
    <description>D012 queue</description>
    </queue>
    </jms-server>
    orion-ejb-jar.xml for the MDB:
    <message-driven-deployment name="MessageListener" destination-location="jms/carnotqueue" connection-factory-location="jms/carnotQCF" max-instances="10">
    Anybody an idea?
    cheers,
    Klaus

    Hi Klaus
    We had the same error as you have.
    After a lot of troubles we are now able to run IBMs MQSeries with OC4J v. 9.0.3.0.0
    Here is an overview of our configuration (on Windows 2000)
    Added the following lines to C:\OC4J\j2ee\home\config\application.xml
    This is to use connect to MQSeries with a file based JNDI. We created the file .bindings in C:\JNDI with IBMs JMSAdmin tool.
    <resource-provider
    class="com.evermind.server.deployment.ContextScanningResourceProvider"
    name="MQSeries">
    <description> MQSeries </description>
    <property name="java.naming.factory.initial" value="com.sun.jndi.fscontext.RefFSContextFactory"> </property>
    <property name="java.naming.provider.url" value="file:/C:/JNDI"> </property>
    </resource-provider>
    We copied the following files from MQSeries to C:\OC4J\j2ee\home\lib
    com.ibm.mq.jar
    com.ibm.mqjms.jar
    com.ibm.mqbind.jar
    mqji.properties
    fscontext.jar
    providerutil.jar
    Added the following line to C:\OC4J\j2ee\home\config\server.xml
    <library path="../lib" />
    This points to C:\OC4J\j2ee\home\lib where our MQSeries .jar files are located.
    In line 176 in com.evermind.server.jms.OrionServerSessionPool.class (located in OC4J.jar) we changed the following lines:
    ((AQjmsSession)new_session).setCloseCheckInterval(2);
    new_consumer = ((QueueSession)new_session).createReceiver((Queue)destination, messageSelector);
    ((AQjmsQueueReceiver)new_consumer).setNavigationMode(1);
    new_connection.start();
    to this:
    new_consumer = ((QueueSession)new_session).createReceiver((Queue)destination, messageSelector);
    new_connection.start();
    The reason to this, is that it looks like OC4J do not accept other queue system than AQ. If we dont change those lines, we get the following error:
    java.lang.InstantiationException: Error: com.evermind.server.jms.EvermindQueueSession at com.evermind.server.jms.OrionServerSessionPool.getServerSessionFull(OrionServerSessionPool.java:377)
    at com.evermind.server.ejb.MessageDrivenHome.run(MessageDrivenHome.java:769)
    at com.evermind.util.ThreadPoolThread.run(ThreadPoolThread.java:66)
    In the MDB sample (C:\OC4J\j2ee\home\demo\mdb) we changed the following (ivtTCF, ivtQCF, ivtT and ivtQ are MQSeries factories and connections):
    Orion-ejb-jar.xml
    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE orion-ejb-jar PUBLIC "-//Evermind//DTD Enterprise JavaBeans 1.1 runtime//EN" "http://xmlns.oracle.com/ias/dtds/orion-ejb-jar.dtd">
    <orion-ejb-jar deployment-version="9.0.3.0.0" deployment-time="ec68ca361c">
    <enterprise-beans>
    <session-deployment
    name="MyCart"
    max-instances="10"
    location="MyCart">
    <resource-ref-mapping
    name="ivtTCF"
    location="java:comp/resource/MQSeries/ivtTCF">
    </resource-ref-mapping>
    <resource-env-ref-mapping
    name="ivtT"
    location="java:comp/resource/MQSeries/ivtT">
    </resource-env-ref-mapping>
    <resource-ref-mapping
    name="ivtQCF"
    location="java:comp/resource/MQSeries/ivtQCF">
    </resource-ref-mapping>
    <resource-env-ref-mapping
    name="ivtQ"
    location="java:comp/resource/MQSeries/ivtQ">
    </resource-env-ref-mapping>
    </session-deployment>
    <message-driven-deployment
    name="MessageBeanTpc"
    connection-factory-location="java:comp/resource/MQSeries/ivtTCF"
    destination-location="java:comp/resource/MQSeries/ivtT"
    subscription-name="MDBSUB">
    <resource-ref-mapping
    name="ivtTCF"
    location="java:comp/resource/MQSeries/ivtTCF">
    </resource-ref-mapping>
    <resource-env-ref-mapping
    name="ivtT"
    location="java:comp/resource/MQSeries/ivtT">
    </resource-env-ref-mapping>
    <resource-ref-mapping
    name="ivtQCF"
    location="java:comp/resource/MQSeries/ivtQCF">
    </resource-ref-mapping>
    <resource-env-ref-mapping
    name="ivtQ"
    location="java:comp/resource/MQSeries/ivtQ">
    </resource-env-ref-mapping>
    </message-driven-deployment>
    <message-driven-deployment
    connection-factory-location="java:comp/resource/MQSeries/ivtQCF"
    destination-location="java:comp/resource/MQSeries/ivtQ"
    name="MessageBeanQue">
    <resource-ref-mapping
    name="ivtTCF"
    location="java:comp/resource/MQSeries/ivtTCF">
    </resource-ref-mapping>
    <resource-env-ref-mapping
    name="ivtT"
    location="java:comp/resource/MQSeries/ivtT">
    </resource-env-ref-mapping>
    <resource-ref-mapping
    name="ivtQCF"
    location="java:comp/resource/MQSeries/ivtQCF">
    </resource-ref-mapping>
    <resource-env-ref-mapping
    name="ivtQ"
    location="java:comp/resource/MQSeries/ivtQ">
    </resource-env-ref-mapping>
    </message-driven-deployment>
    </enterprise-beans>
    <assembly-descriptor>
    <default-method-access>
    <security-role-mapping name="&lt;default-ejb-caller-role&gt;" impliesAll="true" />
    </default-method-access>
    </assembly-descriptor>
    </orion-ejb-jar>
    ejb-jar.xml
    <?xml version="1.0"?>
    <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.2//EN" "http://java.sun.com/j2ee/dtds/ejb-jar_1_2.dtd">
    <ejb-jar>
    <description>A demo cart bean package.</description>
    <display-name>A simple cart jar</display-name>
    <enterprise-beans>
    <session>
    <description>A simple shopping cart.</description>
    <display-name>Shopping Cart</display-name>
    <ejb-name>MyCart</ejb-name>
    <home>cart.ejb.CartHome</home>
    <remote>cart.ejb.Cart</remote>
    <ejb-class>cart.ejb.CartEJB</ejb-class>
    <session-type>Stateful</session-type>
    <transaction-type>Container</transaction-type>
    <resource-ref>
    <res-ref-name>ivtQCF</res-ref-name>
    <res-type>javax.jms.QueueConnectionFactory</res-type>
    <res-auth>Container</res-auth>
    <res-sharing-scope>Shareable</res-sharing-scope>
    </resource-ref>
    <resource-env-ref>
    <resource-env-ref-name>ivtQ</resource-env-ref-name>
    <resource-env-ref-type>javax.jms.Queue</resource-env-ref-type>
    </resource-env-ref>
    <resource-ref>
    <res-ref-name>ivtTCF</res-ref-name>
    <res-type>javax.jms.TopicConnectionFactory</res-type>
    <res-auth>Container</res-auth>
    <res-sharing-scope>Shareable</res-sharing-scope>
    </resource-ref>
    <resource-env-ref>
    <resource-env-ref-name>ivtT</resource-env-ref-name>
    <resource-env-ref-type>javax.jms.Topic</resource-env-ref-type>
    </resource-env-ref>
    </session>
    <message-driven>
    <description></description>
    <display-name>MessageBeanTpc</display-name>
    <ejb-name>MessageBeanTpc</ejb-name>
    <ejb-class>cart.ejb.MessageBean</ejb-class>
    <transaction-type>Container</transaction-type>
    <message-driven-destination>
    <destination-type>javax.jms.Topic</destination-type>
    <subscription-durability>Durable</subscription-durability>
    </message-driven-destination>
    <resource-ref>
    <res-ref-name>ivtQCF</res-ref-name>
    <res-type>javax.jms.QueueConnectionFactory</res-type>
    <res-auth>Container</res-auth>
    <res-sharing-scope>Shareable</res-sharing-scope>
    </resource-ref>
    <resource-env-ref>
    <resource-env-ref-name>ivtQ</resource-env-ref-name>
    <resource-env-ref-type>javax.jms.Queue</resource-env-ref-type>
    </resource-env-ref>
    <resource-ref>
    <res-ref-name>ivtTCF</res-ref-name>
    <res-type>javax.jms.TopicConnectionFactory</res-type>
    <res-auth>Container</res-auth>
    <res-sharing-scope>Shareable</res-sharing-scope>
    </resource-ref>
    <resource-env-ref>
    <resource-env-ref-name>ivtT</resource-env-ref-name>
    <resource-env-ref-type>javax.jms.Topic</resource-env-ref-type>
    </resource-env-ref>
    </message-driven>
    <message-driven>
    <description></description>
    <display-name>MessageBeanQue</display-name>
    <ejb-name>MessageBeanQueBMT</ejb-name>
    <ejb-class>cart.ejb.MessageBean</ejb-class>
    <transaction-type>Bean</transaction-type>
    <message-driven-destination>
    <destination-type>javax.jms.Queue</destination-type>
    </message-driven-destination>
    <resource-ref>
    <res-ref-name>ivtQCF</res-ref-name>
    <res-type>javax.jms.QueueConnectionFactory</res-type>
    <res-auth>Container</res-auth>
    <res-sharing-scope>Shareable</res-sharing-scope>
    </resource-ref>
    <resource-env-ref>
    <resource-env-ref-name>ivtQ</resource-env-ref-name>
    <resource-env-ref-type>javax.jms.Queue</resource-env-ref-type>
    </resource-env-ref>
    <resource-ref>
    <res-ref-name>ivtTCF</res-ref-name>
    <res-type>javax.jms.TopicConnectionFactory</res-type>
    <res-auth>Container</res-auth>
    <res-sharing-scope>Shareable</res-sharing-scope>
    </resource-ref>
    <resource-env-ref>
    <resource-env-ref-name>ivtT</resource-env-ref-name>
    <resource-env-ref-type>javax.jms.Topic</resource-env-ref-type>
    </resource-env-ref>
    </message-driven>
    </enterprise-beans>
    <assembly-descriptor>
    <container-transaction>
    <method>
    <ejb-name>MyCart</ejb-name>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    <container-transaction>
    <method>
    <ejb-name>MessageBeanTpc</ejb-name>
    <method-name>onMessage</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    <container-transaction>
    <method>
    <ejb-name>MessageBeanQue</ejb-name>
    <method-name>onMessage</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    </assembly-descriptor>
    </ejb-jar>
    In MessageBean.java I removed the few lines code related to AQ, and added the following imports to MessageBean.java and CartEJB.java:
    import com.ibm.*;
    import com.ibm.mq.*;
    import com.ibm.mq.jms.*;
    import com.ibm.jms.*;
    It works!!!
    Good luck
    Ole

  • EJB 3.0 MDB configuration for Topic w/ Group only read access

    We currently have a Topic on a weblogic server (10.3) in which the security access has been turned on to only allow certain users to read from that topic.
    The issue we are having is finding the necessary documentation to how to set which user that the MDBs will use when running on the app server.
    I've tried both of these properties, but haven't had any luck yet:
    <run-as-principal-name></run-as-principal-name>
    <create-as-principal-name></create-as-principal-name>
    Any ideas/documentation on how to configure it so the MDB can also listen to the topic. The MDB won't always be on the same server as the JMS as well.
    Thanks

    This page helps -- not sure if there are any other thoughts/comments/newer ways of doing it.
    http://stackoverflow.com/questions/4887427/weblogic-message-driven-bean-reading-from-a-secured-queue-runas-does-not-work
    Thanks.

  • MDB behavior with Foreign JMS Provider

              I am experiencing some MDB behavior which I do not quite understand. I would appreciate
              if someone could tell me what might be happening.
              An application on WebLogic 8.1 SP1 (also tried it with SP2) has MDB's which listen
              on a MQ Queue. If I put a large XML message on the MQ Queue (say around 600 KB),
              the onMessage execution is very random, For the large messages only 1 MDB gets
              invoked and the other messages just sit on the MQ Queue. Even though I have defined
              an weblogic execute queue for the MDB's and they have 15 threads allocated.
              The other messages get picked up after the first one gets completed. The problem
              is the whole transaction (which is XA) can take a while (upto 10 minutes). This
              is not intended, but for some reason it takes that long.
              Also, while monitoring the MDB execute queues, I noticed that none of the threads
              from that queue are performing the work and a thread dump shows that the weblogic.ejb20.internal.JMSPoller
              thread has invoked the MDB and is currently waiting for the database to finish
              some processing.
              When the message size is smaller, the MDB's fire concurrently and are executed
              on the MDB execute queue.
              Thanks,
              Ketan.
              

    When we're using MDBs against a foreign JMS provider with XA, the EJB
              container tries to reduce the number of threads that are blocked waiting for
              a message. You should see lots of threads working when there are lots of
              messages on the queue, a few threads (or only one) working when the queue is
              empty or nearly so, and there should be some ramp-up and ramp-down time in
              between. It sounds like the ramp-up takes longer in your case because
              receiving the very first message takes a long time.
              If this behavior is causing big problems for you, you might want to contact
              product support and file an enhancement request.
              greg
              "Ketan" <[email protected]> wrote in message
              news:[email protected]...
              >
              > Here is some more information regarding this issue.
              >
              > When I place sufficiently large messages (such that the parsing and
              processing
              > of these messages takes longer than it does for normal size messages), I
              notice
              > the following behavior.
              >
              > Lets say I put 6 large messages on the MQ Queue. The server immediately
              picks
              > up 1 message and starts processing it. The other 5 messages are sitting on
              the
              > MQ Queue, while the MDB execute queue has all 15 idle threads.
              >
              > After the processing of the message is done, 2 messages get picked up.
              This time,
              > 1 thread in the MDB execute queue gets the message and the other is
              processed
              > by the JMSPoller thread. After these 2 messages are processed, 3 Messages
              get
              > picked up and this time 2 messages are on the MDB execute queue and 1 is
              processed
              > by the JMSPoller.
              >
              > So based on this the question is ..Is this the expected behavior? I was
              under
              > the impression that the poller would simply dispatch messages to the
              execute queue,
              > and as a result, I was expecting all the messages would get picked up from
              the
              > MQ queue pretty fast and would not have to wait for 1 or more MDB's to
              finish
              > processing.
              >
              > I would really appreciate any suggestions anyone may have for me.
              >
              > Again the environment is WLS 8.1 SP2, MQ 5.3
              >
              > thanks,
              > Ketan
              

  • Use transacted session in MDB

              Hi,
              If I use transacted session in MDB with container managed transaction, dose the
              weblogic ignore the transacted setting or start in it's own transaction. I looked
              the JMS Tutorial from Sun, the J2EE server just ignore the transacted setting,
              treated it as non-transacted session.
              Thanks
              

              Thanks, Greg. I created another XAQCF in MQ JMSADMIN, but still did not help. The
              strange part is when this exception happens, in the Event Viewer there is a Message:
              An internal Websphere MQ Error has occurred'. In the Trace Log of MQ, the Major
              Error Code reported is arcE_XAER_PROTO.
              Has anyone encountered this error? The same code works fine when enlist an XAQCF
              defined in Weblogic and PUT into a Weblogic JMS Queue instead within the same
              XA Transaction. I am attaching the stack trace to this message, just in case,
              someone has useful pointers to help me. May be this is MQ Specific though I made
              sure I have the latest FixPack for MQ installed.
              Thanks,
              Sridhar
              "Greg Brail" <[email protected]> wrote:
              >Yeah. This comes up from time to time. MQ is upset because it wants to
              >be
              >enlisted in the JTA transaction, but JTA is not enlisting it because
              >it
              >thinks it's already enlisted. It thinks it's already enlisted because
              >the
              >same MQ connection factory was used for the MDB input queue, even though
              >it's a different JMS connection and session.
              >
              >You can avoid this by creating another "XAQCF" object in the MQ JNDI
              >space
              >and giving it a different name. If you do that -- essentially use different
              >connection factories for the MDB's input and output queues -- then this
              >will
              >work.
              >
              >Also, the transaction enlistement code in 8.1 that supports the
              >"resource-ref" feature avoids this problem.
              >
              > greg
              >
              >"Sridhar Krishnaswamy" <[email protected]> wrote in message
              >news:[email protected]...
              >>
              >> Hi Greg:
              >> I assume you meant to getXAResource() from an Object of type
              >XAQueueSession. Here
              >> is the code I tried within the onMessage() method of the MDB:
              >>
              >> XAQueueConnectionFactory factory = (XAQueueConnectionFactory)
              >ctx.lookup("XAQCF")
              >> ;
              >> XAConnection connection = factory.createXAQueueConnection() ;
              >>
              >> XAQueueSession mqSession = connection.createXAQueueSession() ;
              >> XAResource mqResource = mqSession.getXAResource() ;
              >> Transaction tran = TxHelper.getTransaction() ;
              >> tran.enlist(mqResource) ;
              >>
              >> //Then I was going to get the QueueSession Object from XAQueueSession,
              >obtain
              >> the Queue
              >> //Object from JNDI, create the Sender
              >> //and call the send. But I commented out these calls. Even then, after
              >the
              >onMessage
              >> Method
              >> // completes, I get the following error:
              >>
              >> javax.transaction.SystemException: start() failed on resource
              >'com.ibm.mq.MQXAResource':
              >> XAER_PROT : Routine was invoked in an improper context
              >> javax.transaction.xa.XAException: XA Operation failed. see errorcode
              >(which I
              >> am assuming is XAER_PROT).
              >>
              >> Any idea, what I am doing wrong?
              >>
              >>
              >>
              >>
              >> "Greg Brail" <[email protected]> wrote:
              >> >In 7.0, you can do your MQ "put" inside the same JTA transaction that
              >> >was
              >> >used to receive the message for the MDB, but you have to do the
              >transaction
              >> >enlistment yourself. Basically, you have to use the class
              >> >weblogic.transaction.TxHelper class to get a reference to the current
              >> >transaction, then call "enlistResource" on the transaction using the
              >> >JTA
              >> >"XAResource" that you get from the MQ JMS "Session" object. I'm sure
              >> >we've
              >> >posted the code in this newsgroup before, but I don't know where,
              >so
              >> >it
              >> >would look something like:
              >> >
              >> >// First, get the MQ QueueSession object you're going to use to send
              >> >the
              >> >message
              >> >QueueSession mqSession = mqConnection.createQueueSession(false, 0);
              >> >XAResource mqResource = mqSession.getXAResource();
              >> >weblogic.transaction.Transaction tran =
              >> >weblogic.transaction.TxHelper.getTransaction();
              >> >tran.enlistResource(mqResource);
              >> >// Now send your message
              >> >
              >> >In 8.1, this will still work, but it's not necessary. If you register
              >> >the MQ
              >> >XA connection factory as a "resource-reference" in your EJB deployment
              >> >descriptors and look it up using java:comp/env the way the documentation
              >> >link way below describes, then this transaction enlistment happens
              >> >automatically. This only happens when you use the "resource-reference"
              >> >feature (which means that old code will still work if it does NOT
              >use
              >> >this
              >> >feature), and it's only in 8.1.
              >> >
              >> > greg
              >> >
              >> >"Sridhar Krishnaswamy" <[email protected]> wrote in
              >message
              >> >news:[email protected]...
              >> >>
              >> >> Hi Greg:
              >> >> Is the Statement
              >> >>
              >> >> 'But in this case, you don't get a "non-transactional" session,
              >but
              >> >actually a
              >> >> session that participates in the current JTA transaction for the
              >thread
              >> >where
              >> >> your EJB is running'
              >> >>
              >> >> also true in the case of an MDB running in Weblogic 7.0 (Container
              >> >Managed
              >> >Transactions)
              >> >> driven by an XAQCF and a Foreign JMS Provider such as MQSeries?
              >In
              >> >other
              >> >words,
              >> >> if I want the MDB to PUT the Message into an MQSeries Queue, can
              >the
              >> >PUT
              >> >be invoked
              >> >> under the Context of the Same XA Transaction? My understanding is
              >that
              >> >WebLogic
              >> >> 7.0 doesn't support send
              >> >> messages out of an MDB within the same XA transaction if the MDB
              >is
              >> >> XA-driven by a foreign JMS provider. Please let me know if this
              >is
              >> >false.
              >> >If true,
              >> >> does Weblogic 8.1 also have this restriction?
              >> >>
              >> >> Thanks,
              >> >> Sridhar Krishnaswamy.
              >> >>
              >> >> "Greg Brail" <[email protected]> wrote:
              >> >> >What do you mean by "use transacted session in MDB?" Are you creating
              >> >> >a new
              >> >> >session inside your MDB, or do you mean something else?
              >> >> >
              >> >> >The only Sun thing I can think of is in code that looks like this:
              >> >> >
              >> >> >InitialContext ctx = new InitialContext();
              >> >> >QueueConnectionFactory qcf = ctx.lookup("java:comp/env/jms/QCF");
              >> >> >Queue queue = ctx.lookup("java:comp/env/jms/Queue");
              >> >> >QueueConnection connection = qcf.createQueueConnection();
              >> >> >// Create "transacted" session:
              >> >> >QueueSession session = connection.createQueueSession(true, 0);
              >> >> >QueueSender sender = session.createQueueSender(queue);
              >> >> >TextMessage message = session.createTextMessage("Hello, world");
              >> >> >sender.send(message);
              >> >> >connection.close();
              >> >> >
              >> >> >If you do this, and exactly this, inside an EJB, including the
              >use
              >> >of
              >> >> >"java:comp/env/jms", in WebLogic Server 8.1, then we do indeed
              >ignore
              >> >> >the
              >> >> >"transacted" flag when you create the session, just like Sun says
              >> >we
              >> >> >should
              >> >> >in the EJB and J2EE specs. But in this case, you don't get a
              >> >> >"non-transactional" session, but actually a session that participates
              >> >> >in the
              >> >> >current JTA transaction for the thread where your EJB is running.
              >> >> >
              >> >> >The idea is that if you are working inside an EJB, you don't use
              >> >transacted
              >> >> >sessions -- you use the transaction control given to you by the
              >EJB
              >> >> >container, including the UserTransaction interface and/or the various
              >> >> >container-managed transaction flags, rather than the JMS "transacted
              >> >> >session".
              >> >> >
              >> >> >You can find more information here:
              >> >> >
              >> >> >http://e-docs.bea.com/wls/docs81/jms/j2ee_components.html
              >> >> >
              >> >> > greg
              >> >> >
              >> >> >"Jen" <[email protected]> wrote in message
              >> >> >news:[email protected]...
              >> >> >>
              >> >> >> Hi,
              >> >> >>
              >> >> >> If I use transacted session in MDB with container managed
              >transaction,
              >> >> >dose the
              >> >> >> weblogic ignore the transacted setting or start in it's own
              >> >transaction.
              >> >> >I
              >> >> >looked
              >> >> >> the JMS Tutorial from Sun, the J2EE server just ignore the
              >transacted
              >> >> >setting,
              >> >> >> treated it as non-transacted session.
              >> >> >> Thanks
              >> >> >
              >> >> >
              >> >>
              >> >
              >> >
              >>
              >
              >
              [eRRORS.txt]
              

  • Handling video messages in MDB

    Hi,
    I have requirment to throw an exception when i recieve a messge in my onmessage method in MDB from Queue.
    if any one has some sample code on this code you forward me.

    There's nothing to it, just throw a runtime exception, however unless your JMS server has been configured to only allow a limited number of retries (or some other error handling strategy) the message will keep being resent indefinitely.

  • Some problem with JMS MDB

    In my application i am writing object messages to several queues considering its message id.
    i am using mdb as queue listener.
    i thought to create a sperate mdb for each queue. is this is correct.
    can one mdb can listen several queie.
    from mdb i get the messages and put them to a hash map
    how can i access the hash map from server side
    please help me

    i didn't have internet connection past couple of days.
    in my application i am writing down objects to respective queue considering its id.
    that means depending on the id the object will be written to respective queue.
    then a mdb listens to the queue and write that in to a hash map.
    say there is a queue called workflowq1. this contains events of workflow 1. the event objects will be retrieved and will be freezed till all the evnts gather. then those events will be written in to respective work flow event file.
    i am using the hash map to freeze the work flow events.all the process is done in server side.
    hence the hash map is created in side the mdb. could plese tell me how shall i access the contains of the hash map from other class. i have declared the hash map as a class variable of mdb.
    i want to access the created hash map outside the mdb. how shall i do that.
    please help me
    thanks in advance

  • Single-instance MDB - jmsra

    Hello,
    I've got the following SAS configuration:
    Sun Java System Application Server Platform Edition 8.1_02 (build b06-fcs).
    It comes with the Sun Java(tm) System Message Queue 3 2005Q1 Sun Microsystems, Inc.; Version: 3.6 SP2-ER Bugs 6256771 - 2005-04-25 (Build 2-A).
    I want to setup the following queues and MDBs.
    Queue-1 consumed by MyFirstMDB.
    Queue-2 consumed by MySecondMDB.
    Both MDBs "use" the same jms/QueueConnectionFactory. I guess this is not the problem.
    The questions I now have are the following:
    Where and how should I specify that only one instance of MyFirstMDB should consume messages from Queue-1 ?
    Where and how should I specify that only one instance of MySecondMDB should consume messages from Queue-2 ?
    Should I specify this in the MDB descriptor in my ejb-jar.xml, or should I put this in the sun-ejb-jar.xml, or still should I configure this somewhere else and if yes where and how ?
    Where and how should I specify that in case of a problem, messages on Queue-1 should be retried 3 times with an interval of 1 hour ?
    Where and how should I specify that in case of a problem, messages on Queue-2 should be retried 10 times with an interval of 2 hour ?
    Should I specify this in the MDB descriptor in my ejb-jar.xml, or should I put this in the sun-ejb-jar.xml, or still should I configure this somewhere else and if yes where and how ?
    Does the fact that the redelivery attempts and redelivery interval differ mean that I need to use two different sessionfactories and that I can't let my MDB share the same ?
    Any help would be appreciated.
    Thanks,
    EDH

    in 11gR2,ASM is part of grid infrastructure so you've to install Grid Infrastructure first on standalone server first.
    http://docs.oracle.com/cd/E11882_01/install.112/e24346/oraclerestart.htm#CIHCBGCC
    http://docs.oracle.com/cd/E18728_01/html/821-2678/gjafo.html
    Single instance Oracle ASM is not supported with Oracle 11g release 2 on Oracle Solaris Clusteri'm not fully sure but i think it should be supported.

  • Stopping task in the progress in queue

    Hi
    I have MDB where I start process of sending mails. I have a list of emails in file, and remove one after another. Now I'd like to add function of stopping this task. I've added a check of STATUS attribute in the file. So, when task will see that status is STOPPED should leave sending mails function. The problem is that message with request of stop (it invokes method that changes status in xml file) goes to end of the queue (which is quite logical...).
    Could anybody give me a hint what to do? This is JBoss' MDB with Queue destination.
    Thanks in advance,
    Michal

    You may try to use selectors. This way you should be able to select a certain message only.

Maybe you are looking for

  • Safari window will disappear if dragged from a tab to an external display

    Try opening a Safari window and add a new tab, then drag that new tab to the external display (e.g. Desktop 3) as a new window, it will disappear when you release the drag-and-drop.  I think this is a bug of Safari 7.0 on Mavericks 10.9.

  • Dynamic file name(Context)

    Hello All, I am using Dynamic file name function in my message mapping. Below is the code that I am using inside UDF: DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC

  • ACR not using .xmp files after 03/09/2011

    I'm using ACR 6.4.1.145 and Bridge CS5 on a Windows 7 x64 Pro machine. Canon S95 and G12 CR2 files created before 04/09/2011 behave exactly as they should: changes aved in .xmp files are recognized and applied in Bridge thumbnails and when the image

  • Downloading new services

    The first Mac I bought for my regular use came with Leopard.  I've upgraded along the way and now have Mountain Lion. I noticed the menu entry called Services, but never took the time to investigate them. Then I learned about "The Automator" (sorry,

  • Playing any movie clip or youtube crashes computer, problem has only been happening for 6 months, what has been changed?

    running Windows XP 3 newish computer with lots of memory and hard drive space. Used to be fine, could play any clip or movie then suddenly about 6 months ago it started crashing when any movie clip played. I believe its an update in Firefox that caus