-->
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: Datasource Connection in hibernate 3
PostPosted: Thu Mar 02, 2006 3:12 am 
Newbie

Joined: Thu Mar 02, 2006 2:59 am
Posts: 1
I am able to 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 version:3.1

Mapping documents:

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;SelectMetho
d=Cursor"
inactivity-timeout="30"
/>
</data-sources>
-------------------------------------------------------------


Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:
ERROR

java.lang.ExceptionInInitializerError
at
com.utc.pw.acs.hibernate.dao.CSessionFactory.<clinit>(CSessionFactory.java:4
4)
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(RequestProces
sor.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(ServletRequestDispa
tcher.java:765)
at com.evermind[Oracle Application Server Containers for J2EE 10g
(9.0.4.0.0)].server.http.ServletRequestDispatcher.forwardInternal(ServletReq
uestDispatcher.java:317)
at com.evermind[Oracle Application Server Containers for J2EE 10g
(9.0.4.0.0)].server.http.HttpRequestHandler.processRequest(HttpRequestHandle
r.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(ReleasableRe
sourcePooledExecutor.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(DatasourceCo
nnectionProvider.java:56)
at
org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(Con
nectionProviderFactory.java:124)
at
org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(Con
nectionProviderFactory.java:56)
at
org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.j
ava: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:3
5)
... 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(DatasourceCo
nnectionProvider.java:52)


Name and version of the database you are using:sqlserver2000

The generated SQL (show_sql=true):
06/03/02 12:29:35 Building SessionFactory
failed.org.hibernate.HibernateExceptio
n: Could not find datasource

Debug level Hibernate log excerpt:


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 02, 2006 11:31 am 
Beginner
Beginner

Joined: Mon Oct 24, 2005 2:45 am
Posts: 23
problem with your database connection .
check roles/user for database


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.