Hey there,
I am very much a newbie to Drools, and I have been following the sample
Application setup in the Drools Jboss Rules 5.0 developers guide.
However, I am having some very very annoying problems with my
persistence setup. My application is giving the following error, and
then appears to use a default database jdbc:h2:mem:mydb,
SEVERE: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'entityManagerFactory' defined in class path resource
[applicationContext.xml]: Invocation of init method failed; nested
exception is
org.springframework.jdbc.datasource.lookup.DataSourceLookupFailureExcept
ion: Failed to look up JNDI DataSource with name 'jdbc/testDS1'; nested
exception is javax.naming.NameNotFoundException: Name jdbc is not bound
in this Context
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFac
tory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFac
tory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFac
tory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFac
tory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObjec
t(AbstractBeanFactory.java:264)
at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.g
etSingleton(DefaultSingletonBeanRegistry.java:222)
at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(
AbstractBeanFactory.java:261)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(Ab
stractBeanFactory.java:185)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(Ab
stractBeanFactory.java:164)
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.pre
InstantiateSingletons(DefaultListableBeanFactory.java:423)
at
org.springframework.context.support.AbstractApplicationContext.finishBea
nFactoryInitialization(AbstractApplicationContext.java:728)
at
org.springframework.context.support.AbstractApplicationContext.refresh(A
bstractApplicationContext.java:380)
at
org.springframework.web.servlet.FrameworkServlet.createWebApplicationCon
text(FrameworkServlet.java:402)
at
org.springframework.web.servlet.FrameworkServlet.initWebApplicationConte
xt(FrameworkServlet.java:316)
at
org.springframework.web.servlet.FrameworkServlet.initServletBean(Framewo
rkServlet.java:282)
at
org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.jav
a:126)
at javax.servlet.GenericServlet.init(GenericServlet.java:212)
at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.jav
a:1173)
at
org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993)
at
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.j
ava:4187)
at
org.apache.catalina.core.StandardContext.start(StandardContext.java:4496
)
at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at
org.apache.catalina.core.StandardService.start(StandardService.java:519)
at
org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by:
org.springframework.jdbc.datasource.lookup.DataSourceLookupFailureExcept
ion: Failed to look up JNDI DataSource with name 'jdbc/testDS1'; nested
exception is javax.naming.NameNotFoundException: Name jdbc is not bound
in this Context
at
org.springframework.jdbc.datasource.lookup.JndiDataSourceLookup.getDataS
ource(JndiDataSourceLookup.java:47)
at
org.springframework.orm.jpa.persistenceunit.PersistenceUnitReader.parseP
ersistenceUnitInfo(PersistenceUnitReader.java:281)
at
org.springframework.orm.jpa.persistenceunit.PersistenceUnitReader.parseD
ocument(PersistenceUnitReader.java:215)
at
org.springframework.orm.jpa.persistenceunit.PersistenceUnitReader.readPe
rsistenceUnitInfos(PersistenceUnitReader.java:139)
at
org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManage
r.readPersistenceUnitInfos(DefaultPersistenceUnitManager.java:303)
at
org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManage
r.preparePersistenceUnitInfos(DefaultPersistenceUnitManager.java:275)
at
org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManage
r.afterPropertiesSet(DefaultPersistenceUnitManager.java:260)
at
org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.creat
eNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:
192)
at
org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterProper
tiesSet(AbstractEntityManagerFactoryBean.java:291)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFac
tory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFac
tory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)
... 34 more
Caused by: javax.naming.NameNotFoundException: Name jdbc is not bound in
this Context
at org.apache.naming.NamingContext.lookup(NamingContext.java:770)
at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
at org.apache.naming.SelectorContext.lookup(SelectorContext.java:152)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at
org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:15
5)
at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:88)
at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:153)
at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:178)
at
org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.ja
va:104)
at
org.springframework.jdbc.datasource.lookup.JndiDataSourceLookup.getDataS
ource(JndiDataSourceLookup.java:44)
... 44 more
I have searched every forum I can find online to see if I can find the
solution to this proble, but so far I have not had any joy. The setup I
have following the book to the finest detail, and my transaction manager
has been set up using the
http://docs.codehaus.org/display/BTM/Tomcat13 site. Please can
somebody advise me on where I could be going wrong? Is there something
in the book that I am missing? I have put the h2-1.0.77.jar in both my
classpath and in the lib directory of Tomcat6.
Thanks in advance,
Julie
Julie Wilson
Java Developer
Technology
Direct dial: +44 (0) 1442 829879
Email: Julie.Wilson(a)grg.com
www.grassroots.uk.com <
http://www.grassroots.uk.com/>
Grass Roots
Logo<http://www.grassroots.uk.com/bdr-emp2/gruk/img/logo-gr-inspiring.jp
g>
________________________________
Grass Roots * * Belfast * * Switchboard +44 (0) 1442 829400
________________________________
Grass Roots is proud to feature in the 2007, 2008, 2009 and 2010 lists
of Sunday Times best 100 companies to work for in the UK.
Registered Name: The Grass Roots Group UK Limited Place of
Incorporation: England & Wales Registered No.: 4155659
Registered Office: Pennyroyal Court, Station Road, Tring, Herts. HP23
5QY
Please consider the environment - do you really need to print this
email?
This e-mail message including any attachment(s) is intended for the addressee only and may
be confidential. If you are not the intended
addressee, we request that you notify us immediately and delete this e-mail including any
attachment(s), without copying, forwarding,
disclosing or using this (these) in any other way.