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

Embedded database support in trouble shutting down Derby [SPR-7602] #12258

Closed
spring-projects-issues opened this issue Sep 29, 2010 · 8 comments
Assignees
Labels
type: bug A general bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Sep 29, 2010

Benson Margulies opened SPR-7602 and commented

I'm using the embedded database mechanism with type="DERBY" and derby 10.6.1.0. It works, but on the way out the door, I get the following rather loud set of complaining.

1    [Thread-2] WARN  org.springframework.jdbc.datasource.embedded.DerbyEmbeddedDatabaseConfigurer  - Could not shutdown in-memory Derby database
java.sql.SQLException: Database 'memory:testdb' not found.
	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.newEmbedSQLException(Unknown Source)
	at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
	at org.apache.derby.impl.jdbc.EmbedConnection.newSQLException(Unknown Source)
	at org.apache.derby.impl.jdbc.EmbedConnection.handleDBNotFound(Unknown Source)
	at org.apache.derby.impl.jdbc.EmbedConnection.<init>(Unknown Source)
	at org.apache.derby.impl.jdbc.EmbedConnection30.<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.EmbeddedDriver.connect(Unknown Source)
	at org.springframework.jdbc.datasource.embedded.DerbyEmbeddedDatabaseConfigurer.shutdown(DerbyEmbeddedDatabaseConfigurer.java:75)
	at org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseFactory.shutdownDatabase(EmbeddedDatabaseFactory.java:177)
	at org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseFactoryBean.destroy(EmbeddedDatabaseFactoryBean.java:57)
	at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:184)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:487)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:463)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:431)
	at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1048)
	at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1022)
	at org.springframework.context.support.AbstractApplicationContext$3.run(AbstractApplicationContext.java:940)
Caused by: java.sql.SQLException: Database 'memory:testdb' not found.
	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
	... 22 more

Affects: 3.0.4

Attachments:

Issue Links:

Referenced from: commits b467f2c

@spring-projects-issues
Copy link
Collaborator Author

Oliver Drotbohm commented

Does that occur repeatedly or just occasionally? In a test case or production? The Derby requires some kind of unusual shutdown process that throws an exception to indicate that it was shut down correctly. The special exception seems to indicate the database is gone entirely already, which seems a little odd

@spring-projects-issues
Copy link
Collaborator Author

Benson Margulies commented

I have a unit test that uses the Spring JUnit test runner. The app context for that test uses jdbc:embedded-database.

Every time I run the unit test I get this backtrace/warning.

@spring-projects-issues
Copy link
Collaborator Author

Benson Margulies commented

The problem here is cause, I think, by the fact that I have two embedded databases in my context,and Spring names them both 'testdb'.

@spring-projects-issues
Copy link
Collaborator Author

Benson Margulies commented

And there seems to be no provision for 'setName' in the jdbc:embedded-database element.

@spring-projects-issues
Copy link
Collaborator Author

Oliver Drotbohm commented

In general, with 10.6 Derby has changed the way to shutdown and purge in memory databases. So there's a compatibility issue of the embedded database support for Derby 10.6. and later. I have a fix for that issue here locally but we still have to negotiate in which version this will be applied (depends on how far we're towards the 3.0.5 release already).

Having multiple embedded databases is currently not supported via the namespace but I think we could use the bean id as database name if set. Would you mind opening another ticket for this?

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues
Copy link
Collaborator Author

Oliver Drotbohm commented

Thanks for opening the ticket. I'll have a look at it. Meanwhile the fix for the general 10.6 issue should be available in tonights snapshot. Feel free to give it a try.

@spring-projects-issues
Copy link
Collaborator Author

Benson Margulies commented

The 10.6 problems don't effect reading a clob, do they? Just shutdown?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants