2 Replies Latest reply on Jul 3, 2003 11:25 AM by Weiqing Huang


    r_kumar Newbie

      Hi Jboss Team,

      I encountered the following problem while trying to achieve the below,

      Within a Session Bean with Container Managed Transaction and transaction attribute as required , i perform database related operations and then try to publish the message to a particular topic (TopicSession is created with "transacted" attribute as true). Below is the same code snippet for the same,

      public void firstBusinessMethod(String msg)
      // Step:1 Perform the DB related operations here.
      // Step:2 Set the JMS stuffs

      InitialContext ic = new InitialContext();
      TopicConnectionFactory connectionFactory =(TopicConnectionFactory)ic.lookup("java:/JmsXA");
      TopicConnection connection = connectionFactory.createTopicConnection();
      TopicSession session = connection.createTopicSession( true , 0 );
      Topic topic = (Topic)ic.lookup("topic/TestTransactionTopic");
      TopicPublisher publisher = session.createPublisher(topic);

      This code works fine, but in the logs the following message gets printed whenever the business method is invoked

      "prepare called on a local tx. You are not getting the semantics you expect! "

      1. What does this mean and why am i getting this ?
      2. What should be done to overcome this warning message ??

      Expecting your assistance .......

      Thanks ,

        • 1. Re: Transaction
          Bernd Zeitler Expert

          You probably want to work with a xa transaction to do your db related operations and the jms stuff in one xa transaction.
          But your are still working with a local transaction with doesn't support preparing the call for comit.

          Probably you missed to tell the container to manage the jmx connection factory and the topic. This is done by using these tags in jboss.xml of your session bean:
          And in your ejb-jar.xml :


          You can now see these resources in the java:comp/env jndi scope of your session bean. Use these for your lookup in the session bean. .
          Be sure you configured everything for xa transaction (datasource, jms, ...).


          • 2. Re: Transaction
            Weiqing Huang Newbie

            your db operation is against a local datasource, not an xa datasource? check your data source definition.