11 Replies Latest reply on Jan 25, 2012 4:44 AM by Lucas Ventura Carro

    seam persistence3 tomcat-7.0.8

    fiorenzo pizza Newbie

      Hi,


      i want use seam 3 persistence in tomcat 7.
      I don't find any seam 3 persistence howto, to replace this Gavin's old post http://seamframework.org/Documentation/WeldAndJPARunningInTomcat


      Below my sample application.


      pom.xml:


      <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/xsd/maven-4.0.0.xsd">
           <modelVersion>4.0.0</modelVersion>
           <groupId>by.giava</groupId>
           <artifactId>test-persistence1</artifactId>
           <version>0.0.1</version>
           <packaging>war</packaging>
           <name>test-persistence1</name>
           <properties>
                <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
                <seam.version>3.0.0.Final</seam.version>
           </properties>
           <repositories>
                <repository>
                     <id>jboss-public-repository-group</id>
                     <name>JBoss Public Maven Repository Group</name>
                     <url>http://repository.jboss.org/nexus/content/groups/public</url>
                     <layout>default</layout>
                     <releases>
                          <enabled>true</enabled>
                          <updatePolicy>never</updatePolicy>
                     </releases>
                     <snapshots>
                          <enabled>false</enabled>
                          <updatePolicy>never</updatePolicy>
                     </snapshots>
                </repository>
                <repository>
                     <id>java-net</id>
                     <name>Java.net Repository for Maven</name>
                     <url>http://download.java.net/maven/2</url>
                     <layout>default</layout>
                </repository>
                <repository>
                     <id>glassfish-maven-repository.dev.java.net</id>
                     <name>GlassFish Maven Repository</name>
                     <url>http://download.java.net/maven/glassfish</url>
                </repository>
           </repositories>
           <dependencyManagement>
                <dependencies>
                     <dependency>
                          <groupId>org.jboss.seam</groupId>
                          <artifactId>seam-bom</artifactId>
                          <version>${seam.version}</version>
                          <type>pom</type>
                          <scope>import</scope>
                     </dependency>
                </dependencies>
           </dependencyManagement>
           <dependencies>
                <dependency>
                     <groupId>org.jboss.seam.persistence</groupId>
                     <artifactId>seam-persistence</artifactId>
                </dependency>
      
                <dependency>
                     <groupId>org.jboss.logging</groupId>
                     <artifactId>jboss-logging</artifactId>
                     <version>3.0.0.Beta4</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.servlet</groupId>
                     <artifactId>seam-servlet</artifactId>
                </dependency>
      
                <dependency>
                     <groupId>org.jboss.seam.catch</groupId>
                     <artifactId>seam-catch</artifactId>
                </dependency>
      
                <dependency>
                     <groupId>org.jboss.seam.config</groupId>
                     <artifactId>seam-config-xml</artifactId>
                </dependency>
      
                <dependency>
                     <groupId>joda-time</groupId>
                     <artifactId>joda-time</artifactId>
                </dependency>
      
                <dependency>
                     <groupId>org.hibernate</groupId>
                     <artifactId>hibernate-core</artifactId>
                     <version>3.5.6-Final</version>
                </dependency>
      
                <dependency>
                     <groupId>org.hibernate</groupId>
                     <artifactId>hibernate-entitymanager</artifactId>
                     <version>3.5.6-Final</version>
                </dependency>
      
                <dependency>
                     <groupId>org.hibernate.javax.persistence</groupId>
                     <artifactId>hibernate-jpa-2.0-api</artifactId>
                     <version>1.0.0-CR-1</version>
                </dependency>
                <dependency>
                     <groupId>org.hibernate</groupId>
                     <artifactId>hibernate-annotations</artifactId>
                     <version>3.5.6-Final</version>
                </dependency>
      
                <dependency>
                     <groupId>org.slf4j</groupId>
                     <artifactId>slf4j-api</artifactId>
                     <version>1.5.10</version>
                </dependency>
      
                <dependency>
                     <groupId>javax.enterprise</groupId>
                     <artifactId>cdi-api</artifactId>
                     <version>1.0</version>
                </dependency>
      
                <dependency>
                     <groupId>com.sun.faces</groupId>
                     <artifactId>jsf-api</artifactId>
                     <version>2.0.4-b09</version>
                </dependency>
                <dependency>
                     <groupId>com.sun.faces</groupId>
                     <artifactId>jsf-impl</artifactId>
                     <version>2.0.4-b09</version>
                </dependency>
                <dependency>
                     <groupId>org.jboss.weld</groupId>
                     <artifactId>weld-api</artifactId>
                     <version>1.1.Final</version>
                </dependency>
      
                <dependency>
                     <groupId>org.jboss.weld</groupId>
                     <artifactId>weld-core</artifactId>
                     <!-- version>1.1.0.Final</version -->
                     <version>1.1.0.Final</version>
                </dependency>
                <dependency>
                     <groupId>org.jboss.weld.servlet</groupId>
                     <artifactId>weld-servlet</artifactId>
                     <!-- version>1.1.0.Final</version -->
                     <version>1.1.0.Final</version>
                </dependency>
           </dependencies>
           <build>
                <finalName>test-persistence1</finalName>
                <plugins>
                     <plugin>
                          <groupId>org.apache.maven.plugins</groupId>
                          <artifactId>maven-compiler-plugin</artifactId>
                          <version>2.3.2</version>
                          <inherited>true</inherited>
                          <configuration>
                               <source>1.6</source>
                               <target>1.6</target>
                          </configuration>
                     </plugin>
                </plugins>
           </build>
      </project>



      WEB-INF/web.xml:


      <?xml version="1.0" encoding="UTF-8"?>
      <web-app version="3.0" 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_3_0.xsd">
      
           <listener>
                <listener-class>org.jboss.weld.environment.servlet.Listener</listener-class>
           </listener>
           <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>/faces/*</url-pattern>
           </servlet-mapping>
           <session-config>
                <session-timeout>30</session-timeout>
           </session-config>
           <welcome-file-list>
                <welcome-file>faces/index.xhtml</welcome-file>
           </welcome-file-list>
      
           <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>
      </web-app>




      WEB-INF/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>



      WEB-INF/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>



      META-INF/context.xml


      <?xml version="1.0" encoding="UTF-8"?>
      <Context>
           <Manager pathname="" /> <!-- disables storage of sessions across restarts -->
           <Resource name="BeanManager" auth="Container"
                type="javax.enterprise.inject.spi.BeanManager" factory="org.jboss.weld.resources.ManagerObjectFactory" />
      </Context>




      my WEB-INF/classes/META-INF/persistence.xml


      <?xml version="1.0" encoding="UTF-8"?>
      <persistence version="1.0"
           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_1_0.xsd">
           <persistence-unit name="pu" transaction-type="RESOURCE_LOCAL">
                <provider>org.hibernate.ejb.HibernatePersistence</provider>
                <properties>
                     <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect" />
                     <property name="hibernate.hbm2ddl.auto" value="update" />
                     <property name="hibernate.connection.driver_class" value="org.gjt.mm.mysql.Driver" />
                     <property name="hibernate.connection.username" value="colonnella" />
                     <property name="hibernate.connection.password" value="colonnella" />
                     <property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/colonnella" />
                     <property name="hibernate.hbm2ddl.auto" value="update" />
                </properties>
           </persistence-unit>
      </persistence>




      some important class:


      WEB-INF/classes/by/giava/producer/EmProducer.java:


      package by.giava.producer;
      
      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.PersistenceContext;
      
      import org.jboss.seam.solder.core.ExtensionManaged;
      
      @ApplicationScoped
      public class EmProducer implements Serializable {
      
           private static final long serialVersionUID = 1L;
      
           @ExtensionManaged
           @Produces
           @PersistenceContext(unitName = "pu")
           @Dependent
           EntityManagerFactory em;
      
           public EmProducer() {
                System.out.println("start em producer");
           }
      
      }




      WEB-INF/classes/by/giava/repository/ConfigurationSession.java


      package by.giava.repository;
      
      import java.io.Serializable;
      
      import javax.enterprise.context.RequestScoped;
      import javax.inject.Inject;
      import javax.inject.Named;
      import javax.persistence.EntityManager;
      
      import org.jboss.seam.transaction.TransactionPropagation;
      import org.jboss.seam.transaction.Transactional;
      
      import by.giava.model.Configuration;
      
      @Named
      @RequestScoped
      public class ConfigurationSession implements Serializable {
      
           private static final long serialVersionUID = 1L;
      
           @Inject
           EntityManager em;
      
           public ConfigurationSession() {
                System.out.println("start configurationSession");
           }
      
           @Transactional(TransactionPropagation.REQUIRED)
           public Configuration readConfiguration() {
                Configuration c = null;
                try {
                     c = getEm().find(Configuration.class, 1L);
                } catch (Exception e) {
                     e.printStackTrace();
                }
                if (c == null) {
                     c = new Configuration();
                     getEm().persist(c);
                }
                return c;
           }
      
           public EntityManager getEm() {
                return em;
           }
      
           public void setEm(EntityManager em) {
                this.em = em;
           }
      }



      Log files.


      catalina.out:



      4-apr-2011 23.27.11 org.apache.catalina.startup.HostConfig deployWAR
      INFO: Deploying web application archive test-persistence1.war
      4-apr-2011 23.27.15 org.jboss.weld.bootstrap.WeldBootstrap <clinit>
      INFO: WELD-000900 1.1.0 (Final)
      4-apr-2011 23.27.15 org.jboss.weld.bootstrap.WeldBootstrap startContainer
      INFO: WELD-000101 Transactional services not available. Injection of @Inject UserTransaction not available. Transactional observers will be invoked synchronously.
      4-apr-2011 23.27.15 org.jboss.seam.solder.core.VersionLoggerUtil logVersionInformation
      INFO: Seam Solder 3.0.0.Final (build id: 3.0.0.Final)
      4-apr-2011 23.27.15 org.jboss.seam.config.xml.bootstrap.XmlConfigExtension beforeBeanDiscovery
      INFO: Seam Config XML provider starting...
      4-apr-2011 23.27.15 org.jboss.seam.config.xml.bootstrap.XmlConfigExtension getDocumentProviders
      INFO: Loading XmlDocumentProvider: org.jboss.seam.config.xml.bootstrap.ResourceLoaderXmlDocumentProvider
      4-apr-2011 23.27.15 org.jboss.seam.config.xml.bootstrap.XmlConfigExtension beforeBeanDiscovery
      INFO: Reading XML file: jar:file:/usr/tomcat/apache-tomcat-7.0.8/webapps/test-persistence1/WEB-INF/lib/seam-catch-3.0.0.Final.jar!/META-INF/beans.xml
      4-apr-2011 23.27.15 org.jboss.seam.config.xml.bootstrap.XmlConfigExtension beforeBeanDiscovery
      INFO: Reading XML file: jar:file:/usr/tomcat/apache-tomcat-7.0.8/webapps/test-persistence1/WEB-INF/lib/seam-servlet-3.0.0.Final.jar!/META-INF/beans.xml
      4-apr-2011 23.27.15 org.jboss.seam.config.xml.bootstrap.XmlConfigExtension beforeBeanDiscovery
      INFO: Reading XML file: jar:file:/usr/tomcat/apache-tomcat-7.0.8/webapps/test-persistence1/WEB-INF/lib/seam-international-3.0.0.Final.jar!/META-INF/beans.xml
      4-apr-2011 23.27.15 org.jboss.seam.config.xml.bootstrap.XmlConfigExtension beforeBeanDiscovery
      INFO: Reading XML file: jar:file:/usr/tomcat/apache-tomcat-7.0.8/webapps/test-persistence1/WEB-INF/lib/seam-solder-3.0.0.Final.jar!/META-INF/beans.xml
      4-apr-2011 23.27.15 org.jboss.weld.environment.servlet.Listener contextInitialized
      INFO: Tomcat 7 detected, CDI injection will be available in Servlets and Filters. Injection into Listeners is not supported
      4-apr-2011 23.27.16 org.jboss.seam.solder.core.CoreExtension processAnnotatedType
      INFO: Preventing class org.jboss.seam.transaction.UTTransaction from being installed as bean due to @Veto annotation
      4-apr-2011 23.27.16 org.jboss.seam.solder.core.CoreExtension processAnnotatedType
      INFO: Preventing class org.jboss.seam.servlet.http.HttpServletRequestContext from being installed as bean due to @Veto annotation
      4-apr-2011 23.27.16 org.jboss.seam.solder.core.CoreExtension processAnnotatedType
      INFO: Preventing class org.jboss.seam.solder.core.VersionLoggerUtil from being installed as bean due to @Veto annotation
      4-apr-2011 23.27.16 org.jboss.seam.solder.core.CoreExtension processAnnotatedType
      INFO: Preventing class org.jboss.seam.transaction.EntityTransaction from being installed as bean due to @Veto annotation
      4-apr-2011 23.27.16 org.jboss.seam.solder.core.CoreExtension processAnnotatedType
      INFO: Preventing class org.jboss.seam.solder.resourceLoader.ResourceProvider from being installed as bean due to @Veto annotation
      4-apr-2011 23.27.16 org.jboss.seam.solder.core.CoreExtension processAnnotatedType
      INFO: Preventing class org.jboss.seam.transaction.SeSynchronizations from being installed as bean due to @Veto annotation
      4-apr-2011 23.27.16 org.jboss.seam.solder.core.CoreExtension processAnnotatedType
      INFO: Preventing class org.jboss.seam.international.locale.LocaleConfiguration from being installed as bean due to @Veto annotation
      4-apr-2011 23.27.16 org.jboss.seam.solder.core.CoreExtension processAnnotatedType
      INFO: Preventing class org.jboss.seam.persistence.HibernatePersistenceProvider from being installed as bean due to @Veto annotation
      4-apr-2011 23.27.16 org.jboss.seam.solder.core.CoreExtension processAnnotatedType
      INFO: Preventing class org.jboss.seam.servlet.ServletRequestContext from being installed as bean due to @Veto annotation
      4-apr-2011 23.27.16 org.jboss.seam.solder.core.CoreExtension processAnnotatedType
      INFO: Preventing class org.jboss.seam.persistence.hibernate.HibernateManagedSessionExtensionImpl from being installed as bean due to @Veto annotation
      4-apr-2011 23.27.16 org.jboss.seam.solder.core.CoreExtension processAnnotatedType
      INFO: Preventing class org.jboss.seam.transaction.NoTransaction from being installed as bean due to @Veto annotation
      4-apr-2011 23.27.16 org.jboss.seam.solder.core.CoreExtension processAnnotatedType
      INFO: Preventing class org.jboss.seam.transaction.HibernateTransaction from being installed as bean due to @Veto annotation
      4-apr-2011 23.27.16 org.jboss.interceptor.util.InterceptionTypeRegistry <clinit>
      AVVERTENZA: Class 'javax.ejb.PostActivate' not found, interception based on it is not enabled
      4-apr-2011 23.27.16 org.jboss.interceptor.util.InterceptionTypeRegistry <clinit>
      AVVERTENZA: Class 'javax.ejb.PrePassivate' not found, interception based on it is not enabled
      4-apr-2011 23.27.17 org.jboss.seam.international.status.TypedStatusMessageBundleExtension detectBundleInjectionTargets
      INFO: Add @MessageBundle to org.jboss.seam.solder.reflection.annotated.AnnotationBuilder.messages injection point for the type: org.jboss.seam.solder.support.SolderMessages
      4-apr-2011 23.27.17 org.jboss.seam.international.status.TypedStatusMessageBundleExtension detectBundleInjectionTargets
      INFO: Add @MessageBundle to org.jboss.seam.solder.reflection.annotated.AnnotatedTypeBuilder.messages injection point for the type: org.jboss.seam.solder.support.SolderMessages
      4-apr-2011 23.27.17 com.sun.faces.config.ConfigureListener contextInitialized
      INFO: Initializing Mojarra 2.0.4 (FCS b09) for context '/test-persistence1'
      4-apr-2011 23.27.17 com.sun.faces.spi.InjectionProviderFactory createInstance
      INFO: JSF1048: PostConstruct/PreDestroy annotations present.  ManagedBeans methods marked with these annotations will have said annotations processed.
      4-apr-2011 23.27.17 org.apache.catalina.core.StandardContext startInternal
      GRAVE: Error listenerStart
      4-apr-2011 23.27.17 org.apache.catalina.core.StandardContext startInternal
      GRAVE: Context [/test-persistence1] startup failed due to previous errors






      localhost.log




      4-apr-2011 23.27.17 org.apache.catalina.core.StandardContext listenerStart
      GRAVE: Exception sending context initialized event to listener instance of class 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] @Inject by.giava.repository.ConfigurationSession.em]
           at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:305)
           at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:139)
           at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:162)
           at org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:385)
           at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:371)
           at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:390)
           at org.jboss.weld.environment.servlet.Listener.contextInitialized(Listener.java:270)
           at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4600)
           at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5097)
           at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5092)
           at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
           at java.util.concurrent.FutureTask.run(FutureTask.java:138)
           at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
           at java.lang.Thread.run(Thread.java:662)



      What is my wrong in my code?


      Thanks in advance


      Fiorenzo

        • 1. Re: seam persistence3 tomcat-7.0.8
          MIklos Piklos Newbie

          That is very very outdated.
          You should use  seam 3 persistence module


          Here is a bit outdated how-to.




          One note though: the annotation @SeamManaged should be changed to @ExtensionManaged.

          • 2. Re: seam persistence3 tomcat-7.0.8
            MIklos Piklos Newbie

            Forget about my post i should have read first what you wrote. Sorry.

            • 3. Re: seam persistence3 tomcat-7.0.8
              fiorenzo pizza Newbie

              Some updates:


              with latest weld 1.1.1.Final



                             <dependency>
                             <groupId>org.jboss.weld</groupId>
                             <artifactId>weld-api</artifactId>
                             <version>1.1.Final</version>
                        </dependency>
              
                        <dependency>
                             <groupId>org.jboss.weld</groupId>
                             <artifactId>weld-core</artifactId>
                             <!-- version>1.1.0.Final</version -->
                             <version>1.1.1.Final</version>
                        </dependency>
                        <dependency>
                             <groupId>org.jboss.weld.servlet</groupId>
                             <artifactId>weld-servlet</artifactId>
                             <!-- version>1.1.0.Final</version -->
                             <version>1.1.1.Final</version>
                        </dependency>



              in tomcat 7.0.11 i have a new error: java.lang.NoClassDefFoundError: org/apache/AnnotationProcessor!


              localhost.log:



              GRAVE: Exception sending context initialized event to listener instance of class org.jboss.weld.environment.servlet.Listener
              java.lang.NoClassDefFoundError: org/apache/AnnotationProcessor
                      at java.lang.ClassLoader.defineClass1(Native Method)
                      at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
                      at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
                      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
                      at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2818)
                      at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1148)
                      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1643)
                      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521)
                      at java.lang.ClassLoader.defineClass1(Native Method)
                      at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
                      at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
                      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
                      at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2818)
                      at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1148)
                      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1643)
                      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521)
                      at org.jboss.weld.environment.tomcat.Tomcat6Container.initialize(Tomcat6Container.java:47)
                      at org.jboss.weld.environment.servlet.Listener.contextInitialized(Listener.java:184)
                      at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4681)
                      at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5184)
                      at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5179)
                      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
                      at java.util.concurrent.FutureTask.run(FutureTask.java:138)
                      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
                      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
                      at java.lang.Thread.run(Thread.java:662)
              Caused by: java.lang.ClassNotFoundException: org.apache.AnnotationProcessor
                      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1676)
                      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521)
                      ... 26 more




              in tomcat 6.0.26:


              localhost.log:



              5-apr-2011 19.17.22 org.apache.catalina.core.StandardContext listenerStart
              GRAVE: Exception sending context initialized event to listener instance of class 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] @Inject by.giava.repository.ConfigurationSession.em]
                   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:396)
                   at org.jboss.weld.environment.servlet.Listener.contextInitialized(Listener.java:205)
                   at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3972)
                   at org.apache.catalina.core.StandardContext.start(StandardContext.java:4467)
                   at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
                   at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
                   at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
                   at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:905)
                   at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:740)
                   at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:500)
                   at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1345)
                   at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:303)




              • 4. Re: seam persistence3 tomcat-7.0.8
                fiorenzo pizza Newbie

                last update!


                using this comment
                My Link



                and adding this file WEB-INF/classes/META-INF/services/org.jboss.weld.environment.Container



                org.jboss.weld.environment.tomcat7.Tomcat7Container




                i have the same error:




                5-apr-2011 22.17.56 org.apache.catalina.core.StandardContext listenerStart
                GRAVE: Exception sending context initialized event to listener instance of class 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] @Inject by.giava.repository.ConfigurationSession.em]
                     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:396)
                     at org.jboss.weld.environment.servlet.Listener.contextInitialized(Listener.java:205)
                     at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4681)
                     at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5184)
                     at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5179)
                     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
                     at java.util.concurrent.FutureTask.run(FutureTask.java:138)
                     at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
                     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
                     at java.lang.Thread.run(Thread.java:662)



                my search continues ..

                • 5. Re: seam persistence3 tomcat-7.0.8
                  MIklos Piklos Newbie

                  In my experience the dependency on hibernate-core is making the org/apache/AnnotationProcessor exception. Try removing the reference to hibernate-core, and hibernate annotations, and see where that leads you with tomcat 7.


                  In Tomcat 6.0.26 you got the exception because you didn't add:




                  <listener>
                       <listener-class>org.jboss.seam.solder.resourceLoader.servlet.ResourceListener</listener-class>
                  </listener>



                  That should lead you one step ahead.


                  I got all that working with a nasty hack.
                  Read about it here

                  • 6. Re: seam persistence3 tomcat-7.0.8
                    fiorenzo pizza Newbie

                    miklos piklos wrote on Apr 05, 2011 17:11:


                    In my experience the dependency on hibernate-core is making the org/apache/AnnotationProcessor exception. Try removing the reference to hibernate-core, and hibernate annotations, and see where that leads you with tomcat 7.

                    In Tomcat 6.0.26 you got the exception because you didn't add:



                    <listener>
                         <listener-class>org.jboss.seam.solder.resourceLoader.servlet.ResourceListener</listener-class>
                    </listener>



                    That should lead you one step ahead.

                    I got all that working with a nasty hack.
                    Read about it here




                    Also if i add org.jboss.seam.solder.resourceLoader.servlet.ResourceListener my error don't change:


                    WELD-001408 Unsatisfied dependencies for type [EntityManager]




                    Can you post your code?

                    • 7. Re: seam persistence3 tomcat-7.0.8
                      MIklos Piklos Newbie

                      Here is a link in my dropbox. I hope it helps at least a little bit.

                      • 8. Re: seam persistence3 tomcat-7.0.8
                        MIklos Piklos Newbie

                        PS just type mvn tomcat:run and it should work.
                        Cheers

                        • 9. Re: seam persistence3 tomcat-7.0.8
                          fiorenzo pizza Newbie

                          Very Very Very stupid error!!!


                          I used


                          @PersistenceContext(unitName = "pu")



                          instead of


                          @PersistenceUnit(unitName = "pu")



                          My complete example code:


                          https://giava.googlecode.com/svn/trunk/tom-flower1



                          I hope it is useful to someone...



                          fiorenzo

                          • 10. Re: seam persistence3 tomcat-7.0.8
                            Thai Dang Vu Apprentice

                            Thanks, Fiorenzo and Miklos. Please do not remove your example from your dropbox and do not remove the example on googlecode because I'll look at them later.

                            • 11. Re: seam persistence3 tomcat-7.0.8
                              Lucas Ventura Carro Newbie

                              fiorenzo pizza wrote on Apr 05, 2011 19:24:


                              My complete example code:

                              https://giava.googlecode.com/svn/trunk/tom-flower1


                              I hope it is useful to someone...


                              fiorenzo

                              Yes! It has been really useful for me. Thanks a lot :D