-->
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.  [ 12 posts ] 
Author Message
 Post subject: org.hibernate.HibernateException: Could not find datasource
PostPosted: Mon Sep 19, 2005 5:09 am 
Newbie

Joined: Mon Sep 19, 2005 4:52 am
Posts: 6
Can't connect to my database :(
using Java Application Server and Pointbase
developping in eclipse

Exception in thread "main" java.lang.ExceptionInInitializerError
at datenbank.HibernateUtil.<clinit>(HibernateUtil.java:14)
at datenbank.HibTest.main(HibTest.java:17)
Caused by: org.hibernate.HibernateException: Could not find datasource
at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:48)
at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:80)
at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:362)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:60)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1463)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1004)
at datenbank.HibernateUtil.<clinit>(HibernateUtil.java:10)
... 1 more
Caused by: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:284)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:44)
... 7 more
at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:284)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:44)
... 7 more

domain.xml:
<resources>
<jdbc-resource enabled="true" jndi-name="jdbc/__TimerPool" object-type="system-admin" pool-name="__TimerPool"/>
<jdbc-resource enabled="true" jndi-name="jdbc/PointBase" object-type="user" pool-name="PointBasePool"/>
<jdbc-resource enabled="true" jndi-name="jdbc/ms-edv" object-type="user" pool-name="ms-edv"/>
<jdbc-connection-pool connection-validation-method="auto-commit" datasource-classname="com.pointbase.jdbc.jdbcDataSource" fail-all-connections="false" idle-timeout-in-seconds="300" is-connection-validation-required="false" is-isolation-level-guaranteed="false" max-pool-size="32" max-wait-time-in-millis="60000" name="ms-edv" pool-resize-quantity="2" res-type="javax.sql.DataSource" steady-pool-size="8">
<property name="Password" value="xxxxxx"/>
<property name="ServerName" value="localhost"/>
<property name="DatabaseName" value="ms-edv"/>
<property name="Description" value="MS-EDV auf PB"/>
<property name="Port" value="9092"/>
<property name="User" value="PBPUBLIC"/>
</jdbc-connection-pool>
</resources>



danke für eure hilfe :)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 19, 2005 6:48 am 
Beginner
Beginner

Joined: Mon Apr 12, 2004 6:33 pm
Posts: 35
Apparently your datasource is not configured properly. Check the following:

- is it created by your app server
- is the driver available in the class path
- is you datasource reference in hibernate.cfg.xml correct

_________________
Kees de Kooter

(don't hesitate to rate ;)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 19, 2005 7:05 am 
Newbie

Joined: Mon Sep 19, 2005 4:52 am
Posts: 6
kdekooter wrote:
Apparently your datasource is not configured properly. Check the following:

- is it created by your app server
- is the driver available in the class path
- is you datasource reference in hibernate.cfg.xml correct



-) well i created it in the webconsole of the Sun AppServer
-) the drivers of Pointbase (pbclient.jar, pbembedded.jar) are in the classpath-suffix of JVM settings
-) my 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="hibernate.connection.datasource">jdbc/ms-edv</property>
<property name="hibernate.dialect">org.hibernate.dialect.PointbaseDialect</property>
</session-factory>
</hibernate-configuration>

so how can i configure it properly

thanks


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 19, 2005 7:43 am 
Beginner
Beginner

Joined: Mon Apr 12, 2004 6:33 pm
Posts: 35
I think your datasource should read

Code:
java:comp/env/jdbc/ms-edv


beacuse it is your local JNDI.

_________________
Kees de Kooter

(don't hesitate to rate ;)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 19, 2005 7:52 am 
Newbie

Joined: Mon Sep 19, 2005 4:52 am
Posts: 6
sorry but doesnt work with this change


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 19, 2005 8:04 am 
Beginner
Beginner

Joined: Mon Apr 12, 2004 6:33 pm
Posts: 35
I do not know the sun appserver. Is it possible to verify the connection from the webconsole?

_________________
Kees de Kooter

(don't hesitate to rate ;)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 19, 2005 8:12 am 
Newbie

Joined: Mon Sep 19, 2005 4:52 am
Posts: 6
good question where i have no answer :(


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 19, 2005 8:23 am 
Beginner
Beginner

Joined: Mon Apr 12, 2004 6:33 pm
Posts: 35
As a workaround (and for development purposes) you can define your datasource entirely in the hibernate.cfg:

Code:
   <property name="hibernate.connection.driver_class"></property>
   <property name="hibernate.connection.url"></property>
   <property name="hibernate.connection.username"></property>
   <property name="hibernate.connection.password"></property>

_________________
Kees de Kooter

(don't hesitate to rate ;)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 19, 2005 8:36 am 
Newbie

Joined: Mon Sep 19, 2005 4:52 am
Posts: 6
kdekooter wrote:
As a workaround (and for development purposes) you can define your datasource entirely in the hibernate.cfg:

Code:
   <property name="hibernate.connection.driver_class"></property>
   <property name="hibernate.connection.url"></property>
   <property name="hibernate.connection.username"></property>
   <property name="hibernate.connection.password"></property>


ok i tried it once but did not work some days ago

as far as i know i have to tell the system where the jdbc drivers are

so what do have to fill in for the property driver_class and ulr e.g.

thanks


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 19, 2005 8:50 am 
Beginner
Beginner

Joined: Mon Apr 12, 2004 6:33 pm
Posts: 35
driver: com.pointbase.jdbc.jdbcUniversalDriver
url: jdbc:pointbase://localhost/ms-edv

The jar containing com.pointbase.jdbc.jdbcUniversalDriver should be in your classpath.

_________________
Kees de Kooter

(don't hesitate to rate ;)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 19, 2005 8:58 am 
Newbie

Joined: Mon Sep 19, 2005 4:52 am
Posts: 6
kdekooter wrote:
driver: com.pointbase.jdbc.jdbcUniversalDriver
url: jdbc:pointbase://localhost/ms-edv

The jar containing com.pointbase.jdbc.jdbcUniversalDriver should be in your classpath.


ok also this question sounds like a stupid question now in which classpath .. of the eclipse project? and you mean the pbclient.jar?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 19, 2005 9:01 am 
Beginner
Beginner

Joined: Mon Apr 12, 2004 6:33 pm
Posts: 35
In the classpath of your application.

_________________
Kees de Kooter

(don't hesitate to rate ;)


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