-->
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.  [ 2 posts ] 
Author Message
 Post subject: How to retrieve a DataSource from JNDI with security set?
PostPosted: Fri Jul 09, 2004 9:22 am 
Newbie

Joined: Tue Jul 06, 2004 6:17 am
Posts: 5
HI,
I'm using Oracle AppServer, and want hibernate to use session bean CMT, and I'm trying to provide it a JNDI-bound datasource to use.

I get the following error:

Code:
INFO: JNDI InitialContext properties:{java.naming.provider.url=ormi://localhost:x23891/current-workspace-app, java.naming.factory.initial=com.evermind.server.ApplicationClientInitialContextFactory}

09-Jul-2004 14:09:19 net.sf.hibernate.connection.DatasourceConnectionProvider configure

SEVERE: Could not find datasource: java:comp/env/jdbc/MyDS

javax.naming.NameNotFoundException: jdbc/MyDS not found in Application Client

   at com.oracle.naming.J2EEContext.getSubContext(J2EEContext.java:93)



I'm thinking that this is probably because I have not specified the principal/credentials for JNDI in the hibernate.cgf.xml, but I cannot find out how to do that anywhere, i.e. what are the properties called that hibernate expects?

Here's my config file as it is now....

Code:
<hibernate-configuration>

    <session-factory>

        <property name="connection.datasource">java:comp/env/jdbc/MyDS</property>
        <property name="dialect">net.sf.hibernate.dialect.OracleDialect</property>
        <property name="jndi.class">com.evermind.server.ApplicationClientInitialContextFactory</property>
        <property name="jndi.url">ormi://localhost:23891/current-workspace-app</property>
       
        <mapping resource="Person.hbm.xml"/>

    </session-factory>

</hibernate-configuration>



any help appreciated!
mike


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 09, 2004 10:43 am 
Newbie

Joined: Tue Jul 06, 2004 6:17 am
Posts: 5
have answered my own question. here's the answer for anyone else who has the same problem in the future...

you can specify any additional jndi properties by just having a property called jndi.<whatever the property is>

so for security, add:

Code:
        <property name="jndi.java.naming.security.principal">admin</property>
        <property name="jndi.java.naming.security.credentials">welcome</property>



mike


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