-->
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.  [ 5 posts ] 
Author Message
 Post subject: NPE at AbstractEntityTuplizer.createProxy(Abstract..)
PostPosted: Thu Feb 02, 2006 2:30 pm 
Newbie

Joined: Tue Nov 22, 2005 11:28 am
Posts: 6
Hi I have some code that loads a "Person" object and calls a method getTrips() which returns a Set of trips. This code was working fine in a command line based app but in my webapp deployed on Sun Appserver i get an NPE. The stacktrace is included after the code.. I observed that the exception occurs when i call the getTrips() method on the Person object.. . can anyone give me some pointers on this.. maybe the mapping files have a bug? not sure....
Thanks
Saniya

Code:
Session session = travelcenterhibernate.HibernateUtil.getSessionFactory().getCurrentSession();
           session.beginTransaction();
           travelcenterhibernate.Person person = (travelcenterhibernate.Person)session.load(travelcenterhibernate.Person.class, personId);
           System.err.println("Person Information: "+ " Person Name "+ person.getName()+ " JobTitle: "+ person.getJobTitle() );
           System.err.println("Person Trips Information: Found ");
         
          java.util.Set personTrips = (org.hibernate.collection.PersistentSet)person.getTrips();
          System.out.println("Total Trips" + personTrips.size());
          Iterator iterator = personTrips.iterator();
          while(iterator.hasNext()){
              travelcenterhibernate.Trip temp = (Trip)iterator.next();
              System.err.println(" \n TripId: "+temp.getTripId()+ " DestCity: "+ temp.getDepCity()+ " TripType: "+temp.getTripType().getName());
          }


=====================================
stacktrace from the exception...

java.lang.NullPointerException
at org.hibernate.tuple.AbstractEntityTuplizer.createProxy(AbstractEntityTuplizer.java:372)
at org.hibernate.persister.entity.AbstractEntityPersister.createProxy(AbstractEntityPersister.java:3120)
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:812)
at org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:782)
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:223)
at org.hibernate.loader.Loader.loadCollection(Loader.java:1916)
at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:71)
at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:520)
at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:60)
at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1493)
at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:344)
at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
at org.hibernate.collection.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:109)
at org.hibernate.collection.PersistentSet.size(PersistentSet.java:114)
at travelcenterhibernateweb.SessionBean1.getPersonsTrips(SessionBean1.java:171)
|#][/code]


Last edited by Saniya on Mon Feb 06, 2006 7:45 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 06, 2006 7:44 pm 
Newbie

Joined: Tue Nov 22, 2005 11:28 am
Posts: 6
I'm still stuck with this problem, I'm not sure if its something to do with my mapping files. I saw this particular problem as an open issue with hibernate:
[url]http://opensource2.atlassian.com/projects/hibernate/browse/HHH-1365
[/url]

I dont think i'musing a sealed jar if thats why this above problem is being caused. Basically I have a Person class that has one-many associations with Trip class and Trip class has one-one association with TripType class.
Here is how i've put the associations:

Person.hbm.xml
Code:
<set name="trips" table="TRIP" lazy="true" inverse="true" cascade="all-delete-orphan">
         <key column="PERSONID"/>
         <one-to-many class="travelcenterhibernateweb.Trip"/>
    </set>


Trip.hbm.xml
Code:
<many-to-one  name="person"
                  column="PERSONID"
                  class="travelcenterhibernateweb.Person"
                  not-null="true"/> 
<many-to-one name="tripType"
                 column="TRIPTYPEID"
                 class="travelcenterhibernateweb.TripType"
                 unique="true"
                 not-null="true"/>



I hope somebody can help out here b4 i go crazy.. maybe its cglib.jar issue? not sure.

Thanks
S
[/code]


Top
 Profile  
 
 Post subject: NPE in createProxy method of AbstractEntityTuplizer?
PostPosted: Tue Feb 14, 2006 6:13 pm 
Beginner
Beginner

Joined: Thu Jun 23, 2005 10:23 pm
Posts: 22
I'm getting the same NPE when trying to do a simple select using Criteria. I just got the latest 3.1.2 version and I'm going through the migration from 2.0.

java.lang.NullPointerException
at org.hibernate.tuple.AbstractEntityTuplizer.createProxy(Ljava.io.Seria
lizable;Lorg.hibernate.engine.SessionImplementor;)Ljava.lang.Object;(AbstractEnt
ityTuplizer.java:372)
at org.hibernate.persister.entity.AbstractEntityPersister.createProxy(Lj
ava.io.Serializable;Lorg.hibernate.engine.SessionImplementor;)Ljava.lang.Object;
(AbstractEntityPersister.java:3121)
at org.hibernate.event.def.DefaultLoadEventListener.createProxyIfNecessa
ry(Lorg.hibernate.event.LoadEvent;Lorg.hibernate.persister.entity.EntityPersiste
r;Lorg.hibernate.engine.EntityKey;Lorg.hibernate.event.LoadEventListener$LoadTyp
e;Lorg.hibernate.engine.PersistenceContext;)Ljava.lang.Object;(DefaultLoadEventL
istener.java:232)
at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(Lorg.hib
ernate.event.LoadEvent;Lorg.hibernate.persister.entity.EntityPersister;Lorg.hibe
rnate.engine.EntityKey;Lorg.hibernate.event.LoadEventListener$LoadType;)Ljava.la
ng.Object;(DefaultLoadEventListener.java:173)
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(Lorg.hibernat
e.event.LoadEvent;Lorg.hibernate.event.LoadEventListener$LoadType;)V(DefaultLoad
EventListener.java:87)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 15, 2006 3:37 am 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
Probably you need to configure security on application server, it looks like stack trace is incomplete, see root cause.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 15, 2006 5:12 pm 
Newbie

Joined: Tue Nov 22, 2005 11:28 am
Posts: 6
Hey there..

Yes you need to give the following permissions..
grant codeBase ".../-"{
permission java.util.PropertyPermission "*", "read,write";
permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
permission java.lang.RuntimePermission "accessDeclaredMembers";
permission java.lang.RuntimePermission "getProtectionDomain";
};


Saniya


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.