The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

ceugster (4) [Avatar] Offline
#1
Hi, I desperatly follow the fancyfood tutorial and have problems with transactions as it seems. I am in chapter 3.2.3. Starting the osgi container I get a BundleException while resolving bundle org.apache.geronimo.components.geronimo-transaction_2.1.3.
Reason: Package uses conflict: Import-Package: javax.resource.spi; version="[1.0.0,2.0.0):

<code>
org.osgi.framework.BundleException: The bundle "org.apache.geronimo.components.geronimo-transaction_2.1.3 [58]" could not be resolved. Reason: Package uses conflict: Import-Package: javax.resource.spi; version="[1.0.0,2.0.0)"
at org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolverError(AbstractBundle.java:1327)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolutionFailureException(AbstractBundle.java:1311)
at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:323)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:389)
at org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1130)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:559)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:544)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:457)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:243)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:43smilie
at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:1)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)
</code>

As a result there is a ComponentDefinitionException thrown with message "Unable to initialize bean populator:

<code>
org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to intialize bean populator
at org.apache.aries.blueprint.container.BeanRecipe.runBeanProcInit(BeanRecipe.java:710)
at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:820)
at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:783)
at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:13smilie
at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:8smilie
at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:245)
at org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:183)
at org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:64smilie
at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:340)
at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:242)
at org.apache.aries.blueprint.utils.threading.impl.DiscardableRunnable.run(DiscardableRunnable.java:4smilie
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:13smilie
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:9smilie
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:90smilie
at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.LinkageError: loader constraint violation: when resolving interface method "javax.transaction.Transaction.enlistResource(Ljavax/transaction/xa/XAResourcesmilieZ" the class loader (instance of org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader) of the current class, org/apache/aries/jpa/container/tx/impl/XADatasourceEnlistingWrapper, and the class loader (instance of org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader) for resolved class, javax/transaction/Transaction, have different Class objects for the type javax/transaction/xa/XAResource used in the signature
at org.apache.aries.jpa.container.tx.impl.XADatasourceEnlistingWrapper.enlist(XADatasourceEnlistingWrapper.java:109)
at org.apache.aries.jpa.container.tx.impl.XADatasourceEnlistingWrapper.getConnection(XADatasourceEnlistingWrapper.java:72)
at org.apache.aries.jpa.container.unit.impl.DelayedLookupDataSource.getConnection(DelayedLookupDataSource.java:36)
at org.apache.openjpa.lib.jdbc.DelegatingDataSource.getConnection(DelegatingDataSource.java:131)
at org.apache.openjpa.lib.jdbc.DecoratingDataSource.getConnection(DecoratingDataSource.java:106)
at org.apache.openjpa.jdbc.sql.DBDictionaryFactory.newDBDictionary(DBDictionaryFactory.java:91)
at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDBDictionaryInstance(JDBCConfigurationImpl.java:595)
at org.apache.openjpa.jdbc.meta.MappingRepository.endConfiguration(MappingRepository.java:1489)
at org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:507)
at org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:432)
at org.apache.openjpa.lib.conf.PluginValue.instantiate(PluginValue.java:104)
at org.apache.openjpa.conf.MetaDataRepositoryValue.instantiate(MetaDataRepositoryValue.java:6smilie
at org.apache.openjpa.lib.conf.ObjectValue.instantiate(ObjectValue.java:83)
at org.apache.openjpa.conf.OpenJPAConfigurationImpl.newMetaDataRepositoryInstance(OpenJPAConfigurationImpl.java:939)
at org.apache.openjpa.conf.OpenJPAConfigurationImpl.getMetaDataRepositoryInstance(OpenJPAConfigurationImpl.java:930)
at org.apache.openjpa.kernel.AbstractBrokerFactory.makeReadOnly(AbstractBrokerFactory.java:626)
at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:193)
at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:156)
at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:213)
at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:57)
at org.apache.aries.jpa.container.impl.CountingEntityManagerFactory.createEntityManager(CountingEntityManagerFactory.java:71)
at org.apache.aries.jpa.container.context.transaction.impl.JTAPersistenceContextRegistry.getCurrentPersistenceContext(JTAPersistenceContextRegistry.java:152)
at org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.getPersistenceContext(JTAEntityManager.java:87)
at org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.createQuery(JTAEntityManager.java:193)
at fancyfoods.persistence.InventoryImpl.getFoodCount(InventoryImpl.java:47)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.aries.proxy.impl.ProxyHandler$1.invoke(ProxyHandler.java:54)
at org.apache.aries.proxy.impl.ProxyHandler.invoke(ProxyHandler.java:119)
at $Proxy13.getFoodCount(Unknown Source)
at fancyfoods.persistence.InventoryPopulator.populate(InventoryPopulator.java:16)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.aries.blueprint.utils.ReflectionUtils.invoke(ReflectionUtils.java:23smilie
at org.apache.aries.blueprint.container.BeanRecipe.invoke(BeanRecipe.java:954)
at org.apache.aries.blueprint.container.BeanRecipe.runBeanProcInit(BeanRecipe.java:70smilie
... 20 more
</code>

Can you give me a hint?

Thank you!
donlaiq (4) [Avatar] Offline
#2
Re: fancyfood persistence starting container throws BundleException
I have the same issue. Actually, I didn't follow exactly the same way the book says, because I did it from a Java EE Eclipse Juno, and then using PDE, but I'm stucked in the same place, the chapter 3.2.3, with the same stack trace.
There's any solution or I missed something?