I am running HSQLDB inside a servlet. When I redistribute the application to the web server, the .lck file will not be correctly released and the HSQL server will not be able to upload the file.
The Tomcat 7.0.22 web server comes with NetBeans ...
Any ideas why this is happening?
Here is the initialization code:
@Override public void init() throws ServletException {
HsqlProperties p = new HsqlProperties();
p.setProperty("server.database.0", dbPath);
p.setProperty("server.dbname.0", Environment.PERSISTENCE_HSQL_DB_NAME);
p.setProperty("server.port", Environment.PERSISTENCE_HSQL_PORT);
server = new Server();
server.setProperties(p);
server.setSilent(false);
server.setTrace(true);
server.setLogWriter(new PrintWriter(System.out));
server.setErrWriter(null);
server.start();
server.checkRunning(true);
}
Here is my shutdown / destroy method:
@Override
public void destroy() {
super.destroy();
server.setNoSystemExit(true);
server.stop();
server.shutdown();
controller.shutdown();
}
I am using JPA. If the database is loading (first start), the application works fine. Here is my persistence.xml:
<persistence-unit name="embedded_hsql" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<properties>
<property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver"/>
<property name="hibernate.connection.url" value="jdbc:hsqldb:hsql://localhost:9001/fst_db;hsqldb.lock_file=false"/>
<property name="hibernate.connection.username" value="SA"/>
<property name="hibernate.connection.password" value=""/>
<property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
<property name="hibernate.cache.provider_class" value="org.hibernate.cache.NoCacheProvider"/>
<property name="hibernate.show_sql" value="false"/>
<property name="hibernate.connection.SetBigStringTryClob" value="true"/>
<property name="hibernate.hbm2ddl.auto" value="update"/>
<property name="current_session_context_class" value="thread" />
<property name="cache.provider_class" value="org.hibernate.cache.NoCacheProvider" />
</properties>
</persistence-unit>
I added "hsqldb.lock_file = false" for testing purposes, which has no effect. In general, I do not want to disable file locking ...
Thank!
user212926
source
share