File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes SessionFactory: javax.naming.NameNotFoundException: hibernate not bound Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "SessionFactory: javax.naming.NameNotFoundException: hibernate not bound" Watch "SessionFactory: javax.naming.NameNotFoundException: hibernate not bound" New topic
Author

SessionFactory: javax.naming.NameNotFoundException: hibernate not bound

Mateusz Moroz
Greenhorn

Joined: Oct 29, 2008
Posts: 21
Hi,

I'm facing following problem with hibernate and jboss. I have postgresql-ds.xml in ${JBOSS}/server/default/deploy:


Then, I have jboss-service.xml in META-INF dir of the har:


In my EJB I try to get access to database via:


The har is deployed in jboss-app.xml:


Application deploys with no errors.
Unfortunately jboss throws an Exception when trying to lookup:



What am I doing wrong? I see that the session factory is not bound to JNDI. How to fix it? Anyone can help to fix it?
zabet tyan
Ranch Hand

Joined: Jan 14, 2009
Posts: 32
Where are you trying to access SessionFactory from?

I had the same problem when I was trying to access SessionFactory from my unit tests (in eclipse) .

if that's the case,
this is what i did (not sure if the best way to solve it or not):

include the jbossall-client.jar, your client.jar and ejb.jar as well as jboss-ejb3.jar, jboss-aop-jdk50-client.jar and jboss-aspect-jdk50-client.jar in the classpath of your unit tests/client and give it another try.

If you came up with a better solution please let me know.
Mateusz Moroz
Greenhorn

Joined: Oct 29, 2008
Posts: 21
I try to access the SessionFactory directly from SessionBean.
MySessionFactory is visible in jboss jmx console and shows no errors.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SessionFactory: javax.naming.NameNotFoundException: hibernate not bound
 
Similar Threads
Data Source Not Found
Problem in getting the datasource for mysql
Probles in setting datasource
please help in setting db connection in jboss
Issue with JBoss restart