And, for what it is worth, this is a Spring project. I don't know if that
changes anything, or allows me to configure things differently.
dmiller44 wrote:
I'm using Tomcat 5.5.27 -- I followed the guide you posted, so everything
described step by step is how I set up my Tomcat instance.
The only difference was, when I used the JNDI config they have in
resources.properties, and added the <Resource> tag in context.xml, I get
an error that says:
Caused by: javax.naming.NameNotFoundException: Name jdbc is not bound in
this Context
However, when I remove the <Resource> from the context.xml and remove
everything from resource.properties, and put back the code I posted
originally (the snippet where I created a new PoolingDataSource and
registered it via InitialContext), I get the error I posted about the file
locking.
I hope that provides some ideas. Is there something that maybe I
described wrong in persistence.xml -- should I try using
comp/env/jdbc/testDS1 instead of jdbc/testDS1 ?
Thanks.
nfox241 wrote:
>
>
> What application server are you using? What did you add to your server's
> configuration files?
>
> For tomcat 6, a few things have to be set. I've found the following link
> helpful in the past:
http://docs.codehaus.org/display/BTM/Tomcat13
>
>
>
>
>
> dmiller44 wrote:
>>
>> After trying suggestion below -- I am now getting the following stack.
>> I've tried deleting the database-generated files figuring a lock
>> existed, but I still get this (even though the files get re-created):
>>
>>
>> org.springframework.beans.factory.BeanCreationException: Error creating
>> bean with name 'droolsEngineFactory' defined in ServletContext resource
>> [/WEB-INF/spring/summit/summit-specific.xml]: Invocation of init method
>> failed; nested exception is javax.persistence.PersistenceException:
>> [PersistenceUnit: org.drools.persistence.jpa] Unable to build
>> EntityManagerFactory
>> at
>>
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)
>> at
>>
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
>> at
>>
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
>> at java.security.AccessController.doPrivileged(Native Method)
>> at
>>
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
>> at
>>
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
>> at
>>
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
>> at
>>
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
>> at
>>
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
>> at
>>
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
>> at
>>
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
>> at
>>
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
>> at
>>
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
>> at
>>
org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
>> at
>>
org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
>> at
>>
org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
>> at
>>
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3764)
>> at
>> org.apache.catalina.core.StandardContext.start(StandardContext.java:4216)
>> at
>> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760)
>> at
>> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740)
>> at
>> org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544)
>> at
>> org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:626)
>> at
>> org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)
>> at
>> org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
>> at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1150)
>> at
>> org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
>> at
>>
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
>> at
>> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022)
>> at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
>> at
>> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
>> at
>> org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
>> at
>> org.apache.catalina.core.StandardService.start(StandardService.java:448)
>> at
>> org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
>> at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
>> 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.catalina.startup.Bootstrap.start(Bootstrap.java:295)
>> at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
>> Caused by: javax.persistence.PersistenceException: [PersistenceUnit:
>> org.drools.persistence.jpa] Unable to build EntityManagerFactory
>> at
>>
org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:677)
>> at
>>
org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:126)
>> at
>> javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83)
>> at
>> javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:60)
>> at
>>
com.versatile.mte.drools.engine.DroolsEngineFactory.init(DroolsEngineFactory.java:176)
>> 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:1414)
>> at
>>
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1375)
>> at
>>
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)
>> ... 39 more
>> Caused by: org.hibernate.HibernateException: Could not obtain BTM
>> transaction manager instance
>> at
>>
org.hibernate.transaction.BTMTransactionManagerLookup.getTransactionManager(BTMTransactionManagerLookup.java:50)
>> at
>> org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:357)
>> at
>> org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327)
>> at
>>
org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
>> at
>>
org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
>> ... 50 more
>> Caused by: java.lang.reflect.InvocationTargetException
>> 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.hibernate.transaction.BTMTransactionManagerLookup.getTransactionManager(BTMTransactionManagerLookup.java:47)
>> ... 54 more
>> Caused by: bitronix.tm.utils.InitializationException: recovery failed,
>> cannot safely start the transaction manager
>> at
>>
bitronix.tm.BitronixTransactionManager.<init>(BitronixTransactionManager.java:65)
>> at
>>
bitronix.tm.TransactionManagerServices.getTransactionManager(TransactionManagerServices.java:41)
>> ... 59 more
>> Caused by: java.nio.channels.OverlappingFileLockException
>> at
>>
sun.nio.ch.FileChannelImpl$SharedFileLockTable.checkList(FileChannelImpl.java:1170)
>> at
>> sun.nio.ch.FileChannelImpl$SharedFileLockTable.add(FileChannelImpl.java:1072)
>> at sun.nio.ch.FileChannelImpl.tryLock(FileChannelImpl.java:878)
>> at
>>
bitronix.tm.journal.TransactionLogAppender.<init>(TransactionLogAppender.java:51)
>> at bitronix.tm.journal.DiskJournal.open(DiskJournal.java:131)
>> at
>>
bitronix.tm.BitronixTransactionManager.<init>(BitronixTransactionManager.java:47)
>> ... 60 more
>>
>>
>>
>>
>> nfox241 wrote:
>>>
>>> Do you have the correct Bitronix configuration setup in your server's
>>> configuration file?
>>>
>>>
>>>
>>>
>>> dmiller44 wrote:
>>>>
>>>> I'm having a lot of trouble getting the default Drools persistence
>>>> stuff working as it's documented in the Drools Flow manual. Below
>>>> I've included the stack trace, my dependencies (only those related
to
>>>> drools persistence), my code snipped (which gets compiled into a jar
>>>> and used by a war) and the persistence.xml file (which is also
>>>> compiled into the jar under META-INF/persistence.xml). Any help would
>>>> be appreciated.
>>>>
>>>> *Note: I tried posting this yesterday, but it doesnt seem to have
>>>> made it to the mailing list, so sorry for a double post if it did *
>>>>
>>>> Stack trace:
>>>>
>>>> 2010-01-07
>>>> 15:36:26,599|org.springframework.web.context.ContextLoader|main|ERROR||
>>>> Context initialization failed
>>>> org.springframework.beans.factory.BeanCreationException: Error
>>>> creating bean with name 'droolsEngineFactory' defined in
>>>> ServletContext resource [/WEB-INF/spring/summit/summit-specific.xml]:
>>>> Invocation of init method failed; nested exception is
>>>> java.lang.RuntimeException: Could not commit session
>>>> at
>>>>
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)
>>>> at
>>>>
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
>>>> at
>>>>
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
>>>> at java.security.AccessController.doPrivileged(Native Method)
>>>> at
>>>>
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
>>>> at
>>>>
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
>>>> at
>>>>
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
>>>> at
>>>>
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
>>>> at
>>>>
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
>>>> at
>>>>
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
>>>> at
>>>>
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
>>>> at
>>>>
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
>>>> at
>>>>
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
>>>> at
>>>>
org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
>>>> at
>>>>
org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
>>>> at
>>>>
org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
>>>> at
>>>>
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3764)
>>>> at
>>>>
org.apache.catalina.core.StandardContext.start(StandardContext.java:4216)
>>>> at
>>>>
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760)
>>>> at
>>>> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740)
>>>> at
>>>> org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544)
>>>> at
>>>>
org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:626)
>>>> at
>>>>
org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)
>>>> at
>>>> org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
>>>> at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1150)
>>>> at
>>>>
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
>>>> at
>>>>
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
>>>> at
>>>> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022)
>>>> at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
>>>> at
>>>> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
>>>> at
>>>> org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
>>>> at
>>>> org.apache.catalina.core.StandardService.start(StandardService.java:448)
>>>> at
>>>> org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
>>>> at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
>>>> 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.catalina.startup.Bootstrap.start(Bootstrap.java:295)
>>>> at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
>>>> Caused by: java.lang.RuntimeException: Could not commit session
>>>> at
>>>>
org.drools.persistence.session.SingleSessionCommandService.<init>(SingleSessionCommandService.java:133)
>>>> at
>>>>
org.drools.persistence.jpa.impl.JPAKnowledgeServiceProviderImpl.newStatefulKnowledgeSession(JPAKnowledgeServiceProviderImpl.java:44)
>>>> at
>>>>
org.drools.persistence.jpa.JPAKnowledgeService.newStatefulKnowledgeSession(JPAKnowledgeService.java:93)
>>>> at
>>>>
com.versatile.mte.drools.engine.DroolsEngineFactory.init(DroolsEngineFactory.java:189)
>>>> 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:1414)
>>>> at
>>>>
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1375)
>>>> at
>>>>
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)
>>>> ... 39 more
>>>> Caused by: javax.naming.NamingException: Cannot create resource
>>>> instance
>>>> at
>>>>
org.apache.naming.factory.TransactionFactory.getObjectInstance(TransactionFactory.java:113)
>>>> at
>>>> javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
>>>> at org.apache.naming.NamingContext.lookup(NamingContext.java:793)
>>>> at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
>>>> at org.apache.naming.NamingContext.lookup(NamingContext.java:781)
>>>> at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
>>>> at org.apache.naming.SelectorContext.lookup(SelectorContext.java:137)
>>>> at javax.naming.InitialContext.lookup(InitialContext.java:392)
>>>> at
>>>>
org.drools.persistence.session.SingleSessionCommandService.<init>(SingleSessionCommandService.java:109)
>>>> ... 49 more
>>>> 2010-01-07
>>>>
15:36:26,607|org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/mte-web-portal]|main|ERROR||
>>>> Exception sending context initialized event to listener instance of
>>>> class org.springframework.web.context.ContextLoaderListener
>>>> org.springframework.beans.factory.BeanCreationException: Error
>>>> creating bean with name 'droolsEngineFactory' defined in
>>>> ServletContext resource [/WEB-INF/spring/summit/summit-specific.xml]:
>>>> Invocation of init method failed; nested exception is
>>>> java.lang.RuntimeException: Could not commit session
>>>> at
>>>>
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)
>>>> at
>>>>
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
>>>> at
>>>>
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
>>>> at java.security.AccessController.doPrivileged(Native Method)
>>>> at
>>>>
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
>>>> at
>>>>
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
>>>> at
>>>>
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
>>>> at
>>>>
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
>>>> at
>>>>
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
>>>> at
>>>>
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
>>>> at
>>>>
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
>>>> at
>>>>
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
>>>> at
>>>>
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
>>>> at
>>>>
org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
>>>> at
>>>>
org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
>>>> at
>>>>
org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
>>>> at
>>>>
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3764)
>>>> at
>>>>
org.apache.catalina.core.StandardContext.start(StandardContext.java:4216)
>>>> at
>>>>
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760)
>>>> at
>>>> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740)
>>>> at
>>>> org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544)
>>>> at
>>>>
org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:626)
>>>> at
>>>>
org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)
>>>> at
>>>> org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
>>>> at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1150)
>>>> at
>>>>
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
>>>> at
>>>>
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
>>>> at
>>>> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022)
>>>> at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
>>>> at
>>>> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
>>>> at
>>>> org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
>>>> at
>>>> org.apache.catalina.core.StandardService.start(StandardService.java:448)
>>>> at
>>>> org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
>>>> at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
>>>> 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.catalina.startup.Bootstrap.start(Bootstrap.java:295)
>>>> at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
>>>> Caused by: java.lang.RuntimeException: Could not commit session
>>>> at
>>>>
org.drools.persistence.session.SingleSessionCommandService.<init>(SingleSessionCommandService.java:133)
>>>> at
>>>>
org.drools.persistence.jpa.impl.JPAKnowledgeServiceProviderImpl.newStatefulKnowledgeSession(JPAKnowledgeServiceProviderImpl.java:44)
>>>> at
>>>>
org.drools.persistence.jpa.JPAKnowledgeService.newStatefulKnowledgeSession(JPAKnowledgeService.java:93)
>>>> at
>>>>
com.versatile.mte.drools.engine.DroolsEngineFactory.init(DroolsEngineFactory.java:189)
>>>> 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:1414)
>>>> at
>>>>
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1375)
>>>> at
>>>>
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)
>>>> ... 39 more
>>>> Caused by: javax.naming.NamingException: Cannot create resource
>>>> instance
>>>> at
>>>>
org.apache.naming.factory.TransactionFactory.getObjectInstance(TransactionFactory.java:113)
>>>> at
>>>> javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
>>>> at org.apache.naming.NamingContext.lookup(NamingContext.java:793)
>>>> at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
>>>> at org.apache.naming.NamingContext.lookup(NamingContext.java:781)
>>>> at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
>>>> at org.apache.naming.SelectorContext.lookup(SelectorContext.java:137)
>>>> at javax.naming.InitialContext.lookup(InitialContext.java:392)
>>>> at
>>>>
org.drools.persistence.session.SingleSessionCommandService.<init>(SingleSessionCommandService.java:109)
>>>> ... 49 more
>>>>
>>>>
>>>> Dependencies:
>>>>
>>>> <file name="hibernate-3.3.1.ga.jar"/>
>>>> <file name="hibernate-annotations-3.4.0.ga.jar"/>
>>>> <file
name="hibernate-commons-annotations-3.4.0.ga.jar"/>
>>>> <file name="hibernate-entitymanager-3.4.0.ga.jar"/>
>>>> <file name="javassist-3.4.ga.jar"/>
>>>> <file name="jta-1.1.jar"/>
>>>> <file name="dom4j-1.6.1.jar"/>
>>>> <file name="slf4j-jdk14-1.5.2.jar" />
>>>> <file name="btm-1.3.2.jar" />
>>>> <file name="h2-1.0.77.jar" />
>>>> <file name="postgresql-8.1-407.jdbc3.jar"/>
>>>> <file name="drools-persistence-jpa-5.1.0.M1.jar" />
>>>> <file name="commons-dbcp-1.2.2.jar" />
>>>> <file name="commons-logging-1.1.1.jar"/>
>>>> <file name="commons-pool-1.5.1.jar"/>
>>>>
>>>>
>>>> Code Snippet (part that should be loading via JPA):
>>>>
>>>> //ADDED FOR DROOLS PERSISTENCE
>>>> PoolingDataSource ds = new PoolingDataSource();
>>>> ds.setUniqueName("jdbc/testDS1");
>>>> ds.setClassName("org.h2.jdbcx.JdbcDataSource");
>>>> ds.setMaxPoolSize(3);
>>>> ds.setAllowLocalTransactions(true);
>>>> ds.getDriverProperties().put("user","sa");
>>>> ds.getDriverProperties().put("password",
"sasa");
>>>> ds.getDriverProperties().put("URL",
>>>> "jdbc:h2:file:/var/tmp/process-instance-db");
>>>> ds.init();
>>>>
>>>> try {
>>>> Context ctx = new InitialContext();
>>>> ctx.createSubcontext("jdbc");
>>>> ctx.rebind("jdbc/testDS1",ds);
>>>> ctx.close();
>>>> } catch (NamingException e) {
>>>> e.printStackTrace(); //To change body of catch statement
>>>> use File | Settings | File Templates.
>>>> }
>>>>
>>>> Environment env = KnowledgeBaseFactory.newEnvironment();
>>>> EntityManagerFactory emf =
>>>>
Persistence.createEntityManagerFactory("org.drools.persistence.jpa");
>>>> env.set(EnvironmentName.ENTITY_MANAGER_FACTORY,emf);
>>>>
>>>> //grab a session
>>>> LOG.debug("Initializing a new
StatefulKnowledgeSession...");
>>>> //this.ksession = this.kbase.newStatefulKnowledgeSession();
>>>> this.ksession =
>>>> JPAKnowledgeService.newStatefulKnowledgeSession(kbase,null,env);
>>>>
>>>>
>>>> And finally the persistence.xml file:
>>>>
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>> <persistence version="1.0"
>>>>
xmlns="http://java.sun.com/xml/ns/persistence"
>>>>
xmlns:orm="http://java.sun.com/xml/ns/persistence/orm"
>>>>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>>
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
>>>>
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd
>>>>
http://java.sun.com/xml/ns/persistence/orm
>>>>
http://java.sun.com/xml/ns/persistence/orm_1_0.xsd">
>>>> <!--persistence-unit name="ProcessService">
>>>> <jta-data-source>java:/DefaultDS</jta-data-source>
>>>> <properties>
>>>> <property name="hibernate.hbm2ddl.auto"
value="create-drop"/>
>>>> </properties>
>>>> </persistence-unit-->
>>>> <persistence-unit name="org.drools.persistence.jpa"
>>>> transaction-type="JTA">
>>>>
<provider>org.hibernate.ejb.HibernatePersistence</provider>
>>>> <jta-data-source>jdbc/testDS1</jta-data-source>
>>>>
<class>org.drools.persistence.session.SessionInfo</class>
>>>>
>>>>
<class>org.drools.persistence.processinstance.ProcessInstanceInfo</class>
>>>>
>>>>
<class>org.drools.persistence.processinstance.ProcessInstanceEventInfo</class>
>>>>
<class>org.drools.persistence.processinstance.WorkItemInfo</class>
>>>>
>>>>
<class>org.drools.persistence.processinstance.variabletypes.JPAPersistedVariable</class>
>>>>
>>>>
<class>org.drools.persistence.processinstance.variabletypes.VariableInstanceInfo</class>
>>>>
>>>>
<class>org.drools.persistence.processinstance.variabletypes.SerializablePersistedVariable</class>
>>>> <properties>
>>>> <property name="hibernate.dialect"
>>>> value="org.hibernate.dialect.H2Dialect"/>
>>>> <property name="hibernate.max_fetch_depth"
value="3"/>
>>>> <property name="hibernate.hbm2ddl.auto"
value="update" />
>>>> <property name="hibernate.show_sql"
value="false" />
>>>> <property
>>>> name="hibernate.transaction.manager_lookup_class"
>>>> value="org.hibernate.transaction.BTMTransactionManagerLookup"
/>
>>>> </properties>
>>>> </persistence-unit>
>>>> </persistence>
>>>>
>>>>
>>>> Any help would be appreciated. This is getting rather frustrating.
>>>>
>>>>
>>>
>>>
>>
>>
>
>