[ 
https://issues.apache.org/jira/browse/DERBY-6410?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Knut Anders Hatlen updated DERBY-6410:
--------------------------------------

    Attachment: d6410-1a.diff

Even though the root cause of this bug is a JVM bug, I think it is possible to 
fix it in Derby.

The failing call is to Files.getFileStore(Path). We only need the FileStore 
instance in order to check if the specific FileAttributeView is supported on 
the file system (by calling FileStore.supportsFileAttributeView()). But this 
information can also be found by checking if Files.getAttributeFileView() 
returns null. Since we already call getAttributeFileView() to get the view, the 
calls to Files.getFileStore() and FileStore.supportsFileAttributeView() are 
redundant and can be removed.

The attached patch, d6410-1a.diff, removes the redundant calls. With the patch, 
I'm able to start the network server on a subst drive without getting an error, 
and the files created by the server instance have restricted file permissions. 
I've also successfully run RestrictiveFilePermissionsTest on a subst drive with 
the patch.

> ClassCastException when launching derby from windows subst drive
> ----------------------------------------------------------------
>
>                 Key: DERBY-6410
>                 URL: https://issues.apache.org/jira/browse/DERBY-6410
>             Project: Derby
>          Issue Type: Bug
>          Components: Services
>    Affects Versions: 10.9.1.0
>         Environment: Windows 7
>            Reporter: Markus Peröbner
>            Priority: Minor
>         Attachments: d6410-1a.diff
>
>
> When launching derby bundled with glassfish4 on a substed drive derby fails 
> to startup and logs the following into the derby.log:
> {code}
> Fri Nov 08 10:30:34 CET 2013 : Sicherheitsmanager mit einfacher 
> Server-Sicherheitsrichtlinie installiert.
> java.lang.reflect.InvocationTargetException
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>       at java.lang.reflect.Method.invoke(Unknown Source)
>       at 
> com.sun.enterprise.admin.cli.optional.DerbyControl.invokeNetworkServerControl(DerbyControl.java:158)
>       at 
> com.sun.enterprise.admin.cli.optional.DerbyControl.main(DerbyControl.java:245)
> Caused by: java.lang.ExceptionInInitializerError
>       at java.lang.Class.forName0(Native Method)
>       at java.lang.Class.forName(Unknown Source)
>       at 
> org.apache.derby.impl.drda.NetworkServerControlImpl.startNetworkServer(Unknown
>  Source)
>       at 
> org.apache.derby.impl.drda.NetworkServerControlImpl.blockingStart(Unknown 
> Source)
>       at 
> org.apache.derby.impl.drda.NetworkServerControlImpl.executeWork(Unknown 
> Source)
>       at org.apache.derby.drda.NetworkServerControl.main(Unknown Source)
>       ... 6 more
> Caused by: java.lang.ClassCastException: java.nio.file.FileSystemException 
> cannot be cast to java.lang.RuntimeException
>       at 
> org.apache.derby.iapi.services.io.FileUtil.limitAccessToOwnerViaACLs(Unknown 
> Source)
>       at 
> org.apache.derby.iapi.services.io.FileUtil.limitAccessToOwner(Unknown Source)
>       at 
> org.apache.derby.impl.services.stream.SingleStream.PBmakeFileHPW(Unknown 
> Source)
>       at org.apache.derby.impl.services.stream.SingleStream.run(Unknown 
> Source)
>       at java.security.AccessController.doPrivileged(Native Method)
>       at 
> org.apache.derby.impl.services.stream.SingleStream.makeFileHPW(Unknown Source)
>       at 
> org.apache.derby.impl.services.stream.SingleStream.createDefaultStream(Unknown
>  Source)
>       at 
> org.apache.derby.impl.services.stream.SingleStream.makeStream(Unknown Source)
>       at org.apache.derby.impl.services.stream.SingleStream.boot(Unknown 
> Source)
>       at org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown 
> Source)
>       at org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown 
> Source)
>       at 
> org.apache.derby.impl.services.monitor.BaseMonitor.startModule(Unknown Source)
>       at 
> org.apache.derby.iapi.services.monitor.Monitor.startSystemModule(Unknown 
> Source)
>       at 
> org.apache.derby.impl.services.monitor.BaseMonitor.runWithState(Unknown 
> Source)
>       at org.apache.derby.impl.services.monitor.FileMonitor.<init>(Unknown 
> Source)
>       at org.apache.derby.iapi.services.monitor.Monitor.startMonitor(Unknown 
> Source)
>       at org.apache.derby.iapi.jdbc.JDBCBoot.boot(Unknown Source)
>       at org.apache.derby.jdbc.EmbeddedDriver.boot(Unknown Source)
>       at org.apache.derby.jdbc.EmbeddedDriver.<clinit>(Unknown Source)
>       ... 12 more
> {code}
> Derby was started via the glassfish command:
> {code}
> $ asadmin start-database
> {code}
> The asadmin command only fails if it is launched from a substed windows 
> drive. The substed drive was created with the following command:
> {code}
> $ subst d: c:\d
> {code}
> When derby is started from drive 'C' everything is fine.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to