[ 
https://issues.apache.org/jira/browse/ARIES-818?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13198606#comment-13198606
 ] 

Timothy Ward commented on ARIES-818:
------------------------------------

It is entirely possible that WebSphere have added imports to the bundle 
manifest at deployment, or that they do it at runtime. This is all well and 
good for running in a full application container like WebSphere where you can 
expect some level of classloader trickery, but for other OSGi runtimes, such as 
Karaf, this bundle is broken. The compiled classes contain references to 
packages that aren't imported by the bundle. 

In my view this is no different to the bundle failing to import 
javax.persistence, or some other package that it uses. If the dependencies are 
in the bytecode that gets packaged into the bundle then they should be in the 
manifest. I personally regard this as a bug/missing feature in the OSGi 
Application development tools. There should be a Warning or perhaps even an 
Error generated to tell you that your manifest file is "incomplete" and the 
entries that it thinks is missing. This is exactly what Bnd or Bndtools would 
do.
                
> JPAWeavingHook fails to add dynamic imports for bundles that contain 
> pre-enhanced classes
> -----------------------------------------------------------------------------------------
>
>                 Key: ARIES-818
>                 URL: https://issues.apache.org/jira/browse/ARIES-818
>             Project: Aries
>          Issue Type: Bug
>          Components: JPA
>         Environment: I am using Equinox 
> org.eclipse.osgi_3.7.2.R37x_v20111028-1418.jar with Apache Aries revision 
> 1187719
>            Reporter: Brian DePradine
>         Attachments: patch.txt
>
>
> If the persistence bundle contains pre-enhanced classes then the 
> JPAWeavingHook does not perform any additional enhancement. This has the 
> side-effect of not adding the dynamic imports for the extra packages required 
> by the pre-enhanced classes. The result is the following exception:
> java.lang.reflect.InvocationTargetException
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
>       at java.lang.reflect.Method.invoke(Method.java:611)
>       at com.ibm.osgi.jpa.jpa2.TestTools.run(TestTools.java:60)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
>       at java.lang.reflect.Method.invoke(Method.java:611)
>       at 
> org.apache.aries.blueprint.utils.ReflectionUtils.invoke(ReflectionUtils.java:238)
>       at 
> org.apache.aries.blueprint.container.BeanRecipe.invoke(BeanRecipe.java:838)
>       at 
> org.apache.aries.blueprint.container.BeanRecipe.runBeanProcInit(BeanRecipe.java:638)
>       at 
> org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:726)
>       at 
> org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:71)
>       at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:314)
>       at java.util.concurrent.FutureTask.run(FutureTask.java:149)
>       at 
> org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:79)
>       at 
> org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:220)
>       at 
> org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:154)
>       at 
> org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:630)
>       at 
> org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:326)
>       at 
> org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:228)
>       at 
> org.apache.aries.blueprint.utils.threading.impl.DiscardableRunnable.run(DiscardableRunnable.java:48)
>       at 
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:452)
>       at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:314)
>       at java.util.concurrent.FutureTask.run(FutureTask.java:149)
>       at 
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:109)
>       at 
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:218)
>       at 
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:897)
>       at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:919)
>       at java.lang.Thread.run(Thread.java:736)
> Caused by: java.lang.NoClassDefFoundError: 
> org.apache.openjpa.enhance.PersistenceCapable
>       at java.lang.ClassLoader.defineClassImpl(Native Method)
>       at java.lang.ClassLoader.defineClass(ClassLoader.java:275)
>       at 
> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass(DefaultClassLoader.java:188)
>       at 
> org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClassHoldingLock(ClasspathManager.java:626)
>       at 
> org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:608)
>       at 
> org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(ClasspathManager.java:562)
>       at 
> org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(ClasspathManager.java:486)
>       at 
> org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:459)
>       at 
> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
>       at 
> org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:400)
>       at 
> org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:476)
>       at 
> org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
>       at 
> org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
>       at 
> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
>       at java.lang.ClassLoader.loadClass(ClassLoader.java:619)
>       at java.lang.Class.forNameImpl(Native Method)
>       at java.lang.Class.forName(Class.java:172)
>       at 
> org.apache.openjpa.meta.MetaDataRepository.classForName(MetaDataRepository.java:1552)
>       at 
> org.apache.openjpa.meta.MetaDataRepository.loadPersistentTypesInternal(MetaDataRepository.java:1528)
>       at 
> org.apache.openjpa.meta.MetaDataRepository.loadPersistentTypes(MetaDataRepository.java:1506)
>       at 
> org.apache.openjpa.kernel.AbstractBrokerFactory.loadPersistentTypes(AbstractBrokerFactory.java:282)
>       at 
> org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java:238)
>       at 
> org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:212)
>       at 
> org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:156)
>       at 
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:227)
>       at 
> com.ibm.ws.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:50)
>       at 
> com.ibm.ws.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:35)
>       at 
> org.apache.aries.jpa.container.impl.CountingEntityManagerFactory.createEntityManager(CountingEntityManagerFactory.java:65)
>       at 
> Proxy5c17bfcd_497a_4e6b_80f8_395b2e49aa63.createEntityManager(Unknown Source)
>       at com.ibm.osgi.jpa.jpa2.NewAPITest.primeDB(NewAPITest.java:87)
>       at com.ibm.osgi.jpa.jpa2.NewAPITest.before(NewAPITest.java:36)
>       ... 31 more
> Caused by: java.lang.ClassNotFoundException: 
> org.apache.openjpa.enhance.PersistenceCapable
>       at 
> org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:513)
>       at 
> org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
>       at 
> org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
>       at 
> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
>       at java.lang.ClassLoader.loadClass(ClassLoader.java:619)
>       ... 62 more

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to