10 Replies Latest reply on Nov 1, 2011 12:15 AM by Jason Porter

    Error loading TransactionInterceptor in tomcat 6

    Thierry Ler Newbie

      Hello.


      I am using Seam 3 in Tomcat 6, with a MySql database but I get the following error when I launch Tomcat :


      28 oct. 2011 14:05:09 org.apache.catalina.core.StandardContext listenerStart
      GRAVE: Exception lors de l'envoi de l'évènement contexte initialisé (context initialized) à l'instance de classe d'écoute (listener) org.jboss.weld.environment.servlet.Listener
      org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [EntityManager] with qualifiers [@Default] at injection point [[field] @PersistenceContext @Inject com.mycorp.myprojectpoc3.dao.TotoDao.entityManager]
           at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:270)
           at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:106)
           at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:129)
           at org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:351)
           at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:336)
           at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:404)
           at org.jboss.weld.environment.servlet.Listener.contextInitialized(Listener.java:206)
           at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4135)
           at org.apache.catalina.core.StandardContext.start(StandardContext.java:4630)
           at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
           at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
           at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
           at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)
           at org.apache.catalina.core.StandardService.start(StandardService.java:519)
           at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
           at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:597)
           at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
           at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
      28 oct. 2011 14:05:10 com.sun.faces.config.ConfigureListener contextInitialized




      My seam-beans.xml :


      <?xml version="1.0" encoding="UTF-8"?>
      <beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:s="urn:java:ee" xmlns:t="urn:java:org.jboss.seam.transaction"
           xsi:schemaLocation="
            http://java.sun.com/xml/ns/javaee
            http://docs.jboss.org/cdi/beans_1_0.xsd">
           <t:SeSynchronizations>
                <s:modifies />
           </t:SeSynchronizations>
           <t:EntityTransaction>
                <s:modifies />
           </t:EntityTransaction>
      </beans>



      My beans.xml :


      <?xml version="1.0" encoding="UTF-8"?>
      <beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
            http://docs.jboss.org/cdi/beans_1_0.xsd">
           <!-- <interceptors>
                <class>org.jboss.seam.transaction.TransactionInterceptor</class>
           </interceptors> -->
      </beans>



      I commented the TransactionInterceptor because it generates a class not found...


      My context.xml :


      <?xml version="1.0" encoding="UTF-8"?>
      <Context>
         <!-- disable storage of sessions across restarts -->
         <Manager pathname=""/>
         <Resource name="BeanManager" auth="Container" type="javax.enterprise.inject.spi.BeanManager" 
                   factory="org.jboss.weld.resources.ManagerObjectFactory"/>
         <!-- Uncomment to enable injection into Servlets, Servlet Listeners and Filters in Tomcat -->
         <!-- <Listener className="org.jboss.weld.environment.tomcat.WeldLifecycleListener"/> -->
      </Context>



      Here I get an other class not found if I uncomment the WeldLifecycleListener...


      My web.xml :


      <?xml version="1.0" encoding="UTF-8"?>
      <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="
            http://java.sun.com/xml/ns/javaee
            http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
      
           <context-param>
                <param-name>javax.faces.PROJECT_STAGE</param-name>
                <param-value>Development</param-value>
           </context-param>
      
           <context-param>
                <param-name>org.apache.myfaces.annotation.SCAN_PACKAGES</param-name>
                <param-value>com.mycorp</param-value>
           </context-param>
      
           <filter>
                <filter-name>Pretty Filter</filter-name>
                <filter-class>com.ocpsoft.pretty.PrettyFilter</filter-class>
           </filter>
      
           <filter-mapping>
                <filter-name>Pretty Filter</filter-name>
                <url-pattern>/*</url-pattern>
                <dispatcher>FORWARD</dispatcher>
                <dispatcher>REQUEST</dispatcher>
                <dispatcher>ERROR</dispatcher>
           </filter-mapping>
      
           <servlet>
                <servlet-name>Faces Servlet</servlet-name>
                <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
                <load-on-startup>1</load-on-startup>
           </servlet>
      
           <servlet-mapping>
                <servlet-name>Faces Servlet</servlet-name>
                <url-pattern>*.jsf</url-pattern>
           </servlet-mapping>
      
           <welcome-file-list>
                <welcome-file>index.jsf</welcome-file>
           </welcome-file-list>
      
           <listener>
                <listener-class>org.jboss.weld.environment.servlet.Listener</listener-class>
           </listener>
      
           <listener>
                <listener-class>org.jboss.seam.solder.resourceLoader.servlet.ResourceListener</listener-class>
           </listener>
      
           <resource-env-ref>
                <description>Object factory for the CDI Bean Manager</description>
                <resource-env-ref-name>BeanManager</resource-env-ref-name>
                <resource-env-ref-type>javax.enterprise.inject.spi.BeanManager</resource-env-ref-type>
           </resource-env-ref>
      
           <resource-ref>
                <description>mysql</description>
                <res-ref-name>jdbc/test_myproject_tomcat</res-ref-name>
                <res-type>javax.sql.DataSource</res-type>
                <res-auth>Container</res-auth>
           </resource-ref>
      </web-app>



      my persistence.xml (copied from a spring project) :


      <?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="C4myprojectPU" transaction-type="RESOURCE_LOCAL">
              <provider>org.hibernate.ejb.HibernatePersistence</provider>
              <non-jta-data-source>java:comp/env/jdbc/test_myproject_tomcat</non-jta-data-source>
              <properties>
                  <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLInnoDBDialect" />
                  <property name="hibernate.show_sql" value="true"/>
                  <property name="hibernate.transaction.flush_before_completion" value="true"/>
                  <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
              </properties>
          </persistence-unit>
      </persistence>



      EMFProducer.java :


      package com.mycorp.myprojectpoc3.dao;
      
      import java.io.Serializable;
      
      import javax.enterprise.context.ApplicationScoped;
      import javax.enterprise.context.Dependent;
      import javax.enterprise.inject.Produces;
      import javax.persistence.EntityManagerFactory;
      import javax.persistence.PersistenceUnit;
      
      import org.jboss.seam.solder.core.ExtensionManaged;
      
      @ApplicationScoped
      public class EMFProducer implements Serializable {
      
           private static final long serialVersionUID = 2029250023471989564L;
      
           @ExtensionManaged
           @Produces
           @PersistenceUnit(unitName = "C4myprojectPU")
           @Dependent
           EntityManagerFactory emf;
      
           public EMFProducer() {
                System.out.println("hello");
           }
      }



      my dao :


      package com.mycorp.myprojectpoc3.dao;
      
      import java.util.List;
      
      import javax.inject.Inject;
      import javax.inject.Named;
      import javax.persistence.EntityManager;
      import javax.persistence.PersistenceContext;
      
      import com.mycorp.myprojectpoc3.model.Toto;
      import com.google.common.collect.Lists;
      
      @Named
      public class TotoDao {
      
           @Inject
           @PersistenceContext
           EntityManager entityManager;
      }




      pom.xml :


      <?xml version="1.0" encoding="UTF-8"?>
      <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
           <modelVersion>4.0.0</modelVersion>
      
      
           <groupId>com.mycorp</groupId>
           <artifactId>C4myprojectPoc3</artifactId>
           <version>1.0-SNAPSHOT</version>
           <packaging>war</packaging>
      
           <name>C4myprojectPocWeb3</name>
           <description>mycorp Connect Web </description>
      
      
      
           <properties>
                <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
                <maven-compiler-plugin.version>2.3.2</maven-compiler-plugin.version>
                <junit.version>4.8.1</junit.version>
                <maven-site-plugin.version>3.0-beta-3</maven-site-plugin.version>
                <maven-javadoc-plugin.version>2.8</maven-javadoc-plugin.version>
                <maven-checkstyle-plugin.version>2.7</maven-checkstyle-plugin.version>
                <maven-pmd-plugin.version>2.5</maven-pmd-plugin.version>
                <maven-jxr-plugin.version>2.3</maven-jxr-plugin.version>
                <taglist-maven-plugin.version>2.4</taglist-maven-plugin.version>
                <cobertura-maven-plugin.version>2.5.1</cobertura-maven-plugin.version>
                <maven-surefire-plugin.version>2.9</maven-surefire-plugin.version>
                <maven-surefire-report-plugin>2.9</maven-surefire-report-plugin>
                <log4j.version>1.2.13</log4j.version>
                <guava.version>10.0</guava.version>
      
                <version.weld-servlet>1.1.2.Final</version.weld-servlet>
                <version.arquillian>1.0.0.Alpha4</version.arquillian>
                <version.mojarra>2.0.3</version.mojarra>
      
                <seam.version>3.0.0.Final</seam.version>
      
      
                <hibernate-validator.version>4.0.0.GA</hibernate-validator.version>
                <servlet-api.version>2.5</servlet-api.version>
      
                <prettyfaces-jsf2.version>3.3.0</prettyfaces-jsf2.version>
                <ocpsoft-pretty-time.version>1.0.7</ocpsoft-pretty-time.version>
      
                <slf4j-api.version>1.5.10</slf4j-api.version>
      
      
                <hibernate.version>3.6.7.Final</hibernate.version>
                <mysql-connector-java.version>5.1.18</mysql-connector-java.version>
           </properties>
      
           <repositories>
                <repository>
                     <id>jboss-public-repository</id>
                     <name>JBoss Repository</name>
                     <url>https://repository.jboss.org/nexus/content/groups/public</url>
                     <releases>
                          <updatePolicy>never</updatePolicy>
                     </releases>
                     <snapshots>
                          <updatePolicy>daily</updatePolicy>
                     </snapshots>
                </repository>
           </repositories>
      
           <pluginRepositories>
                <pluginRepository>
                     <id>jboss-public-repository</id>
                     <name>JBoss Repository</name>
                     <url>https://repository.jboss.org/nexus/content/groups/public</url>
                     <releases>
                          <updatePolicy>never</updatePolicy>
                     </releases>
                     <snapshots>
                          <enabled>false</enabled>
                          <updatePolicy>daily</updatePolicy>
                     </snapshots>
                </pluginRepository>
           </pluginRepositories>
      
           <dependencyManagement>
                <dependencies>
                     <!-- JUnit -->
                     <dependency>
                          <groupId>junit</groupId>
                          <artifactId>junit</artifactId>
                          <version>${junit.version}</version>
                          <scope>test</scope>
                     </dependency>
      
                     <!-- JAX WS RT -->
                     <dependency>
                          <groupId>com.sun.xml.ws</groupId>
                          <artifactId>jaxws-rt</artifactId>
                          <version>${jaxws-rt.version}</version>
                     </dependency>
      
                     <!-- log4j -->
                     <dependency>
                          <groupId>log4j</groupId>
                          <artifactId>log4j</artifactId>
                          <version>${log4j.version}</version>
                     </dependency>
      
                     <!-- Weld -->
                     <dependency>
                          <groupId>org.jboss.weld.servlet</groupId>
                          <artifactId>weld-servlet-parent</artifactId>
                          <version>${version.weld-servlet}</version>
                          <type>pom</type>
                          <scope>import</scope>
                     </dependency>
      
                     <!-- Seam -->
                     <dependency>
                          <groupId>org.jboss.seam</groupId>
                          <artifactId>seam-bom</artifactId>
                          <version>${seam.version}</version>
                          <type>pom</type>
                          <scope>import</scope>
                     </dependency>
      
                     <!-- Guava -->
                     <dependency>
                          <groupId>com.google.guava</groupId>
                          <artifactId>guava</artifactId>
                          <version>${guava.version}</version>
                     </dependency>
      
                     <!-- Prety time -->
                     <dependency>
                          <groupId>com.ocpsoft</groupId>
                          <artifactId>ocpsoft-pretty-time</artifactId>
                          <version>${ocpsoft-pretty-time.version}</version>
                     </dependency>
      
      
                     <!-- pretty faces -->
                     <dependency>
                          <groupId>com.ocpsoft</groupId>
                          <artifactId>prettyfaces-jsf2</artifactId>
                          <version>${prettyfaces-jsf2.version}</version>
                     </dependency>
      
                     <!-- slf4j -->
                     <dependency>
                          <groupId>org.slf4j</groupId>
                          <artifactId>slf4j-api</artifactId>
                          <version>${slf4j-api.version}</version>
                     </dependency>
      
                </dependencies>
           </dependencyManagement>
      
      
           <dependencies>
      
      
                <!-- JUnit -->
                <dependency>
                     <groupId>junit</groupId>
                     <artifactId>junit</artifactId>
                     <scope>test</scope>
                </dependency>
      
                <!-- Common to JEE and Servlet containers -->
                <dependency>
                     <groupId>javax.enterprise</groupId>
                     <artifactId>cdi-api</artifactId>
                     <scope>provided</scope>
                </dependency>
      
                <dependency>
                     <groupId>javax.annotation</groupId>
                     <artifactId>jsr250-api</artifactId>
                     <scope>provided</scope>
                </dependency>
      
                <dependency>
                     <groupId>javax.servlet</groupId>
                     <artifactId>servlet-api</artifactId>
                     <version>${servlet-api.version}</version>
                     <scope>provided</scope>
                </dependency>
      
                <dependency>
                     <groupId>org.jboss.weld.servlet</groupId>
                     <artifactId>weld-servlet</artifactId>
                     <scope>runtime</scope>
                </dependency>
      
                <!-- Bean Validation API (JSR 303) -->
                <dependency>
                     <groupId>javax.validation</groupId>
                     <artifactId>validation-api</artifactId>
                </dependency>
      
                <!-- Bean Validation Implementation -->
                <!-- Provides portable constraints such as @NotEmpty, @Email and @Url -->
                <dependency>
                     <groupId>org.hibernate</groupId>
                     <artifactId>hibernate-validator</artifactId>
                     <version>${hibernate-validator.version}</version>
                </dependency>
      
      
                <!-- JPA Persistence Dependencies -->
                <!-- <dependency>
                     <groupId>org.hibernate</groupId>
                     <artifactId>hibernate-entitymanager</artifactId>
                     <version>${hibernate.version}</version>
                     <scope>compile</scope>
                </dependency> -->
      
                <!-- <dependency>
                     <groupId>hsqldb</groupId>
                     <artifactId>hsqldb</artifactId>
                     <version>1.8.0.10</version>
                </dependency> -->
      
                <!-- <dependency>
                     <groupId>org.hibernate.javax.persistence</groupId>
                     <artifactId>hibernate-jpa-2.0-api</artifactId>
                     <version>1.0.0.Final</version>
                     <scope>compile</scope>
                </dependency> -->
      
                <dependency>
                     <groupId>org.hibernate</groupId>
                     <artifactId>hibernate-core</artifactId>
                     <version>${hibernate.version}</version>
                </dependency>
      
      
                <!-- Arquilliam -->
                <dependency>
                     <groupId>org.jboss.arquillian</groupId>
                     <artifactId>arquillian-junit</artifactId>
                     <version>${version.arquillian}</version>
                     <scope>test</scope>
                </dependency>
      
      
                <!-- JSF -->
                <dependency>
                     <groupId>com.sun.faces</groupId>
                     <artifactId>jsf-api</artifactId>
                     <version>${version.mojarra}</version>
                </dependency>
                <dependency>
                     <groupId>com.sun.faces</groupId>
                     <artifactId>jsf-impl</artifactId>
                     <version>${version.mojarra}</version>
                     <scope>runtime</scope>
                </dependency>
      
                <!-- Joda time -->
                <dependency>
                     <groupId>joda-time</groupId>
                     <artifactId>joda-time</artifactId>
                </dependency>
      
      
                <!-- Pretty time -->
                <dependency>
                     <groupId>com.ocpsoft</groupId>
                     <artifactId>ocpsoft-pretty-time</artifactId>
                </dependency>
      
                <!-- Pretty faces -->
                <dependency>
                     <groupId>com.ocpsoft</groupId>
                     <artifactId>prettyfaces-jsf2</artifactId>
                </dependency>
      
      
                <!-- seam -->
                <dependency>
                     <groupId>org.jboss.seam.solder</groupId>
                     <artifactId>seam-solder</artifactId>
                </dependency>
      
                <dependency>
                     <groupId>org.jboss.seam.faces</groupId>
                     <artifactId>seam-faces</artifactId>
                </dependency>
      
                <dependency>
                     <groupId>org.jboss.seam.international</groupId>
                     <artifactId>seam-international</artifactId>
                </dependency>
      
                <dependency>
                     <groupId>org.jboss.seam.config</groupId>
                     <artifactId>seam-config-xml</artifactId>
                </dependency>
      
      
                <dependency>
                     <groupId>org.jboss.seam.persistence</groupId>
                     <artifactId>seam-persistence-api</artifactId>
                </dependency>
                <dependency>
                     <groupId>org.jboss.seam.persistence</groupId>
                     <artifactId>seam-persistence-impl</artifactId>
                </dependency>
      
                <!-- <dependency> <groupId>org.jboss.seam.security</groupId> <artifactId>seam-security</artifactId> 
                     </dependency> -->
      
                <!-- Guava -->
                <dependency>
                     <groupId>com.google.guava</groupId>
                     <artifactId>guava</artifactId>
                </dependency>
      
                <!-- slf4j -->
                <dependency>
                     <groupId>org.slf4j</groupId>
                     <artifactId>slf4j-api</artifactId>
                </dependency>
      
                <!-- mysql -->
                <dependency>
                     <groupId>mysql</groupId>
                     <artifactId>mysql-connector-java</artifactId>
                     <version>${mysql-connector-java.version}</version>
                     <scope>provided</scope>
                </dependency>
      
           </dependencies>
      
           <build>
                <finalName>C4myprojectPoc3</finalName>
                <plugins>
      
                     <!-- Maven compiler -->
                     <plugin>
                          <artifactId>maven-compiler-plugin</artifactId>
                          <version>${maven-compiler-plugin.version}</version>
                          <configuration>
                               <source>1.6</source>
                               <target>1.6</target>
                               <encoding>${project.build.sourceEncoding}</encoding>
                          </configuration>
                     </plugin>
      
                     <plugin>
                          <groupId>org.apache.maven.plugins</groupId>
                          <artifactId>maven-eclipse-plugin</artifactId>
                          <version>2.8</version>
                          <configuration>
                               <wtpversion>2.0</wtpversion>
                               <source>1.6</source>
                               <target>1.6</target>
                          </configuration>
                     </plugin>
      
                     <!-- pour faire fonctionner sous maven 3 -->
                     <plugin>
                          <groupId>org.apache.maven.plugins</groupId>
                          <artifactId>maven-site-plugin</artifactId>
                          <version>${maven-site-plugin.version}</version>
                     </plugin>
      
                     <!-- Surefire -->
                     <plugin>
                          <groupId>org.apache.maven.plugins</groupId>
                          <artifactId>maven-surefire-plugin</artifactId>
                          <version>${maven-surefire-plugin.version}</version>
                     </plugin>
      
                     <!-- Embedded Tomcat (package tomcat:run) -->
                     <!-- Standalone Tomcat (package tomcat:deploy) -->
                     <plugin>
                          <groupId>org.codehaus.mojo</groupId>
                          <artifactId>tomcat-maven-plugin</artifactId>
                          <version>1.0</version>
                          <configuration>
                               <path>/${project.build.finalName}</path>
                               <!-- Embedded port -->
                               <port>9090</port>
                               <!-- The default authentication credentials for remote deployment are 
                                    username "admin" with no password To override credentials, define a server 
                                    in settings.xml and activate it using the <server> element -->
                               <url>http://localhost:9090/manager</url>
                          </configuration>
                     </plugin>
                </plugins>
           </build>
      
      
      
           <reporting>
                <plugins>
                     <!-- javadoc -->
                     <plugin>
                          <groupId>org.apache.maven.plugins</groupId>
                          <artifactId>maven-javadoc-plugin</artifactId>
                          <version>${maven-javadoc-plugin.version}</version>
                     </plugin>
      
                     <!-- checkstyle -->
                     <plugin>
                          <groupId>org.apache.maven.plugins</groupId>
                          <artifactId>maven-checkstyle-plugin</artifactId>
                          <version>${maven-checkstyle-plugin.version}</version>
                          <configuration>
                               <configLocation>checkstyle.xml</configLocation>
                          </configuration>
                     </plugin>
      
                     <!-- PMD -->
                     <plugin>
                          <groupId>org.apache.maven.plugins</groupId>
                          <artifactId>maven-pmd-plugin</artifactId>
                          <version>${maven-pmd-plugin.version}</version>
                     </plugin>
      
                     <!-- JXR : pour lier les sources -->
                     <plugin>
                          <groupId>org.apache.maven.plugins</groupId>
                          <artifactId>maven-jxr-plugin</artifactId>
                          <version>${maven-jxr-plugin.version}</version>
                     </plugin>
      
                     <!-- taglist -->
                     <plugin>
                          <groupId>org.codehaus.mojo</groupId>
                          <artifactId>taglist-maven-plugin</artifactId>
                          <version>${taglist-maven-plugin.version}</version>
                          <configuration>
                               <tagListOptions>
                                    <tagClasses>
                                         <tagClass>
                                              <displayName>Todo Work</displayName>
                                              <tags>
                                                   <tag>
                                                        <matchString>todo</matchString>
                                                        <matchType>ignoreCase</matchType>
                                                   </tag>
                                                   <tag>
                                                        <matchString>FIXME</matchString>
                                                        <matchType>exact</matchType>
                                                   </tag>
                                              </tags>
                                         </tagClass>
                                         <tagClass>
                                              <displayName>Regles</displayName>
                                              <tags>
                                                   <tag>
                                                        <matchString>REGLE</matchString>
                                                        <matchType>ignoreCase</matchType>
                                                   </tag>
                                              </tags>
                                         </tagClass>
                                    </tagClasses>
                               </tagListOptions>
                          </configuration>
                     </plugin>
      
                     <!-- Cobertura : couverture de code -->
                     <plugin>
                          <groupId>org.codehaus.mojo</groupId>
                          <artifactId>cobertura-maven-plugin</artifactId>
                          <version>${cobertura-maven-plugin.version}</version>
                     </plugin>
      
                     <!-- Surefire (junit) -->
                     <plugin>
                          <groupId>org.apache.maven.plugins</groupId>
                          <artifactId>maven-surefire-report-plugin</artifactId>
                          <version>${maven-surefire-report-plugin}</version>
                     </plugin>
      
                </plugins>
           </reporting>
      </project>




      Any idea ?...


        • 1. Re: Error loading TransactionInterceptor in tomcat 6
          Thierry Ler Newbie

          Wrong title: sorry. Should have been WELD-001408 Unsatisfied dependencies

          • 2. Re: Error loading TransactionInterceptor in tomcat 6
            hantsy bai Master

            replace


            @Inject
            @PersistenceContext
            EntityManager entityManager;
            



            with


            @Inject EntityManager entityManager;
            



            • 3. Re: Error loading TransactionInterceptor in tomcat 6
              Thierry Ler Newbie

              Well, for some reasons, my laptop restarted. Tomcat starts with no error now.


              But when I go to http://localhost:8080/C4myprojectPoc3, i get an error : Could not start transaction



              java.lang.IllegalStateException: Could not start transaction
                   at org.jboss.seam.faces.transaction.TransactionPhaseListener.begin(TransactionPhaseListener.java:96)
                   at org.jboss.seam.faces.transaction.TransactionPhaseListener.begin(TransactionPhaseListener.java:86)
                   at org.jboss.seam.faces.transaction.TransactionPhaseListener.handleTransactionsBeforePhase(TransactionPhaseListener.java:67)
                   at org.jboss.seam.faces.transaction.TransactionPhaseListener.beforePhase(TransactionPhaseListener.java:49)
                   at org.jboss.seam.faces.event.DelegatingPhaseListener.beforePhase(DelegatingPhaseListener.java:28)
                   at com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:224)
                   at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:95)
                   at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:107)
                   at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:114)
                   at javax.faces.webapp.FacesServlet.service(FacesServlet.java:308)
                   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                   at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:118)
                   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                   at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
                   at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
                   at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
                   at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
                   at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:110)
                   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
                   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
                   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
                   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
                   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
                   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
                   at java.lang.Thread.run(Thread.java:662)
              Caused by: java.lang.RuntimeException: javax.naming.NamingException: Cannot create resource instance
                   at org.jboss.seam.transaction.DefaultSeamTransaction.getSeamTransaction(DefaultSeamTransaction.java:153)
                   at org.jboss.seam.transaction.DefaultSeamTransaction.isActiveOrMarkedRollback(DefaultSeamTransaction.java:62)
                   at org.jboss.seam.faces.transaction.TransactionPhaseListener.begin(TransactionPhaseListener.java:91)
                   ... 31 more
              Caused by: javax.naming.NamingException: Cannot create resource instance
                   at org.apache.naming.factory.TransactionFactory.getObjectInstance(TransactionFactory.java:113)
                   at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
                   at org.apache.naming.NamingContext.lookup(NamingContext.java:793)
                   at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
                   at org.apache.naming.NamingContext.lookup(NamingContext.java:781)
                   at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
                   at org.apache.naming.SelectorContext.lookup(SelectorContext.java:152)
                   at javax.naming.InitialContext.lookup(InitialContext.java:392)
                   at org.jboss.seam.transaction.DefaultSeamTransaction.getUserTransaction(DefaultSeamTransaction.java:177)
                   at org.jboss.seam.transaction.DefaultSeamTransaction.createUTTransaction(DefaultSeamTransaction.java:169)
                   at org.jboss.seam.transaction.DefaultSeamTransaction.getSeamTransaction(DefaultSeamTransaction.java:134)
                   ... 33 more



              • 4. Re: Error loading TransactionInterceptor in tomcat 6
                Jason Porter Master

                Looks like you don't have JPA in your deploying archive.

                • 5. Re: Error loading TransactionInterceptor in tomcat 6
                  Jason Porter Master

                  In your previous I didn't see any JTA implementation setup.

                  • 6. Re: Error loading TransactionInterceptor in tomcat 6
                    Thierry Ler Newbie

                    Hello. What implementatons would you recommand to add in my pom.xml

                    • 7. Re: Error loading TransactionInterceptor in tomcat 6
                      Thierry Ler Newbie

                      I guest that the pom.xml file is ok with jpa :


                      <version.weld-servlet>1.1.2.Final</version.weld-servlet>
                      <seam.version>3.0.0.Final</seam.version>
                      <hibernate.version>3.6.7.Final</hibernate.version>
                      
                      <dependency>
                           <groupId>org.hibernate</groupId>
                           <artifactId>hibernate-core</artifactId>
                           <version>${hibernate.version}</version> 
                      </dependency>
                      
                      <dependency>
                           <groupId>org.jboss.seam.solder</groupId>
                           <artifactId>seam-solder</artifactId>
                      </dependency>
                      
                      <dependency>
                           <groupId>org.jboss.seam.faces</groupId>
                           <artifactId>seam-faces</artifactId>
                      </dependency>
                      
                      <dependency>
                           <groupId>org.jboss.seam.international</groupId>
                           <artifactId>seam-international</artifactId>
                      </dependency>
                      
                      <dependency>
                           <groupId>org.jboss.seam.config</groupId>
                           <artifactId>seam-config-xml</artifactId>
                      </dependency>
                      
                      <dependency>
                           <groupId>org.jboss.seam.persistence</groupId>
                           <artifactId>seam-persistence-api</artifactId>
                      </dependency>
                      <dependency>
                           <groupId>org.jboss.seam.persistence</groupId>
                           <artifactId>seam-persistence-impl</artifactId>
                      </dependency>



                      The seam documentation says (section 22.2 getting started) :


                      <dependency>
                           <groupId>org.jboss.seam.persistence</groupId>
                           <artifactId>seam-persistence-api</artifactId>
                           <version>${seam.persistence.version}</version>
                      </dependency>
                      <dependency>
                           <groupId>org.jboss.seam.persistence</groupId>
                           <artifactId>seam-persistence-impl</artifactId>
                           <version>${seam.persistence.version}</version>
                      </dependency>
                      <dependency>
                           <groupId>org.jboss.seam.solder</groupId>
                           <artifactId>seam-solder</artifactId>
                           <version>${seam.solder.version}</version>
                      </dependency>
                      <dependency>
                           <groupId>org.jboss.seam.xml</groupId>
                           <artifactId>seam-xml-config</artifactId>
                           <version>${seam.xml.version}</version>
                      </dependency>



                      And seam recommands Hibernate :


                      <dependency>
                           <groupId>org.hibernate</groupId>
                           <artifactId>hibernate-core</artifactId>
                           <version>3.5.1-Final</version>
                      </dependency>



                      Then I may need a JTA-implementation but which one ?... This is not included in Seam ?


                      • 8. Re: Error loading TransactionInterceptor in tomcat 6
                        Jason Porter Master

                        The documentation for all of the Seam modules is assuming you're using a full / web profile Java EE server, not just a servlet container.


                        Your pom only has Hibernate core, you can use Hibernate core if you'd like and use the Hibernate APIs. If you would like to use JPA with Hibernate as a provider you'll need to include hibernate-entitymanager, you'll also need the jpa api jar, which should be pulled in.


                        As for JTA, there's a few to choose from, what works best on Tomcat, I don't really know, I haven't had to deal with it before as I don't use Tomcat very often. Try their forms or Google for JTA implementations.

                        • 9. Re: Error loading TransactionInterceptor in tomcat 6
                          Thierry Ler Newbie

                          Hello,


                          I added the following dependency into my pom.xml for the JPA part :


                          <dependency>
                                  <groupId>org.hibernate</groupId>
                                  <artifactId>hibernate-entitymanager</artifactId>
                                  <version>${hibernate.version}</version>
                                  <scope>compile</scope>
                          </dependency> 
                          
                          <dependency>
                                  <groupId>hsqldb</groupId>
                                  <artifactId>hsqldb</artifactId>
                                  <version>1.8.0.10</version>
                          </dependency> 
                          
                           <dependency>
                                  <groupId>org.hibernate.javax.persistence</groupId>
                                  <artifactId>hibernate-jpa-2.0-api</artifactId>
                                  <version>1.0.0.Final</version>
                                  <scope>compile</scope>
                          </dependency> 
                          
                          <dependency>
                                  <groupId>org.hibernate</groupId>
                                  <artifactId>hibernate-core</artifactId>
                                  <version>${hibernate.version}</version>
                          </dependency>



                          But it does not change anything.


                          I still have to add JTA. But actually, I don't really need JTA for this project. Is it possible to disable JTA in Seam ?


                          A friend told me that I may have problems with


                          transaction-type="RESOURCE_LOCAL"



                          Anyway I will have a look at the Tomcat forum as you suggested.


                          • 10. Re: Error loading TransactionInterceptor in tomcat 6
                            Jason Porter Master

                            Thierry Ler wrote on Oct 29, 2011 04:54:


                            Hello,

                            I added the following dependency into my pom.xml for the JPA part :

                            <dependency>
                                    <groupId>org.hibernate</groupId>
                                    <artifactId>hibernate-entitymanager</artifactId>
                                    <version>${hibernate.version}</version>
                                    <scope>compile</scope>
                            </dependency> 
                            
                            <dependency>
                                    <groupId>hsqldb</groupId>
                                    <artifactId>hsqldb</artifactId>
                                    <version>1.8.0.10</version>
                            </dependency> 
                            
                             <dependency>
                                    <groupId>org.hibernate.javax.persistence</groupId>
                                    <artifactId>hibernate-jpa-2.0-api</artifactId>
                                    <version>1.0.0.Final</version>
                                    <scope>compile</scope>
                            </dependency> 
                            
                            <dependency>
                                    <groupId>org.hibernate</groupId>
                                    <artifactId>hibernate-core</artifactId>
                                    <version>${hibernate.version}</version>
                            </dependency>



                            But it does not change anything.

                            I still have to add JTA. But actually, I don't really need JTA for this project. Is it possible to disable JTA in Seam ?


                            You should be able to. I'll have to dig into the Transaction code to double check though. However, I'm focusing on bug fixes this week so I may not get to it, I'll do my best though.



                            A friend told me that I may have problems with

                            transaction-type="RESOURCE_LOCAL"




                            Not sure what problems he's talking about.