ClassCastException with javax.jms.ObjectMessage

Hello
          I have the following problem:
          I filled a JMS queue with ObjectMessages containing a so called container class (self written, plain old java class implementing serializable).
          I have also written a Servlet that runs in the same EAR like the EJB that fills the JMS queue. This servlet uses a JMS QueueBrowser to show the messages. It casts the Message to ObjectMessage, calls getObject() and casts again in my container class.
          Now when I shutdown the server, regenerate my source and restart the server, the last cast to my container class doesn't work anymore (ClassCastException). When I print out the hash value of the class (containerFromObjectMessage.getClass().hashCode() and Container.class.hashCode() those two hashcodes are different!
          Does anybody have an idea? Is there a switch that I have to set to my WLS 8.1 be a little less secure?
          Regards,
          Stephan

Correction:
          This only happens when I don't restart my server. So when I hot deploy the EAR with the new compiled classes it doesn't work (ClassCastException). But when I restart the server the servlet runs fine.
          So there must be a cache in the server or something like that.
          Does anybody know any hints or tips to help me?
          Stephan

Similar Messages

  • One vote for a javax.jms.MapMessage

    I need to send and receive MapMessages to integrate with other Java clients in my Flex app however i have seen that in the documentation message-type parameter of the jms property of a message destination only accepts javax.jms.TextMessage and javax.jms.ObjectMessage.
    If implementing a MapMessage would not be too difficult and someone can point me in the right direction i would be happy to contribute to the project.
    Max

    Hi Max,
    This would be a great enhancement to JMSAdapter and I don't think it'll be hard. These are the classes you need to touch.
    -JMSSettings.setMessageType should support the new message type.
    -JMSProducer.validate should support the new message type.
    -JMSProducer should have a new abstract method called sendMapMessage.
    -JMSQueueProducer and JMSTopicProducer should provide the implementation for sendMapMessage.
    I think this should be it! Once you get this working, please open an enhancement request to BlazeDS and provide your code. And let us know the bug number here so we can vote for it.
    -Mete

  • Import javax.jms cannot be resolved

    This is error i am getting The import javax.jms cannot be resolved even though
    my class path contains mail.jar and activation.jar.
    please suggest me, to resolve above error
    Thanks in advance

    sir
    These below import packages are not resloved by class path
    import javax.jms.ObjectMessage;
    import javax.jms.Session;
    import javax.jms.Topic;
    import javax.jms.TopicConnection;
    import javax.jms.TopicConnectionFactory;
    import javax.jms.TopicPublisher;
    import javax.jms.TopicSession;
    and below packages are resolved
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;

  • Javax.jms.*

    This is a very very basic question.
    I am trying to compile a class with javax.jms.*, I already have installed jdk1.3.1_02, I thought this version contains all the JMS jars also, anyways I am getting the following error.
    Publisher.java:1: package javax.jms does not exist
    Does anyone know where to get that jar ? with javax.jms package ?
    Thanks in advance
    - Sairam

    Download and install the J2EE version and keep the j2ee.jar file in the classpath. You can try JMS programs with Sun J2EE server. Otherwise if you have WebLogic server, you can use set weblogic.jar file in classpath
    Sagar

  • PasswordSync with a Sun JMS Server: javax.jms.QueueConnectionFactory

    Hi,
    I have installed Sun IDM 8.1 and Sun DSEE7 and uses Active Directory as source for identities.
    I then added a resource for the JMS Listener, but when I tried to do Test Connection I got this message:
    Test connection failed for resource:
    java.lang.ClassCastException: com.sun.messaging.ConnectionFactory cannot be cast to javax.jms.QueueConnectionFactory
    Can anybody help me with this.
    rgds
    Crimson
    Edited by: Crimson on May 3, 2010 4:46 AM

    Hi Sean,
    it's better to ask this question at Sun Java System Messaging Server forum:
    http://swforum.sun.com/jive/forum.jspa?forumID=15

  • When using rabbitmq-jms for vFabric RabbitMQ javax.jms.Message.getJMSDestination does not return the actual destination when it is received from a consumer listening on a Topic with a wild card

    When using rabbitmq-jms for vFabric RabbitMQ javax.jms.Message.getJMSDestination does not return the actual destination when it is received from a consumer listening on a Topic with a wild card. I have tested with both 1.0.3 and 1.0.5 clients with RabbitMQ 3.1.5.
    I was wondering if the community was aware of this problem and if there are any workarounds? If not what is the proper channel to file a bug report. An example code snippet is below. The test fails because the TextMessageMatcher expects the destination passed in on construction (second parameter) to equal the desination on the message received (aquired from getJMSDestination).
            Mockery context = new Mockery();
            final MessageListener messageListener = context.mock(MessageListener.class);
            final Latch latch = new LatchImpl();
            final String prefix = "test" + System.currentTimeMillis();
            context.checking(new Expectations() {
                    oneOf(messageListener).onMessage(with(new TextMessageMatcher("MSG1", prefix + ".1234")));
                    will(new CustomAction("release latch") {
                        @Override
                        public Object invoke(Invocation invocation) throws Throwable {
                            latch.unlatch();
                            return null;
            final Connection connection = createConnection(null, null);
            Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
            connection.start();
            Topic wildcardTopic = (Topic) getInitialContext().lookup(prefix + "." + "#");
            Topic destination = (Topic) getInitialContext().lookup(prefix + ".1234");
            final MessageConsumer consumer = session.createConsumer(wildcardTopic);
            consumer.setMessageListener(messageListener);
            MessageProducer producer = session.createProducer(null);
            producer.send(destination, session.createTextMessage("MSG1"));
            latch.await(5000);
            connection.close();
            Thread.sleep(5);
            context.assertIsSatisfied();

    Check where your MDB sends the [response] messages to.

  • Instanceof with a javax.jms.Topic

    I have an instance of Topic called "testTopic". Can somebody explain to me why both of these statements return true?
    testTopic instanceof javax.jms.Topic
    testTopic instanceof javax.jms.Queue
    How can something be both a Topic and a Queue. The second one should return false.
    Try it and see for yourself.

    Translating bbritta's code into plain text (nice example!): many JMS vendors actually use the same implementation class for both Queues and Topics, which is why you got the results you did.
    Now, there are a couple of ways to tell them apart. You'll have to experiment to see which works "best for you." And some of these may be vendor-specific handling, so not all results will apply on different servers.
    1) Invoke getTopicName() after casting your Destination to Topic (or Queue); check the result or see if you get an exception.
    2) If you have control (or input) over the server environment, make the names of the Destinations "BlahQueue" and "BlechTopic" and use the name to determine which one.
    3) Try to send a message and catch it when it barfs - if it does, that is.
    4) Pass a boolean or int to your methods using Destination, designating which one it is.
    My opinion: don't use generic Destinations - always code explicitly to a Queue or Topic JMS method. This helps you keep track of how your messages are handled and avoids confusion later on.

  • 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
              

  • Problem with transacted JMS connection factory and transaction timeouts

              We encountered an interesting problem using transacted JMS connection factories.
              An EJB starts a container managed transaction and tries to validate a credit card
              before creating some information to a database for the user, in case of success
              an SMS is sent to the user via the transacted JMS queue. If the credit card authentications
              duration is about the same as the transactions timeout (in this case the default
              30 seconds) sometimes the database inserts is committed but the JMS insert is
              rollbacked. How can this be?
              If the authorization duration is much longer than 30 seconds everything works
              fine (both database and JMS inserts rollbacked), the same is true if a rollback
              is insured by calling EJBContext.setRollbackOnly(). The problem thus occurs only
              if the duration is approximately the same as the transaction timeout, it appears
              that the database insert is not timeouted but the JMS insert is. How can this
              be if they are both participating in the same transaction.
              The JMSConnectionFactory used is a Connection factory with XA-enabled. The result
              is the same also with the default "javax.jms.QueueConnectionFactory" and if we
              configure our own factory with user transactions enabled.
              Any help appreciated!
              

    Tomas Granö wrote:
              > We encountered an interesting problem using transacted JMS connection factories.
              > An EJB starts a container managed transaction and tries to validate a credit card
              > before creating some information to a database for the user, in case of success
              > an SMS is sent to the user via the transacted JMS queue. If the credit card authentications
              > duration is about the same as the transactions timeout (in this case the default
              > 30 seconds) sometimes the database inserts is committed but the JMS insert is
              > rollbacked. How can this be?
              It should not be.
              >
              > If the authorization duration is much longer than 30 seconds everything works
              > fine (both database and JMS inserts rollbacked), the same is true if a rollback
              > is insured by calling EJBContext.setRollbackOnly(). The problem thus occurs only
              > if the duration is approximately the same as the transaction timeout, it appears
              > that the database insert is not timeouted but the JMS insert is. How can this
              > be if they are both participating in the same transaction.
              >
              > The JMSConnectionFactory used is a Connection factory with XA-enabled. The result
              > is the same also with the default "javax.jms.QueueConnectionFactory" and if we
              > configure our own factory with user transactions enabled.
              >
              > Any help appreciated!
              Make sure that your session is not "transacted". In other words,
              the first parameter to createSession() must be false. There is an
              unfortunate name re-use here. If a session is "transacted", it
              maintains an independent "inner transaction" independent of the
              outer transaction. From the above description, it seems unlikely
              that your application has this wrong, as you say that
              "setRollbackOnly" works - but please check anyway.
              Make sure that you are using a true XA capable driver and database
              (XA "emulation" may not suffice)
              Beyond the above, I do not see what can be going wrong. You
              may want to try posting to the transactions and jdbc newsgroups. Note
              that JMS is appears to be exhibiting the correct behavior, but the
              JDBC operation is not. The JDBC operation appears to have
              its timeout independent of the transaction monitor's timeout.
              Tom
              

  • Javax.jms.JMSException: Not supported in XA-backed session outside globaltx

    I am trying to setup OracleOJMS provider and tries to access queue and post to queue from a normal jsp for testing.
    I am getting the following
    code:
    javax.jms.JMSException: Not supported in XA-backed session outside global transaction
         at oracle.j2ee.ra.jms.generic.RAUtils.make(RAUtils.java:525)
         at oracle.j2ee.ra.jms.generic.RAUtils.toJMSException(RAUtils.java:199)
         at oracle.j2ee.ra.jms.generic.RAUtils.toJMSException(RAUtils.java:210)
         at oracle.j2ee.ra.jms.generic.CommonProducerWrapper.prepareForSend(CommonProducerWrapper.java:350)
         at oracle.j2ee.ra.jms.generic.CommonProducerWrapper.send(CommonProducerWrapper.java:159)
         at ResourceProvider.jspService(_ResourceProvider.java:112)
         at com.orionserver[Oracle Containers for J2EE 10g (10.1.3.1.0) ].http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:453)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:591)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:515)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:711)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:368)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:866)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:448)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:216)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:117)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:110)
         at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
         at java.lang.Thread.run(Thread.java:595)
    Steps i have done
    ResourceProvider.jsp
    code:
    <!-- JSP Imports -->
    <%@ page import="javax.jms.QueueConnectionFactory "%>
    <%@ page import="javax.jms.XAQueueConnectionFactory "%>
    <%@ page import="javax.jms.QueueConnection "%>
    <%@ page import="javax.jms.QueueSession "%>
    <%@ page import="javax.jms.Queue "%>
    <%@ page import="javax.jms.QueueSender "%>
    <%@ page import="javax.jms.Message "%>
    <%@ page import="javax.jms.Session "%>
    <%@ page import="javax.naming.Context "%>
    <%@ page import="javax.naming.InitialContext "%>
    <html>
    <head>
    <title>
    Configuration of ResourceProvider for Advanced Queueing
    </title>
    </head>
    <body>
    <form name="TestResourceProvider" method="GET">
    <%
    // Check if the message has to be enqueued
    if (request.getParameter("Message") != null){
    Context jndiContext = new InitialContext();
    XAQueueConnectionFactory queueCF = (XAQueueConnectionFactory)jndiContext.lookup
    ("java:comp/env/jms/InQueueCF");
    Queue queue = (Queue)jndiContext.lookup("java:comp/env/jms/InQueue");
    QueueConnection queueConnection = queueCF.createQueueConnection();
    // Start the Connection
    queueConnection.start();
    QueueSender sender = queueSession.createSender(queue);
    Message msg = queueSession.createTextMessage(request.getParameter("Message"));
    sender.send(msg);
    queueSession.commit();
    sender.close();
    queueSession.close();
    queueConnection.close();
    %>
    <%
    }else{
    // User can enter the message to be enqueued through here
    %>
    Enter the message to be enqueued
    <INPUT type="text" name="Message">
    <br><br>
    <input type="Submit" value="Enqueue Message">
    <%
    %>
    </form>
    </body>
    </html>
    My Steps for OJMS PRovider
    1. Creating AQ queue in DB
    2. configuration of resource adapter and provider
    3. configuration of connection factories for resourceadapter[jmsconnector]
    code:
    1. Created the Queue table in DB using the sql
    DROP USER jmsuser CASCADE;
    GRANT connect, resource,AQ_ADMINISTRATOR_ROLE TO jmsuser IDENTIFIED BY jmsuser;
    GRANT execute ON sys.dbms_aqadm TO jmsuser;
    GRANT execute ON sys.dbms_aq TO jmsuser;
    GRANT execute ON sys.dbms_aqin TO jmsuser;
    GRANT execute ON sys.dbms_aqjms TO jmsuser;
    connect jmsuser/jmsuser;
    -- Create table to hold the queue, then create queue.
    -- For topics multiple_consumers must be true
    BEGIN
    DBMS_AQADM.CREATE_QUEUE_TABLE( Queue_table => 'SMSCP_INQTBL', Queue_payload_type => 'SYS.AQ$_JMS_MESSAGE',
    sort_list => 'PRIORITY,ENQ_TIME', multiple_consumers => false, compatible => '8.1.5');
    DBMS_AQADM.CREATE_QUEUE( Queue_name => 'SMSCP_INQ', Queue_table => 'SMSCP_INQTBL');
    DBMS_AQADM.START_QUEUE(queue_name => 'SMSCP_INQ');
    END;
    quit;
    Now our queue Name is queue Name : SMSCP_INQ table Name: SMSCP_INQTBL
    2. Creating the Cp and datasource for the db [jmsuser] to make java to access queue
    Creating ConnectionPool jmsDBPool
    Creating DataSource jmsDBDataSource
    Jndi jdbc jdbc/JMSDBDS
    After creating, i got the following data-sources.xml
    DATASOURCES.XML
    <?xml version = '1.0' encoding = 'UTF-8'?>
    <data-sources xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xmlns.oracle.com/oracleas/schema/data-sources-10_1.xsd" schema-major-version="10" schema-minor-version="1">
    <!-- default one comes with oracle shipping -->
    <managed-data-source connection-pool-name="Example Connection Pool" jndi-name="jdbc/OracleDS" name="OracleDS"/>
    <!-- New one Created -->
         <managed-data-source connection-pool-name="jmsDBPool" jndi-name="jdbc/JMSDBDS" name="jmsDBDataSource"/>
    <!-- default one comes with oracle shipping -->
    <connection-pool name="Example Connection Pool">
    <connection-factory factory-class="oracle.jdbc.pool.OracleDataSource" user="scott" password="tiger" url="jdbc racle:thin:@//localhost:1521/ORCL"/>
    </connection-pool>
    <!-- New one Created -->
    <connection-pool name="jmsDBPool">
    <connection-factory factory-class="oracle.jdbc.pool.OracleDataSource" user="jmsuser" password="jmsuser" url="jdbc racle:thin:@//localhost:1521/xe"/>
    </connection-pool>
    </data-sources>
    3. JMS Connector Task. Customising the ra.xml
    ra.xml
    <!-- resourceadapter -->
    <resourceadapter>
    <resourceadapter-class>oracle.j2ee.ra.jms.generic.JMSResourceAdapter</resourceadapter-class>
    <config-property>
    <config-property-name>lookupMethod</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value>resourceProvider</config-property-value>
    </config-property>
    <config-property>
    <config-property-name>resourceProviderName</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value>testResourceProvider</config-property-value>
    </config-property>
    <!-- adminobject configuration -->
              <adminobject>
    <adminobject-interface>javax.jms.Queue</adminobject-interface>
    <adminobject-class>oracle.j2ee.ra.jms.generic.AdminObjectQueueImpl</adminobject-class>
    <config-property>
    <config-property-name>jndiName</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value>Queues/MY_QUEUE</config-property-value>
    </config-property>
    <config-property>
    <config-property-name>resourceProviderName</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value>testResourceProvider</config-property-value>
    </config-property>
    </adminobject>
    <!--
    <adminobject>
    <adminobject-interface>javax.jms.Topic</adminobject-interface>
    <adminobject-class>oracle.j2ee.ra.jms.generic.AdminObjectTopicImpl</adminobject-class>
    <config-property>
    <config-property-name>jndiName</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value>Topics/MY_TOPIC</config-property-value>
    </config-property>
    <config-property>
    <config-property-name>resourceProviderName</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value>testResourceProvider</config-property-value>
    </config-property>
    </adminobject>
    -->
    <adminobject>
    <adminobject-interface>javax.jms.Queue</adminobject-interface>
    <adminobject-class>oracle.j2ee.ra.jms.generic.AdminObjectQueueImpl</adminobject-class>
    <config-property>
    <config-property-name>resourceProviderName</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value>testResourceProvider</config-property-value>
    </config-property>
    </adminobject>
    <adminobject>
    <adminobject-interface>javax.jms.Topic</adminobject-interface>
    <adminobject-class>oracle.j2ee.ra.jms.generic.AdminObjectTopicImpl</adminobject-class>
    <config-property>
    <config-property-name>resourceProviderName</config-property-name>
    <config-property-type>java.lang.String</config-property-type>
    <config-property-value>testResourceProvider</config-property-value>
    </config-property>
    </adminobject>
    </resourceadapter>
    4. Create a JMS Connector INstance
    oc4j-connectors.xml
         <connector name="testResourceAdapter" path="testResourceAdapter.rar">
              <config-property name="lookupMethod" value="resourceProvider"/>
              <config-property name="resourceProviderName" value="testResourceProvider"/>
              <!-- Default element generated by OC4J. Please uncomment and modify to suit your configuration needs.
              <adminobject-config location="">
                   <adminobject-class>oracle.j2ee.ra.jms.generic.AdminObjectQueueImpl</adminobject-class>
                   <config-property name="jndiName" value="Queues/MY_QUEUE"/>
                   <config-property name="resourceProviderName" value="ojmsRP"/>
              </adminobject-config>
              -->
              <!-- Default element generated by OC4J. Please uncomment and modify to suit your configuration needs.
              <adminobject-config location="">
                   <adminobject-class>oracle.j2ee.ra.jms.generic.AdminObjectTopicImpl</adminobject-class>
                   <config-property name="jndiName" value="Topics/MY_TOPIC"/>
                   <config-property name="resourceProviderName" value="ojmsRP"/>
              </adminobject-config>
              -->
         </connector>
    5. RA Connection Factories
    <?xml version="1.0" encoding="UTF-8"?>
    <oc4j-connector-factories xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="http://xmlns.oracle.com/oracleas/schema/oc4j-connector-factories-10_0.xsd"
    schema-major-version="10"
    schema-minor-version="0">
    <connector-factory location="resourceAdapterXAQCF/MYXAQCF" connector-name="testResourceAdapter">
    <config-property name="jndiLocation" value="XAQueueConnectionFactories/XAQCF"/>
    <connection-pooling use="private">
    <property name="waitTimeout" value="300" />
    <property name="scheme" value="fixed_wait" />
    <property name="maxConnections" value="50" />
    <property name="minConnections" value="0" />
    </connection-pooling>
    <connectionfactory-interface>javax.jms.XAQueueConnectionFactory</connectionfactory-interface>
    </connector-factory>
    </oc4j-connector-factories>
    orion-web.xml
    <?xml version="1.0"?>
    <orion-web-app
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xmlns.oracle.com/oracleas/schema/orion-web-10_0.xsd"      deployment-version="10.1.3.1.0"
         deployment-time="1218369811921"
         jsp-cache-directory="./persistence"
         jsp-cache-tlds="standard"
         temporary-directory="./temp"
         context-root="/smscpReceiver"
    schema-major-version="10" schema-minor-version="0" >
         <!-- Uncomment this element to control web application class loader behavior.
              <web-app-class-loader search-local-classes-first="true" include-war-manifest-class-path="true" />
         -->
         <resource-ref-mapping name="jms/InQueueCF" location="resourceAdapterXAQCF/MYXAQCF" />
         <message-destination-ref-mapping location="resourceAdapterInQ/MYINQ" name="jms/InQueue">
              </message-destination-ref-mapping>
         <web-app>
         </web-app>
    </orion-web-app>
    web.xml
    <resource-ref>
         <res-ref-name>jms/InQueueCF</res-ref-name>
         <res-type>javax.jms.XAQueueConnectionFactory</res-type>
         <res-auth>Container</res-auth>
    </resource-ref>
    <message-destination-ref>
         <message-destination-ref-name>jms/InQueue</message-destination-ref-name>
         <message-destination-type>javax.jms.Queue</message-destination-type>
         <message-destination-usage>Produces</message-destination-usage>
         <message-destination-link>jms/InQueue</message-destination-link>
    </message-destination-ref>
    <message-destination>
    <message-destination-name>jms/InQueue</message-destination-name>
    </message-destination>

    Sorry for the jammed one
    Neat one.
    am trying to setup OracleOJMS provider and tries to access queue and post to queue from a normal jsp for testing.
    I am getting the following
    javax.jms.JMSException: Not supported in XA-backed session outside global transaction
    at oracle.j2ee.ra.jms.generic.RAUtils.make(RAUtils.java:525)
    at oracle.j2ee.ra.jms.generic.RAUtils.toJMSException(RAUtils.java:199)
    at oracle.j2ee.ra.jms.generic.RAUtils.toJMSException(RAUtils.java:210)
    at oracle.j2ee.ra.jms.generic.CommonProducerWrapper.prepareForS
    INVOCATION
    <form name="TestResourceProvider" method="GET">
    <%
    // Check if the message has to be enqueued
    if (request.getParameter("Message") != null){
    Context jndiContext = new InitialContext();
    XAQueueConnectionFactory queueCF = (XAQueueConnectionFactory)jndiContext.lookup
    ("java:comp/env/jms/InQueueCF");
    Queue queue = (Queue)jndiContext.lookup("java:comp/env/jms/InQueue");
    QueueConnection queueConnection = queueCF.createQueueConnection();
    // Start the Connection
    queueConnection.start();
    QueueSender sender = queueSession.createSender(queue);
    Message msg = queueSession.createTextMessage(request.getParameter("Message"));
    sender.send(msg);
    queueSession.commit();
    sender.close();
    queueSession.close();
    queueConnection.close();
    %>
    <%
    }else{
    // User can enter the message to be enqueued through here
    %>
    Enter the message to be enqueued
    <INPUT type="text" name="Message">
    <br><br>
    <input type="Submit" value="Enqueue Message">
    <%
    %>
    </form>
    </body>
    </html>
    ---------------------

  • Weblogic Unit Of Order on Javax.JMS

    Hi I want to use Weblogic Unit of Order on Javax.jms and not on Weblogic.jms, does anyone know how to do that.

    You need to use WLS JMS extension interface to programmatically set a Unit-of-order. In order for applications that use pure javax.jms interfaces to take the advantage of Unit-of-order feature, WLS allows administrators to enable unit-of-order via configuration. Once you enable Unit-of-order on a connection factory, all messages sent from one session will belong to the same unit-of-order either with a system-generated name or a user-generated name. In addition, you could enable unit-of-order on a per destination basis as well.
    For details, please refer to http://docs.oracle.com/cd/E17904_01/web.1111/e13727/uoo.htm#i1040257.

  • Deprecation of javax.jms.QueueConnectionFactory

    i found out in weblogic 6.1 docs that javax.jms.QueueConnectionFactory and javax.jms.TopicConnectionFactory is deprecated.
    But i found no mention of this in the latest javadocs that i downloaded from java.sun.com.(jms 1.0.2 b)
    clarifications in this regard is appreciated

    Hi -
    I'm the JMS Specifecation Lead. Let me reassure you: the javax.jms.QueueConnectionFactory and and javax.jmsTopicConnectionFactory interfaces have not been deprecated.
    I spoke with a senior BEA techincal person for JMS, and he explained that this is a documentation issue. He's filed a request to have it fixed. Here's what he said.
    " In WebLogic, there are default connection
    factories. Those default factories have some well known names. The
    original names chosen were "javax.jms.QueueConnectionFactory" and
    "javax.jms.TopicConnectionFactory". WebLogic changed the JNDI name in 6.0
    (multiple reasons mostly to do with customer backward compatibility).
    As far as I know the specification makes no statements about how a product
    is administered, that there would even be default connection factories, or
    what their names might be if there were. The documentation is misleading
    in that it doesn't mention that those are the *JNDI names* of the factories,
    not the interfaces for the factories. I will file an appropriate bug
    report against the documentation.
    Feel free to post my comments in your forum, or send me to the URL where I
    can officially respond. Thanks for bringing this up."
    I want to thank BEA for a prompt response on this.
    i found out in weblogic 6.1 docs that
    javax.jms.QueueConnectionFactory and
    javax.jms.TopicConnectionFactory is deprecated.
    But i found no mention of this in the latest javadocs
    that i downloaded from java.sun.com.(jms 1.0.2 b)
    clarifications in this regard is appreciated

  • Javax.jms.IllegalStateException: Operation not allowed

    Hi all, (first time posting, so go easy on me!)
    just wondering can anyone out their shed some light on a problem I am having here with JMS. I am attempting to access JMS from a stateless EJB. The problem is I get an illegalStateException when I call "setMessageListener(..)". The bean simply creates an object (which implements the MessageListener interface) passing an RMI client callback reference into the constructor. The idea here is that when JMS forwards a message onto my listener, in the onMessage(..) function I call back into the RMI client. So the idea sounds simple, but JMS wont let me register the listener from the EJB. Heres some code and the exception which is generated (including the call stack):
    jndiContext = new InitialContext();
    Object objRef = (Object)jndiContext.lookup ("java:comp/env/jms/TopicConnectionFactory");
    topicConnectionFactory = (TopicConnectionFactory)PortableRemoteObject.narrow(objRef, TopicConnectionFactory.class);
    topic = (Topic) jndiContext.lookup(topicName);
    topicConnection = topicConnectionFactory.createTopicConnection("Administrator", "123");
    topicSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
    topicSubscriber = topicSession.createSubscriber(topic);
    AppletSubscriber as = new AppletSubscriber(listener);
    topicSubscriber.setMessageListener(as); // here's were the exception is thrown
    Here's the exception & stack trace:
    JMS Exception registerEventsListener: javax.jms.IllegalStateException: Operation
    not allowed
    javax.jms.IllegalStateException: Operation not allowed
    at com.sun.enterprise.jms.MessageConsumerWrapperRestricted.setMessageLis
    tener(MessageConsumerWrapperRestricted.java:40)
    at RespondAdministrator.registerUserEventsListener(RespondAdministrator.
    java:61)
    at UserLogOnEJB.registerUserEventsListener(UserLogOnEJB.java:53)
    at UserLogOnEJB_EJBObjectImpl.registerUserEventsListener(UserLogOnEJB_EJ
    BObjectImpl.java:57)
    at UserLogOnEJBEJBObjectImpl_Tie._invoke(Unknown Source)
    at com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispatchToServant(Ge
    nericPOAServerSC.java:519)
    at com.sun.corba.ee.internal.POA.GenericPOAServerSC.internalDispatch(Gen
    ericPOAServerSC.java:204)
    at com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispatch(GenericPOAS
    erverSC.java:112)
    at com.sun.corba.ee.internal.iiop.ORB.process(ORB.java:273)
    at com.sun.corba.ee.internal.iiop.RequestProcessor.process(RequestProces
    sor.java:84)
    at com.sun.corba.ee.internal.orbutil.ThreadPool$PooledThread.run(ThreadP
    ool.java:99)
    thanks in advance, this is driving me nuts.

    The reason you get this is that you cannot use MessageListeners within a J2EE environment. The J2EE specification says that this method should not work from within EJBs. If you wish to have asynchronous message delivery from an EJB you need to use EJB 2.0s Message Driven Beans.
    Hope this helps.

  • Reference to Queue is ambiguous, both class javax.jms

    hi i already posted the problem .still i have not got the reply.
    i am using jboss-4.0.2 ant-1.6.0 jdk1.5.04
    error report
    makebuilddir:
    compileclasses:
    [javac] Compiling 161 source files to D:\New project\build\itracker\classes
    [javac] D:\New project\itracker\src\cowsultants\itracker\ejb\beans\session\I
    ssueHandlerBean.java:1158: reference to Queue is ambiguous, both class javax.jms
    .Queue in javax.jms and class java.util.Queue in java.util match
    [javac] Queue notificationQueue = (Queue) ic.lookup("java:comp/e
    nv/" + notificationQueueName);
    [javac] ^
    [javac] D:\New project\itracker\src\cowsultants\itracker\ejb\beans\session\I
    ssueHandlerBean.java:1158: reference to Queue is ambiguous, both class javax.jms
    .Queue in javax.jms and class java.util.Queue in java.util match
    [javac] Queue notificationQueue = (Queue) ic.lookup("java:comp/e
    nv/" + notificationQueueName);
    [javac] ^
    [javac] D:\New project\itracker\src\cowsultants\itracker\ejb\beans\session\U
    serHandlerBean.java:957: reference to Queue is ambiguous, both class javax.jms.Q
    ueue in javax.jms and class java.util.Queue in java.util match
    [javac] Queue notificationQueue = (Queue) ic.lookup("java:comp/e
    nv/" + notificationQueueName);
    [javac] ^
    [javac] D:\New project\itracker\src\cowsultants\itracker\ejb\beans\session\U
    serHandlerBean.java:957: reference to Queue is ambiguous, both class javax.jms.Q
    ueue in javax.jms and class java.util.Queue in java.util match
    [javac] Queue notificationQueue = (Queue) ic.lookup("java:comp/e
    nv/" + notificationQueueName);
    [javac] ^
    [javac] Note: Some input files use unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
    [javac] 4 errors
    BUILD FAILED
    D:\New project\itracker\build.xml:43: The following error occurred while executi
    ng this line:
    D:\New project\itracker\build.xml:54: The following error occurred while executi
    ng this line:
    D:\New project\itracker\build.xml:277: Compile failed; see the compiler error ou
    tput for details.
    Total time: 5 seconds
    Message was edited by:
    mastery20

    The problem here is that java compiler is a bit confused between
    both the classes javax.jms.Queue in javax.jms and java.util.Queue in java.util
    Just Edit
    IssueHandlerBean.java
    UserHandlerBean.java
    just add the line import javax.jms.*;
    D:\New project\itracker\src\cowsultants\itracker\ejb\beans\session\I
    ssueHandlerBean.java:
    D:\New project\itracker\src\cowsultants\itracker\ejb\beans\session\U
    serHandlerBean.java:
    Hope this will resolve ur problem. dont forget to update.

  • Where do I get javax:jms:jms:jar:1.1 for maven2?  Error message is misleadi

    I decided to give this ActiveMQ thing a spin and created a simple pom.
    When I run
         $mvn install
    I get the following error message (see below).
    I went to the following URL : http://java.sun.com/products/jms/docs.html
    to download a jar to put in the repo but at this URL there are only PDF files (no reference impl's).
    What to do?
    --- Error message
    [ERROR] BUILD ERROR
    [INFO] ------------------------------------------------------------------------
    [INFO] Failed to resolve artifact.
    Missing:
    1) javax.jms:jms:jar:1.1
    Try downloading the file manually from:
    http://java.sun.com/products/jms/docs.html
    Then, install it using the command:
    mvn install:install-file -DgroupId=javax.jms -DartifactId=jms -Dversion=1.1 -Dpackaging=jar -Dfile=/path/to/file
    Alternatively, if you host your own repository you can deploy the file there:
    mvn deploy:deploy-file -DgroupId=javax.jms -DartifactId=jms -Dversion=1.1 -Dpackaging=jar -Dfile=/path/to/file -Durl=url -DrepositoryId=[id]
    Path to dependency:
    1) shift:activemq-sample:jar:1.0-SNAPSHOT
    2) log4j:log4j:jar:1.2.15
    3) javax.jms:jms:jar:1.1
    1 required artifact is missing.
    for artifact:
    shift:activemq-sample:jar:1.0-SNAPSHOT
    from the specified remote repositories:
    http://people.apache.org/repo/m2-snapshot-repository (http://people.apache.org/repo/m2-snapshot-repository/),
    maven2-repository.dev.java.net (http://download.java.net/maven/2/),
    central (http://repo1.maven.org/maven2)

    MGW
    Bottom line..... if you want to import the Copied Folder's audio exclusively for playback as a music file, you use the copy of the music file itself in the Copied Folder and not its conformed audio files (cfa and pek) of which the pek file is one (involved in the project'sTimeline waveform). You do not use cfa and/or pek as a playback audio file.
    More....
    When you write
    00001.m2ts 48000_1.pek
    In the BDMV folder, 00000.m2ts represents the movie file; 00001.m2ts represents the main menu of the disc menu; 00002.m2ts scene menu
    What you wrote tells me that you are trying to play back a standalone conformed audio file that relates to a main menu replacement audio in a disc menu. The replacement audio has 3 possible files associated with it, the audio file itself (Project Assets, .mp3, wav), the conformed audio set of cfa file and pek file (Media Cache Files Folder). The pek file is related to the waveform that you see in the audio track display style that displays the audio's waveform in the project.
    If you have imported audio to the project's Timeline and have replacement audio in the disc menu, then in the Copied Folder you should expect to find
    IN EACH CASE 3 files -  the music file itself and the associated conformed audio files (cfa and pek).
    If you remove the .pek file from the Copied Folder, the project.prel that you open from there will have audio issues (no audio track display waveform and
    probably no sound). The program automatically generates these conformed audio files if deleted, but.... that is another story.
    You are not looking for a .m2ts codec.
    ATR

Maybe you are looking for