Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Derby generated files should be under build directory [BATCH-2699] #908

Closed
spring-issuemaster opened this issue Mar 7, 2018 · 0 comments
Closed

Comments

@spring-issuemaster
Copy link
Collaborator

@spring-issuemaster spring-issuemaster commented Mar 7, 2018

Mahmoud Ben Hassine opened BATCH-2699 and commented

When building the project, the derby generated files are under the root directory of the spring-batch-infrastructure module:

$>cd spring-batch-infrastructure
$>tree -L 1
.
├── build
├── derby-home
├── derby.log
├── derbydb
├── out
└── src

5 directories, 1 file

These files are not cleaned up by ./gradlew clean command. These files are better placed under the build directory.

The issue with this is when switching from branch to branch (let's say from master to 3.0.x), issuing a ./gradlew clean build causes the build to fail:

$> git checkout master
$> ./gradlew clean build
...
BUILD SUCCESSFUL

Total time: 6 mins 55.565 secs
$>git checkout 3.0.x
Switched to branch '3.0.x'
Your branch is up to date with 'origin/3.0.x'.
$>./gradlew clean build
...
:spring-batch-infrastructure:test

org.springframework.batch.support.DatabaseTypeIntegrationTests > testDerby FAILED
    org.springframework.jdbc.support.MetaDataAccessException at DatabaseTypeIntegrationTests.java:43
        Caused by: org.springframework.jdbc.CannotGetJdbcConnectionException at DatabaseTypeIntegrationTests.java:43
            Caused by: org.apache.commons.dbcp.SQLNestedException at DatabaseTypeIntegrationTests.java:43
                Caused by: java.sql.SQLException at DatabaseTypeIntegrationTests.java:43
                    Caused by: org.apache.derby.impl.jdbc.EmbedSQLException at DatabaseTypeIntegrationTests.java:43
                        Caused by: org.apache.derby.impl.jdbc.EmbedSQLException at DatabaseTypeIntegrationTests.java:43
                            Caused by: org.apache.derby.iapi.error.StandardException at DatabaseTypeIntegrationTests.java:43

org.springframework.batch.item.database.StoredProcedureItemReaderIntegrationTests > testRollbackOnFirstChunkAndRestart FAILED
    java.lang.IllegalStateException
        Caused by: org.springframework.beans.factory.BeanCreationException
            Caused by: org.springframework.transaction.CannotCreateTransactionException
                Caused by: java.sql.SQLException
                    Caused by: org.apache.derby.impl.jdbc.EmbedSQLException
                        Caused by: org.apache.derby.impl.jdbc.EmbedSQLException
                            Caused by: org.apache.derby.iapi.error.StandardException

org.springframework.batch.item.database.StoredProcedureItemReaderIntegrationTests > testRestartOnSecondPage FAILED
    java.lang.IllegalStateException
        Caused by: org.springframework.beans.factory.BeanCreationException
            Caused by: org.springframework.transaction.CannotCreateTransactionException
                Caused by: java.sql.SQLException
                    Caused by: org.apache.derby.impl.jdbc.EmbedSQLException
                        Caused by: org.apache.derby.impl.jdbc.EmbedSQLException
                            Caused by: org.apache.derby.iapi.error.StandardException

org.springframework.batch.item.database.StoredProcedureItemReaderIntegrationTests > testInvalidRestore FAILED
    java.lang.IllegalStateException
        Caused by: org.springframework.beans.factory.BeanCreationException
            Caused by: org.springframework.transaction.CannotCreateTransactionException
                Caused by: java.sql.SQLException
                    Caused by: org.apache.derby.impl.jdbc.EmbedSQLException
                        Caused by: org.apache.derby.impl.jdbc.EmbedSQLException
                            Caused by: org.apache.derby.iapi.error.StandardException

org.springframework.batch.item.database.StoredProcedureItemReaderIntegrationTests > testMultipleRestarts FAILED
    java.lang.IllegalStateException
        Caused by: org.springframework.beans.factory.BeanCreationException
            Caused by: org.springframework.transaction.CannotCreateTransactionException
                Caused by: java.sql.SQLException
                    Caused by: org.apache.derby.impl.jdbc.EmbedSQLException
                        Caused by: org.apache.derby.impl.jdbc.EmbedSQLException
                            Caused by: org.apache.derby.iapi.error.StandardException

org.springframework.batch.item.database.StoredProcedureItemReaderIntegrationTests > testNormalProcessing FAILED
    java.lang.IllegalStateException
        Caused by: org.springframework.beans.factory.BeanCreationException
            Caused by: org.springframework.transaction.CannotCreateTransactionException
                Caused by: java.sql.SQLException
                    Caused by: org.apache.derby.impl.jdbc.EmbedSQLException
                        Caused by: org.apache.derby.impl.jdbc.EmbedSQLException
                            Caused by: org.apache.derby.iapi.error.StandardException

org.springframework.batch.item.database.StoredProcedureItemReaderIntegrationTests > testRestoreFromEmptyData FAILED
    java.lang.IllegalStateException
        Caused by: org.springframework.beans.factory.BeanCreationException
            Caused by: org.springframework.transaction.CannotCreateTransactionException
                Caused by: java.sql.SQLException
                    Caused by: org.apache.derby.impl.jdbc.EmbedSQLException
                        Caused by: org.apache.derby.impl.jdbc.EmbedSQLException
                            Caused by: org.apache.derby.iapi.error.StandardException

org.springframework.batch.item.database.StoredProcedureItemReaderIntegrationTests > testRestart FAILED
    java.lang.IllegalStateException
        Caused by: org.springframework.beans.factory.BeanCreationException
            Caused by: org.springframework.transaction.CannotCreateTransactionException
                Caused by: java.sql.SQLException
                    Caused by: org.apache.derby.impl.jdbc.EmbedSQLException
                        Caused by: org.apache.derby.impl.jdbc.EmbedSQLException
                            Caused by: org.apache.derby.iapi.error.StandardException

org.springframework.batch.item.database.StoredProcedureItemReaderIntegrationTests > testRollbackAndRestart FAILED
    java.lang.IllegalStateException
        Caused by: org.springframework.beans.factory.BeanCreationException
            Caused by: org.springframework.transaction.CannotCreateTransactionException
                Caused by: java.sql.SQLException
                    Caused by: org.apache.derby.impl.jdbc.EmbedSQLException
                        Caused by: org.apache.derby.impl.jdbc.EmbedSQLException
                            Caused by: org.apache.derby.iapi.error.StandardException

org.springframework.batch.item.database.StoredProcedureItemReaderIntegrationTests > testTransacted FAILED
    java.lang.IllegalStateException
        Caused by: org.springframework.beans.factory.BeanCreationException
            Caused by: org.springframework.transaction.CannotCreateTransactionException
                Caused by: java.sql.SQLException
                    Caused by: org.apache.derby.impl.jdbc.EmbedSQLException
                        Caused by: org.apache.derby.impl.jdbc.EmbedSQLException
                            Caused by: org.apache.derby.iapi.error.StandardException

org.springframework.batch.item.database.StoredProcedureItemReaderCommonTests > testRestartWithDriverSupportsAbsolute FAILED
    org.springframework.beans.factory.BeanCreationException at StoredProcedureItemReaderCommonTests.java:49
        Caused by: org.springframework.transaction.CannotCreateTransactionException at StoredProcedureItemReaderCommonTests.java:49
            Caused by: java.sql.SQLException at StoredProcedureItemReaderCommonTests.java:49
                Caused by: org.apache.derby.impl.jdbc.EmbedSQLException at StoredProcedureItemReaderCommonTests.java:49
                    Caused by: org.apache.derby.impl.jdbc.EmbedSQLException at StoredProcedureItemReaderCommonTests.java:49
                        Caused by: org.apache.derby.iapi.error.StandardException at StoredProcedureItemReaderCommonTests.java:49
    java.lang.NullPointerException

org.springframework.batch.item.database.StoredProcedureItemReaderCommonTests > testReadBeforeOpen FAILED
    org.springframework.beans.factory.BeanCreationException at StoredProcedureItemReaderCommonTests.java:49
        Caused by: org.springframework.transaction.CannotCreateTransactionException at StoredProcedureItemReaderCommonTests.java:49
            Caused by: java.sql.SQLException at StoredProcedureItemReaderCommonTests.java:49
                Caused by: org.apache.derby.impl.jdbc.EmbedSQLException at StoredProcedureItemReaderCommonTests.java:49
                    Caused by: org.apache.derby.impl.jdbc.EmbedSQLException at StoredProcedureItemReaderCommonTests.java:49
                        Caused by: org.apache.derby.iapi.error.StandardException at StoredProcedureItemReaderCommonTests.java:49
    java.lang.NullPointerException

org.springframework.batch.item.database.StoredProcedureItemReaderCommonTests > testReadToExhaustion FAILED
    org.springframework.beans.factory.BeanCreationException at StoredProcedureItemReaderCommonTests.java:49
        Caused by: org.springframework.transaction.CannotCreateTransactionException at StoredProcedureItemReaderCommonTests.java:49
            Caused by: java.sql.SQLException at StoredProcedureItemReaderCommonTests.java:49
                Caused by: org.apache.derby.impl.jdbc.EmbedSQLException at StoredProcedureItemReaderCommonTests.java:49
                    Caused by: org.apache.derby.impl.jdbc.EmbedSQLException at StoredProcedureItemReaderCommonTests.java:49
                        Caused by: org.apache.derby.iapi.error.StandardException at StoredProcedureItemReaderCommonTests.java:49
    java.lang.NullPointerException

org.springframework.batch.item.database.StoredProcedureItemReaderCommonTests > testResetAndRestart FAILED
    org.springframework.beans.factory.BeanCreationException at StoredProcedureItemReaderCommonTests.java:49
        Caused by: org.springframework.transaction.CannotCreateTransactionException at StoredProcedureItemReaderCommonTests.java:49
            Caused by: java.sql.SQLException at StoredProcedureItemReaderCommonTests.java:49
                Caused by: org.apache.derby.impl.jdbc.EmbedSQLException at StoredProcedureItemReaderCommonTests.java:49
                    Caused by: org.apache.derby.impl.jdbc.EmbedSQLException at StoredProcedureItemReaderCommonTests.java:49
                        Caused by: org.apache.derby.iapi.error.StandardException at StoredProcedureItemReaderCommonTests.java:49
    java.lang.NullPointerException

org.springframework.batch.item.database.StoredProcedureItemReaderCommonTests > testRestart FAILED
    org.springframework.beans.factory.BeanCreationException at StoredProcedureItemReaderCommonTests.java:49
        Caused by: org.springframework.transaction.CannotCreateTransactionException at StoredProcedureItemReaderCommonTests.java:49
            Caused by: java.sql.SQLException at StoredProcedureItemReaderCommonTests.java:49
                Caused by: org.apache.derby.impl.jdbc.EmbedSQLException at StoredProcedureItemReaderCommonTests.java:49
                    Caused by: org.apache.derby.impl.jdbc.EmbedSQLException at StoredProcedureItemReaderCommonTests.java:49
                        Caused by: org.apache.derby.iapi.error.StandardException at StoredProcedureItemReaderCommonTests.java:49
    java.lang.NullPointerException

org.springframework.batch.item.database.StoredProcedureItemReaderCommonTests > testReopen FAILED
    org.springframework.beans.factory.BeanCreationException at StoredProcedureItemReaderCommonTests.java:49
        Caused by: org.springframework.transaction.CannotCreateTransactionException at StoredProcedureItemReaderCommonTests.java:49
            Caused by: java.sql.SQLException at StoredProcedureItemReaderCommonTests.java:49
                Caused by: org.apache.derby.impl.jdbc.EmbedSQLException at StoredProcedureItemReaderCommonTests.java:49
                    Caused by: org.apache.derby.impl.jdbc.EmbedSQLException at StoredProcedureItemReaderCommonTests.java:49
                        Caused by: org.apache.derby.iapi.error.StandardException at StoredProcedureItemReaderCommonTests.java:49
    java.lang.NullPointerException

org.springframework.batch.item.database.StoredProcedureItemReaderCommonTests > testEmptyInput FAILED
    org.springframework.beans.factory.BeanCreationException at StoredProcedureItemReaderCommonTests.java:49
        Caused by: org.springframework.transaction.CannotCreateTransactionException at StoredProcedureItemReaderCommonTests.java:49
            Caused by: java.sql.SQLException at StoredProcedureItemReaderCommonTests.java:49
                Caused by: org.apache.derby.impl.jdbc.EmbedSQLException at StoredProcedureItemReaderCommonTests.java:49
                    Caused by: org.apache.derby.impl.jdbc.EmbedSQLException at StoredProcedureItemReaderCommonTests.java:49
                        Caused by: org.apache.derby.iapi.error.StandardException at StoredProcedureItemReaderCommonTests.java:49
    java.lang.NullPointerException

org.springframework.batch.item.database.StoredProcedureItemReaderCommonTests > testRead FAILED
    org.springframework.beans.factory.BeanCreationException at StoredProcedureItemReaderCommonTests.java:49
        Caused by: org.springframework.transaction.CannotCreateTransactionException at StoredProcedureItemReaderCommonTests.java:49
            Caused by: java.sql.SQLException at StoredProcedureItemReaderCommonTests.java:49
                Caused by: org.apache.derby.impl.jdbc.EmbedSQLException at StoredProcedureItemReaderCommonTests.java:49
                    Caused by: org.apache.derby.impl.jdbc.EmbedSQLException at StoredProcedureItemReaderCommonTests.java:49
                        Caused by: org.apache.derby.iapi.error.StandardException at StoredProcedureItemReaderCommonTests.java:49
    java.lang.NullPointerException

1306 tests completed, 18 failed, 1 skipped
:spring-batch-infrastructure:test FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':spring-batch-infrastructure:test'.
> There were failing tests. See the report at: file:///projects/spring-batch/spring-batch-infrastructure/build/reports/tests/index.html

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 8 mins 12.304 secs
$ 

The build fails due to the following error:

org.springframework.jdbc.support.MetaDataAccessException: Could not get Connection for extracting meta data; nested exception is org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Failed to start database 'derby-home/test' with class loader sun.misc.Launcher$AppClassLoader@18b4aac2, see the next exception for details.)

	at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:293)
	at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:320)
	at org.springframework.batch.support.DatabaseType.fromMetaData(DatabaseType.java:98)
	at org.springframework.batch.support.DatabaseTypeIntegrationTests.testDerby(DatabaseTypeIntegrationTests.java:43)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Failed to start database 'derby-home/test' with class loader sun.misc.Launcher$AppClassLoader@18b4aac2, see the next exception for details.)
	at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:80)
	at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:280)
	... 25 more
Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Failed to start database 'derby-home/test' with class loader sun.misc.Launcher$AppClassLoader@18b4aac2, see the next exception for details.)
	at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549)
	at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388)
	at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
	at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111)
	at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77)
	... 26 more
Caused by: java.sql.SQLException: Failed to start database 'derby-home/test' with class loader sun.misc.Launcher$AppClassLoader@18b4aac2, see the next exception for details.
	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source)
	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(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.<init>(Unknown Source)
	at org.apache.derby.impl.jdbc.EmbedConnection40.<init>(Unknown Source)
	at org.apache.derby.jdbc.Driver40.getNewEmbedConnection(Unknown Source)
	at org.apache.derby.jdbc.InternalDriver.connect(Unknown Source)
	at org.apache.derby.jdbc.Driver20.connect(Unknown Source)
	at org.apache.derby.jdbc.AutoloadedDriver.connect(Unknown Source)
	at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38)
	at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:582)
	at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1556)
	at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1545)
	... 30 more
Caused by: java.sql.SQLException: Failed to start database 'derby-home/test' with class loader sun.misc.Launcher$AppClassLoader@18b4aac2, see the next exception for details.
	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
	... 44 more
Caused by: java.sql.SQLException: Database at /projects/spring-batch/spring-batch-infrastructure/derby-home/test has an incompatible format with the current version of the software.  The database was created by or upgraded by version 10.14.
	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source)
	at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
	... 41 more
Caused by: ERROR XSLAN: Database at /projects/spring-batch/spring-batch-infrastructure/derby-home/test has an incompatible format with the current version of the software.  The database was created by or upgraded by version 10.14.
	at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
	at org.apache.derby.impl.store.raw.log.LogToFile.readControlFile(Unknown Source)
	at org.apache.derby.impl.store.raw.log.LogToFile.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.bootServiceModule(Unknown Source)
	at org.apache.derby.impl.store.raw.data.BaseDataFileFactory.bootLogFactory(Unknown Source)
	at org.apache.derby.impl.store.raw.data.BaseDataFileFactory.setRawStoreFactory(Unknown Source)
	at org.apache.derby.impl.store.raw.RawStore.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.bootServiceModule(Unknown Source)
	at org.apache.derby.impl.store.access.RAMAccessManager.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.bootServiceModule(Unknown Source)
	at org.apache.derby.impl.db.BasicDatabase.bootStore(Unknown Source)
	at org.apache.derby.impl.db.BasicDatabase.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.bootService(Unknown Source)
	at org.apache.derby.impl.services.monitor.BaseMonitor.startProviderService(Unknown Source)
	at org.apache.derby.impl.services.monitor.BaseMonitor.findProviderAndStartService(Unknown Source)
	at org.apache.derby.impl.services.monitor.BaseMonitor.startPersistentService(Unknown Source)
	at org.apache.derby.iapi.services.monitor.Monitor.startPersistentService(Unknown Source)
	... 41 more

Removing derby generated files by hand fixes the issue. This can be done automatically by the clean task of gradle if these files are moved under build directory.


Affects: 4.0.0

Referenced from: pull request #597, and commits 2913c8d, 234a2f0, 8748fff

Backported to: 4.1.0.M1, 4.0.2, 3.0.10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.