You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by Michael Mogley <mm...@adelphia.net> on 2004/02/29 07:09:44 UTC

getObjectByIdentity fails after cvs update

Hi Dev Guys,

I just cvs-updated the last few weeks worth of changes and now get this error from my web-app when looking up an object by identity:

java.lang.NullPointerException
        at org.apache.ojb.broker.core.PersistenceBrokerImpl.getClassDescriptor(PersistenceBrokerImpl.java:1602)
        at org.apache.ojb.broker.cache.CacheDistributor.searchInClassDescriptor(CacheDistributor.java:276)
        at org.apache.ojb.broker.cache.CacheDistributor.getCache(CacheDistributor.java:198)
        at org.apache.ojb.broker.cache.AbstractMetaCache.lookup(AbstractMetaCache.java:117)
        at org.apache.ojb.broker.cache.InternalCache.lookup(InternalCache.java:80)
        at org.apache.ojb.broker.core.PersistenceBrokerImpl.doGetObjectByIdentity(PersistenceBrokerImpl.java:1229)
        at org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(PersistenceBrokerImpl.java:1212)
        at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByIdentity(DelegatingPersistenceBroker.java:296)
        at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByIdentity(DelegatingPersistenceBroker.java:296)

I have tried with various cache implementations including ObjectCacheEmptyImpl.

Could this be due to some recent OJB code changes?  Do I need to add something new to my class descriptors?

Grateful for any help.

Michael 

Re: getObjectByIdentity fails after cvs update

Posted by Michael Mogley <mm...@adelphia.net>.
I found the problem.  Has to do with PersistenceBrokerSyncImpl actually
calling close() on the broker, which of course nullifies the
descriptorRepository reference.  This is done right after my initial
getCollection call.  Hence, the observed behavior.

I read some recent messages on the changes to PersistenceBrokerSyncImpl
which cause this problem.  It seems the main motivation for the chances is
to have the PB connection be physically closed in nontransactional contexts.
So in this case, why just close the connection and leave the broker intact?
Then, next time the broker is used, if connection is null, it retrieves a
fresh connection.

This may be irrelevant for me now that I've decided to retrieve brokers on
demand (instead of holding onto a single broker throughout the EJB's
lifecycle), but I still think it's unexpected behavior.

Michael

----- Original Message ----- 
From: "Armin Waibel" <ar...@apache.org>
To: "OJB Developers List" <oj...@db.apache.org>
Sent: Sunday, February 29, 2004 11:14 AM
Subject: Re: getObjectByIdentity fails after cvs update


> Hi again,
>
> Michael Mogley wrote:
>
> > Hi Armin,
> >
> > I don't do anything exotic.  The scenario is this:
> >
> > 1) app.ear is deployed.
> > 2) I go to the app.war home-page.  No problems.
> > 3) I go to the entity-listing page that retrieves a collection of
OJB-mapped
> > entities from the db.  No problems.
> > 4) I click on a specific entity to go to its detail page (which uses the
> > getObjectByIdentity - which worked before the cvs-update).  Problems.
> >
> > It is hard to see how the descriptor repository can be null if step 3
> > succeeded.  One thing I should mention is I'm retrieving proxies for the
> > collection.  However, as I said, this worked before.
> >
>
> indeed this sounds strange!
> When did you the last CVS update that works?
> Proxy could be a problem, but as long as all is done in the same JVM
> this should work.
> Did you get any other error/warn log messages?
>
>
> regards,
> Armin
>
> > Any other ideas?
> >
> > Michael
> >
> > ----- Original Message ----- 
> > From: "Armin Waibel" <ar...@apache.org>
> > To: "OJB Developers List" <oj...@db.apache.org>
> > Sent: Sunday, February 29, 2004 2:35 AM
> > Subject: Re: getObjectByIdentity fails after cvs update
> >
> >
> >
> >>Hi Michael,
> >>
> >>current CVS head pass all PB-Tests without problems. Seems that in your
> >>case, the DescriptorRepository was not set for used PB instance or was
> >>set to 'null'. Do you do "any exotic things" in your application,
> >>setting of DescriptorRepository for PB instance, using own PB
> >>implementation, ...?
> >>
> >>regards,
> >>Armin
> >>
> >>Michael Mogley wrote:
> >>
> >>
> >>>Hi Dev Guys,
> >>>
> >>>I just cvs-updated the last few weeks worth of changes and now get this
> >
> > error from my web-app when looking up an object by identity:
> >
> >>>java.lang.NullPointerException
> >>>        at
> >
> >
org.apache.ojb.broker.core.PersistenceBrokerImpl.getClassDescriptor(Persiste
> > nceBrokerImpl.java:1602)
> >
> >>>        at
> >
> >
org.apache.ojb.broker.cache.CacheDistributor.searchInClassDescriptor(CacheDi
> > stributor.java:276)
> >
> >>>        at
> >
> >
org.apache.ojb.broker.cache.CacheDistributor.getCache(CacheDistributor.java:
> > 198)
> >
> >>>        at
> >
> >
org.apache.ojb.broker.cache.AbstractMetaCache.lookup(AbstractMetaCache.java:
> > 117)
> >
> >>>        at
> >
> > org.apache.ojb.broker.cache.InternalCache.lookup(InternalCache.java:80)
> >
> >>>        at
> >
> >
org.apache.ojb.broker.core.PersistenceBrokerImpl.doGetObjectByIdentity(Persi
> > stenceBrokerImpl.java:1229)
> >
> >>>        at
> >
> >
org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Persist
> > enceBrokerImpl.java:1212)
> >
> >>>        at
> >
> >
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByIdentity(D
> > elegatingPersistenceBroker.java:296)
> >
> >>>        at
> >
> >
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByIdentity(D
> > elegatingPersistenceBroker.java:296)
> >
> >>>I have tried with various cache implementations including
> >
> > ObjectCacheEmptyImpl.
> >
> >>>Could this be due to some recent OJB code changes?  Do I need to add
> >
> > something new to my class descriptors?
> >
> >>>Grateful for any help.
> >>>
> >>>Michael
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> >>For additional commands, e-mail: ojb-dev-help@db.apache.org
> >>
> >>
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> > For additional commands, e-mail: ojb-dev-help@db.apache.org
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Re: getObjectByIdentity fails after cvs update

Posted by Armin Waibel <ar...@apache.org>.
Hi again,

Michael Mogley wrote:

> Hi Armin,
> 
> I don't do anything exotic.  The scenario is this:
> 
> 1) app.ear is deployed.
> 2) I go to the app.war home-page.  No problems.
> 3) I go to the entity-listing page that retrieves a collection of OJB-mapped
> entities from the db.  No problems.
> 4) I click on a specific entity to go to its detail page (which uses the
> getObjectByIdentity - which worked before the cvs-update).  Problems.
> 
> It is hard to see how the descriptor repository can be null if step 3
> succeeded.  One thing I should mention is I'm retrieving proxies for the
> collection.  However, as I said, this worked before.
> 

indeed this sounds strange!
When did you the last CVS update that works?
Proxy could be a problem, but as long as all is done in the same JVM 
this should work.
Did you get any other error/warn log messages?


regards,
Armin

> Any other ideas?
> 
> Michael
> 
> ----- Original Message ----- 
> From: "Armin Waibel" <ar...@apache.org>
> To: "OJB Developers List" <oj...@db.apache.org>
> Sent: Sunday, February 29, 2004 2:35 AM
> Subject: Re: getObjectByIdentity fails after cvs update
> 
> 
> 
>>Hi Michael,
>>
>>current CVS head pass all PB-Tests without problems. Seems that in your
>>case, the DescriptorRepository was not set for used PB instance or was
>>set to 'null'. Do you do "any exotic things" in your application,
>>setting of DescriptorRepository for PB instance, using own PB
>>implementation, ...?
>>
>>regards,
>>Armin
>>
>>Michael Mogley wrote:
>>
>>
>>>Hi Dev Guys,
>>>
>>>I just cvs-updated the last few weeks worth of changes and now get this
> 
> error from my web-app when looking up an object by identity:
> 
>>>java.lang.NullPointerException
>>>        at
> 
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getClassDescriptor(Persiste
> nceBrokerImpl.java:1602)
> 
>>>        at
> 
> org.apache.ojb.broker.cache.CacheDistributor.searchInClassDescriptor(CacheDi
> stributor.java:276)
> 
>>>        at
> 
> org.apache.ojb.broker.cache.CacheDistributor.getCache(CacheDistributor.java:
> 198)
> 
>>>        at
> 
> org.apache.ojb.broker.cache.AbstractMetaCache.lookup(AbstractMetaCache.java:
> 117)
> 
>>>        at
> 
> org.apache.ojb.broker.cache.InternalCache.lookup(InternalCache.java:80)
> 
>>>        at
> 
> org.apache.ojb.broker.core.PersistenceBrokerImpl.doGetObjectByIdentity(Persi
> stenceBrokerImpl.java:1229)
> 
>>>        at
> 
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Persist
> enceBrokerImpl.java:1212)
> 
>>>        at
> 
> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByIdentity(D
> elegatingPersistenceBroker.java:296)
> 
>>>        at
> 
> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByIdentity(D
> elegatingPersistenceBroker.java:296)
> 
>>>I have tried with various cache implementations including
> 
> ObjectCacheEmptyImpl.
> 
>>>Could this be due to some recent OJB code changes?  Do I need to add
> 
> something new to my class descriptors?
> 
>>>Grateful for any help.
>>>
>>>Michael
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>For additional commands, e-mail: ojb-dev-help@db.apache.org
>>
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Re: getObjectByIdentity fails after cvs update

Posted by Michael Mogley <mm...@adelphia.net>.
Hi Armin,

I don't do anything exotic.  The scenario is this:

1) app.ear is deployed.
2) I go to the app.war home-page.  No problems.
3) I go to the entity-listing page that retrieves a collection of OJB-mapped
entities from the db.  No problems.
4) I click on a specific entity to go to its detail page (which uses the
getObjectByIdentity - which worked before the cvs-update).  Problems.

It is hard to see how the descriptor repository can be null if step 3
succeeded.  One thing I should mention is I'm retrieving proxies for the
collection.  However, as I said, this worked before.

Any other ideas?

Michael

----- Original Message ----- 
From: "Armin Waibel" <ar...@apache.org>
To: "OJB Developers List" <oj...@db.apache.org>
Sent: Sunday, February 29, 2004 2:35 AM
Subject: Re: getObjectByIdentity fails after cvs update


> Hi Michael,
>
> current CVS head pass all PB-Tests without problems. Seems that in your
> case, the DescriptorRepository was not set for used PB instance or was
> set to 'null'. Do you do "any exotic things" in your application,
> setting of DescriptorRepository for PB instance, using own PB
> implementation, ...?
>
> regards,
> Armin
>
> Michael Mogley wrote:
>
> > Hi Dev Guys,
> >
> > I just cvs-updated the last few weeks worth of changes and now get this
error from my web-app when looking up an object by identity:
> >
> > java.lang.NullPointerException
> >         at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getClassDescriptor(Persiste
nceBrokerImpl.java:1602)
> >         at
org.apache.ojb.broker.cache.CacheDistributor.searchInClassDescriptor(CacheDi
stributor.java:276)
> >         at
org.apache.ojb.broker.cache.CacheDistributor.getCache(CacheDistributor.java:
198)
> >         at
org.apache.ojb.broker.cache.AbstractMetaCache.lookup(AbstractMetaCache.java:
117)
> >         at
org.apache.ojb.broker.cache.InternalCache.lookup(InternalCache.java:80)
> >         at
org.apache.ojb.broker.core.PersistenceBrokerImpl.doGetObjectByIdentity(Persi
stenceBrokerImpl.java:1229)
> >         at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Persist
enceBrokerImpl.java:1212)
> >         at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByIdentity(D
elegatingPersistenceBroker.java:296)
> >         at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByIdentity(D
elegatingPersistenceBroker.java:296)
> >
> > I have tried with various cache implementations including
ObjectCacheEmptyImpl.
> >
> > Could this be due to some recent OJB code changes?  Do I need to add
something new to my class descriptors?
> >
> > Grateful for any help.
> >
> > Michael
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Re: getObjectByIdentity fails after cvs update

Posted by Armin Waibel <ar...@apache.org>.
Hi Michael,

current CVS head pass all PB-Tests without problems. Seems that in your 
case, the DescriptorRepository was not set for used PB instance or was 
set to 'null'. Do you do "any exotic things" in your application, 
setting of DescriptorRepository for PB instance, using own PB 
implementation, ...?

regards,
Armin

Michael Mogley wrote:

> Hi Dev Guys,
> 
> I just cvs-updated the last few weeks worth of changes and now get this error from my web-app when looking up an object by identity:
> 
> java.lang.NullPointerException
>         at org.apache.ojb.broker.core.PersistenceBrokerImpl.getClassDescriptor(PersistenceBrokerImpl.java:1602)
>         at org.apache.ojb.broker.cache.CacheDistributor.searchInClassDescriptor(CacheDistributor.java:276)
>         at org.apache.ojb.broker.cache.CacheDistributor.getCache(CacheDistributor.java:198)
>         at org.apache.ojb.broker.cache.AbstractMetaCache.lookup(AbstractMetaCache.java:117)
>         at org.apache.ojb.broker.cache.InternalCache.lookup(InternalCache.java:80)
>         at org.apache.ojb.broker.core.PersistenceBrokerImpl.doGetObjectByIdentity(PersistenceBrokerImpl.java:1229)
>         at org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(PersistenceBrokerImpl.java:1212)
>         at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByIdentity(DelegatingPersistenceBroker.java:296)
>         at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByIdentity(DelegatingPersistenceBroker.java:296)
> 
> I have tried with various cache implementations including ObjectCacheEmptyImpl.
> 
> Could this be due to some recent OJB code changes?  Do I need to add something new to my class descriptors?
> 
> Grateful for any help.
> 
> Michael 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Re: getObjectByIdentity fails after cvs update

Posted by Michael Mogley <mm...@adelphia.net>.
Hi Jakob,

Well, this one doesn't. :)

Hard to see how descriptor repository could be null since right before I
access the individual entity (when I get the error), I am successfully able
to retrieve the collection of entities and display them.

Michael

----- Original Message ----- 
From: "Jakob Braeuchi" <jb...@gmx.ch>
To: "OJB Developers List" <oj...@db.apache.org>
Sent: Sunday, February 29, 2004 1:53 AM
Subject: Re: getObjectByIdentity fails after cvs update


> hi michael,
>
> there are many calls to getObjectByIdentity and they all work.
> PbImpl#getClassDescriptor is quit simple but descriptorRepository could be
null
>
> ..
> public ClassDescriptor getClassDescriptor(Class clazz) throws
> PersistenceBrokerException
>      {
>          return descriptorRepository.getDescriptorFor(clazz);
>      }
> ..
>
>
> jakob
>
> Michael Mogley wrote:
>
> > Hi Dev Guys,
> >
> > I just cvs-updated the last few weeks worth of changes and now get this
error from my web-app when looking up an object by identity:
> >
> > java.lang.NullPointerException
> >         at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getClassDescriptor(Persiste
nceBrokerImpl.java:1602)
> >         at
org.apache.ojb.broker.cache.CacheDistributor.searchInClassDescriptor(CacheDi
stributor.java:276)
> >         at
org.apache.ojb.broker.cache.CacheDistributor.getCache(CacheDistributor.java:
198)
> >         at
org.apache.ojb.broker.cache.AbstractMetaCache.lookup(AbstractMetaCache.java:
117)
> >         at
org.apache.ojb.broker.cache.InternalCache.lookup(InternalCache.java:80)
> >         at
org.apache.ojb.broker.core.PersistenceBrokerImpl.doGetObjectByIdentity(Persi
stenceBrokerImpl.java:1229)
> >         at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Persist
enceBrokerImpl.java:1212)
> >         at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByIdentity(D
elegatingPersistenceBroker.java:296)
> >         at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByIdentity(D
elegatingPersistenceBroker.java:296)
> >
> > I have tried with various cache implementations including
ObjectCacheEmptyImpl.
> >
> > Could this be due to some recent OJB code changes?  Do I need to add
something new to my class descriptors?
> >
> > Grateful for any help.
> >
> > Michael
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Re: getObjectByIdentity fails after cvs update

Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi michael,

there are many calls to getObjectByIdentity and they all work. 
PbImpl#getClassDescriptor is quit simple but descriptorRepository could be null

..
public ClassDescriptor getClassDescriptor(Class clazz) throws 
PersistenceBrokerException
     {
         return descriptorRepository.getDescriptorFor(clazz);
     }
..


jakob

Michael Mogley wrote:

> Hi Dev Guys,
> 
> I just cvs-updated the last few weeks worth of changes and now get this error from my web-app when looking up an object by identity:
> 
> java.lang.NullPointerException
>         at org.apache.ojb.broker.core.PersistenceBrokerImpl.getClassDescriptor(PersistenceBrokerImpl.java:1602)
>         at org.apache.ojb.broker.cache.CacheDistributor.searchInClassDescriptor(CacheDistributor.java:276)
>         at org.apache.ojb.broker.cache.CacheDistributor.getCache(CacheDistributor.java:198)
>         at org.apache.ojb.broker.cache.AbstractMetaCache.lookup(AbstractMetaCache.java:117)
>         at org.apache.ojb.broker.cache.InternalCache.lookup(InternalCache.java:80)
>         at org.apache.ojb.broker.core.PersistenceBrokerImpl.doGetObjectByIdentity(PersistenceBrokerImpl.java:1229)
>         at org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(PersistenceBrokerImpl.java:1212)
>         at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByIdentity(DelegatingPersistenceBroker.java:296)
>         at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByIdentity(DelegatingPersistenceBroker.java:296)
> 
> I have tried with various cache implementations including ObjectCacheEmptyImpl.
> 
> Could this be due to some recent OJB code changes?  Do I need to add something new to my class descriptors?
> 
> Grateful for any help.
> 
> Michael 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org