[
https://issues.apache.org/jira/browse/OPENJPA-2542?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14244286#comment-14244286
]
Ancoron Luciferis commented on OPENJPA-2542:
--------------------------------------------
Just as a side-note: I've also encountered this issue but I was working around
it by providing the custom BrokerFactory and related classes inside an OSGi
fragment bundle, attaching to the OpenJPA one.
That way, it's automatically part of the OpenJPA ClassLoader.
Nevertheless, having official support for application-level BrokerFactory
customization is really nice, thank you.
> Using custom openjpa.BrokerFactory not working in OSGi due to ClassLoader
> -------------------------------------------------------------------------
>
> Key: OPENJPA-2542
> URL: https://issues.apache.org/jira/browse/OPENJPA-2542
> Project: OpenJPA
> Issue Type: Bug
> Components: osgi
> Affects Versions: 2.3.0, 2.4.0
> Environment: JBoss Fuse 6.1, Apache Aries JPA 1.0.1.redhat-610379
> Reporter: Jörn Gersdorf
> Assignee: Rick Curtis
> Fix For: 2.4.0
>
> Attachments: OPENJPA-2542.patch
>
>
> For reasons discussed on the [openjpa-user
> MailingList|http://mail-archives.apache.org/mod_mbox/openjpa-users/201411.mbox/%3CCALLZsMnXPQT%2BeQB3VjYe4U05%2BgSR%2Bw37QqXGRdxdvM-kgEXdLw%40mail.gmail.com%3E]
> I need to use a custom BrokerFactory in an OSGi environment.
> My custom BrokerFactory is obviously in my own OSGi bundle, not in the
> official OpenJPA bundle. Now, due to OPENJPA-1491
> {{org.apache.openjpa.kernel.Bootstrap}} (in connection with
> {{org.apache.openjpa.persistence.PersistenceProviderImpl.createContainerEntityManagerFactory(PersistenceUnitInfo,
> Map) and
> org.apache.openjpa.persistence.osgi.PersistenceActivator.getBundleClassLoader()),
> my BrokerFactories can only live in the official OpenJPA bundle, so that my
> custom BrokerFactory is not found.
> In my opinion it would be better if
> {{org.apache.openjpa.persistence.osgi.PersistenceActivator.getBundleClassLoader()}}
> would return a ClassLoader not only delegating to openjpa´s bundle but _in
> addition_ (as a fallback) to the {{PersistenceUnitInfo}}´s bundle.
> That way one would be able to use arbitrary BrokerFactories by importing them
> if required to the bundle where {{persistence.xml}} is defined.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)