-->
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.  [ 5 posts ] 
Author Message
 Post subject: jndi.url and jndi.class to access SAR via JNDI
PostPosted: Sun Nov 09, 2003 11:17 am 
Pro
Pro

Joined: Wed Oct 08, 2003 10:31 am
Posts: 247
I've deployed Hibernate in JBoss using a SAR file.
To access Hibernate's Factory using JNDI, I need fill the following properties:

hibernate.jndi.url
hibernate.jndi.class

What values do these properties usually have to access via JNDI?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 09, 2003 11:18 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
You shouldn't need them. Appservers usually provide defaults, so that you can just do:

new InitialContext();


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 09, 2003 11:31 am 
Pro
Pro

Joined: Wed Oct 08, 2003 10:31 am
Posts: 247
gavin wrote:
You shouldn't need them. Appservers usually provide defaults, so that you can just do:

new InitialContext();


Sorry for asking, but if a client class issues a "new InitialContext();" command, how does it know that it will access JBoss's JNDI to retrieve the Hibernate Factory without having the JNDI url and class defined?
I'm a little confused.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 09, 2003 1:04 pm 
Regular
Regular

Joined: Sun Sep 21, 2003 11:43 pm
Posts: 85
Location: Massachusetts
I asked the same question about JNDI under Tomcat. After new InitialContext(), I did a:

Context ctx = new InitialiContext();
SessionFactory sf = (SessionFactory)ctx.lookup("dgf:/made/up/jndiName");

I used my sessionFactory normally after that. I put it into that context by using a hibernate.cfg.xml and in the opening sessionfactory statement doing this:

<session-factory name="dgf:/made/up/jndiName">

Hibernate created that non-existent context for me. I didn't have to specify any web.xml or server resources to hold it. On Tomcat, my one trick was to not use the example "java:comp/env" related name because, in Tomcat, that is read-only and can't be added to by Hibernate or any webapp unless it's there before the servlet started (i.e. in the server configuration's context or as a resource in web.xml).

Regards,
David


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 09, 2003 1:33 pm 
Pro
Pro

Joined: Wed Oct 08, 2003 10:31 am
Posts: 247
humble wrote:
I asked the same question about JNDI under Tomcat. After new InitialContext(), I did a:

Context ctx = new InitialiContext();
SessionFactory sf = (SessionFactory)ctx.lookup("dgf:/made/up/jndiName");

I used my sessionFactory normally after that. I put it into that context by using a hibernate.cfg.xml and in the opening sessionfactory statement doing this:

<session-factory name="dgf:/made/up/jndiName">

Hibernate created that non-existent context for me. I didn't have to specify any web.xml or server resources to hold it. On Tomcat, my one trick was to not use the example "java:comp/env" related name because, in Tomcat, that is read-only and can't be added to by Hibernate or any webapp unless it's there before the servlet started (i.e. in the server configuration's context or as a resource in web.xml).

Regards,
David


Thanks David. I'll try it.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.