Really need some help with Derby (coming from Railo)

I’ve recently migrated from Railo to Lucee. Everything works fine. EXCEPT my databases.

I’m using Derby databases. In Railo, I simply copied “derby.jar” (the JDBC driver) to Railo’s LIB directory and I could create datasources using the class “org.apache.derby.jdbc.EmbeddedDriver” and the connection string "jdbc:derby:C:\dblocation".

When I do EXACTLY the same in Lucee, I get the following error and I really don’t know what’s wrong:

lucee.runtime.exp.DatabaseException: Failed to start database ‘C:\dblocation’ with class loader java.net.URLClassLoader@681a9515, see the next exception for details.
at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.bootDatabase(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.(Unknown Source)
at org.apache.derby.jdbc.InternalDriver.getNewEmbedConnection(Unknown Source)
at org.apache.derby.jdbc.InternalDriver.connect(Unknown Source)
at org.apache.derby.jdbc.InternalDriver.connect(Unknown Source)
at org.apache.derby.jdbc.EmbeddedDriver.connect(Unknown Source)
at lucee.runtime.db.DataSourceSupport._getConnection(DataSourceSupport.java:107)
at lucee.runtime.db.DataSourceSupport.getConnection(DataSourceSupport.java:89)
at lucee.runtime.db.DatasourceConnectionPool.loadDatasourceConnection(DatasourceConnectionPool.java:141)
at lucee.runtime.db.DatasourceConnectionPool.getDatasourceConnection(DatasourceConnectionPool.java:105)
at lucee.runtime.db.DatasourceManagerImpl.getConnection(DatasourceManagerImpl.java:75)
at lucee.runtime.tag.Query.executeDatasoure(Query.java:894)
at lucee.runtime.tag.Query.doEndTag(Query.java:663)
at index2_cfm$cf.call(/index2.cfm:3)
at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:939)
at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:833)
at lucee.runtime.listener.ClassicAppListener._onRequest(ClassicAppListener.java:63)
at lucee.runtime.listener.MixedAppListener.onRequest(MixedAppListener.java:44)
at lucee.runtime.PageContextImpl.execute(PageContextImpl.java:2405)
at lucee.runtime.PageContextImpl._execute(PageContextImpl.java:2395)
at lucee.runtime.PageContextImpl.executeCFML(PageContextImpl.java:2363)
at lucee.runtime.engine.Request.exe(Request.java:44)
at lucee.runtime.engine.CFMLEngineImpl._service(CFMLEngineImpl.java:1091)
at lucee.runtime.engine.CFMLEngineImpl.serviceCFML(CFMLEngineImpl.java:1039)
at lucee.loader.engine.CFMLEngineWrapper.serviceCFML(CFMLEngineWrapper.java:102)
at lucee.loader.servlet.CFMLServlet.service(CFMLServlet.java:51)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
at org.apache.coyote.ajp.AjpProcessor.service(AjpProcessor.java:486)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)

Hi there. Using Lucee 5.2.5 I was able to connect to a Derby database by placing the derby.jar in any of the following places within my Lucee installation root (lucee):

  • lucee/lib
  • lucee/tomcat/lib
  • lucee/tomcat/lucee-server/bundles

The first two locations required Tomcat to be restarted, but after putting the jar in the bundles directory it was available for use immediately.

Obviously your installation directory structure may differ depending on how you have Lucee setup.

1 Like

PS: your stack trace suggests the problem isn’t with loading the Derby jar, but with the path to your database in the connection string. Is that definitely correct?