-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: NPE when calling query.list() in AbstractEntityTuplizer
PostPosted: Mon Mar 06, 2006 11:46 am 
Newbie

Joined: Mon Mar 06, 2006 11:12 am
Posts: 2
Hibernate version:
3.1.2

Mapping documents:
[many]

Code between sessionFactory.openSession() and session.close():
query = session.createQuery( "select distinct(t.journal) from Toc as t" );
List resources = query.list();

Full stack trace of any exception that occurs:
Exception in thread "main" java.lang.NullPointerException
at org.hibernate.tuple.AbstractEntityTuplizer.createProxy(AbstractEntityTuplizer.java:372)
at org.hibernate.persister.entity.AbstractEntityPersister.createProxy(AbstractEntityPersister.java:3121)
at org.hibernate.event.def.DefaultLoadEventListener.createProxyIfNecessary(DefaultLoadEventListener.java:232)
at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:173)
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:87)
at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:891)
at org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:859)
at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:266)
at org.hibernate.type.EntityType.resolve(EntityType.java:303)
at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:113)
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 edu.ncsu.lib.tocload.SendMessages.main(SendMessages.java:56)

Name and version of the database you are using:
Oracle 9i2

Debug level Hibernate log excerpt:


My application is a simple Java app (run by main() method) that sends out emails. I'm using a model that is used elsewhere with no problems, so I'm guessing that this might be some kind of dependency issue. Anyhow, I'm getting three different exceptions and I'm not sure why it's only occurring in my app (notably the only app using this ORM that isn't web-based).



This is thrown during SessionFactory initialization:



06 Mar 2006 10:01:29,187 ERROR org.hibernate.proxy.BasicLazyInitializer - CGLIB Enhancement failed: edu.ncsu.lib.ematrix.orm.dto.RipUse
java.lang.NoClassDefFoundError: org/objectweb/asm/Type
at net.sf.cglib.core.TypeUtils.parseType(TypeUtils.java:180)
at net.sf.cglib.core.KeyFactory.<clinit>(KeyFactory.java:66)
at net.sf.cglib.proxy.Enhancer.<clinit>(Enhancer.java:69)
at org.hibernate.proxy.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:116)
at org.hibernate.proxy.CGLIBProxyFactory.postInstantiate(CGLIBProxyFactory.java:41)
at org.hibernate.tuple.PojoEntityTuplizer.buildProxyFactory(PojoEntityTuplizer.java:161)
at org.hibernate.tuple.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:131)
at org.hibernate.tuple.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:55)
at org.hibernate.tuple.TuplizerLookup.create(TuplizerLookup.java:64)
at org.hibernate.tuple.EntityMetamodel.<init>(EntityMetamodel.java:257)
at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:412)
at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:108)
at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:215)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1176)
at edu.ncsu.lib.tocload.HibernateUtil.<clinit>(HibernateUtil.java:32)
at edu.ncsu.lib.tocload.SendMessages.main(SendMessages.java:54)



This class (RipUse) does not define a proxy, but it is th eonly one out of about 100 POJOs that throws this particular exception. So I'm not sure why it's only croaking on that one class. I'm also not sure what JAR is supposed to contain this org.objectweb.asm.Type, or why it's needed. Next, when attempting to execute a query:



06 Mar 2006 10:01:29,234 ERROR org.hibernate.proxy.BasicLazyInitializer - CGLIB Enhancement failed: edu.ncsu.lib.ematrix.orm.dto.Privilege
java.lang.NoClassDefFoundError
at org.hibernate.proxy.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:116)
at org.hibernate.proxy.CGLIBProxyFactory.postInstantiate(CGLIBProxyFactory.java:41)
at org.hibernate.tuple.PojoEntityTuplizer.buildProxyFactory(PojoEntityTuplizer.java:161)
at org.hibernate.tuple.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:131)
at org.hibernate.tuple.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:55)
at org.hibernate.tuple.TuplizerLookup.create(TuplizerLookup.java:64)
at org.hibernate.tuple.EntityMetamodel.<init>(EntityMetamodel.java:257)
at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:412)
at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:108)
at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:215)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1176)
at edu.ncsu.lib.tocload.HibernateUtil.<clinit>(HibernateUtil.java:32)
at edu.ncsu.lib.tocload.SendMessages.main(SendMessages.java:54)
06 Mar 2006 10:01:29,234 WARN org.hibernate.tuple.PojoEntityTuplizer - could not create proxy factory for:edu.ncsu.lib.ematrix.orm.dto.Privilege
org.hibernate.HibernateException: CGLIB Enhancement failed: edu.ncsu.lib.ematrix.orm.dto.Privilege
at org.hibernate.proxy.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:132)
at org.hibernate.proxy.CGLIBProxyFactory.postInstantiate(CGLIBProxyFactory.java:41)
at org.hibernate.tuple.PojoEntityTuplizer.buildProxyFactory(PojoEntityTuplizer.java:161)
at org.hibernate.tuple.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:131)
at org.hibernate.tuple.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:55)
at org.hibernate.tuple.TuplizerLookup.create(TuplizerLookup.java:64)
at org.hibernate.tuple.EntityMetamodel.<init>(EntityMetamodel.java:257)
at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:412)
at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:108)
at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:215)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1176)
at edu.ncsu.lib.tocload.HibernateUtil.<clinit>(HibernateUtil.java:32)
at edu.ncsu.lib.tocload.SendMessages.main(SendMessages.java:54)
Caused by: java.lang.NoClassDefFoundError
at org.hibernate.proxy.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:116)
... 13 more



This stack is thrown for EACH object in the model. And here's what gets printed to System.err that finally kills the app:



Exception in thread "main" java.lang.NullPointerException
at org.hibernate.tuple.AbstractEntityTuplizer.createProxy(AbstractEntityTuplizer.java:372)
at org.hibernate.persister.entity.AbstractEntityPersister.createProxy(AbstractEntityPersister.java:3121)
at org.hibernate.event.def.DefaultLoadEventListener.createProxyIfNecessary(DefaultLoadEventListener.java:232)
at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:173)
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:87)
at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:891)
at org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:859)
at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:266)
at org.hibernate.type.EntityType.resolve(EntityType.java:303)
at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:113)
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 edu.ncsu.lib.tocload.SendMessages.main(SendMessages.java:56)



None of the objects define a proxy in the mapping file. I have cglib-2.1.3.jar in the classpath and no others. Unfortunately I can't find any documentation about this problem, and I don't know enough low-level stuff about Hibernate to know what's causing the NPE.

Has anyone encountered this before?

TIA,

Andy


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 06, 2006 12:23 pm 
Newbie

Joined: Mon Mar 06, 2006 11:12 am
Posts: 2
Hi, I've solved this mystery. I tried the no-dependencies CGLIB jar file and the application appears to be working.

CHeers.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 29, 2006 2:27 pm 
Beginner
Beginner

Joined: Mon Mar 27, 2006 3:44 pm
Posts: 26
Can you let me know what is the version of the cglib file which made this problem go away?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.