openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Simon Droscher (JIRA)" <>
Subject [jira] Commented: (OPENJPA-384) ClassCastException when trying to load OpenJPA 1.0.0 based webapp in WebLogic 10
Date Wed, 31 Oct 2007 23:35:50 GMT


Simon Droscher commented on OPENJPA-384:

The problem is defintely classloader related. None of the filtering class loader option are
helpful in this case - it seems to be impossible to get WebLogic 10 to actually use OpenJPA

This is because when weblogic starts, before it loads any applications etc, it uses its version
of OpenJPA for the loading of persistence security data. Any classloaders for applications
will (due to classloader inheritance) use this already loaded instance of OpenJPA. Doing any
of the WebLogic changes to the classloader heirarchy (eg prefer-web-inf-classes, prefer-application-packages
or even defining a custom classloader heirarchy with classloader-structure) doesn't work as
these will only force the classloader to load the local version in preference to an ancestor
if the class is not already loaded! So this would only work if WebLogic wasn't actively using
OpenJPA at startup.

It seems to me the only workaround for this issue (which I guess is more a WebLogic issue
rather than OpenJPA issue) is to take a copy of the OpenJPA 1.0.0 source and rename all the
packages and rebuild, and use this renamed openjpa jar file in my application. Thus the classes
used by my application are totally different to the ones loaded by WebLogic on startup and
all runs nicely.

Personally I don't like having to use this workaround :) 

> ClassCastException when trying to load OpenJPA 1.0.0 based webapp in WebLogic 10
> --------------------------------------------------------------------------------
>                 Key: OPENJPA-384
>                 URL:
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 1.0.0
>         Environment: WebLogic 10
>            Reporter: Simon Droscher
> I am trying to deploy a web application which uses OpenJPA 1.0.0 into a WebLogic 10 environment.
The application deployment (and subsequent startup) fails with the following error:
> {code}java.lang.ClassCastException: weblogic.kodo.WebLogicLogFactory
> 	at org.apache.openjpa.lib.conf.ConfigurationImpl.getLogFactory(
> 	at org.apache.openjpa.lib.conf.ConfigurationImpl.getLog(
> 	at org.apache.openjpa.conf.OpenJPAConfigurationImpl.getConfigurationLog(
> 	at org.apache.openjpa.persistence.PersistenceProductDerivation$ConfigurationProviderImpl.setInto(
> 	at org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.newInstance(
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(
> 	at java.lang.reflect.Method.invoke(
> 	at org.apache.openjpa.kernel.Bootstrap.invokeFactory(
> 	at org.apache.openjpa.kernel.Bootstrap.newBrokerFactory(
> 	at org.apache.openjpa.persistence.PersistenceProviderImpl.createContainerEntityManagerFactory(
> 	at org.apache.openjpa.persistence.PersistenceProviderImpl.createContainerEntityManagerFactory(
> 	at weblogic.deployment.PersistenceUnitInfoImpl.createEntityManagerFactory(
> 	at weblogic.deployment.PersistenceUnitInfoImpl.<init>(
> {code}
> There doesn't seem to be any details or documentation on running apps based on newer
versions of OpenJPA under WebLogic 10 (which packages OpenJPA 0.9.7 as part of Kodo).

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

View raw message