-->
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.  [ 4 posts ] 
Author Message
 Post subject: Connect to Hibernate on Jboss from a clientside app w/o ejb?
PostPosted: Fri Feb 04, 2005 12:45 pm 
Beginner
Beginner

Joined: Fri Mar 05, 2004 1:48 pm
Posts: 28
Hello,

Is it possible to connect to retrieve a Hibernate session remotely?
I have a har deployed on Jboss. I know that is all configured correctly because I have successfully connect to it from jndi and use it from an ejb also deployed on the SAME Jboss server.
I am wondering if I can connect to the session factory from an application outside of the Jboss server and how?

This is what I have in the har:

Code:
<attribute name="SessionFactoryName">java:/foo/hibernate/SessionFactory</attribute>


I've been trying to look it up from a stand alone java application like this:
Code:
Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
props.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
props.put(Context.PROVIDER_URL, "X.X.X.X:1099");
InitialContext ctx = new InitialContext(props);
ctx.lookup("java:/foo/hibernate/SessionFactory");


I get a name not bound exception.

Is this even possible to do?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 04, 2005 2:06 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
This is not possible.


Top
 Profile  
 
 Post subject: Thanks!
PostPosted: Fri Feb 04, 2005 2:13 pm 
Beginner
Beginner

Joined: Fri Mar 05, 2004 1:48 pm
Posts: 28
I just wish I would have asked an hour into trying it this morning.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 07, 2005 6:14 am 
Newbie

Joined: Thu Jun 03, 2004 7:31 am
Posts: 2
tlh1005 has bound the SessionFactory to the "java:" naming context, which is not accessible from outside the app server of course.

When the factory is bound to the remotely accessible name "hibernate/SessionFactory" a lookup causes no exceptions but it still doesn't return anything but null.

Same question again, is it somehow possible to retrieve a JNDI bound SessionFactory from a remote client application? Perhaps if it is configured as an J2EE application client with its own "comp:" naming context? (only a guess, I never used J2EE application clients before)

best regards


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