db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dag H. Wanvik (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-4944) Embedded Derby does not start when derby.jar is dynamically uploaded / added to the classpath
Date Wed, 15 Dec 2010 22:10:01 GMT

    [ https://issues.apache.org/jira/browse/DERBY-4944?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12971863#action_12971863

Dag H. Wanvik commented on DERBY-4944:

Hi Michael,

what Javadoc are you looking at to arrive at that conclusion? ("the apidoc of CodeSource implies
that getLocation() can return null")
Looking at the Javadoc for Java 1.6[1], I see this:

> CodeSource#getLocation:
> public final URL getLocation()
>   Returns the location associated with this CodeSource.
>    Returns:
>        the location (URL).

It seems there is no indication that the returned value could be null?

[1] http://download.oracle.com/javase/6/docs/api/

> Embedded Derby does not start when derby.jar is dynamically uploaded / added to the classpath
> ---------------------------------------------------------------------------------------------
>                 Key: DERBY-4944
>                 URL: https://issues.apache.org/jira/browse/DERBY-4944
>             Project: Derby
>          Issue Type: Bug
>          Components: Store
>    Affects Versions:
>         Environment: various windows versions, jdk1.6.0 and 1.5.0
>            Reporter: Michael Dobrovnik
>            Assignee: Dag H. Wanvik
>            Priority: Minor
>         Attachments: BDFF.diff
> Hi, 
> For our workflow-system, we can use a variety of DBMS as the store engine. Derby is one
of them especially popular
> for test and development purposes. During setup of our system, we allow to upload a jar
file with the JDBC-Driver for the DBMS.
> In case of derby, we use the embedded mode and upload derby.jar. After that we add the
jar to the repositories of our class loader
> and call 
> Class drc = Class.forName("org.apache.derby.jdbc.EmbeddedDriver", true, ourclassloader);
> Driver drv = (Driver)drc.newInstance();
> this worked perfectly for many years up to version, but ceased to work in;

> i assume the unreleased future versions are affected, too
> when derby.jar is placed in the classpath manually before starting our setup, everything
works fine regardless of the derby version.
> investigations lead to the following conclusion:
> - since rev. 982370 this is broken, in the immediate predecessor rev. 980035  it worked.
> - rev. 982370 in  the org.apache.derby.impl.store.raw.data.BaseDataFileFactory class
introduced a new method
>     private static String jarClassPath(final Class cls) which tries to find the jarfile
from which derby was loaded.
>   it contains the following lines: 
> if ( cs == null )
>   return null;
> URL result = cs.getLocation();
> return result.toString();        
>   but in the case, when we dynamically load derby, 
>   cs is not null but cs.getLocation() is null. so i propose to change the line with the
if to:
> ...
> if ( cs == null || cs.getLocation()==null)
>   return null;
> ...
> or maybe it would be better to surround the whole body of the method with a try catch,
since it is not essential, and a null 
> return value is also ok?
> thank you for your efforts concerning derby at large, 
> Michael

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message