db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Olav Sandstaa <Olav.Sands...@Sun.COM>
Subject Re: How to start and stop Derby from within a test
Date Thu, 30 Mar 2006 11:25:38 GMT
Rick Hillegas <Richard.Hillegas@Sun.COM> wrote:
> Somewhere in the test output there should be a detailed stack trace for 
> this exception (you may have to run the test with verbose=true).  That 
> stack trace will point you at a piece of code which may need to be 
> wrapped in a privileged block. You can grep the codeline for 
> "AccessController.doPrivileged" for example of how to code one of these. 
> You may also need to add some permissions to the policy file used by 
> derbyall tests: derby_tests.policy.

Rick, thanks for the hints on how to get the stack trace for where the
security exception occurs and hints on how to fix it. I still hope
that I do not have to do changes related to the security manager and I
am still hoping for some hints for functionality in the test framework
or code other tests on how to start and stop Derby in a less ad hoc
way than I am doing it in this test.

Anyway, here is the stack trace for the security exception:

java.sql.SQLException: Failed to start database 'wombat', see the next exception for details.
	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:66)
	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:87)
	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:93)
	at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java:172)
	at org.apache.derby.impl.jdbc.EmbedConnection.newSQLException(EmbedConnection.java:1939)
	at org.apache.derby.impl.jdbc.EmbedConnection.bootDatabase(EmbedConnection.java:1603)
	at org.apache.derby.impl.jdbc.EmbedConnection.<init>(EmbedConnection.java:216)
	at org.apache.derby.impl.jdbc.EmbedConnection30.<init>(EmbedConnection30.java:72)
	at org.apache.derby.impl.jdbc.EmbedConnection40.<init>(EmbedConnection40.java:48)
	at org.apache.derby.jdbc.Driver40.getNewEmbedConnection(Driver40.java:62)
	at org.apache.derby.jdbc.InternalDriver.connect(InternalDriver.java:199)
	at org.apache.derby.impl.drda.Database.makeConnection(Database.java:231)
	at org.apache.derby.impl.drda.DRDAConnThread.getConnFromDatabaseName(DRDAConnThread.java:1147)
	at org.apache.derby.impl.drda.DRDAConnThread.verifyUserIdPassword(DRDAConnThread.java:1125)
	at org.apache.derby.impl.drda.DRDAConnThread.parseSECCHK(DRDAConnThread.java:2709)
	at org.apache.derby.impl.drda.DRDAConnThread.parseDRDAConnection(DRDAConnThread.java:987)
	at org.apache.derby.impl.drda.DRDAConnThread.processCommands(DRDAConnThread.java:830)
	at org.apache.derby.impl.drda.DRDAConnThread.run(DRDAConnThread.java:236)
java.sql.SQLException: Java exception: 'access denied (java.io.FilePermission /export/home/tmp/derbyjdbc4/DerbyNetClient/TestConnectionMethods/wombat/log/logmirror.ctrl
read): java.security.AccessControlException'.
	at java.security.AccessControlContext.checkPermission(AccessControlContext.java:321)
	at java.security.AccessController.checkPermission(AccessController.java:546)
	at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
	at java.lang.SecurityManager.checkRead(SecurityManager.java:871)
	at java.io.File.exists(File.java:731)
	at org.apache.derby.impl.store.raw.log.LogToFile.boot(LogToFile.java:2940)
	at org.apache.derby.impl.services.monitor.BaseMonitor.boot(BaseMonitor.java:1996)
	at org.apache.derby.impl.services.monitor.TopService.bootModule(TopService.java:290)
	at org.apache.derby.impl.services.monitor.BaseMonitor.startModule(BaseMonitor.java:542)
	at org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Monitor.java:418)
	at org.apache.derby.impl.store.raw.data.BaseDataFileFactory.bootLogFactory(BaseDataFileFactory.java:1762)
	at org.apache.derby.impl.store.raw.data.BaseDataFileFactory.setRawStoreFactory(BaseDataFileFactory.java:1218)
	at org.apache.derby.impl.store.raw.RawStore.boot(RawStore.java:250)
	at org.apache.derby.impl.services.monitor.BaseMonitor.boot(BaseMonitor.java:1996)
	at org.apache.derby.impl.services.monitor.TopService.bootModule(TopService.java:290)
	at org.apache.derby.impl.services.monitor.BaseMonitor.startModule(BaseMonitor.java:542)
	at org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Monitor.java:418)
	at org.apache.derby.impl.store.access.RAMAccessManager.boot(RAMAccessManager.java:987)
	at org.apache.derby.impl.services.monitor.BaseMonitor.boot(BaseMonitor.java:1996)
	at org.apache.derby.impl.services.monitor.TopService.bootModule(TopService.java:290)
	at org.apache.derby.impl.services.monitor.BaseMonitor.startModule(BaseMonitor.java:542)
	at org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Monitor.java:418)
	at org.apache.derby.impl.db.BasicDatabase.bootStore(BasicDatabase.java:738)
	at org.apache.derby.impl.db.BasicDatabase.boot(BasicDatabase.java:178)
	at org.apache.derby.impl.services.monitor.BaseMonitor.boot(BaseMonitor.java:1996)
	at org.apache.derby.impl.services.monitor.TopService.bootModule(TopService.java:290)
	at org.apache.derby.impl.services.monitor.BaseMonitor.bootService(BaseMonitor.java:1831)
	at org.apache.derby.impl.services.monitor.BaseMonitor.startProviderService(BaseMonitor.java:1697)
	at org.apache.derby.impl.services.monitor.BaseMonitor.findProviderAndStartService(BaseMonitor.java:1577)
	at org.apache.derby.impl.services.monitor.BaseMonitor.startPersistentService(BaseMonitor.java:990)
	at org.apache.derby.iapi.services.monitor.Monitor.startPersistentService(Monitor.java:541)
	at org.apache.derby.impl.jdbc.EmbedConnection.bootDatabase(EmbedConnection.java:1586)
	at org.apache.derby.impl.jdbc.EmbedConnection.<init>(EmbedConnection.java:216)
	at org.apache.derby.impl.jdbc.EmbedConnection30.<init>(EmbedConnection30.java:72)
	at org.apache.derby.impl.jdbc.EmbedConnection40.<init>(EmbedConnection40.java:48)
	at org.apache.derby.jdbc.Driver40.getNewEmbedConnection(Driver40.java:62)
	at org.apache.derby.jdbc.InternalDriver.connect(InternalDriver.java:199)
	at org.apache.derby.impl.drda.Database.makeConnection(Database.java:231)
	at org.apache.derby.impl.drda.DRDAConnThread.getConnFromDatabaseName(DRDAConnThread.java:1147)
	at org.apache.derby.impl.drda.DRDAConnThread.verifyUserIdPassword(DRDAConnThread.java:1125)
	at org.apache.derby.impl.drda.DRDAConnThread.parseSECCHK(DRDAConnThread.java:2709)
	at org.apache.derby.impl.drda.DRDAConnThread.parseDRDAConnection(DRDAConnThread.java:987)
	at org.apache.derby.impl.drda.DRDAConnThread.processCommands(DRDAConnThread.java:830)
	at org.apache.derby.impl.drda.DRDAConnThread.run(DRDAConnThread.java:236)

The security exception is raised when Derby tries to get access to the
log/logmirror.ctrl file during the second startup of the database. I
would have expected that since this file was created earlier during
the initial startup of the test, the test should already have the
required security permissions to access it during the second startup?

Anyway, the best solution to this problem would be to be able to reuse
functionality that already might exist in the test framework. Any
suggestions are appreciated.

Regards,
Olav

Mime
View raw message