-->
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.  [ 1 post ] 
Author Message
 Post subject: Hibernate3 + OC4J Datasource Connection
PostPosted: Tue Feb 14, 2006 3:07 am 
Beginner
Beginner

Joined: Mon Oct 24, 2005 2:45 am
Posts: 23
I could connect to SQL server from my web application on OC4J in hibernate2 version.
with following properties
<property name="connection.datasource">jdbc/MSSQL2K</property>
<property name="hibernate.dialect">net.sf.hibernate.dialect.SQLServerDialect</property>

But i am unable to connect with hibernate 3. Please find Stacktrace of error

--------------------------------------------
hibernate.cfg.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="connection.datasource">java:comp/env/jdbc/MSSQL2K</property>
<property name="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</property>
<property name="show_sql">true</property>
</session-factory>
</hibernate-configuration>
---------------------------------------------

data-sources.xml in OC4j 9.0.4 at
OC4J_HOME\j2ee\home\config


<data-sources>
<data-source
class="com.evermind.sql.DriverManagerDataSource"
name="MSSQL2K"
location="jdbc/MSSQL2K"
xa-location="jdbc/xa/MSSQL2K"
ejb-location="jdbc/MSSQL2K"
schema="database-schemas/ms-sql.xml"
connection-driver="com.microsoft.jdbc.sqlserver.SQLServerDriver"
username="test"
password="test"
url="jdbc:microsoft:sqlserver://raghuveer:1433;DatabaseName=test;SelectMethod=Cursor"
inactivity-timeout="30"
/>
</data-sources>

------------------------------------------------------
ERROR

java.lang.ExceptionInInitializerError
at com.utc.pw.acs.hibernate.dao.CSessionFactory.<clinit>(CSessionFactory.java:44)
at com.utc.pw.acs.hibernate.dao.CLoginDAO.getContactData(CLoginDAO.java:73)
at com.utc.pw.acs.action.CLoginAction.loginCheck(CLoginAction.java:90)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:274)
at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:194)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:765)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:317)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
at java.lang.Thread.run(Thread.java:534)
Caused by: org.hibernate.HibernateException: Could not find datasource
at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:56)
at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124)
at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:56)
at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:366)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:60)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1859)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1152)
at com.utc.pw.acs.hibernate.dao.CSessionFactory.<clinit>(CSessionFactory.java:35)
... 21 more
Caused by: javax.naming.NameNotFoundException: jdbc/MSSQL2K not found in Aero Quote
at com.oracle.naming.J2EEContext.getSubContext(J2EEContext.java:93)
at com.oracle.naming.J2EEContext.lookup(J2EEContext.java:76)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.ApplicationContext.lookup(ApplicationContext.java:177)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.ApplicationContext.lookup(ApplicationContext.java:119)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:52)
... 28 more


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

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.