| Author |
Unable to lookup JNDI name - hibernate 4.1.5 , Spring 3.1.1 , JBoss 5
|
suresh pandey
Greenhorn
Joined: Jul 23, 2012
Posts: 6
|
|
Hi,
I am getting the error "nested exception is org.hibernate.service.jndi.JndiException: Unable to lookup JNDI name" while using hibernate with spring for jboss.
hibernate -config is
<hibernate-configuration>
<session-factory >
<property name="connection.pool_size">10</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="connection.datasource">ScionDS</property>
<property name="show_sql">true</property>
<property name="hbm2ddl.auto">create</property>
<mapping class="com.tms.efc.configuratoradmin.entity.Employee" />
</session-factory>
</hibernate-configuration>
application-context is
<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="configLocation" value="classpath:config/hibernate-config.xml"/>
</bean>
I have configured the data soucre on jboss.
Thanks
|
 |
Bill Gorder
Bartender
Joined: Mar 07, 2010
Posts: 1282
|
|
Please UseCodeTags when posting code or configuration.
I am going to move this to the Spring forum as it appears to be a Spring configuration issue.
Where is your datasource configured in your application context?
|
[How To Ask Questions][Read before you PM me]
|
 |
suresh pandey
Greenhorn
Joined: Jul 23, 2012
Posts: 6
|
|
Well the problem has been solved, data source is configure on JBoss server. Actually JBoss internally append 'java:' with the JNDI name so if you have configured JNDI name as 'ScioDS' you need to access it using 'java:ScionDS'.
Thanks
|
 |
Bill Gorder
Bartender
Joined: Mar 07, 2010
Posts: 1282
|
|
OK that was my mistake I missed that you had set this property.
Yeah they all have to be different with the jndi binding
The more typical is java:comp/env/
With the code you are currently having it may not be portable to other major application servers. This may or may not be an issue for you.
You might find this useful:
https://community.jboss.org/thread/121272?tstart=0#4084585
Thanks for posting back with your solution.
|
 |
 |
|
|
subject: Unable to lookup JNDI name - hibernate 4.1.5 , Spring 3.1.1 , JBoss 5
|
|
|