Uploaded image for project: 'OpenJPA'
  1. OpenJPA
  2. OPENJPA-2521

Cannot load entities from a different bundle in an OSGi environment.

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.3.0
    • Fix Version/s: 2.4.0
    • Component/s: None
    • Labels:
      None
    • Environment:
      Apache Servicemix
    • Patch Info:
      Patch Available

      Description

      When you integrate the OpenJPA 2.3.0 with Spring and Apache-Camel in an OSGi environment like Apache Servicemix, you can't load the entities from a different bundle because the path given for this bundle in OSGi specific. A stack trace is bellow:

      openjpa.Runtime - An error occurred while registering a ClassTransformer with PersistenceUnitInfo: name 'openjpa-test', root URL [bundle://240.0:1]. The error is logged along with this warning. Load-time class transformation will not be available.<openjpa-2.3.0-r422266:1540826 nonfatal general error> org.apache.openjpa.util.GeneralException: Resource does not exist: bundle://240.0:1
      at org.apache.openjpa.meta.AbstractCFMetaDataFactory.getPersistentTypeNames(AbstractCFMetaDataFactory.java:635)
      at org.apache.openjpa.meta.MetaDataRepository.getPersistentTypeNamesInternal(MetaDataRepository.java:1478)
      at org.apache.openjpa.meta.MetaDataRepository.getPersistentTypeNames(MetaDataRepository.java:1470)
      at org.apache.openjpa.enhance.PCClassFileTransformer.<init>(PCClassFileTransformer.java:103)
      at org.apache.openjpa.enhance.PCClassFileTransformer.<init>(PCClassFileTransformer.java:67)
      at org.apache.openjpa.persistence.PersistenceProviderImpl$ClassTransformerImpl.<init>(PersistenceProviderImpl.java:284)
      at org.apache.openjpa.persistence.PersistenceProviderImpl$ClassTransformerImpl.<init>(PersistenceProviderImpl.java:266)
      at org.apache.openjpa.persistence.PersistenceProviderImpl.createContainerEntityManagerFactory(PersistenceProviderImpl.java:169)
      at org.apache.openjpa.persistence.PersistenceProviderImpl.createContainerEntityManagerFactory(PersistenceProviderImpl.java:62)
      at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:288)
      at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:310)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1541)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
      at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1117)
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:922)
      at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)
      at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)
      at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
      at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)
      at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)
      at java.lang.Thread.run(Thread.java:744)
      Caused by: java.io.IOException: Resource does not exist: bundle://240.0:1
      at org.apache.felix.framework.URLHandlersBundleURLConnection.<init>(URLHandlersBundleURLConnection.java:60)
      at org.apache.felix.framework.URLHandlersBundleStreamHandler.openConnection(URLHandlersBundleStreamHandler.java:64)
      at java.net.URL.openConnection(URL.java:971)
      at java.net.URL.openStream(URL.java:1037)
      at org.apache.openjpa.lib.util.J2DoPrivHelper$43.run(J2DoPrivHelper.java:946)
      at org.apache.openjpa.lib.util.J2DoPrivHelper$43.run(J2DoPrivHelper.java:944)
      at java.security.AccessController.doPrivileged(Native Method)
      at org.apache.openjpa.meta.AbstractCFMetaDataFactory.parsePersistentTypeNames(AbstractCFMetaDataFactory.java:769)
      at org.apache.openjpa.meta.AbstractCFMetaDataFactory.getPersistentTypeNames(AbstractCFMetaDataFactory.java:623)
      ... 26 more

        Activity

        Hide
        fabien7474 Fabien Benichou added a comment -

        I am experencing the same issue.

        Is there any ways to include this patch in next OpneJPA Release ?

        Show
        fabien7474 Fabien Benichou added a comment - I am experencing the same issue. Is there any ways to include this patch in next OpneJPA Release ?
        Hide
        chris@die-schneider.net Christian Schneider added a comment -

        This problem also affects openjpa 2.4.0.

        Show
        chris@die-schneider.net Christian Schneider added a comment - This problem also affects openjpa 2.4.0.
        Hide
        githubbot ASF GitHub Bot added a comment -

        GitHub user artaxerxe opened a pull request:

        https://github.com/apache/openjpa/pull/1

        OPENJPA-2521 Cannot load entities from a different bundle in an OSGi environment

        Fixed this issue, so that now you can load those entities even in a OSGi context.

        You can merge this pull request into a Git repository by running:

        $ git pull https://github.com/artaxerxe/openjpa 2.3.x

        Alternatively you can review and apply these changes as the patch at:

        https://github.com/apache/openjpa/pull/1.patch

        To close this pull request, make a commit to your master/trunk branch
        with (at least) the following in the commit message:

        This closes #1


        commit e664d67daa30a59cce88ca903925026d30aa7902
        Author: Mura Andrei <andrei.mura@moredevs.ro>
        Date: 2014-07-30T13:13:05Z

        OPENJPA-2521 Cannot load entities from a different bundle in an OSGi environment.


        Show
        githubbot ASF GitHub Bot added a comment - GitHub user artaxerxe opened a pull request: https://github.com/apache/openjpa/pull/1 OPENJPA-2521 Cannot load entities from a different bundle in an OSGi environment Fixed this issue, so that now you can load those entities even in a OSGi context. You can merge this pull request into a Git repository by running: $ git pull https://github.com/artaxerxe/openjpa 2.3.x Alternatively you can review and apply these changes as the patch at: https://github.com/apache/openjpa/pull/1.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #1 commit e664d67daa30a59cce88ca903925026d30aa7902 Author: Mura Andrei <andrei.mura@moredevs.ro> Date: 2014-07-30T13:13:05Z OPENJPA-2521 Cannot load entities from a different bundle in an OSGi environment.

          People

          • Assignee:
            Unassigned
            Reporter:
            artaxerxe Mura Andrei Petru
          • Votes:
            3 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:

              Development