9 Replies Latest reply on Feb 25, 2008 4:46 PM by judy guglielmin

    NullPointerException at com.sun.enterprise.util.EntityManagerWrapper

    Piotr Janik Newbie
      I'm trying to run my SEAM ICEFACES app on GLASSFISH.
      But I'm getting this error, when I want to use hibernate(searching db).

      Code:

      `

      javax.ejb.TransactionRolledbackLocalException: Exception thrown from bean; nested exception is: java
      .lang.NullPointerException
      java.lang.NullPointerException
              at com.sun.enterprise.util.EntityManagerWrapper.createQuery(EntityManagerWrapper.java:349)
              at org.jboss.seam.persistence.EntityManagerProxy.createQuery(EntityManagerProxy.java:79)
              at nautilia.sklepy.ejb.web.customers.Cu||stomerSearch.Find(CustomerSearch.java:76)
              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 com.sun.enterprise.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.j
      ava:1067)
              at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:176)
              at com.sun.ejb.containers.BaseContainer.invokeBeanMethod(BaseContainer.java:4005)
              at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.j
      ava:483)
              at com.sun.ejb.Invocation.proceed(Invocation.java:498)
              at org.jboss.seam.intercept.EJBInvocationContext.proceed(EJBInvocationContext.java:44)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
              at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
              at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
              at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:4
      2)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
              at org.jboss.seam.persistence.EntityManagerProxyInterceptor.aroundInvoke(EntityManagerProxyI
      nterceptor.java:26)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
              at org.jboss.seam.persistence.HibernateSessionProxyInterceptor.aroundInvoke(HibernateSession
      ProxyInterceptor.java:27)
      `
           



      persistence.xml
      `

      <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="sklepyPU" transaction-type="JTA">
              <provider>org.hibernate.ejb.HibernatePersistence</provider>
              <jta-data-source>jdbc/mysql</jta-data-source>
              <properties>
                 
                  <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.SunONETransactionManagerLookup"/>
                  <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
                  <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
                  <property name="hibernate.case.user_query_cache" value="true"/>
                  <property name="hibernate.show_sql" value="true"/>
              </properties>
             
             
             
          </persistence-unit>
      </persistence>
           
      `


      components.xml
      `
      <?xml version="1.0" encoding="UTF-8"?>
      <components xmlns="http://jboss.com/products/seam/components"
                  xmlns:core="http://jboss.com/products/seam/core"
                  xmlns:persistence="http://jboss.com/products/seam/persistence"
                  xmlns:transaction="http://jboss.com/products/seam/transaction"
                  xmlns:security="http://jboss.com/products/seam/security"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation=
                  "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.0.xsd
                  http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.
      0.xsd
                  http://jboss.com/products/seam/transaction http://jboss.com/products/seam/transaction-2.
      0.xsd
                  http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.0.xsd
      http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.0.xsd">
         
          <core:init jndi-pattern="java:comp/env/sklepy/#{ejbName}/local" debug="true"/>
         
          <core:manager conversation-timeout="120000"
                        concurrent-request-timeout="500"
                        conversation-id-parameter="cid"/>
         
          <persistence:entity-manager-factory name="sklepyPU" persistence-unit-name="sklepyPU"/>
         
          <persistence:managed-persistence-context name="em"
                                                   auto-create="true"
                                                   entity-manager-factory="#{sklepyPU}"/>
        
          <transaction:ejb-transaction />
         
         
      </components>
      `

      THX