-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 9 posts ] 
Author Message
 Post subject: Hibernate in JBoss
PostPosted: Sun Nov 16, 2003 10:49 am 
Beginner
Beginner

Joined: Tue Oct 28, 2003 6:43 am
Posts: 33
I'm using Hibernate in JBoss but my application can't find hibernate.cfg.xml file that i put in javasource of my war. Why I can solve this problem?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 17, 2003 3:51 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Not sure why you are looking for a cfg file. It is usually configured using JMX or JCA. See http://hibernate.bluemars.net/66.html. If your only using servlets then I would expect it to be placed in WEB-INF directory.


Top
 Profile  
 
 Post subject: having the same problem - can't find hibernate.cfg.xml
PostPosted: Thu Nov 20, 2003 1:18 pm 
Newbie

Joined: Thu Nov 20, 2003 1:11 pm
Posts: 2
Hi,

I'm having the same problem, and I _believe_ that I've configured the JCA MBean for the HibernateFactory correctly (I can find the MBean details in my JBoss jmx-console and they look sensible)

Any thoughts on why, when I make the following call -

SessionFactory sessionFactory =
new Configuration().configure().buildSessionFactory();

I get a the following exception ?

17:01:22,566 ERROR [HibernateServiceEJB] HibernateException thrown for cat[uk.co.mfl.app.motabilityOnlineAgreements.domain.gc.Cat@1d16ecf]
net.sf.hibernate.HibernateException: /hibernate.cfg.xml not found

I'm running JBoss 3.2.0 with Tomcat 4.1.24 and Hibernate 2.0.3

Thanks for any help,
Gino


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 20, 2003 10:06 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
The session factory is created by the JMX MBean and thus it uses the deployment descriptor to configure the session factory at deployment time. It places the SessionFactory into JNDI hence you do not need to create the factory. All you do is look it up from JNDI and then use the session as normal.


Top
 Profile  
 
 Post subject: thanks
PostPosted: Fri Nov 21, 2003 5:48 am 
Newbie

Joined: Thu Nov 20, 2003 1:11 pm
Posts: 2
... obvious really...

Thanks for the info,
Gino


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 23, 2003 6:53 pm 
Newbie

Joined: Tue Nov 18, 2003 10:46 pm
Posts: 4
This access method ([color=red]JNDI[/color]) it's works fine to me if i access from web-application, in the same JVM (Jboss 3.2.2), but i can't access it if i tried from a standalone application.
I got this exception:
javax.naming.NameNotFoundException: hibernate not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:495)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:503)
at org.jnp.server.NamingServer.getObject(NamingServer.java:509)
at org.jnp.server.NamingServer.lookup(NamingServer.java:253)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:528)

This is the jndi.properties file (locate it in CLASSPATH):

java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
java.naming.provider.url=jnp://localhost:1099

that I am making bad?

Thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 24, 2003 8:15 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Your jndi.properties looks correct. I have never tried accessing the SessionFactory directly like this and I don't think the session factory can be used this way. I have accessed the data store through a SLSB service layer which is the way I would recommend you do it.


Top
 Profile  
 
 Post subject: I set it in the hibernate.cfg.xml sessionfactory
PostPosted: Mon Nov 24, 2003 9:00 pm 
Regular
Regular

Joined: Sun Sep 21, 2003 11:43 pm
Posts: 85
Location: Massachusetts
I set the JNDI name (and access it via JNDI) in Tomcat, not JBOSS, using:

<session-factory name="dgf:/hibernate/SessionFactory">
.....
</session-factory>

Hibernate seems to initalize it and creat the JNDI context for me with any name="..." that I make up, automatically.

Regards,
David


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 25, 2003 7:23 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Your still using tomcat JNDI from within Tomcat not remotely - That is the issue, eg, SessionFactory is not remoteable.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 9 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.