I'm having a problem with OJB and Apache Tomcat servlet context reloads. In my simple authentication method, I'm just grabbing a user object out of the DB based on the username (primary key) & then checking out matching passwd's etc. This works great until my servlet context is reloaded... Then I start getting strange messages from the persistence broker & my user objects are not retrieved.

Here's the error:

{{{ [] WARN: Candidate object [System User: admin]

Anyone have any idea as to what may be causing this, or how I can fix it? If I fully restart Tomcat everything works fine. It's just when the context reloads automatically due to a class being compiled. This shouldn't be an issue in the real world, but it's frustrating in development.

Thanks! - RyanDlugosz


Using OJB with the JDO API and Apache Tomcat, the source below works fine until the context reloads. My source was retrieving an object from an Extent Iterator:

{{{ Extent allSchools = persistenceManager.getExtent(School.class, true);

The error that I get is a ClassCastException on the indicated line. Interestingly, if I added a line that dumped the class of the next Object like this: {{{ Object obj = i.getNext();

It would report that the object was indeed a "School".

The below answer solved my problem as well. Thanks! -


JimCushing was able to help me out with this. His response:

{{{ Make sure that you are not including the OBJ JAR files or any of the JAR files that

I did as he suggested and all is well. Thanks!

OJBProjectPages/TomcatReloadBreaksOjB (last edited 2009-09-20 22:56:16 by localhost)