5 Replies Latest reply on Mar 30, 2006 5:21 PM by Emmanuel Bernard

    Exception is thrown when large number of records is returned

    Michael Shpigel Newbie

      I defined an Entity Bean with about 20 variables based on the view in tbe
      MS SQL 2000 database.

      @Entity
      @Table(name = "Listing")
      public class Listing implements Serializable
      {
      ....
      }


      I am colling select method from the SLSB:

      public Collection <Listing> selectData(int accountId)
      {
       Query query = em.createQuery("from Listing where accountid :accountId");
       query.setParameter("accountId", new Integer (accountId));
       return query.getResultList();
      
      }


      If I use accountId that returns about 40 records I am fine.
      If I use another one that retursn about 100 records I am getting the follosing exception:

      Exception in thread "main" java.lang.reflect.UndeclaredThrowableException
       at $Proxy0.selectData(Unknown Source)
       at net.isobar.data.client.BenchmarkTest.main(BenchmarkTest.java:38)
      Caused by: java.lang.ClassNotFoundException: net.sf.cglib.beans.BulkBeanException
       at java.net.URLClassLoader$1.run(Unknown Source)
       at java.security.AccessController.doPrivileged(Native Method)
       at java.net.URLClassLoader.findClass(Unknown Source)
       at java.lang.ClassLoader.loadClass(Unknown Source)
       at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
       at java.lang.ClassLoader.loadClass(Unknown Source)
       at org.jboss.remoting.loading.RemotingClassLoader.loadClass(RemotingClassLoader.java:50)
       at org.jboss.remoting.loading.ObjectInputStreamWithClassLoader.resolveClass(ObjectInputStreamWithClassLoader.java:120)
       at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
       at java.io.ObjectInputStream.readClassDesc(Unknown Source)
       at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
       at java.io.ObjectInputStream.readObject0(Unknown Source)
       at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
       at java.io.ObjectInputStream.readSerialData(Unknown Source)
       at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
       at java.io.ObjectInputStream.readObject0(Unknown Source)
       at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
       at java.io.ObjectInputStream.readSerialData(Unknown Source)
       at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
       at java.io.ObjectInputStream.readObject0(Unknown Source)
       at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
       at java.io.ObjectInputStream.readSerialData(Unknown Source)
       at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
       at java.io.ObjectInputStream.readObject0(Unknown Source)
       at java.io.ObjectInputStream.readObject(Unknown Source)
       at org.jboss.remoting.serialization.impl.java.JavaSerializationManager.receiveObject(JavaSerializationManager.java:128)
       at org.jboss.remoting.marshal.serializable.SerializableUnMarshaller.read(SerializableUnMarshaller.java:66)
       at org.jboss.remoting.transport.socket.SocketClientInvoker.transport(SocketClientInvoker.java:265)
       at org.jboss.remoting.RemoteClientInvoker.invoke(RemoteClientInvoker.java:136)
       at org.jboss.remoting.Client.invoke(Client.java:444)
       at org.jboss.remoting.Client.invoke(Client.java:407)
       at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:41)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:46)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:40)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:65)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:102)
       ... 2 more


      I've tried both MS and jstdl drivers and I am getting the same exception.
      Does anyone has any ideas?

        • 2. Re: Exception is thrown when large number of records is retu
          Michael Shpigel Newbie

          that helped a bit. Thank you.
          Now I am getting:

          Exception in thread "main" javax.ejb.EJBException: org.hibernate.PropertyAccessException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of net.isobar.data.Listing.setCategoryCustomId
          at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:69)
          at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
          at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:192)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
          at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
          at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:54)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
          at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
          at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
          at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
          at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:219)
          at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:107)
          at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
          at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:660)
          at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:513)
          at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:290)
          at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:344)
          at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:202)
          Caused by: org.hibernate.PropertyAccessException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of net.isobar.data.Listing.setCategoryCustomId
          at org.hibernate.tuple.PojoEntityTuplizer.setPropertyValuesWithOptimizer(PojoEntityTuplizer.java:215)
          at org.hibernate.tuple.PojoEntityTuplizer.setPropertyValues(PojoEntityTuplizer.java:185)
          at org.hibernate.persister.entity.AbstractEntityPersister.setPropertyValues(AbstractEntityPersister.java:3232)
          at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:126)
          at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:842)
          at org.hibernate.loader.Loader.doQuery(Loader.java:717)
          at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
          at org.hibernate.loader.Loader.doList(Loader.java:2145)
          at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
          at org.hibernate.loader.Loader.list(Loader.java:2024)
          at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:375)
          at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:308)
          at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:153)
          at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1129)
          at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
          at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:39)
          at net.isobar.data.DALBean.selectData(DALBean.java:43)
          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.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:109)
          at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
          at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
          at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:192)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
          at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
          at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:54)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
          at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
          at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
          at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
          at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:219)
          at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:107)
          at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
          at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:660)
          at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:513)
          at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:290)
          at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:344)
          at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:202)
          at org.jboss.remoting.RemoteClientInvoker.invoke(RemoteClientInvoker.java:183)
          at org.jboss.remoting.Client.invoke(Client.java:444)
          at org.jboss.remoting.Client.invoke(Client.java:407)
          at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:41)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
          at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:46)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
          at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:40)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
          at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:65)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
          at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:102)
          at $Proxy0.selectData(Unknown Source)
          at net.isobar.data.client.BenchmarkTest.main(BenchmarkTest.java:38)
          Caused by: net.sf.cglib.beans.BulkBeanException
          at net.isobar.data.Listing$$BulkBeanByCGLIB$$491e8d4d.setPropertyValues()
          at org.hibernate.tuple.PojoEntityTuplizer.setPropertyValuesWithOptimizer(PojoEntityTuplizer.java:212)
          at org.hibernate.tuple.PojoEntityTuplizer.setPropertyValues(PojoEntityTuplizer.java:185)
          at org.hibernate.persister.entity.AbstractEntityPersister.setPropertyValues(AbstractEntityPersister.java:3232)
          at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:126)
          at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:842)
          at org.hibernate.loader.Loader.doQuery(Loader.java:717)
          at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
          at org.hibernate.loader.Loader.doList(Loader.java:2145)
          at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
          at org.hibernate.loader.Loader.list(Loader.java:2024)
          at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:375)
          at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:308)
          at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:153)
          at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1129)
          at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
          at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:39)
          at net.isobar.data.DALBean.selectData(DALBean.java:43)
          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.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:109)
          at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
          at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
          at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:192)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
          at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
          at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:54)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
          at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
          at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
          at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
          at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:219)
          at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:107)
          at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
          at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:660)
          at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:513)
          at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:290)
          at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:344)
          at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:202)
          Caused by: java.lang.NullPointerException
          ... 46 more

          • 3. Re: Exception is thrown when large number of records is retu
            Emmanuel Bernard Master

            set hibernate.cglib.use_reflection_optimizer=false for more info
            you need to do it through a java property though

            java -D hibernate.cglib.use_reflection_optimizer=false

            • 4. Re: Exception is thrown when large number of records is retu
              Michael Shpigel Newbie

              Turned out that my problem was that some of the columns in the database
              were NULL and the varibale for this column in my entity bean was primitive type int. Apperarently Hibernate has problems tening NULLS into ints. I've changed the column type to Integer and everything works fine.
              Not a very good solution though, I think.

              • 5. Re: Exception is thrown when large number of records is retu
                Emmanuel Bernard Master

                hug, and how the hell Hibernate should represent NULL in a int. Of course not 0.