Announcement Announcement Module
Collapse
No announcement yet.
Embedded Derby initialization problem Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Embedded Derby initialization problem

    I am using Spring 2.0.7, Atomikos 3.1.6, Hibernate 3.2.5.ga and Derby 10.3.1.4

    Here's my XA datasource configuration:
    Code:
    		<!-- configure an Atomikos JTA-aware datasource -->
    	<bean id="datasource"
    		class="com.atomikos.jdbc.SimpleDataSourceBean" init-method="init"
    		destroy-method="close">
    		<!-- set an arbitrary but unique name for the datasource -->
    		<property name="uniqueResourceName"
    			value="localDB" />
    		<!-- set the underlying driver class to use, in this example case we use Oracle -->
    		<property name="xaDataSourceClassName"
    			value="org.apache.derby.jdbc.EmbeddedXADataSource" />
    		<!-- set the driver-specific XADataSource properties (check your driver docs for more info) -->
    		<property name="xaDataSourceProperties"
    			value="databaseName=localPresistence;createDatabase=create" />
    		<!-- exclusive mode determines when connections are reused; safest choice is true -->
    		<property name="exclusiveConnectionMode" value="true" />
    	</bean>
    But when I initialize the context, following exception is thrown
    Code:
    Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'datasource' defined in class path resource [hibernate.config.xml]: Invocation of init method failed; nested exception is java.lang.ExceptionInInitializerError
    Caused by: java.lang.ExceptionInInitializerError
    	at org.apache.derby.jdbc.EmbeddedDataSource.findDriver(Unknown Source)
    	at org.apache.derby.jdbc.EmbeddedDataSource.getConnection(Unknown Source)
    	at org.apache.derby.jdbc.EmbeddedDataSource.getConnection(Unknown Source)
    	at org.apache.derby.jdbc.EmbeddedXADataSource.setupResourceAdapter(Unknown Source)
    	at org.apache.derby.jdbc.EmbeddedXADataSource.getXAConnection(Unknown Source)
    	at com.atomikos.jdbc.XAConnectionFactory.getPooledConnection(Unknown Source)
    	at com.atomikos.jdbc.ConnectionPool.<init>(Unknown Source)
    	at com.atomikos.jdbc.JtaDataSourceImp.<init>(Unknown Source)
    	at com.atomikos.jdbc.SimpleDataSourceBean.checkSetup(Unknown Source)
    	at com.atomikos.jdbc.SimpleDataSourceBean.init(Unknown Source)
    	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.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1237)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1203)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1167)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:427)
    	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:249)
    	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:155)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:246)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:291)
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
    	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:122)
    	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:66)
    	at com.gvp.rpt.service.ReportingServiceContext.createRoot(ReportingServiceContext.java:50)
    	at org.restlet.Application.getRoot(Application.java:254)
    	at com.noelios.restlet.application.ApplicationHelper.start(ApplicationHelper.java:145)
    	at org.restlet.Application.start(Application.java:340)
    	at com.noelios.restlet.component.ComponentHelper.checkVirtualHost(ComponentHelper.java:246)
    	at com.noelios.restlet.component.ComponentHelper.start(ComponentHelper.java:134)
    	at org.restlet.Component.start(Component.java:129)
    	at com.gvp.rpt.service.StandAloneReportingService.startService(StandAloneReportingService.java:64)
    	at com.gvp.rpt.service.StandAloneReportingService.main(StandAloneReportingService.java:40)
    Caused by: java.lang.SecurityException: sealing violation: package org.apache.derby.impl.store.raw.data is sealed
    	at java.net.URLClassLoader.defineClass(URLClassLoader.java:227)
    	at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
    	at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    	at java.lang.ClassLoader.defineClass1(Native Method)
    	at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
    	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
    	at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
    	at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
    	at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    	at java.lang.Class.forName0(Native Method)
    	at java.lang.Class.forName(Class.java:169)
    	at org.apache.derby.impl.services.monitor.BaseMonitor.getImplementations(Unknown Source)
    	at org.apache.derby.impl.services.monitor.BaseMonitor.getDefaultImplementations(Unknown Source)
    	at org.apache.derby.impl.services.monitor.BaseMonitor.runWithState(Unknown Source)
    	at org.apache.derby.impl.services.monitor.FileMonitor.<init>(Unknown Source)
    	at org.apache.derby.iapi.services.monitor.Monitor.startMonitor(Unknown Source)
    	at org.apache.derby.iapi.jdbc.JDBCBoot.boot(Unknown Source)
    	at org.apache.derby.jdbc.EmbeddedDriver.boot(Unknown Source)
    	at org.apache.derby.jdbc.EmbeddedDriver.<clinit>(Unknown Source)
    	... 35 more
    Any idea how to resolve this problem?

  • #2
    Can you check if you have two derby jars in your classpath? Essentially, the sealing issue hints that classes from the same package aren't loaded from the same jar (which is exactly what sealing tries to enforce).

    Comment


    • #3
      Yeah found the problem, turns out the activemq.jar file that I'm using already has derby included.

      Thx for the help =)

      Comment

      Working...
      X