I'm having a struggle with my first attempt with little application based on Spring, Hibernate on HSQLDB and JSF, finally deployed with Tomcat. I face two problems now.
First of all I tried to run Java Application on console based on
main (String args)
\____ spring-module.xml ... for Java Console Application
\____ applicationContext.xml ... for web application
... or ...
<bean id="customerBo" class="nch.spring.customer.bo.impl.CustomerBoImpl"></bean>
org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.JDBCConnectionException: Could not open connection
Caused by: org.hibernate.exception.JDBCConnectionException: Could not open connection
Caused by: java.sql.SQLException: No suitable driver found for jdbc:hsqldb:database/customers
<!-- HSQLDB -->
The core of the issue is that you're using HSQLDB with a database file, that is actually a resource of your project (i.e. inside its classpath). This means that the file will be embedded inside your WAR, and you will not be able to update it (as contents inside the WAR file will be read-only).
Your connection string for HSQLDB is:
When ran inside your IDE, you need to be aware that it does not package your application in a JAR but as an exploded directory. So when you run it as a console application, it will access the database file and update it just fine. However, when packaged in a WAR, it won't find it.
res: stored in a Java resource, such as a Jar and always read-only.
This will load a database from the resource located in
/database/customers of the classpath of your application.
However, if you want to update it, then you have to use another way. A typical way is to use a Server Database URL, where the database is hosted on a server, possibly
localhost for testing purposes.