Details
Description
If derby tests are running with JVM options that slow things down substantially, it can fail with:
1) testBootLock(org.apache.derbyTesting.functionTests.tests.store.BootLockTest)j
unit.framework.ComparisonFailure: Dual boot not detected: check BootLockMinion.l
og expected:<...SDB6> but was:<...CY03>
at org.apache.derbyTesting.junit.BaseJDBCTestCase.assertSQLState(BaseJDB
CTestCase.java:769)
at org.apache.derbyTesting.junit.BaseJDBCTestCase.assertSQLState(BaseJDB
CTestCase.java:804)
at org.apache.derbyTesting.functionTests.tests.store.BootLockTest.testBo
otLock(BootLockTest.java:145)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:60)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:37)
at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:
109)
at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
at junit.extensions.TestSetup$1.protect(TestSetup.java:19)
at junit.extensions.TestSetup.run(TestSetup.java:23)
at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57
)
at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
at junit.extensions.TestSetup$1.protect(TestSetup.java:19)
at junit.extensions.TestSetup.run(TestSetup.java:23)
at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
at junit.extensions.TestSetup$1.protect(TestSetup.java:19)
at junit.extensions.TestSetup.run(TestSetup.java:23)
Caused by: java.sql.SQLException: Required property 'derby.serviceProtocol' has
not been set.
at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLE
xceptionFactory40.java:95)
at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java:256)
at org.apache.derby.impl.jdbc.EmbedConnection.bootDatabase(EmbedConnecti
on.java:2723)
at org.apache.derby.impl.jdbc.EmbedConnection.<init>(EmbedConnection.jav
a:384)
at org.apache.derby.jdbc.Driver40.getNewEmbedConnection(Driver40.java:68
)
at org.apache.derby.jdbc.InternalDriver.connect(InternalDriver.java:238)
at org.apache.derby.jdbc.AutoloadedDriver.connect(AutoloadedDriver.java:
128)
at java.sql.DriverManager.getConnection(DriverManager.java:322)
at java.sql.DriverManager.getConnection(DriverManager.java:297)
at org.apache.derbyTesting.junit.DriverManagerConnector.openConnection(D
riverManagerConnector.java:81)
at org.apache.derbyTesting.junit.DriverManagerConnector.openConnection(D
riverManagerConnector.java:43)
at org.apache.derbyTesting.junit.TestConfiguration.openDefaultConnection
(TestConfiguration.java:1538)
at org.apache.derbyTesting.junit.BaseJDBCTestCase.openDefaultConnection(
BaseJDBCTestCase.java:428)
at org.apache.derbyTesting.junit.BaseJDBCTestCase.getConnection(BaseJDBC
TestCase.java:110)
at org.apache.derbyTesting.functionTests.tests.store.BootLockTest.testBo
otLock(BootLockTest.java:136)
... 31 more
Caused by: java.sql.SQLException: Required property 'derby.serviceProtocol' has
not been set.
at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExc
eptionFactory.java:45)
at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransport
AcrossDRDA(SQLExceptionFactory40.java:119)
at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLE
xceptionFactory40.java:70)
... 45 more
Caused by: ERROR XCY03: Required property 'derby.serviceProtocol' has not been s
et.
at org.apache.derby.iapi.error.StandardException.newException(StandardEx
ception.java:286)
at org.apache.derby.impl.services.monitor.BaseMonitor.startProviderServi
ce(BaseMonitor.java:1679)
at org.apache.derby.impl.services.monitor.BaseMonitor.findProviderAndSta
rtService(BaseMonitor.java:1560)
at org.apache.derby.impl.services.monitor.BaseMonitor.startPersistentSer
vice(BaseMonitor.java:979)
at org.apache.derby.iapi.services.monitor.Monitor.startPersistentService
(Monitor.java:550)
at org.apache.derby.impl.jdbc.EmbedConnection.bootDatabase(EmbedConnecti
on.java:2686)
... 43 more
The test waits for the spawned process to create db.lck and service.properties and then waits three seconds more to make sure the properties have been written, but this might not be enough time.
Although I have not seen this myself with unchanged code , I can simulate it on windows by changing StorageFactoryService.saveServiceProperties() to have a sleep between creating the service.properties file and writing the properties out, e.g.
try
{
os = servicePropertiesFile.getOutputStream();
try
catch (Exception e) {}
properties.store( os, serviceName + MessageService.getTextMessage(MessageId.SERVICE_PROPERTIES_DONT_EDIT));