Uploaded image for project: 'Commons DBCP'
  1. Commons DBCP
  2. DBCP-445

java.lang.NoClassDefFoundError: javax/transaction/SystemException after update

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.4, 2.0, 2.0.1, 2.1, 2.1.1
    • 2.2.0
    • None
    • java 8, OSGi

    Description

      Updating dbcp in my OSGi application, from 2.0.1 to 2.1.1 I now get the following exception:

      ...
      Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource': FactoryBean threw exception on object creation; nested exception is java.lang.NoClassDefFoundError: javax/transaction/SystemException
      at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:175) ~[org.apache.servicemix.bundles.spring-beans-4.2.0.RELEASE_1.jar:na]
      at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:103) ~[org.apache.servicemix.bundles.spring-beans-4.2.0.RELEASE_1.jar:na]
      at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1574) ~[org.apache.servicemix.bundles.spring-beans-4.2.0.RELEASE_1.jar:na]
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:316) ~[org.apache.servicemix.bundles.spring-beans-4.2.0.RELEASE_1.jar:na]
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:196) ~[org.apache.servicemix.bundles.spring-beans-4.2.0.RELEASE_1.jar:na]
      at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351) ~[org.apache.servicemix.bundles.spring-beans-4.2.0.RELEASE_1.jar:na]
      ... 72 common frames omitted
      Caused by: java.lang.NoClassDefFoundError: javax/transaction/SystemException
      at org.apache.commons.dbcp2.managed.LocalXAConnectionFactory.<init>(LocalXAConnectionFactory.java:57) ~[na:na]
      at org.apache.commons.dbcp2.managed.BasicManagedDataSource.createConnectionFactory(BasicManagedDataSource.java:139) ~[na:na]
      at org.apache.commons.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:2033) ~[na:na]
      at org.apache.commons.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:1533) ~[na:na]
      at com.softmodeler.server.persistence.BasicManagedDataSourceFactory.getBasicManagedDataSource(BasicManagedDataSourceFactory.java:115) ~[na:na]
      at com.softmodeler.server.persistence.BasicManagedDataSourceFactory.getObject(BasicManagedDataSourceFactory.java:331) ~[na:na]
      at com.softmodeler.server.persistence.BasicManagedDataSourceFactory.getObject(BasicManagedDataSourceFactory.java:1) ~[na:na]
      at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:168) ~[org.apache.servicemix.bundles.spring-beans-4.2.0.RELEASE_1.jar:na]
      ... 77 common frames omitted
      Caused by: java.lang.ClassNotFoundException: javax.transaction.SystemException cannot be found by org.apache.commons.dbcp2_2.1.1
      at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:389) [org.eclipse.osgi_3.10.100.v20150529-1857.jar:na]
      at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:352) [org.eclipse.osgi_3.10.100.v20150529-1857.jar:na]
      at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:344) [org.eclipse.osgi_3.10.100.v20150529-1857.jar:na]
      at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:160) [org.eclipse.osgi_3.10.100.v20150529-1857.jar:na]
      at java.lang.ClassLoader.loadClass(ClassLoader.java:357) [na:1.8.0_51]
      ... 85 common frames omitted

      In my environment I have javax.transaction 1.2, I suspected that since there is no version declared in the MANIFEST.MF, the JRE package "javax.transaction" is used.
      Where there is no SystemException.

      So changing the Manifest.MF from
      javax.transaction,
      javax.transaction.xa
      to
      javax.transaction;version="1.1.0",
      javax.transaction.xa;version="1.1.0",
      solves the issue.

      Setting it to version 1.1.0 instead of 1.2.0 since there is no sign that 1.2.0 is required.

      Attachments

        Activity

          People

            Unassigned Unassigned
            flavio.donze Flavio Donzé
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: