Differences between revisions 1 and 2
Revision 1 as of 2005-03-22 05:43:34
Size: 2251
Editor: anonymous
Comment: missing edit-log entry for this revision
Revision 2 as of 2009-09-20 22:56:16
Size: 2251
Editor: localhost
Comment: converted to 1.6 markup
No differences found!

QUESTION:

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:

{{{ [org.apache.ojb.broker.core.PersistenceBrokerImpl] WARN: Candidate object [System User: admin]

  • class [net.dlugosz.core.SystemUser] is not a subtype of [net.dlugosz.core.SystemUser] or any type of proxy. NOT INCLUDED in result collection }}}

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

SIMILAR QUESTION:

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);

  • for (Iterator i = allSchools.iterator(); i.hasNext();) {
    • School school = (School) i.getNext(); // <-- ClassCastException here (only after context reloads)

    • .. }}}

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();

  • System.out.println("obj class: " + obj.getClass()); }}}

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

The below answer solved my problem as well. Thanks! - mailto:nick@imagenmultimedia.com

ANSWER:

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

  • it uses (commons-*.jar, etc.) in the classpath. Instead, include them only in your WEB-INF/lib directory. I've used OJB with Tomcat with no problem, so perhaps this will help. }}}

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

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