openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Donald Woods (JIRA)" <>
Subject [jira] Resolved: (OPENJPA-1491) org.apache.openjpa.kernel.Bootstrap uses the application classloader to load OpenJPA internals
Date Fri, 12 Mar 2010 21:01:27 GMT


Donald Woods resolved OPENJPA-1491.

    Resolution: Fixed

trunk r922397

> org.apache.openjpa.kernel.Bootstrap uses the application classloader to load OpenJPA
> ----------------------------------------------------------------------------------------------
>                 Key: OPENJPA-1491
>                 URL:
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: osgi
>    Affects Versions: 2.0.0-beta
>         Environment: OSGi
>            Reporter: Timothy Ward
>            Assignee: Donald Woods
>             Fix For: 2.0.0
>         Attachments: OPENJPA-1491-trunk.patch
> When attempting to create an EntityManagerFactory in an OSGi environment the org.apache.openjpa.kernel.Bootstrap
class attempts to instantiate a BrokerFactory using reflection. When the Bootstrap class attempts
to load this class it only ever uses the ClassLoader passed in by the PersistenceUnitInfo.
This means that the default broker (contained within OpenJPA) can never be loaded. The client
bundle should not have to import the internals of OpenJPA to make this work, so OpenJPA should
attempt to load the class using its own bundle classloader. This is the expected behaviour
for an OSGi bundle.
> Additionally, the implementation uses Class.forName() which should be used carefully
in an OSGi envrionment (to see why read
). It should be fine here because the variant that takes a ClassLoader is used.
> The following exception is generated when OpenJPA attempts to use the application classloader
to load an internal class.
> <openjpa-2.0.0-SNAPSHOT-r422266:905001 fatal user error> org.apache.openjpa.persistence.ArgumentException:
Could not invoke the static newInstance method on the named factory class "<<openjpa-2.0.0-SNAPSHOT-r422266:905001
fatal user error> org.apache.openjpa.util.UserException: The named BrokerFactory "org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory"
is not valid.>".
> 	at org.apache.openjpa.kernel.Bootstrap.newBrokerFactory(
> 	at org.apache.openjpa.persistence.PersistenceProviderImpl.getBrokerFactory(
> 	at org.apache.openjpa.persistence.PersistenceProviderImpl.createContainerEntityManagerFactory(
> 	at org.apache.openjpa.persistence.PersistenceProviderImpl.createContainerEntityManagerFactory(
> 	at org.apache.aries.jpa.container.impl.EntityManagerFactoryManager.createEntityManagerFactories(
> 	at org.apache.aries.jpa.container.impl.EntityManagerFactoryManager.bundleStateChange(
> 	at org.apache.aries.jpa.container.impl.PersistenceBundleManager.modifiedBundle(
> 	at org.apache.aries.util.tracker.MultiBundleTracker$InternalBundleTracker.modifiedBundle(
> 	at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(
> 	at org.osgi.util.tracker.AbstractTracked.track(
> 	at org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(
> 	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(
> 	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(
> 	at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(
> 	at org.eclipse.osgi.framework.internal.core.Framework.publishBundleEventPrivileged(
> 	at org.eclipse.osgi.framework.internal.core.Framework.publishBundleEvent(
> 	at org.eclipse.osgi.framework.internal.core.BundleHost.stopWorker(
> 	at org.eclipse.osgi.framework.internal.core.AbstractBundle.suspend(
> 	at org.eclipse.osgi.framework.internal.core.Framework.suspendBundle(
> 	at org.eclipse.osgi.framework.internal.core.PackageAdminImpl.suspendBundle(
> 	at org.eclipse.osgi.framework.internal.core.PackageAdminImpl.processDelta(
> 	at org.eclipse.osgi.framework.internal.core.PackageAdminImpl.doResolveBundles(
> 	at org.eclipse.osgi.framework.internal.core.PackageAdminImpl$
> 	at
> Caused by: <openjpa-2.0.0-SNAPSHOT-r422266:905001 fatal user error> org.apache.openjpa.persistence.ArgumentException:
The named BrokerFactory "org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory" is not valid.
> 	at org.apache.openjpa.kernel.Bootstrap.getFactoryClass(
> 	at org.apache.openjpa.kernel.Bootstrap.invokeFactory(
> 	at org.apache.openjpa.kernel.Bootstrap.newBrokerFactory(
> 	... 23 more
> Caused by: java.lang.ClassNotFoundException: org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory
> 	at java.lang.Class.forName(
> 	at org.apache.openjpa.kernel.Bootstrap.getFactoryClass(
> 	... 25 more

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

View raw message