8 Replies Latest reply on Jun 5, 2007 2:14 AM by Jere Malinen

    Problem with Hibernate

    Flavio Ferreira Newbie

      hi people!

      i do reverse engineering (mysql5) with 'seam generate-entities' and works with success, when I 'seam restart' builds OK too, but when the application runs I got this error related with Hibernate:

      ...
      --- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
      ObjectName: persistence.units:ear=helloworld.ear,jar=helloworld.jar,unitName=hel
      loworld
       State: FAILED
       Reason: javax.persistence.PersistenceException: org.hibernate.HibernateExcepti
      on: Hibernate Dialect must be explicitly set
       I Depend On:
       jboss.jca:service=DataSourceBinding,name=helloworldDatasource
      


      my seam-gen/build.properties seems to be OK:
      ...
      hibernate.connection.url=jdbc\:mysql\:///foo
      hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
      


      what am I missing ??!

      thanks in advance

        • 1. Re: Problem with Hibernate
          Pete Muir Master

          You need to post the exception (and full stack trace) that occurs earlier in startup

          • 2. Re: Problem with Hibernate
            Flavio Ferreira Newbie

            sure

            http://localhost:8080/helloworld/home.seam

            An Error Occurred:
            Cannot get value for expression '#{usuariosList.firstResult}'

            Stack trace:
            javax.faces.el.EvaluationException: Cannot get value for expression '#{usuariosList.firstResult}'
            at org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:402)
            at org.jboss.seam.core.Expressions$1.getValue(Expressions.java:53)
            at org.jboss.seam.pages.Param.getValueFromModel(Param.java:93)
            at org.jboss.seam.core.Pages.getPageParameterValue(Pages.java:414)
            at org.jboss.seam.core.Pages.getConvertedParameters(Pages.java:390)
            at org.jboss.seam.ui.HtmlLink.encodeBegin(HtmlLink.java:123)
            at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:242)
            at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:249)
            at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:573)
            at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
            at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
            at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:29)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
            at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:43)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
            at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
            at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
            at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
            at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
            at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
            at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
            at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
            at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
            at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
            at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
            at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
            at java.lang.Thread.run(Thread.java:595)
            Caused by: java.lang.IllegalArgumentException: EntityManagerFactory not found in JNDI
            at org.jboss.seam.core.ManagedPersistenceContext.getEntityManagerFactoryFromJndiOrValueBinding(ManagedPersistenceContext.java:159)
            at org.jboss.seam.core.ManagedPersistenceContext.initEntityManager(ManagedPersistenceContext.java:76)
            at org.jboss.seam.core.ManagedPersistenceContext.getEntityManager(ManagedPersistenceContext.java:100)
            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:585)
            at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
            at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:102)
            at org.jboss.seam.Component.callComponentMethod(Component.java:1835)
            at org.jboss.seam.Component.unwrap(Component.java:1861)
            at org.jboss.seam.Component.getInstance(Component.java:1683)
            at org.jboss.seam.Component.getInstance(Component.java:1636)
            at org.jboss.seam.Component.getInstance(Component.java:1630)
            at org.jboss.seam.framework.Controller.getComponentInstance(Controller.java:257)
            at org.jboss.seam.framework.PersistenceController.getPersistenceContext(PersistenceController.java:20)
            at org.jboss.seam.framework.EntityQuery.getEntityManager(EntityQuery.java:83)
            at org.jboss.seam.framework.EntityQuery.validate(EntityQuery.java:28)
            at org.jboss.seam.framework.EntityQuery$$FastClassByCGLIB$$225925e6.invoke()
            at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
            at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:45)
            at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:55)
            at org.jboss.seam.interceptors.OutcomeInterceptor.interceptOutcome(OutcomeInterceptor.java:21)
            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:585)
            at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
            at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
            at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
            at org.jboss.seam.interceptors.RollbackInterceptor.rollbackIfNecessary(RollbackInterceptor.java:29)
            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:585)
            at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
            at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
            at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
            at org.jboss.seam.interceptors.ConversationInterceptor.endOrBeginLongRunningConversation(ConversationInterceptor.java:52)
            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:585)
            at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
            at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
            at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
            at org.jboss.seam.interceptors.TransactionInterceptor$1.work(TransactionInterceptor.java:28)
            at org.jboss.seam.util.Work.workInTransaction(Work.java:37)
            at org.jboss.seam.interceptors.TransactionInterceptor.doInTransactionIfNecessary(TransactionInterceptor.java:23)
            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:585)
            at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
            at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
            at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
            at org.jboss.seam.interceptors.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:27)
            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:585)
            at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
            at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
            at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
            at org.jboss.seam.intercept.RootInterceptor.createSeamInvocationContext(RootInterceptor.java:144)
            at org.jboss.seam.intercept.RootInterceptor.invokeInContexts(RootInterceptor.java:129)
            at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:102)
            at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:145)
            at org.jboss.seam.intercept.JavaBeanInterceptor.intercept(JavaBeanInterceptor.java:80)
            at org.jboss.helloworld.UsuariosList$$EnhancerByCGLIB$$8aa74775.validate()
            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:585)
            at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
            at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:102)
            at org.jboss.seam.Component.callComponentMethod(Component.java:1835)
            at org.jboss.seam.Component.callCreateMethod(Component.java:1783)
            at org.jboss.seam.Component.newInstance(Component.java:1772)
            at org.jboss.seam.Component.getInstance(Component.java:1669)
            at org.jboss.seam.Component.getInstance(Component.java:1636)
            at org.jboss.seam.jsf.SeamVariableResolver.resolveVariable(SeamVariableResolver.java:53)
            at org.apache.myfaces.config.LastVariableResolverInChain.resolveVariable(LastVariableResolverInChain.java:42)
            at org.apache.myfaces.el.ValueBindingImpl$ELVariableResolver.resolveVariable(ValueBindingImpl.java:574)
            at org.apache.commons.el.NamedValue.evaluate(NamedValue.java:124)
            at org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:140)
            at org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:383)
            ... 36 more
            Caused by: javax.naming.NameNotFoundException: helloworldEntityManagerFactory not bound
            at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
            at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
            at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
            at org.jnp.server.NamingServer.lookup(NamingServer.java:296)
            at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625)
            at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
            at javax.naming.InitialContext.lookup(InitialContext.java:351)
            at org.jboss.seam.core.ManagedPersistenceContext.getEntityManagerFactoryFromJndiOrValueBinding(ManagedPersistenceContext.java:155)
            ... 122 more

            • 3. Re: Problem with Hibernate
              Gavin King Master

              I always get this whenever I have not started the database. Anyway, it occurs because Hibernate cannot connect to MySQL.

              • 4. Re: Problem with Hibernate
                Flavio Ferreira Newbie

                the MySQL server seems to be OK, 'generate-entities' and phpmyadmin connects to the server normaly.
                what am I missing?

                • 5. Re: Problem with Hibernate
                  eeckmann Newbie

                  I have the same problem with jboss-seam from head.

                  • 6. Re: Problem with Hibernate
                    Siarhei Dudzin Apprentice

                    Is this hot deployment?

                    • 7. Re: Problem with Hibernate
                      Gavin King Master

                      This is a JDBC or JPA configuration problem, nothing else.

                      • 8. Re: Problem with Hibernate
                        Jere Malinen Newbie

                        Did anyone manage to solve this problem? I have same problem in Windows but my co-worker doen't have problem in Linux.