Hello, I have a fairly serious problem. I have a web application deployed as a WAR file, service.war. Now inside this WAR file, specifically the WEB-INF folder, I have a portable HSQL database. Previously I didn't know how JBOSS works, I didn't know that it extracts the WAR file to the tmp folder. What this meant was that each time I restart JBOSS all the data in my HSQL database and my XML files appear to be wiped out or reset. My question basically is, is there a way of specifying that certain files in my WAR file are not to be deleted or that each time the WAR file is redeployed or reloaded, those files will remain in the state they were in the tmp directory. Thanks.
Joined: Jan 23, 2002
Would it make sense to "externalize" the HSQL data file instead of keeping it located inside WEB-INF (or wherever you put it inside the .war)?
For example, instead of reading the database from "/WEB-INF/hsql.db", reading it from "/tmp/myapp/hsql.db".
Lasse is right, you should externalize this. Writing data into the WAR file/directory is a bad idea. JBoss provides the data directory (server/default/data, for example) for you to place application data that you want to survive a server reset. In fact, that's exactly where JBoss puts the hypersonic database that it provides to you.
And that begs the question, why not simply use the HSQL JBoss provides? Or better yet, why not simply use a standard datasource and not overcomplicate your application with database-specific code? One of the things that makes application servers so appealing is that you can externalize services your application requires and make your life much simpler.
[<a href="http://members.capmac.org/~orb/blog.cgi" target="_blank" rel="nofollow">blog</a>] [<a href="http://www.amazon.com/exec/obidos/ASIN/0596100078/orb-20" target="_blank" rel="nofollow">JBoss: A Developer's Notebook</a>] [<a href="http://www.amazon.com/exec/obidos/ASIN/1932394052/orb-20" target="_blank" rel="nofollow">XDoclet in Action</a>]
igwe kalu kalu ogba
Joined: Feb 03, 2005
Hi, thanks for your replies. However I am really new to JBOSS and probably can't act on everything you have suggested. My question now is, from a JSP page, how can I get to the JBOSS data folder? In my JSP page, to get to Card.xml in WEB-INF/templates I use