Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exception: Could not find datasource

 
Steve Bigham
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to put together a "simple" webapp with Tomcat, Hibernate, and the HyperSonic database but seem to be stymied by this exception.

net.sf.hibernate.HibernateException: Could not find datasource at

That's it! No path or directory is given before the rest of the stack trace. I'm guessing maybe a JDBC config problem but don't know enough to make any progress.

My webapp context from server.xml is:

<Context path="" docBase="swiss" debug="4">
<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs" prefix="swiss-" suffix=".txt"
timestamp="true"/>

<Resource name="jdbc/AppDS" auth="Container"
type="javax.sql.DataSource"/>

<ResourceParams name="jdbc/AppDS">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>org.hsqldb.jdbcDriver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:hsqldb:webapps/swiss/db/music</value>
</parameter>
<parameter>
<name>username</name>
<value>sa</value>
</parameter>
<parameter>
<name>password</name>
<value></value>
</parameter>
<parameter>
<name>maxActive</name>
<value>40</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>10</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>-1</value>
</parameter>
</ResourceParams>

</Context>


and WEB-INF/classes/hibernate.cfg.xml has

<hibernate-configuration>

<session-factory>

<property name="connection.datasource">java:comp/env/jdbc/AppDS</property>
<property name="show_sql">false</property>
<property name="dialect">net.sf.hibernate.dialect.HSQLDialect</property>

<!-- Mapping files -->
<mapping resource="com/oreilly/hh/Track.hbm.xml"/>

</session-factory>

</hibernate-configuration>


My databse lives in a db directory at the same level as WEB-INF. Any suggestions?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic