Unable to lookup JNDI in JBoss 5
--------------------------------
Key: HHH-7268
URL:
https://hibernate.onjira.com/browse/HHH-7268
Project: Hibernate ORM
Issue Type: Bug
Affects Versions: 4.1.2, 4.1.1
Environment: hibernate 4.1.2.Final, JBoss 5.1.0.GA, Spring 3.1.1
Reporter: T
Priority: Minor
There seems to be a problem using JNDI in Hibernate 4 in JBoss 5. The hibernate jar files
are deployed to WEB-INF\lib folder.
I have defined jboss-web.xml and can see the data source is bounded.
INFO [org.jboss.resource.connectionmanager.ConnectionFactoryBindingService] (main) Bound
ConnectionManager 'jboss.jca:service=DataSourceBinding,name=jdbc/my_app' to JNDI
name 'java:jdbc/my_app'
...
However, the following error is received. It doesn't matter if I use java:/jdbc/my_app
or not or java:/comp/env/jdbc/my_app. If I switched to use DriverManagerDataSource for
Hibernate, my app can deploy without a problem.
Caused by: org.hibernate.service.jndi.JndiException: Unable to lookup JNDI name
[/jdbc/my_app]
at org.hibernate.service.jndi.internal.JndiServiceImpl.locate(JndiServiceImpl.java:68)
at
org.hibernate.service.jdbc.connections.internal.DatasourceConnectionProviderImpl.configure(DatasourceConnectionProviderImpl.java:116)
at
org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:75)
at
org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:159)
at
org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131)
at
org.hibernate.engine.jdbc.internal.JdbcServicesImpl.buildJdbcConnectionAccess(JdbcServicesImpl.java:223)
at
org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:89)
at
org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:75)
at
org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:159)
at
org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:71)
at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2274)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2270)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1739)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1779)
at
org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.buildSessionFactory(LocalSessionFactoryBuilder.java:189)
at
org.springframework.orm.hibernate4.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:350)
at
org.springframework.orm.hibernate4.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:335)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)
... 252 more
Caused by: javax.naming.NameNotFoundException: jdbc not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:771)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:779)
at org.jnp.server.NamingServer.getObject(NamingServer.java:785)
at org.jnp.server.NamingServer.lookup(NamingServer.java:396)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:726)
at javax.naming.InitialContext.lookup(InitialContext.java:396)
at org.hibernate.service.jndi.internal.JndiServiceImpl.locate(JndiServiceImpl.java:65)
--
This message is automatically generated by JIRA.
For more information on JIRA, see:
http://www.atlassian.com/software/jira