1 Reply Latest reply on Dec 21, 2011 1:24 AM by Jason Porter

    how can i build a correct weld+seam3+hibernate3+jpa development enviroment?

    mi haisheng Newbie
      i want to build a development enviroment in eclipse-indigo,include weld,seam3,hibernate3,jpa.
       
        the configuration is below:
        1.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/maven-v4_0_0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <groupId>mydept</groupId>
        <artifactId>testprog</artifactId>
        <packaging>war</packaging>
        <version>0.0.1-SNAPSHOT</version>
        <name>testprog Maven Webapp</name>
        <url>http://maven.apache.org</url>
        <dependencies>
          <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
          </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.4.Final</version>
      </dependency>
      <dependency>
              <groupId>org.jboss.weld.servlet</groupId>
              <artifactId>weld-servlet</artifactId>
              <version>1.1.4.Final</version>
      </dependency>
             
             
              <dependency>
               <groupId>javax.enterprise</groupId>
               <artifactId>cdi-api</artifactId>
               <scope>provided</scope>
               <version>1.0</version>
          </dependency>
      <dependency>
              <groupId>jboss</groupId>
              <artifactId>jboss-j2ee</artifactId>
              <version>4.2.2.GA</version>
      </dependency>
          <dependency>
               <groupId>org.jboss.seam.remoting</groupId>
               <artifactId>seam-remoting</artifactId>
               <version>3.0.0.Final</version>
          </dependency>
          <dependency>
                      <groupId>mysql</groupId>
                      <artifactId>mysql-connector-java</artifactId>
                      <version>5.0.5</version>
              </dependency>
              <dependency>
               <groupId>org.jboss.seam.persistence</groupId>
               <artifactId>seam-persistence</artifactId>
               <version>3.0.0.Final</version>
            </dependency>
            <dependency>
               <groupId>org.jboss.seam.solder</groupId>
               <artifactId>seam-solder</artifactId>
               <version>3.0.0.Final</version>
            </dependency>
            <dependency>
               <groupId>org.jboss.seam.xml</groupId>
               <artifactId>seam-xml-config</artifactId>
               <version>3.0.0.Alpha2</version>
            </dependency>
            <dependency>
               <groupId>org.hibernate.javax.persistence</groupId>
               <artifactId>hibernate-jpa-2.0-api</artifactId>
               <scope>provided</scope>
               <version>1.0.0.Final</version>
            </dependency>
          
               <dependency>
                  <groupId>org.hibernate</groupId>
                  <artifactId>hibernate-core</artifactId>
                  <version>3.6.8.Final</version>
           </dependency>

              <dependency>
                      <groupId>org.hibernate</groupId>
                      <artifactId>hibernate-annotations</artifactId>
                      <version>3.5.6-Final</version>
              </dependency>


      <dependency>
              <groupId>org.hibernate</groupId>
              <artifactId>hibernate-commons-annotations</artifactId>
              <version>3.2.0.Final</version>
      </dependency>
                 
      <dependency>
              <groupId>commons-collections</groupId>
              <artifactId>commons-collections</artifactId>
              <version>3.2.1</version>
      </dependency>
                 

        </dependencies>
        <build>
          <finalName>testprog</finalName>

        </build>
      <repositories>
           <repository>
             <id>Ibiblio</id>
             <name>Ibiblio</name>
             <url>http://repository.atlassian.com/maven2</url>
           </repository>
         </repositories>
      </project>


      --------------------------
        2.persistence.xml
      --------------------------
      <?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="biz"  transaction-type="JTA">
          <provider>org.hibernate.ejb.HibernatePersistence</provider>
              <properties>
                  <!-- Properties for Hibernate (default provider for JBoss AS) -->
                  <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
                     <property name="hibernate.connection.username" value="root" />
                                      <property name="hibernate.connection.password" value="root" />
                                      <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver" />
                                      <property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/testdb?useUnicode=true&amp;characterEncoding=UTF-8" />
                  <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
                  <property name="hibernate.show_sql" value="true"/>
                  <!-- Only format when you need to debug, because it slows things down -->
                  <property name="hibernate.format_sql" value="false"/>
                  <property name="hibernate.show_sql" value="false" />
              </properties>
          </persistence-unit>
      </persistence>
      ----------------------
         3.bean.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:p="urn:java:org.jboss.seam.transaction"
         xmlns:s="urn:java:ee"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
            http://jboss.org/schema/cdi/beans_1_0.xsd">
        
         <p:SeSynchronizations>
           <s:modifies/>
         </p:SeSynchronizations>

      </beans>
      -----------------------
         4.web.xml
      -----------------------
      <!DOCTYPE web-app PUBLIC
      "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
      "http://java.sun.com/dtd/web-app_2_3.dtd" >
      <web-app>
        <display-name>Archetype Created Web Application</display-name>
        <listener>
            <listener-class>org.jboss.weld.environment.servlet.Listener</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>
      </web-app>
      ------------------------
        5.jboss-deployment-structure.xml
      ------------------------
      <jboss-deployment-structure>
      <deployment>
      <dependencies>
      <module name="org.dom4j" />
      </dependencies>
      </deployment>
      </jboss-deployment-structure>
      -------------------------------
        
         i use [mvn dependency:tree],[mvn clean package] commend, then get a "testprog.war".then copy to standalone/deployments.

        jboss-as7.0.2.final show erro message:
      -------------------------------
      13:15:27,203 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC00001: Failed to start service jboss.deployment.unit."testprog.war".WeldService: org.jboss.msc.service.StartException in service jboss.deployment.unit."testprog.war".WeldService: org.jboss.weld.exceptions.DefinitionException: Exception List with 1 exceptions:
      Exception 0 :
      java.lang.NullPointerException
              at org.jboss.weld.extensions.core.CoreExtension.processAnnotatedType(CoreExtension.java:81)
              at sun.reflect.GeneratedMethodAccessor11.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:305)
              at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54)
              at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:163)
              at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:299)
              at org.jboss.weld.introspector.jlr.WeldMethodImpl.invokeOnInstance(WeldMethodImpl.java:188)
              at org.jboss.weld.introspector.ForwardingWeldMethod.invokeOnInstance(ForwardingWeldMethod.java:59)
              at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:198)
              at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:282)
              at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:265)
              at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:234)
              at org.jboss.weld.manager.BeanManagerImpl.notifyObservers(BeanManagerImpl.java:635)
              at org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:622)
              at org.jboss.weld.bootstrap.events.AbstractContainerEvent.fire(AbstractContainerEvent.java:67)
              at org.jboss.weld.bootstrap.events.AbstractDefinitionContainerEvent.fire(AbstractDefinitionContainerEvent.java:42)
              at org.jboss.weld.bootstrap.events.ProcessAnnotatedTypeImpl.fire(ProcessAnnotatedTypeImpl.java:44)
              at org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:105)
              at org.jboss.weld.bootstrap.BeanDeployer.addClasses(BeanDeployer.java:134)
              at org.jboss.weld.bootstrap.BeanDeployment.createBeans(BeanDeployment.java:191)
              at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:368)
              at org.jboss.as.weld.WeldContainer.start(WeldContainer.java:81)
              at org.jboss.as.weld.services.WeldService.start(WeldService.java:89)
              at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824)
              at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759)
              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)

              at org.jboss.as.weld.services.WeldService.start(WeldService.java:96)
              at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
              at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
              at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_25]
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_25]
              at java.lang.Thread.run(Thread.java:662) [:1.6.0_25]
      Caused by: org.jboss.weld.exceptions.DefinitionException: Exception List with 1 exceptions:
      Exception 0 :
      java.lang.NullPointerException
              at org.jboss.weld.extensions.core.CoreExtension.processAnnotatedType(CoreExtension.java:81)
              at sun.reflect.GeneratedMethodAccessor11.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:305)
              at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54)
              at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:163)
              at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:299)
              at org.jboss.weld.introspector.jlr.WeldMethodImpl.invokeOnInstance(WeldMethodImpl.java:188)
              at org.jboss.weld.introspector.ForwardingWeldMethod.invokeOnInstance(ForwardingWeldMethod.java:59)
              at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:198)
              at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:282)
              at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:265)
              at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:234)
              at org.jboss.weld.manager.BeanManagerImpl.notifyObservers(BeanManagerImpl.java:635)
              at org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:622)
              at org.jboss.weld.bootstrap.events.AbstractContainerEvent.fire(AbstractContainerEvent.java:67)
              at org.jboss.weld.bootstrap.events.AbstractDefinitionContainerEvent.fire(AbstractDefinitionContainerEvent.java:42)
              at org.jboss.weld.bootstrap.events.ProcessAnnotatedTypeImpl.fire(ProcessAnnotatedTypeImpl.java:44)
              at org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:105)
              at org.jboss.weld.bootstrap.BeanDeployer.addClasses(BeanDeployer.java:134)
              at org.jboss.weld.bootstrap.BeanDeployment.createBeans(BeanDeployment.java:191)
              at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:368)
              at org.jboss.as.weld.WeldContainer.start(WeldContainer.java:81)
              at org.jboss.as.weld.services.WeldService.start(WeldService.java:89)
              at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824)
              at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759)
              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)

              at org.jboss.weld.bootstrap.events.AbstractDefinitionContainerEvent.fire(AbstractDefinitionContainerEvent.java:45)
              at org.jboss.weld.bootstrap.events.ProcessAnnotatedTypeImpl.fire(ProcessAnnotatedTypeImpl.java:44)
              at org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:105)
              at org.jboss.weld.bootstrap.BeanDeployer.addClasses(BeanDeployer.java:134)
              at org.jboss.weld.bootstrap.BeanDeployment.createBeans(BeanDeployment.java:191)
              at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:368)
              at org.jboss.as.weld.WeldContainer.start(WeldContainer.java:81)
              at org.jboss.as.weld.services.WeldService.start(WeldService.java:89)
              ... 5 more

      13:15:27,546 INFO  [org.jboss.as.server.controller] (DeploymentScanner-threads - 2) Deployment of "testprog.war" was rolled back with failure message {"Failed services" => {"jboss.deployment.unit.\"testprog.war\".WeldService" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"testprog.war\".WeldService: org.jboss.weld.exceptions.DefinitionException: Exception List with 1 exceptions:
      Exception 0 :
      java.lang.NullPointerException
              at org.jboss.weld.extensions.core.CoreExtension.processAnnotatedType(CoreExtension.java:81)
              at sun.reflect.GeneratedMethodAccessor11.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:305)
              at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54)
              at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:163)
              at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:299)
              at org.jboss.weld.introspector.jlr.WeldMethodImpl.invokeOnInstance(WeldMethodImpl.java:188)
              at org.jboss.weld.introspector.ForwardingWeldMethod.invokeOnInstance(ForwardingWeldMethod.java:59)
              at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:198)
              at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:282)
              at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:265)
              at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:234)
              at org.jboss.weld.manager.BeanManagerImpl.notifyObservers(BeanManagerImpl.java:635)
              at org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:622)
              at org.jboss.weld.bootstrap.events.AbstractContainerEvent.fire(AbstractContainerEvent.java:67)
              at org.jboss.weld.bootstrap.events.AbstractDefinitionContainerEvent.fire(AbstractDefinitionContainerEvent.java:42)
              at org.jboss.weld.bootstrap.events.ProcessAnnotatedTypeImpl.fire(ProcessAnnotatedTypeImpl.java:44)
              at org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:105)
              at org.jboss.weld.bootstrap.BeanDeployer.addClasses(BeanDeployer.java:134)
              at org.jboss.weld.bootstrap.BeanDeployment.createBeans(BeanDeployment.java:191)
              at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:368)
              at org.jboss.as.weld.WeldContainer.start(WeldContainer.java:81)
              at org.jboss.as.weld.services.WeldService.start(WeldService.java:89)
              at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824)
              at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759)
              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)
      "}}
      13:15:27,578 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) Stopped deployment testprog.war in 139ms
      13:15:27,593 ERROR [org.jboss.as.deployment] (DeploymentScanner-threads - 1) {"Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"Failed services" => {"jboss.deployment.unit.\"testprog.war\".WeldService" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"testprog.war\".WeldService: org.jboss.weld.exceptions.DefinitionException: Exception List with 1 exceptions:
      Exception 0 :
      java.lang.NullPointerException
              at org.jboss.weld.extensions.core.CoreExtension.processAnnotatedType(CoreExtension.java:81)
              at sun.reflect.GeneratedMethodAccessor11.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:305)
              at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54)
              at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:163)
              at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:299)
              at org.jboss.weld.introspector.jlr.WeldMethodImpl.invokeOnInstance(WeldMethodImpl.java:188)
              at org.jboss.weld.introspector.ForwardingWeldMethod.invokeOnInstance(ForwardingWeldMethod.java:59)
              at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:198)
              at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:282)
              at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:265)
              at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:234)
              at org.jboss.weld.manager.BeanManagerImpl.notifyObservers(BeanManagerImpl.java:635)
              at org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:622)
              at org.jboss.weld.bootstrap.events.AbstractContainerEvent.fire(AbstractContainerEvent.java:67)
              at org.jboss.weld.bootstrap.events.AbstractDefinitionContainerEvent.fire(AbstractDefinitionContainerEvent.java:42)
              at org.jboss.weld.bootstrap.events.ProcessAnnotatedTypeImpl.fire(ProcessAnnotatedTypeImpl.java:44)
              at org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:105)
              at org.jboss.weld.bootstrap.BeanDeployer.addClasses(BeanDeployer.java:134)
              at org.jboss.weld.bootstrap.BeanDeployment.createBeans(BeanDeployment.java:191)
              at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:368)
              at org.jboss.as.weld.WeldContainer.start(WeldContainer.java:81)
              at org.jboss.as.weld.services.WeldService.start(WeldService.java:89)
              at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824)
              at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759)
              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)
      "}}}}
      --------------------------------------
      help me ,thanks !!! im crazing!!!