7 Replies Latest reply on Feb 24, 2012 1:09 AM by Jason Porter

    Can any one Help in Hibernate session  in seam 3 with CDI

    chinna raja Newbie

      Hi  Guys ..

       

       

      i m using jboss 7 with eclipse , ant build  with eclipse indigo , i want to configure Hibernate Session in my project ,,

       

      so i modified my Pages called  persisitant.xml

       

       

      persisitant.xml

      -----------------------

      <?xml version="1.0" encoding="UTF-8"?>

      <persistence version="2.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_2_0.xsd">

           <persistence-unit name="JBossPU" transaction-type="JTA">

              <provider>org.hibernate.ejb.HibernatePersistence</provider>

              <jta-data-source>java:jboss/datasources/MySqlDS</jta-data-source>

              <properties>

                  <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />          

                  <property name="hibernate.transaction.manager_lookup_class"

                      value="org.hibernate.transaction.JBossTransactionManagerLookup" />

                  <property name="hibernate.archive.autodetection" value="class" />

                  <property name="hibernate.hbm2ddl.auto" value="update"/>

                   <property name="hibernate.current_session_context_class" value="managed"></property>

                     <property name="hibernate.jdbc.batch_size" value="30"></property>

                    <property name="hibernate.connection.autocommit" value="false"></property>

              </properties>

          </persistence-unit></persistence>

       

      Beans.xml

      -------------------

      <?xml version="1.0" encoding="UTF-8"?>

      <!-- The contents of this file is permitted to be empty. The schema definition

          is provided for your convenience. -->

      <beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

          xmlns:plidm="urn:java:org.jboss.seam.security.management.picketlink"

          xmlns:security="urn:java:org.jboss.seam.security.permission" xmlns:s="urn:java:ee"

          xsi:schemaLocation="

            http://java.sun.com/xml/ns/javaee

            http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">

       

          <interceptors>

              <class>org.jboss.seam.security.extension.SecurityInterceptor</class>

       

              <class>org.jboss.seam.transaction.TransactionInterceptor</class>

          </interceptors>

       

          <alternatives>

              <class>com.ids.jpms.authorization.CustomCredentials</class>

          </alternatives>

       

      </beans>

       

      SeamManagedSessionFactoryProducer.java

      --------------------------------------------------------------

      package com.ids.jpms.authorization;

       

      import javax.enterprise.context.ConversationScoped;

      import javax.enterprise.inject.Produces;

      import javax.persistence.EntityManagerFactory;

      import javax.persistence.PersistenceUnit;

       

      import org.jboss.seam.solder.core.ExtensionManaged;

       

      public class SeamManagedSessionFactoryProducer {

           @ExtensionManaged

           @Produces

           @PersistenceUnit

           @ConversationScoped

           private EntityManagerFactory entityManagerFactory;

       

      }

       

      still i am getting this error  please see this console---->

       

      Error:

      ---------

       

       

      javax.enterprise.event.ObserverException

          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

          at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)

          at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)

          at java.lang.reflect.Constructor.newInstance(Constructor.java:513)

          at java.lang.Class.newInstance0(Class.java:355)

          at java.lang.Class.newInstance(Class.java:308)

          at org.jboss.weld.util.reflection.SecureReflections$16.work(SecureReflections.java:395)

          at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54)

          at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInstantiation(SecureReflectionAccess.java:216)

          at org.jboss.weld.util.reflection.SecureReflections.newInstance(SecureReflections.java:390)

          at org.jboss.weld.injection.Exceptions.rethrowException(Exceptions.java:40)

          at org.jboss.weld.injection.Exceptions.rethrowException(Exceptions.java:92)

          at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:214)

          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:106)

          at org.jboss.weld.bootstrap.BeanDeployer.addClasses(BeanDeployer.java:133)

          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.run(ServiceControllerImpl.java:1765)

          at org.jboss.msc.service.ServiceControllerImpl$ClearTCCLTask.run(ServiceControllerImpl.java:2291)

          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:619)

      Caused by: java.lang.NoClassDefFoundError: org/apache/lucene/search/Query

          at java.lang.Class.getDeclaredMethods0(Native Method)

          at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)

          at java.lang.Class.privateGetPublicMethods(Class.java:2547)

          at java.lang.Class.getMethods(Class.java:1410)

          at sun.misc.ProxyGenerator.generateClassFile(ProxyGenerator.java:409)

          at sun.misc.ProxyGenerator.generateProxyClass(ProxyGenerator.java:306)

          at java.lang.reflect.Proxy.getProxyClass(Proxy.java:501)

          at org.jboss.seam.persistence.ManagedPersistenceContextBeanLifecycle.<init>(ManagedPersistenceContextBeanLifecycle.java:80)

          at org.jboss.seam.persistence.ManagedPersistenceContextExtension.registerManagedPersistenceContext(ManagedPersistenceContextExtension.java:273)

          at org.jboss.seam.persistence.ManagedPersistenceContextExtension.processAnnotatedType(ManagedPersistenceContextExtension.java:180)

          at sun.reflect.GeneratedMethodAccessor9.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)

          ... 19 more

        • 1. Re: Can any one Help in Hibernate session  in seam 3 with CDI
          zeeman Novice

          lucene jar is missing from the class path. Do mvn dependency:tree from the root folder of your project. Find what requires Lucene and either exclude Lucene if you don't need it or add it.

           

          If you're using Hibernate search you'll need Lucene.

          • 2. Re: Can any one Help in Hibernate session  in seam 3 with CDI
            Jason Porter Master

            Is this an INFO / WARNING or an actual exception that stops your app from deploying?

            • 3. Re: Can any one Help in Hibernate session  in seam 3 with CDI
              chinna raja Newbie

              This is an error that stops me while deploying .... if i remove SeamManagedSessionFactoryProducer.java its works fine .. if not showing the above error

              • 4. Re: Can any one Help in Hibernate session  in seam 3 with CDI
                Jason Porter Master

                Wow. I haven't seen this actually stop a deployment before.

                • 5. Re: Can any one Help in Hibernate session  in seam 3 with CDI
                  chinna raja Newbie

                  Hi guys

                   

                  The above error has been resolved  by adding the required jar  that Thanks ....but while loading the application i am getiing this error ..can u tel me why ??????

                   

                  Error :

                  ---------

                  [org.jboss.web] (MSC service thread 1-2) registering web context: /JPMS

                  12:25:48,687 INFO  [org.jboss.as.server.controller] (DeploymentScanner-threads - 2) Deployed "JPMSEAR.ear"

                  12:25:59,171 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/JPMS].[Faces Servlet]] (http--127.0.0.1-8080-1) Servlet.service() for servlet Faces Servlet threw exception: java.lang.RuntimeException: Can't find a deployment unit named  at subdeployment "JPMS.war" of deployment "JPMSEAR.ear"

                      at org.jboss.as.weld.services.bootstrap.WeldJpaInjectionServices.getScopedPUName(WeldJpaInjectionServices.java:96) [jboss-as-weld-7.0.0.Final.jar:7.0.0.Final]

                      at org.jboss.as.weld.services.bootstrap.WeldJpaInjectionServices.resolvePersistenceUnit(WeldJpaInjectionServices.java:78) [jboss-as-weld-7.0.0.Final.jar:7.0.0.Final]

                      at org.jboss.weld.util.Beans.injectEEFields(Beans.java:789) [weld-core-1.1.2.AS7.jar:2011-07-06 12:26]

                      at org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget$1$1.proceed(ManagedBean.java:181) [weld-core-1.1.2.AS7.jar:2011-07-06 12:26]

                      at org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:54) [weld-core-1.1.2.AS7.jar:2011-07-06 12:26]

                      at org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget$1.work(ManagedBean.java:176) [weld-core-1.1.2.AS7.jar:2011-07-06 12:26]

                      at org.jboss.weld.bean.ManagedBean$FixInjectionPoint.run(ManagedBean.java:142) [weld-core-1.1.2.AS7.jar:2011-07-06 12:26]

                      at org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget.inject(ManagedBean.java:170) [weld-core-1.1.2.AS7.jar:2011-07-06 12:26]

                      at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:339) [weld-core-1.1.2.AS7.jar:2011-07-06 12:26]

                      at org.jboss.weld.context.unbound.DependentContextImpl.get(DependentContextImpl.java:67) [weld-core-1.1.2.AS7.jar:2011-07-06 12:26]

                      at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:693) [weld-core-1.1.2.AS7.jar:2011-07-06 12:26]

                      at org.jboss.weld.bean.AbstractReceiverBean.getReceiver(AbstractReceiverBean.java:84) [weld-core-1.1.2.AS7.jar:2011-07-06 12:26]

                      at org.jboss.weld.bean.ProducerField$1.produce(ProducerField.java:134) [weld-core-1.1.2.AS7.jar:2011-07-06 12:26]

                      at org.jboss.weld.bean.AbstractProducerBean.create(AbstractProducerBean.java:361) [weld-core-1.1.2.AS7.jar:2011-07-06 12:26]

                      at org.jboss.weld.bean.builtin.ee.EEResourceProducerField.createUnderlying(EEResourceProducerField.java:170) [weld-core-1.1.2.AS7.jar:2011-07-06 12:26]

                      at org.jboss.weld.bean.builtin.ee.EEResourceProducerField.access$000(EEResourceProducerField.java:54) [weld-core-1.1.2.AS7.jar:2011-07-06 12:26]

                      at org.jboss.weld.bean.builtin.ee.EEResourceProducerField$EEResourceCallable.call(EEResourceProducerField.java:80) [weld-core-1.1.2.AS7.jar:2011-07-06 12:26]

                      at org.jboss.weld.bean.builtin.CallableMethodHandler.invoke(CallableMethodHandler.java:50) [weld-core-1.1.2.AS7.jar:2011-07-06 12:26]

                      at org.jboss.weld.bean.proxy.EnterpriseTargetBeanInstance.invoke(EnterpriseTargetBeanInstance.java:62) [weld-core-1.1.2.AS7.jar:2011-07-06 12:26]

                      at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:125) [weld-core-1.1.2.AS7.jar:2011-07-06 12:26]

                      at org.jboss.weldx.persistence.EntityManagerFactory$-1180863918$Proxy$_$$_Weld$Proxy$.createEntityManager(EntityManagerFactory$-1180863918$Proxy$_$$_Weld$Proxy$.java) [weld-core-1.1.2.AS7.jar:]

                      at org.jboss.seam.persistence.ManagedPersistenceContextBeanLifecycle.create(ManagedPersistenceContextBeanLifecycle.java:105) [seam-persistence-3.0.0.Final.jar:]

                      at org.jboss.seam.persistence.ManagedPersistenceContextBeanLifecycle.create(ManagedPersistenceContextBeanLifecycle.java:46) [seam-persistence-3.0.0.Final.jar:]

                      at org.jboss.seam.solder.bean.ImmutableBean.create(ImmutableBean.java:87) [seam-solder-3.0.0.Final.jar:]

                      at org.jboss.weld.context.AbstractContext.get(AbstractContext.java:122) [weld-core-1.1.2.AS7.jar:2011-07-06 12:26]

                      at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:99) [weld-core-1.1.2.AS7.jar:2011-07-06 12:26]

                      at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:124) [weld-core-1.1.2.AS7.jar:2011-07-06 12:26]

                      at org.jboss.weld.proxies.EntityManager$FullTextEntityManager$ManagedPersistenceContext$1178990079$Proxy$_$$_WeldClientProxy.getQualifiers(EntityManager$FullTextEntityManager$ManagedPersistenceContext$1178990079$Proxy$_$$_WeldClientProxy.java) [weld-core-1.1.2.AS7.jar:]

                      at org.jboss.seam.persistence.PersistenceContextsImpl.beforeRender(PersistenceContextsImpl.java:142) [seam-persistence-3.0.0.Final.jar:]

                      at org.jboss.seam.persistence.PersistenceContextsImpl$Proxy$_$$_WeldClientProxy.beforeRender(PersistenceContextsImpl$Proxy$_$$_WeldClientProxy.java) [seam-persistence-3.0.0.Final.jar:]

                      at org.jboss.seam.faces.transaction.TransactionPhaseListener.handleTransactionsBeforePhase(TransactionPhaseListener.java:78) [seam-faces-3.0.2.Final.jar:]

                      at org.jboss.seam.faces.transaction.TransactionPhaseListener.beforePhase(TransactionPhaseListener.java:64) [seam-faces-3.0.2.Final.jar:]

                      at org.jboss.seam.faces.event.DelegatingPhaseListener.beforePhase(DelegatingPhaseListener.java:43) [seam-faces-3.0.2.Final.jar:]

                      at com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:228) [jsf-impl-2.0.4-b09-jbossorg-4.jar:2.0.4-b09-jbossorg-4]

                      at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:99) [jsf-impl-2.0.4-b09-jbossorg-4.jar:2.0.4-b09-jbossorg-4]

                      at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) [jsf-impl-2.0.4-b09-jbossorg-4.jar:2.0.4-b09-jbossorg-4]

                      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:313) [jboss-jsf-api_2.0_spec-1.0.0.Final.jar:1.0.0.Final]

                      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]

                      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]

                      at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:67) [weld-core-1.1.2.AS7.jar:2011-07-06 12:26]

                      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]

                      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]

                      at org.jboss.seam.servlet.exception.CatchExceptionFilter.doFilter(CatchExceptionFilter.java:65) [seam-servlet-3.0.0.Final.jar:]

                      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]

                      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]

                      at org.jboss.seam.servlet.event.ServletEventBridgeFilter.doFilter(ServletEventBridgeFilter.java:72) [seam-servlet-3.0.0.Final.jar:]

                      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]

                      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]

                      at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:115) [prettyfaces-jsf2.jar:]

                      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]

                      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]

                      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]

                      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]

                      at org.jboss.as.web.NamingValve.invoke(NamingValve.java:57) [jboss-as-web-7.0.0.Final.jar:7.0.0.Final]

                      at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:49) [jboss-as-jpa-7.0.0.Final.jar:7.0.0.Final]

                      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:154) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]

                      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]

                      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]

                      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]

                      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]

                      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:667) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]

                      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:951) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]

                      at java.lang.Thread.run(Thread.java:619) [:1.6.0_14]

                  • 6. Re: Can any one Help in Hibernate session  in seam 3 with CDI
                    chinna raja Newbie

                    Please Any one can reply  for this post .... i need a solution ....

                    • 7. Re: Can any one Help in Hibernate session  in seam 3 with CDI
                      Jason Porter Master

                      Sounds like you're missing the war component in your ear that has been declared.