| Summary: | NoClassDefFoundError: javax/transaction/TransactionManager when publishing UserTransaction service using Atomikos 3.6.5 | ||
|---|---|---|---|
| Product: | [RT] Virgo | Reporter: | guofeng zhang <guofeng> |
| Component: | unknown | Assignee: | Glyn Normington <glyn.normington> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | glyn.normington |
| Version: | 2.1.0.M05-incubation | ||
| Target Milestone: | 2.1.0.RC1-incubation | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| URL: | http://dev.eclipse.org/mhonarc/lists/virgo-dev/msg00301.html | ||
| Whiteboard: | |||
Looking at the NoClassDefFoundError, it appears the bundle com.atomikos.transactions-api_3.6.5 is not wired to a bundle providing the class javax.transaction.TransactionManager. Please could you paste the contents of that bundle's META-INF/MANIFEST.MF here for us to see. The following is the content of MANIFEST.MF in the bundle "org.planner.infrastructure.jtatransaction": Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Jtatransaction Bundle-SymbolicName: org.planner.infrastructure.jtatransaction Bundle-Version: 1.0.0.qualifier Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Import-Package: com.atomikos.icatch.admin;version="[3.6.5,4.0.0)", com.atomikos.icatch.admin.imp;version="[3.6.5,4.0.0)", com.atomikos.icatch.config;version="[3.6.5,4.0.0)", com.atomikos.icatch.jta;version="[3.6.5,4.0.0)", com.atomikos.icatch.standalone;version="[3.6.5,4.0.0)", javax.naming, javax.sql, javax.transaction;version="1.1.0", javax.transaction.xa;version="1.1.0", org.apache.xbean.spring.jndi;version=3, org.springframework.transaction;version="3.0.0", org.springframework.transaction.jta;version="3.0.0" The manifest of the org.planner.infrastructure.jtatransaction isn't particularly relevant. This portion of the stack trace: org.eclipse.virgo.kernel.osgi.framework.ExtendedClassNotFoundException: javax.transaction.TransactionManager in KernelBundleClassLoader: [bundle=com.atomikos.transactions-api_3.6.5] shows that the bundle com.atomikos.transactions is the one which needs to import the package javax.transaction. That's why I am interested in the manifest of the bundle com.atomikos.transactions. Please could you paste it here. Manifest-Version: 1.0 Created-By: 1.5.0_19 (Apple Inc.) Import-Package: com.atomikos.datasource;resolution:=optional;version=" 3.6",com.atomikos.finitestates;resolution:=optional,com.atomikos.icat ch;resolution:=optional;version="3.6",com.atomikos.icatch.admin;resol ution:=optional;version="3.6",com.atomikos.icatch.config;resolution:= optional;version="3.6",com.atomikos.util;resolution:=optional,javax.t ransaction;resolution:=optional Atomikos-Version: 3.6.5 Bnd-LastModified: 1271735329448 Export-Package: com.atomikos.datasource;uses:="com.atomikos.icatch";ve rsion="3.6.5",com.atomikos.icatch;uses:="com.atomikos.finitestates";v ersion="3.6.5",com.atomikos.icatch.admin;uses:="com.atomikos.icatch"; version="3.6.5",com.atomikos.icatch.config;uses:="com.atomikos.dataso urce,com.atomikos.icatch.admin,com.atomikos.icatch,javax.transaction, com.atomikos.util";version="3.6.5" Bundle-Version: 3.6.5 Atomikos-Build-Number: 1400 Bundle-Name: atomikos-transactions-api Bundle-Description: transactions api module Ant-Version: Apache Ant 1.7.1 Originally-Created-By: 1.5.0_19-137 (Apple Inc.) Bundle-ManifestVersion: 2 Bundle-SymbolicName: com.atomikos.transactions-api Implementation-Title: transactions-api.jar Tool: Bnd-0.0.384 Implementation-Version: 3.6.5 Implementation-Vendor: Atomikos Thanks. So the Atomikos API bundle imports javax.transaction but as an optional import. I wonder if this optional import is being dropped for some reason. Take a look at the package wiring for javax.transaction using the Equinox console (you need to uncomment the osgi.console setting in the file config/org.eclipse.virgo.kernel.userregion.properties and restart Virgo first), accessed via telnet. Use the package(s) command to see whether the Atomikos API bundle is wired to a provider of javax.transaction. However, I would expect the bundle to be wired correctly if you are using the Virgo web server (rather than Virgo kernel on its own) since the javax.transaction bundle is provided in repository/ext. You may however like to check that the bundle is present if the Atomikos API bundle isn't wired to javax.transaction. I use Virgo Admin Console to check the "com.atomikos.transactions-api - 3.6.5" bundle. The following is how javax.transaction is imported by this bundle displayed under Imported Pacakges: javax.transaction[0.0.0, oo)/0 (org.eclipse.osgi - 3.6.1.R36x_v20100806)/resolution:=optional/bundle-version=0.0.0 version=0.0.0 Equinox exported javax.transaction 0.0.0, 1.0.1 and 1.1.0. From the above, we know that the provider for javax.transaction is Equinox, which will export some of the Java System classes, but rt.jar has javax.transaction package defined, but has no javax.transacntion.TransactionManager in it. The above information is displayed the same on M4. But I cannot figure out why it is failed on M5. Note: I use Virgo Web Server M5. I too cannot see why this would be any different between milestone 4 and milestone 5 because lib/java6-server.profile is unchanged between those milestones and contains the following: org.osgi.framework.system.packages = \ ... javax.transaction,\ javax.transaction;version="1.0.1",\ javax.transaction;version="1.1.0",\ javax.transaction.xa,\ javax.transaction.xa;version="1.0.1",\ javax.transaction.xa;version="1.1.0",\ ... As you observe, javax.transaction.TransactionManager is not provided by Java SE 6, so it would seem that milestone 5 is behaving correctly. If you want a TransactionManager type, you'll have to get hold of a bundle that provides it and then make sure the relevant imports wire to that bundle. The only problem I can see is that you were able to load TransactionManager in milestone 4. So can you go back to milestone 4, reproduce the behaviour, and see where you are getting TransactionManager from. This is easily determined in a debugger by evaluating an expression like TransactionManager.class.getClassLoader(). I created an Activator class to print which classloader loaded the TransactionManager. I deployed it on M4. The output:
org.eclipse.osgi.launch.EquinoxFWClassLoader@3f3b9b
Someone else spotted that a necessary JAR went missing in milestone 5 - see the link to virgo-dev in the URL field of this bug. I have reinstated the JAR. Apologies for the inconvenience! Meanwhile, as a workaround, please copy the JAR com.springsource.javax.transaction-1.1.0.jar from milestone 4's lib directory to milestone 5's lib/launcher directory and restart Virgo. If you move up to milestone 6, the JAR needs to go in lib. The proper fix will be in RC1 and in any milestones we issue between now and then. (In reply to comment #8) > I created an Activator class to print which classloader loaded the > TransactionManager. I deployed it on M4. The output: > org.eclipse.osgi.launch.EquinoxFWClassLoader@3f3b9b Thanks for this detective work which further confirms the problem as described in comment 9. I am rippling up the kernel change to ensure that the lib directory in the web server does indeed get the correct content. |
Build Identifier: virgo-web-server-2.1.0.M05 The bundle create a userTransactionService bean. It works well on Virgo Web Server M4, but failed on Virgo Web Server M5. Reproducible: Always Steps to Reproduce: The bean in the module-context.xml: <bean id="userTransactionService" class="com.atomikos.icatch.config.UserTransactionServiceImp" init-method="init" destroy-method="shutdownForce"> <constructor-arg> <props> <prop key="com.atomikos.icatch.service">com.atomikos.icatch.standalone.UserTransactionServiceFactory</prop> <prop key="com.atomikos.icatch.default_jta_timeout">300000</prop> <!-- Need this for long running transactions. --> <prop key="com.atomikos.icatch.max_timeout">172800000</prop> <!--Max number of active transactions. --> <prop key="com.atomikos.icatch.max_actives">-1</prop> <prop key="com.atomikos.icatch.force_shutdown_on_vm_exit">true</prop> <prop key="com.atomikos.icatch.console_log_level">DEBUG</prop> <prop key="com.atomikos.icatch.enable_logging">false</prop> </props> </constructor-arg> <!--property name="initialLogAdministrators"> <list> <ref bean="localLogAdministrator"/> </list> </property--> </bean> the error output: [2010-10-09 16:19:31.229] start-signalling-1 org.eclipse.virgo.medic.eventlog.default DE0006E Start failed for bundle 'org.planner.infrastructure.jtatransaction' version '1.0.0.201009211243'. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransactionService' defined in URL [bundleentry://81.fwk28358501/META-INF/spring/module-context.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javax/transaction/TransactionManager at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1401) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:512) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:557) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:842) 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 org.eclipse.virgo.kernel.agent.dm.ContextPropagatingTaskExecutor$2.run(ContextPropagatingTaskExecutor.java:95) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619) Caused by: java.lang.NoClassDefFoundError: javax/transaction/TransactionManager at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2427) at java.lang.Class.getMethod0(Class.java:2670) at java.lang.Class.getMethod(Class.java:1603) at org.springframework.beans.BeanUtils.findMethod(BeanUtils.java:162) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1483) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1468) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1398) ... 17 common frames omitted Caused by: org.eclipse.virgo.kernel.osgi.framework.ExtendedClassNotFoundException: javax.transaction.TransactionManager in KernelBundleClassLoader: [bundle=com.atomikos.transactions-api_3.6.5] at org.eclipse.virgo.kernel.userregion.internal.equinox.KernelBundleClassLoader.loadClass(KernelBundleClassLoader.java:139) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) ... 25 common frames omitted Caused by: java.lang.ClassNotFoundException: javax.transaction.TransactionManager at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:460) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410) at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107) at org.eclipse.virgo.kernel.userregion.internal.equinox.KernelBundleClassLoader.loadClass(KernelBundleClassLoader.java:135) ... 26 common frames omitted