Lo, George C wrote:
>Lo, George C wrote:
>> While trying to deploy the JPetStoreApp demo on Tomcat 6.0 on JDK 1.6, I
>> got the following error. Did I miss something?
>
>Hello,
>
>Not having tried the JPetStoreApp demo, my pieces of advice are pretty
>general. Since the database can't be found;
>
> 1) Verify that the database has indeed been created.
> (and that it is not being deleted)
> 2) Make sure the JDBC connection URL is valid.
>
>I notice you are using a relative path in the JDBC connection URL
>(Databases/JPetStoreDB). This might not work as expected based on
>whether derby.system.home is set, or from which directory the container
>(Tomcat) starts Derby.
>You can see if this is indeed the problem by trying with an absolute
>path to the database.
Hi Kristian,
Thanks for your reply. Here is additional info.
I put the database files that come with the JPetStoreApp demo in the
home directory of tomcat, as described by the doc.
I didn’t set the derby.system.home property with Tomcat. Is there any
info on how I can do this. I tried setting the
Environmental variable DERBY_HOME from (on windows) from where I bring
up Tomcat, but it didn’t work. Thanks ahead.
George
Hi George -
I took a look at the Tomcat / JPetStore write-up on the Derby resources
tab and noted this:
{Derby_System_Home}
the directory containing the derby.log file. This is the default
output directory for Derby and should be the same as {Tomcat_Home}.
The JPetStoreDB database will be located in the
{Derby_System_Home}\Databases subdirectory.
So with Tomcat 5.5 derby.system.home defaulted to {tomcat_home}. It
sounds like this is the not the case with your setup. Your error message
(/Database 'Databases/JPetStoreDB' not found.) /says Derby is looking
for the database in: <derby_system_home>\/Databases /and expects the db
name to be/ JPetStoreDB./ Does {tomcat_home}\Databases\JPetStoreDB exist
with the proper subdiretories and *.dat / *.log files to be a Derby
database?
A kludgy way to determine where derby.system.home is defaulting to is
the append ';create=true' to the database URL. This will cause an empty
database to be created and you can scan the file system to find the
location. You then adjust the URL accrodingly, remove ';create=true',
copy the database to that location and restart Tomcat.
I think this is what the datasource entry should look like so the
database will be created:
<!-- Global Datasource for Derby JPetStoreDB database -->
<Resource name="jdbc/JPetStoreDB"
type="javax.sql.DataSource" auth="Container"
description="Derby database for JPetStoreApp"
maxActive="100" maxIdle="30" maxWait="10000"
username="" password=""
driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
url="jdbc:derby:Databases/JPetStoreDB;create=true"/>
HTH