简体   繁体   中英

Derby included in Tomcat Webapp

My Web app connects to a Derby Database - OK.

My Web app and Derby are installed separately in my Tomcat 7 server - OK

Derby is installed using the derby.war file being deployed and by me moving the derby*.jar files into the Tomcat lib directory.

My Web app is deployed by exporting the war file into the Tomcat webapps directory.

I would like to deploy Derby without having to put the jars into the Tomcat lib directory - This could be a problem in production environments.

My question(s) is/are

Can the derby.war file be amended in anyway? - I tried adding a WEB-INF/lib directory and putting the derby*.jar files in there and re-deploying it. This didn't work, it actually removed the jars and the lib directory. Perhaps I need to do something else?

Or

Is there a way of including the derby jar files and the derby web.xml into my own web application? I tried this but not in anger, as my first attempt caused a few issues so I regressed back quickly in panic.

I will admit to you all now that my attempts to deploy Derby without using the Tomcat lib directory were a little rushed and I could have spent more time researching it. But I won't have access to that dev system for a while, I thought I'd ask if this could be/has been done by anyone.

Trevor

You use tomcat datasource to connect to derby? I think if you use jdbc directly(initializing connection pool in the webapp using c3p0 or tomcat pools), it could be no problem to include derby jars in WEB-INF/lib. You can use embedded derby driver now. If you need derby network server, you could start it with a ContextListener, or you can configure the datasource in spring context if you are using spring.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM