db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stanley Bradbury <Stan.Bradb...@gmail.com>
Subject Re: Feedback for derby-tomcat 5.5 embedded demo
Date Tue, 03 Jan 2006 23:27:50 GMT
Winslow, Eric - BLS wrote:

>Hello.
>
>I just ran through the 'Embedding Apache Derby in Tomcat and creating an
>iBATIS JPetStore Demo' at
>http://db.apache.org/derby/integrate/DerbyTomcat5512JPetStor.html
>and ran into some issues that might need to be addressed.
>
>I did this on Windows XP with Java 1.5_06 and Tomcat 5.5.14
>
>I ran into issues with the paths given at a couple of points.
>
>1. When deploying the app in the manager interface I needed to use the
>full path to the XML config file and the WAR; e.g.,
>c:\apache-tomcat-5.5.14\work\file.xml. Otherwise the deployment failed
>with a file not found exception.
>
>2. When running the app iBatis ran into issues with finding the
>database. Again, server.xml the URL to the database needed to be fully
>specified: 
>jdbc:derby:c:\apache-tomcat-5.5.14\Databases\JPetStoreDB
>
>Maybe this is just a Windows issue. My catalina_home environmental var
>is defined. I have not had a chance to go through in on Linux/Unix.
>
>Thanks.
>
>Eric M. Winslow
>
>
>  
>
Hi Eric -
Thanks for sharing your experience - you ran afoul of the assumption I 
made that CATALINA_HOME will end up being the default working directory 
for the JVM process and thus be the default directory for derby (a.k.a. 
derby.system.home).  I have found that the location of the JVM default 
working directory depends on how you start Tomcat.  When CATALINA_HOME 
is not the JVM default directory (as in your environment) then the full 
path to the database must be specified (as you stated in item 2) or some 
other method used to set derby.system.home.  A different default working 
directory is likely (I still need to test this) the reason you needed to 
specify a full path when deploying using the manager interface.  In the 
next few weeks I will update the document to add this information. 

I found an alternate way of 'solving' the database path problem that I 
would appreciate you commenting on.  This appeals to me because I like 
to use environment variables and JVM properties where possible to 
specify installation specific information so that this information does 
not need to be hardcoded in other places.  I found that defining 
derby.system.home in the  CATLAINA_HOME\config\catalina.properties file 
insures that the derby system directory is not Dependant on how Tomcat 
is started and eliminates the need to specify a complete path in the 
server.xml file.   In my installation I set it to be the same as 
CATALINA_HOME.  The lines I added are:

##  Set Derby System HOME property
derby.system.home=C:/Program Files/Apache/Tomcat 5.5.12

Does this seem like a good practice to you?




Mime
View raw message