You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Kevin Sutter (JIRA)" <ji...@apache.org> on 2007/09/28 15:11:50 UTC

[jira] Commented: (OPENJPA-387) Getting "java.lang.ClassNotFoundException" when loading datacache plug-in which is a class outside of OpenJPA package.

    [ https://issues.apache.org/jira/browse/OPENJPA-387?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12531005 ] 

Kevin Sutter commented on OPENJPA-387:
--------------------------------------

Daniel,
It looks like the patch resolves the immediate problem.  Thanks.  But, I have a couple of questions about the patch itself...

With this patch, could we be accidentally be corrupting the loaderCaches?  We first lookup the proper loaderCache based on the loader being
used on the first attempt.  Since the problem is surfacing with a non-null loader variable, then we have looked up an existing loaderCache (or just created one).  But, then if we drop into your new code (because the class wasn't cached yet), then we null out the loader variable and try again.  If this one succeeds, then we store the class into the loaderCache instance that was first accessed by the non-null loader instance.  Is that what we really want to do?  It seems that we may need the loaderCache lookup as part of the while loop as well.  Either that, or we need more explanation on the keys being used for the loaderCache lookups.

Second comment...  Why limit the retry to packages that don't start with "org.apache.openjpa"?  Why not just re-try all class lookup failures with a null class loader and see if they work?  It's always possible that somebody may have named their plugin with "org.apache.openjpa.*", especially if they are just testing.

Thanks,
Kevin

> Getting "java.lang.ClassNotFoundException" when loading datacache plug-in which is a class outside of OpenJPA package.
> ----------------------------------------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-387
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-387
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: datacache
>    Affects Versions: 1.0.0
>            Reporter: Daniel Lee
>             Fix For: 1.0.1, 1.1.0
>
>         Attachments: OpenJPA1.0.0Trunk.patch, OpenJPA1.0.xBranch.patch
>
>
> Getting "java.lang.ClassNotFoundException" when loading datacache plug-in which is a class outside of OpenJPA package.
> This happens when loading the class as DatCache plug-in but it can potentially happen to any plug-in classes that reside outside of OpenJPA package.  In order to load these classes, the fix is to get the class loader (by calling findDerivedLoader with no interface loader, loader = null) to load it again when the current class loading fails and the target class is not part of OpenJPA package.  The same exception is still thrown if the second attempt fail or the target class is actually part of OpenJPA.
> Please see the patch for detail changes.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.