13 Replies Latest reply on Jul 26, 2011 2:40 PM by Jason Porter

    Failed to lookup UserTransaction in JNDI

    JEE 4 Hire Newbie

      How can I get a handle to a UserTransaction?
      Hibernate is making the EntityManagerFactory available via JNDI.
      However, it is not making UserTransaction available via JNDI.

      ##############################################################
      env:
      Linux omega 2.6.32-33-generic-pae #70-Ubuntu SMP Thu Jul 7 22:51:12 UTC 2011 i686 GNU/Linux
      Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
      jboss-as-web-7.0.0.Final
      ##############################################################
      <?xml version="1.0" encoding="UTF-8"?>
      <persistence xmlns="http://java.sun.com/xml/ns/persistence"
                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                   xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
                   version="2.0">
         <persistence-unit name="testPU">
            <provider>org.hibernate.ejb.HibernatePersistence</provider>
            <jta-data-source>java:jboss/datasources/MySqlDS</jta-data-source>
            <properties>
               <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
               <property name="hibernate.show_sql" value="false"/>
               <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect"/>
               <property name="jboss.entity.manager.factory.jndi.name" value="java:/TestEntityManagerFactory" />
               <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup" />
               <property name="hibernate.transaction.factory_class" value="org.hibernate.transaction.JTATransactionFactory" />
               <property name="jta.UserTransaction" value="java:/UserTransaction" />
            </properties>
         </persistence-unit>
      </persistence>
      ##############################################################
        public void test() throws Exception {
          InitialContext initCtx = new InitialContext();
          EntityManagerFactory emf = (EntityManagerFactory) initCtx.lookup("java:/TestEntityManagerFactory");
          log.info(">>>BEFORE:  initCtx.lookup(java:/UserTransaction)");
          UserTransaction userTransaction = (UserTransaction) initCtx.lookup("java:/UserTransaction");
          log.info(">>>AFTER:  initCtx.lookup(java:/UserTransaction)");
          userTransaction.begin();
          EntityManager em = emf.createEntityManager();
          em.merge(...);
          em.flush();
          userTransaction.commit();
        }
      ################################################################
      error:
      12:18:00,695 INFO  [class HelloJob] (QuartzScheduler00_Worker-1) >>>BEFORE:  initCtx.lookup(java:/UserTransaction)
      12:18:00,696 ERROR [stderr] (QuartzScheduler00_Worker-1) javax.naming.NameNotFoundException: Name 'UserTransaction' not found in context ''
      12:18:00,697 ERROR [stderr] (QuartzScheduler00_Worker-1)        at org.jboss.as.naming.util.NamingUtils.nameNotFoundException(NamingUtils.java:109)
      12:18:00,697 ERROR [stderr] (QuartzScheduler00_Worker-1)        at org.jboss.as.naming.InMemoryNamingStore$NodeTraversingVisitor.visit(InMemoryNamingStore.java:368)
      12:18:00,697 ERROR [stderr] (QuartzScheduler00_Worker-1)        at org.jboss.as.naming.InMemoryNamingStore$ContextNode.accept(InMemoryNamingStore.java:307)
      12:18:00,698 ERROR [stderr] (QuartzScheduler00_Worker-1)        at org.jboss.as.naming.InMemoryNamingStore.lookup(InMemoryNamingStore.java:162)
      12:18:00,698 ERROR [stderr] (QuartzScheduler00_Worker-1)        at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:173)
      12:18:00,698 ERROR [stderr] (QuartzScheduler00_Worker-1)        at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:207)
      12:18:00,698 ERROR [stderr] (QuartzScheduler00_Worker-1)        at javax.naming.InitialContext.lookup(InitialContext.java:392)
      12:18:00,699 ERROR [stderr] (QuartzScheduler00_Worker-1)        at HelloJob.test(HelloJob.java:218)
      12:18:00,699 ERROR [stderr] (QuartzScheduler00_Worker-1)        at HelloJob.execute(HelloJob.java:134)
      12:18:00,699 ERROR [stderr] (QuartzScheduler00_Worker-1)        at org.quartz.core.JobRunShell.run(JobRunShell.java:206)
      12:18:00,699 ERROR [stderr] (QuartzScheduler00_Worker-1)        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:548)
      ##############################################################
      war:
         61504  Defl:N    56482   8% 2011-07-21 10:31 92d0520b  WEB-INF/lib/i18nlog-1.0.10.jar
        358085  Defl:N   324832   9% 2011-04-04 11:37 8c574f28  WEB-INF/lib/log4j-1.2.12.jar
         47399  Defl:N    41460  13% 2011-07-21 10:31 ac044dbb  WEB-INF/lib/jboss-logging-3.0.0.Beta5.jar
        204093  Defl:N   181695  11% 2011-07-07 12:54 ed9a2ff2  WEB-INF/lib/picketlink-idm-core-1.5.0.Alpha02.jar
         55966  Defl:N    44907  20% 2011-07-07 12:54 d81b0cc2  WEB-INF/lib/seam-international-3.0.0.Final.jar
        529064  Defl:N   490198   7% 2011-07-18 14:13 cb9a1aec  WEB-INF/lib/quartz-2.0.1.jar
      1627515  Defl:N  1470306  10% 2011-07-07 12:54 e71d8ef4  WEB-INF/lib/primefaces-3.0.M2.jar
        136473  Defl:N   114983  16% 2011-07-21 07:56 264bf278  WEB-INF/lib/richfaces-core-api-4.1.0-20110721.100225-64.jar
        231287  Defl:N   203688  12% 2011-07-21 10:31 76154858  WEB-INF/lib/jboss-marshalling-1.3.0.CR9.jar
        543011  Defl:N   456324  16% 2011-07-12 14:02 f915bdef  WEB-INF/lib/joda-time-1.6.1.jar
         80863  Defl:N    74890   7% 2011-07-21 10:31 1074f519  WEB-INF/lib/jboss-marshalling-river-1.3.0.CR9.jar
        153633  Defl:N   139858   9% 2011-07-18 08:58 267a0105  WEB-INF/lib/seam-security-impl-3.0.1-20110624.041853-12.jar
        546379  Defl:N   489412  10% 2011-07-21 10:38 7810d5c7  WEB-INF/lib/jboss-common-core-2.2.17.GA.jar
        161455  Defl:N   122304  24% 2011-07-12 15:10 55c0bc93  WEB-INF/lib/knowledge-api-5.2.0.Final.jar
        416075  Defl:N   384209   8% 2011-07-21 07:56 93b1f301  WEB-INF/lib/richfaces-core-impl-4.1.0-20110721.100225-63.jar
        559366  Defl:N   483675  14% 2011-05-16 12:39 d10e962a  WEB-INF/lib/commons-collections-3.1.jar
      1902276  Defl:N  1719856  10% 2011-07-12 15:10 91eaa4f6  WEB-INF/lib/drools-core-5.2.0.Final.jar
      1567364  Defl:N  1417499  10% 2011-07-21 07:56 ed62d11c  WEB-INF/lib/richfaces-components-ui-4.1.0-20110721.101518-66.jar
         15071  Defl:N    12479  17% 2011-04-04 11:31 a1e02acb  WEB-INF/lib/jta-1.1.jar
          7635  Defl:N     5428  29% 2011-07-21 10:31 ed71d5ec  WEB-INF/lib/rhq-pluginAnnotations-3.0.1.jar
        313898  Defl:N   291488   7% 2011-05-16 12:02 7a3d526a  WEB-INF/lib/dom4j-1.6.1.jar
        897071  Defl:N   858346   4% 2011-07-12 15:16 a1635c95  WEB-INF/lib/antlr-3.3.jar
        443432  Defl:N   420698   5% 2011-05-16 12:02 d108cdd2  WEB-INF/lib/antlr-2.7.6.jar
      1674737  Defl:N  1601274   4% 2011-07-07 12:55 b5de0b5f  WEB-INF/lib/ecj-3.5.1.jar
         10899  Defl:N     7710  29% 2011-07-21 10:31 b580639d  WEB-INF/lib/jboss-transaction-api-1.0.1.GA.jar
         85245  Defl:N    64256  25% 2011-07-21 07:55 296ed057  WEB-INF/lib/richfaces-components-api-4.1.0-20110721.101518-66.jar
         15808  Defl:N    12066  24% 2011-07-07 12:54 cbb7cd31  WEB-INF/lib/sac-1.3.jar
         91494  Defl:N    81063  11% 2011-07-18 08:58 297819e6  WEB-INF/lib/seam-config-xml-3.0.1-20110511.043145-7.jar
        269014  Defl:N   245020   9% 2011-06-20 14:42 0d19c92a  WEB-INF/lib/commons-net-3.0.1.jar
        787920  Defl:N   754098   4% 2011-07-18 16:27 68512c76  WEB-INF/lib/mysql-connector-java-5.1.17.jar
      1472606  Defl:N  1320427  10% 2011-07-21 10:31 0084c472  WEB-INF/lib/infinispan-core-5.0.0.CR7.jar
          7457  Defl:N     5972  20% 2011-07-18 14:13 cdac3310  WEB-INF/lib/quartz-jboss-2.0.1.jar
         83295  Defl:N    68441  18% 2011-07-20 07:39 870586b9  WEB-INF/lib/seam-servlet-3.0.1-20110720.040801-6.jar
        713433  Defl:N   657365   8% 2011-07-12 15:10 3e88a598  WEB-INF/lib/mvel2-2.1.0.drools2.jar
         71283  Defl:N    59023  17% 2011-07-21 10:46 1a4552c0  WEB-INF/lib/hibernate-commons-annotations-3.2.0.Final.jar
         12623  Defl:N    10267  19% 2011-07-21 10:38 77d0c4ba  WEB-INF/lib/jboss-logging-spi-2.1.0.GA.jar
        253950  Defl:N   241386   5% 2011-05-12 11:27 f758d70e  WEB-INF/lib/cssparser-0.9.5.jar
      1114265  Defl:N   987976  11% 2011-05-12 11:27 57d773f1  WEB-INF/lib/guava-r08.jar
      3113588  Defl:N  2857031   8% 2011-07-21 10:57 3e4703b0  WEB-INF/lib/hibernate-core-3.6.6.Final.jar
         25496  Defl:N    22183  13% 2011-07-14 12:55 1a95d60b  WEB-INF/lib/slf4j-api-1.6.1.jar
        119223  Defl:N   103690  13% 2011-07-18 08:58 fb1581b3  WEB-INF/lib/seam-persistence-3.0.1-20110711.040751-17.jar
        148627  Defl:N   138829   7% 2011-07-12 15:16 3e8b388d  WEB-INF/lib/stringtemplate-3.2.1.jar
        397907  Defl:N   343667  14% 2011-07-07 12:54 7f34b227  WEB-INF/lib/seam-solder-3.0.0.Final.jar
        102661  Defl:N    80043  22% 2011-07-07 12:54 b67dd2a4  WEB-INF/lib/hibernate-jpa-2.0-api-1.0.1.Final.jar
      2135793  Defl:N  2028099   5% 2011-07-21 10:31 ade69d61  WEB-INF/lib/jgroups-2.12.0.Final.jar
        988489  Defl:N   902079   9% 2011-07-12 15:16 22c8db9d  WEB-INF/lib/drools-compiler-5.2.0.Final.jar
         33716  Defl:N    23689  30% 2011-07-18 08:58 3a591eab  WEB-INF/lib/seam-security-api-3.0.1-20110624.041806-12.jar
        163650  Defl:N   149460   9% 2011-07-12 15:16 e8acd98f  WEB-INF/lib/antlr-runtime-3.3.jar
        608376  Defl:N   554163   9% 2011-07-14 12:55 4bb8e85b  WEB-INF/lib/c3p0-0.9.1.1.jar
         23055  Defl:N    14694  36% 2011-07-07 12:54 5dfcdff2  WEB-INF/lib/picketlink-idm-spi-1.5.0.Alpha02.jar
         27714  Defl:N    18846  32% 2011-07-07 12:54 9718b1ca  WEB-INF/lib/picketlink-idm-api-1.5.0.Alpha02.jar
         25717  Defl:N    20670  20% 2011-07-07 12:54 8473b909  WEB-INF/lib/picketlink-idm-common-1.5.0.Alpha02.jar
        • 1. Re: Failed to lookup UserTransaction in JNDI
          Jason Porter Master

          It's at java:jboss/TransactionManager in AS7

          • 2. Re: Failed to lookup UserTransaction in JNDI
            JEE 4 Hire Newbie
            How can I use the delegate to get a handle to UserTransaction?

            The following statement produced a ClassCastException:

            UserTransaction userTransaction = (UserTransaction) initCtx.lookup("java:jboss/TransactionManager");

            08:29:00,063 ERROR [stderr] (QuartzScheduler00_Worker-1) java.lang.ClassCastException: com.arjuna.ats.jbossatx.jta.TransactionManagerDelegate cannot be cast to javax.transaction.UserTransaction
            • 3. Re: Failed to lookup UserTransaction in JNDI
              JEE 4 Hire Newbie
              I am now able to get a handle to UserTransaction and execute the following method. However, no changes are reflected in the database.

                public void test() throws Exception {
                  InitialContext initCtx = new InitialContext();
                  EntityManagerFactory emf = (EntityManagerFactory) initCtx.lookup("java:/TestEntityManagerFactory");
                  TransactionManagerDelegate delegate = (TransactionManagerDelegate) initCtx.lookup("java:jboss/TransactionManager");
                  UserTransaction userTransaction = (UserTransaction) delegate.getTransaction();
                  userTransaction.begin();
                  EntityManager em = emf.createEntityManager();
                  em.merge(...);
                  em.flush();
                  userTransaction.commit();
                }


              To compile with the reference to the delegate, I had to include the following in pom.xml:

              <dependency>
                <groupId>org.jboss.jbossts</groupId>
                <artifactId>jbossjta-integration</artifactId>
                <version>5.0.0-SNAPSHOT</version>
                <scope>provided</scope>
              </dependency>

              Did adding this dependency include a duplicate jar related to transactions that is causing the failure to update the entity in the database?
              war:

                 61504  Defl:N    56482   8% 2011-07-21 10:31 92d0520b  WEB-INF/lib/i18nlog-1.0.10.jar
                358085  Defl:N   324832   9% 2011-04-04 11:37 8c574f28  WEB-INF/lib/log4j-1.2.12.jar
                 47399  Defl:N    41460  13% 2011-07-21 10:31 ac044dbb  WEB-INF/lib/jboss-logging-3.0.0.Beta5.jar
                204093  Defl:N   181695  11% 2011-07-07 12:54 ed9a2ff2  WEB-INF/lib/picketlink-idm-core-1.5.0.Alpha02.jar
                 55966  Defl:N    44907  20% 2011-07-07 12:54 d81b0cc2  WEB-INF/lib/seam-international-3.0.0.Final.jar
                529064  Defl:N   490198   7% 2011-07-18 14:13 cb9a1aec  WEB-INF/lib/quartz-2.0.1.jar
                 85243  Defl:N    64157  25% 2011-07-25 08:27 3d4d4e88  WEB-INF/lib/richfaces-components-api-4.1.0-20110723.100145-68.jar
              1627515  Defl:N  1470306  10% 2011-07-07 12:54 e71d8ef4  WEB-INF/lib/primefaces-3.0.M2.jar
                231287  Defl:N   203688  12% 2011-07-21 10:31 76154858  WEB-INF/lib/jboss-marshalling-1.3.0.CR9.jar
                416075  Defl:N   384500   8% 2011-07-25 08:27 1c728073  WEB-INF/lib/richfaces-core-impl-4.1.0-20110722.100606-64.jar
                543011  Defl:N   456324  16% 2011-07-12 14:02 f915bdef  WEB-INF/lib/joda-time-1.6.1.jar
                 80863  Defl:N    74890   7% 2011-07-21 10:31 1074f519  WEB-INF/lib/jboss-marshalling-river-1.3.0.CR9.jar
                153633  Defl:N   139858   9% 2011-07-18 08:58 267a0105  WEB-INF/lib/seam-security-impl-3.0.1-20110624.041853-12.jar
                546379  Defl:N   489412  10% 2011-07-21 10:38 7810d5c7  WEB-INF/lib/jboss-common-core-2.2.17.GA.jar
                161455  Defl:N   122304  24% 2011-07-12 15:10 55c0bc93  WEB-INF/lib/knowledge-api-5.2.0.Final.jar
                100884  Defl:N    78356  22% 2011-07-13 07:36 2612b4ce  WEB-INF/lib/hibernate-jpa-2.0-api-1.0.0.Final.jar
                559366  Defl:N   483675  14% 2011-05-16 12:39 d10e962a  WEB-INF/lib/commons-collections-3.1.jar
              1902276  Defl:N  1719856  10% 2011-07-12 15:10 91eaa4f6  WEB-INF/lib/drools-core-5.2.0.Final.jar
                 15071  Defl:N    12479  17% 2011-04-04 11:31 a1e02acb  WEB-INF/lib/jta-1.1.jar
                  7635  Defl:N     5428  29% 2011-07-21 10:31 ed71d5ec  WEB-INF/lib/rhq-pluginAnnotations-3.0.1.jar
                313898  Defl:N   291488   7% 2011-05-16 12:02 7a3d526a  WEB-INF/lib/dom4j-1.6.1.jar
                897071  Defl:N   858346   4% 2011-07-12 15:16 a1635c95  WEB-INF/lib/antlr-3.3.jar
                 91540  Defl:N    81205  11% 2011-07-25 08:27 6d5bdd9e  WEB-INF/lib/seam-config-xml-3.0.1-20110723.041850-8.jar
                443432  Defl:N   420698   5% 2011-05-16 12:02 d108cdd2  WEB-INF/lib/antlr-2.7.6.jar
              1674737  Defl:N  1601274   4% 2011-07-07 12:55 b5de0b5f  WEB-INF/lib/ecj-3.5.1.jar
                136474  Defl:N   115053  16% 2011-07-25 08:27 1055394e  WEB-INF/lib/richfaces-core-api-4.1.0-20110722.100606-65.jar
              1567625  Defl:N  1417826  10% 2011-07-25 08:27 4664082b  WEB-INF/lib/richfaces-components-ui-4.1.0-20110723.100145-68.jar
                 10899  Defl:N     7710  29% 2011-07-21 10:31 b580639d  WEB-INF/lib/jboss-transaction-api-1.0.1.GA.jar
                 15808  Defl:N    12066  24% 2011-07-07 12:54 cbb7cd31  WEB-INF/lib/sac-1.3.jar
                269014  Defl:N   245020   9% 2011-06-20 14:42 0d19c92a  WEB-INF/lib/commons-net-3.0.1.jar
                787920  Defl:N   754098   4% 2011-07-18 16:27 68512c76  WEB-INF/lib/mysql-connector-java-5.1.17.jar
              1472606  Defl:N  1320427  10% 2011-07-21 10:31 0084c472  WEB-INF/lib/infinispan-core-5.0.0.CR7.jar
                  7457  Defl:N     5972  20% 2011-07-18 14:13 cdac3310  WEB-INF/lib/quartz-jboss-2.0.1.jar
                 83295  Defl:N    68441  18% 2011-07-20 07:39 870586b9  WEB-INF/lib/seam-servlet-3.0.1-20110720.040801-6.jar
                713433  Defl:N   657365   8% 2011-07-12 15:10 3e88a598  WEB-INF/lib/mvel2-2.1.0.drools2.jar
                 71283  Defl:N    59023  17% 2011-07-21 10:46 1a4552c0  WEB-INF/lib/hibernate-commons-annotations-3.2.0.Final.jar
                 12623  Defl:N    10267  19% 2011-07-21 10:38 77d0c4ba  WEB-INF/lib/jboss-logging-spi-2.1.0.GA.jar
                253950  Defl:N   241386   5% 2011-05-12 11:27 f758d70e  WEB-INF/lib/cssparser-0.9.5.jar
              1114265  Defl:N   987976  11% 2011-05-12 11:27 57d773f1  WEB-INF/lib/guava-r08.jar
              3113588  Defl:N  2857031   8% 2011-07-21 10:57 3e4703b0  WEB-INF/lib/hibernate-core-3.6.6.Final.jar
                 25496  Defl:N    22183  13% 2011-07-14 12:55 1a95d60b  WEB-INF/lib/slf4j-api-1.6.1.jar
                119223  Defl:N   103690  13% 2011-07-18 08:58 fb1581b3  WEB-INF/lib/seam-persistence-3.0.1-20110711.040751-17.jar
                148627  Defl:N   138829   7% 2011-07-12 15:16 3e8b388d  WEB-INF/lib/stringtemplate-3.2.1.jar
                397907  Defl:N   343667  14% 2011-07-07 12:54 7f34b227  WEB-INF/lib/seam-solder-3.0.0.Final.jar
              2135793  Defl:N  2028099   5% 2011-07-21 10:31 ade69d61  WEB-INF/lib/jgroups-2.12.0.Final.jar
                988489  Defl:N   902079   9% 2011-07-12 15:16 22c8db9d  WEB-INF/lib/drools-compiler-5.2.0.Final.jar
                 33716  Defl:N    23689  30% 2011-07-18 08:58 3a591eab  WEB-INF/lib/seam-security-api-3.0.1-20110624.041806-12.jar
                163650  Defl:N   149460   9% 2011-07-12 15:16 e8acd98f  WEB-INF/lib/antlr-runtime-3.3.jar
                608376  Defl:N   554163   9% 2011-07-14 12:55 4bb8e85b  WEB-INF/lib/c3p0-0.9.1.1.jar
                 23055  Defl:N    14694  36% 2011-07-07 12:54 5dfcdff2  WEB-INF/lib/picketlink-idm-spi-1.5.0.Alpha02.jar
                 27714  Defl:N    18846  32% 2011-07-07 12:54 9718b1ca  WEB-INF/lib/picketlink-idm-api-1.5.0.Alpha02.jar
                 25717  Defl:N    20670  20% 2011-07-07 12:54 8473b909  WEB-INF/lib/picketlink-idm-common-1.5.0.Alpha02.jar



              • 4. Re: Failed to lookup UserTransaction in JNDI
                JEE 4 Hire Newbie
                Correction: The system hangs on the following statement:

                    TransactionManagerDelegate delegate = (TransactionManagerDelegate) initCtx.lookup("java:jboss/TransactionManager");

                I do not have any idea where to go from here.


                war:
                   61504  Defl:N    56482   8% 2011-07-21 10:31 92d0520b  WEB-INF/lib/i18nlog-1.0.10.jar
                  358085  Defl:N   324832   9% 2011-04-04 11:37 8c574f28  WEB-INF/lib/log4j-1.2.12.jar
                   47399  Defl:N    41460  13% 2011-07-21 10:31 ac044dbb  WEB-INF/lib/jboss-logging-3.0.0.Beta5.jar
                  204093  Defl:N   181695  11% 2011-07-07 12:54 ed9a2ff2  WEB-INF/lib/picketlink-idm-core-1.5.0.Alpha02.jar
                   55966  Defl:N    44907  20% 2011-07-07 12:54 d81b0cc2  WEB-INF/lib/seam-international-3.0.0.Final.jar
                  529064  Defl:N   490198   7% 2011-07-18 14:13 cb9a1aec  WEB-INF/lib/quartz-2.0.1.jar
                   85243  Defl:N    64157  25% 2011-07-25 08:27 3d4d4e88  WEB-INF/lib/richfaces-components-api-4.1.0-20110723.100145-68.jar
                1627515  Defl:N  1470306  10% 2011-07-07 12:54 e71d8ef4  WEB-INF/lib/primefaces-3.0.M2.jar
                  231287  Defl:N   203688  12% 2011-07-21 10:31 76154858  WEB-INF/lib/jboss-marshalling-1.3.0.CR9.jar
                  416075  Defl:N   384500   8% 2011-07-25 08:27 1c728073  WEB-INF/lib/richfaces-core-impl-4.1.0-20110722.100606-64.jar
                  543011  Defl:N   456324  16% 2011-07-12 14:02 f915bdef  WEB-INF/lib/joda-time-1.6.1.jar
                   80863  Defl:N    74890   7% 2011-07-21 10:31 1074f519  WEB-INF/lib/jboss-marshalling-river-1.3.0.CR9.jar
                  153633  Defl:N   139858   9% 2011-07-18 08:58 267a0105  WEB-INF/lib/seam-security-impl-3.0.1-20110624.041853-12.jar
                  546379  Defl:N   489412  10% 2011-07-21 10:38 7810d5c7  WEB-INF/lib/jboss-common-core-2.2.17.GA.jar
                  161455  Defl:N   122304  24% 2011-07-12 15:10 55c0bc93  WEB-INF/lib/knowledge-api-5.2.0.Final.jar
                  559366  Defl:N   483675  14% 2011-05-16 12:39 d10e962a  WEB-INF/lib/commons-collections-3.1.jar
                1902276  Defl:N  1719856  10% 2011-07-12 15:10 91eaa4f6  WEB-INF/lib/drools-core-5.2.0.Final.jar
                   15071  Defl:N    12479  17% 2011-04-04 11:31 a1e02acb  WEB-INF/lib/jta-1.1.jar
                    7635  Defl:N     5428  29% 2011-07-21 10:31 ed71d5ec  WEB-INF/lib/rhq-pluginAnnotations-3.0.1.jar
                  313898  Defl:N   291488   7% 2011-05-16 12:02 7a3d526a  WEB-INF/lib/dom4j-1.6.1.jar
                  897071  Defl:N   858346   4% 2011-07-12 15:16 a1635c95  WEB-INF/lib/antlr-3.3.jar
                   91540  Defl:N    81205  11% 2011-07-25 08:27 6d5bdd9e  WEB-INF/lib/seam-config-xml-3.0.1-20110723.041850-8.jar
                  443432  Defl:N   420698   5% 2011-05-16 12:02 d108cdd2  WEB-INF/lib/antlr-2.7.6.jar
                1674737  Defl:N  1601274   4% 2011-07-07 12:55 b5de0b5f  WEB-INF/lib/ecj-3.5.1.jar
                  136474  Defl:N   115053  16% 2011-07-25 08:27 1055394e  WEB-INF/lib/richfaces-core-api-4.1.0-20110722.100606-65.jar
                1567625  Defl:N  1417826  10% 2011-07-25 08:27 4664082b  WEB-INF/lib/richfaces-components-ui-4.1.0-20110723.100145-68.jar
                   10899  Defl:N     7710  29% 2011-07-21 10:31 b580639d  WEB-INF/lib/jboss-transaction-api-1.0.1.GA.jar
                   15808  Defl:N    12066  24% 2011-07-07 12:54 cbb7cd31  WEB-INF/lib/sac-1.3.jar
                  269014  Defl:N   245020   9% 2011-06-20 14:42 0d19c92a  WEB-INF/lib/commons-net-3.0.1.jar
                  787920  Defl:N   754098   4% 2011-07-18 16:27 68512c76  WEB-INF/lib/mysql-connector-java-5.1.17.jar
                1472606  Defl:N  1320427  10% 2011-07-21 10:31 0084c472  WEB-INF/lib/infinispan-core-5.0.0.CR7.jar
                    7457  Defl:N     5972  20% 2011-07-18 14:13 cdac3310  WEB-INF/lib/quartz-jboss-2.0.1.jar
                   83295  Defl:N    68441  18% 2011-07-20 07:39 870586b9  WEB-INF/lib/seam-servlet-3.0.1-20110720.040801-6.jar
                  713433  Defl:N   657365   8% 2011-07-12 15:10 3e88a598  WEB-INF/lib/mvel2-2.1.0.drools2.jar
                   71283  Defl:N    59023  17% 2011-07-21 10:46 1a4552c0  WEB-INF/lib/hibernate-commons-annotations-3.2.0.Final.jar
                   12623  Defl:N    10267  19% 2011-07-21 10:38 77d0c4ba  WEB-INF/lib/jboss-logging-spi-2.1.0.GA.jar
                  253950  Defl:N   241386   5% 2011-05-12 11:27 f758d70e  WEB-INF/lib/cssparser-0.9.5.jar
                1114265  Defl:N   987976  11% 2011-05-12 11:27 57d773f1  WEB-INF/lib/guava-r08.jar
                3113588  Defl:N  2857031   8% 2011-07-21 10:57 3e4703b0  WEB-INF/lib/hibernate-core-3.6.6.Final.jar
                   25496  Defl:N    22183  13% 2011-07-14 12:55 1a95d60b  WEB-INF/lib/slf4j-api-1.6.1.jar
                  119223  Defl:N   103690  13% 2011-07-18 08:58 fb1581b3  WEB-INF/lib/seam-persistence-3.0.1-20110711.040751-17.jar
                  148627  Defl:N   138829   7% 2011-07-12 15:16 3e8b388d  WEB-INF/lib/stringtemplate-3.2.1.jar
                  397907  Defl:N   343667  14% 2011-07-07 12:54 7f34b227  WEB-INF/lib/seam-solder-3.0.0.Final.jar
                  102661  Defl:N    80043  22% 2011-07-07 12:54 b67dd2a4  WEB-INF/lib/hibernate-jpa-2.0-api-1.0.1.Final.jar
                2135793  Defl:N  2028099   5% 2011-07-21 10:31 ade69d61  WEB-INF/lib/jgroups-2.12.0.Final.jar
                  988489  Defl:N   902079   9% 2011-07-12 15:16 22c8db9d  WEB-INF/lib/drools-compiler-5.2.0.Final.jar
                   33716  Defl:N    23689  30% 2011-07-18 08:58 3a591eab  WEB-INF/lib/seam-security-api-3.0.1-20110624.041806-12.jar
                  163650  Defl:N   149460   9% 2011-07-12 15:16 e8acd98f  WEB-INF/lib/antlr-runtime-3.3.jar
                  608376  Defl:N   554163   9% 2011-07-14 12:55 4bb8e85b  WEB-INF/lib/c3p0-0.9.1.1.jar
                   23055  Defl:N    14694  36% 2011-07-07 12:54 5dfcdff2  WEB-INF/lib/picketlink-idm-spi-1.5.0.Alpha02.jar
                   27714  Defl:N    18846  32% 2011-07-07 12:54 9718b1ca  WEB-INF/lib/picketlink-idm-api-1.5.0.Alpha02.jar
                   25717  Defl:N    20670  20% 2011-07-07 12:54 8473b909  WEB-INF/lib/picketlink-idm-common-1.5.0.Alpha02.jar
                • 7. Re: Failed to lookup UserTransaction in JNDI
                  Jason Porter Master

                  I'm a little confused as to what you're trying to do. Could you please explain what it is you're trying to do (at a high level)?

                  • 8. Re: Failed to lookup UserTransaction in JNDI
                    JEE 4 Hire Newbie

                    Forum Reference: http://seamframework.org/Community/NullEntityManagerInQuartzJob#comment161211

                    I want to schedule a Quartz job to run non-periodically:
                    0) Start the Quartz scheduler.
                    1) Schedule a new job to start at an arbitrary start time.
                    2) When the job runs, use the entityManager in the job to read/write objects from/to the database to determine next time to run job.
                    3) Reschedule the job by modifying the associated Quartz trigger with the determined next time to run.

                    I would like to have maximum flexibility in job scheduling.

                    • 9. Re: Failed to lookup UserTransaction in JNDI
                      Jason Porter Master

                      Have you looked at Seam Cron? This kind of thing should be possible in Seam Cron, if not please create a JIRA ticket.


                      Probably the easiest way to do this would be to get a hold of a BeanManager (possibly via JNDI, or use the BeanManagerAware class from Solder) and use it to lookup and get the UserTransaction.


                      Also for doing this in AS7, you have way too many jars in your war. For example, I have no idea why you have JPA api jars in there, picket link jars, jboss-logging, log4j (unless you prefer this logging solution), jboss-marshalling, jboss-common-core, JTA (could possibly the problem you're seeing above because the class isn't what is found in JNDI because the classloaders are different), hibernate-core (AS7 ships with a beta of 4.0). Clean up your classpath first and try using CDI by getting an instance of the BeanManager. It will simplify things for you.

                      • 10. Re: Failed to lookup UserTransaction in JNDI
                        richard yang Newbie

                        I got the following error in deploying my war in jboss 7 AS Final with seam 3.0.1-Snapshot:


                        Caused by: javax.naming.NamingException: Failed to get context with name comp
                             at org.jboss.as.naming.context.NamespaceObjectFactory.getObjectInstance(NamespaceObjectFactory.java:71)
                             at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:283)
                             at javax.naming.spi.NamingManager.getContext(NamingManager.java:422)
                             at javax.naming.spi.ContinuationContext.getTargetContext(ContinuationContext.java:38)
                             at javax.naming.spi.NamingManager.getContinuationContext(NamingManager.java:770)
                             at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:175)
                             at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:207)
                             at javax.naming.InitialContext.lookup(InitialContext.java:392)
                             at org.jboss.seam.transaction.DefaultSeamTransaction.getUserTransaction(DefaultSeamTransaction.java:142)
                             at org.jboss.seam.transaction.DefaultSeamTransaction.createUTTransaction(DefaultSeamTransaction.java:136)
                             at org.jboss.seam.transaction.DefaultSeamTransaction.getSeamTransaction(DefaultSeamTransaction.java:113)
                             ... 70 more

                        • 11. Re: Failed to lookup UserTransaction in JNDI
                          Jason Porter Master

                          I've been using the snapshot of persistence for a while on AS7 without issue. Perhaps some more info?

                          • 12. Re: Failed to lookup UserTransaction in JNDI
                            richard yang Newbie

                            I certaily still have problems, even I have 3.0.1-SNAPSHOT defined for seam persistence dependencies.
                            The jar is seam-persistence-impl-3.0.1-20110711.040736-17.jar. Is this right?


                            When seam 3.0.1.CR will be available?
                            Could you tell me the working jar's name (timestamp?)
                            Also, the bom of 3.0.1-Snapshot is pointing to 3.0.0.Final.

                            • 13. Re: Failed to lookup UserTransaction in JNDI
                              Jason Porter Master

                              I built it locally a while ago, maybe a month ago. As for the timeline, not sure, have to ask Stuart about that.