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: how to configure JNDI in an APP server
PostPosted: Wed Apr 21, 2004 11:45 am 
Beginner
Beginner

Joined: Wed Apr 21, 2004 8:33 am
Posts: 27
hi,
i have finished a web application, where i used struts, hibernate, database is oracle9i , and the application server used is Oracle10g. everything is working fine. now i want to configure the database using JNDI. earlier i edited the Hibernate.properties file for getting the database connection for Oracle database configuration. Now i want to configure the datbase connection using JNDI. so here in hibernate.properties i have JNDI datsource, where i have given the data source name, and in the oracle 10g Adminsitration propeties i am configuring this datasource , but now its not able to connect to the database. can anybody tell me how to configure the database conncetion through JNDI in APP servers like SunOne or Oracle 10 g


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 21, 2004 11:49 am 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
it's an hibernate forum....
you'll find more help on oracle user forum


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 21, 2004 5:51 pm 
Senior
Senior

Joined: Wed Mar 24, 2004 11:40 am
Posts: 146
Location: Indianapolis, IN, USA
You might want to read this

http://otn.oracle.com/sample_code/tutorials/jdbc10g/connectioncache/files/OrderEntry.pdf


Top
 Profile  
 
 Post subject: regd JNDI configuration
PostPosted: Thu Apr 22, 2004 12:03 am 
Beginner
Beginner

Joined: Wed Apr 21, 2004 8:33 am
Posts: 27
hi all,
thanx for those speedy replies. i shall try to look in to oracle forums too, but i have small query , how do integrate hibernate with JNDI ...i mean do i just need to edit the Hibernate.properties give the datasource name and do the rest in the Oracle server Setings or should i do something else for the JNDI stuff to get working . Like generally fo the databse connection we generally edit the properties file give the database name, username password under the particular database (here Oracle) we are using. But my client doesnt want to do so he doesnt want to edit the properties file everytime we send the source code. so i am looking in to JNDI issue. In the hibernate.properties file there is something calle JNDI
where we give the DAtasource name (mandatory), username and passowrd(optinal).
is it enough that i give only the datasource name here, and using the datasource name i confiure the JNDI stuff in my APP Server. or shuoul i need to do something else in hibernate. Since configuring the App server with the datasource ( i feel its correct) bu the application is not accessible....i get the follwing stack trace

Sun ONE Application Server - HTTP Status 500 Error
The server encountered an internal error (Internal Server Error) that prevented it from fulfilling this request.
Type: Exception Report

Message: Internal Server Error

Exception

javax.servlet.ServletException: Servlet execution threw an exception
at org.apache.catalina.core.StandardWrapperValve.invokeServletService(StandardWrapperValve.java:742)
at org.apache.catalina.core.StandardWrapperValve.access$000(StandardWrapperValve.java:118)
at org.apache.catalina.core.StandardWrapperValve$1.run(StandardWrapperValve.java:278)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:274)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:212)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:203)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
at com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:157)
at com.iplanet.ias.web.WebContainer.service(WebContainer.java:598)


Root Cause

java.lang.ExceptionInInitializerError
at net.sf.hibernate.cfg.Configuration.(Configuration.java:86)
at dataaccess.UserHibDAO.getUsers(UserHibDAO.java:73)
at service.SearchService.searchUsers(SearchService.java:58)
at action.AdminSearchAction.execute(AdminSearchAction.java:89)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.StandardWrapperValve.invokeServletService(StandardWrapperValve.java:720)
at org.apache.catalina.core.StandardWrapperValve.access$000(StandardWrapperValve.java:118)
at org.apache.catalina.core.StandardWrapperValve$1.run(StandardWrapperValve.java:278)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:274)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:212)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:203)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
at com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:157)
at com.iplanet.ias.web.WebContainer.service(WebContainer.java:598)
Caused by: java.security.AccessControlException: access denied (java.util.PropertyPermission * read,write)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:270)
at java.security.AccessController.checkPermission(AccessController.java:401)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:542)
at java.lang.SecurityManager.checkPropertiesAccess(SecurityManager.java:1259)
at java.lang.System.getProperties(System.java:500)
at net.sf.hibernate.cfg.Environment.(Environment.java:511)
... 22 more

Thank you
VijayKumar


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 22, 2004 9:32 am 
Senior
Senior

Joined: Wed Mar 24, 2004 11:40 am
Posts: 146
Location: Indianapolis, IN, USA
You setup the JNDI configuration in the hibernate.cfg.xml/hibernate.properties file and specify the dialect. The rest is taken care of by the JNDI setting on your Application Server.

For example:


Code:
<property name="hibernate.datasource">java:comp/env/hibernate/foo</property>
    <property name="dialect">net.sf.hibernate.dialect.DatabaseDialect</property>


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.