It sounds like your test case does not try to recreate database again.

-D





On 2/20/07, bkbonner <[EMAIL PROTECTED]> wrote:


I'm trying to use the sql-maven-plugin with derby.

My pom is as follows:

                        <plugin>
                               <groupId>org.apache.maven.plugins</groupId>

<artifactId>maven-surefire-plugin</artifactId>
                               <configuration>
                                       <skip>false</skip>
                               </configuration>
                       </plugin>
                       <plugin>
                               <groupId>org.codehaus.mojo</groupId>
                               <artifactId>sql-maven-plugin</artifactId>
                               <dependencies>
                                       <!-- specify the dependent jdbc
driver here -->
                                       <dependency>
                                               <groupId>org.apache.derby
</groupId>

<artifactId>derby</artifactId>
                                               <version>10.2.2.0</version>
                                       </dependency>
                               </dependencies>
                               <configuration>
                                       <username>me</username>
                                       <password>mine</password>
                                       <driver>

org.apache.derby.jdbc.EmbeddedDriver
                                       </driver>

<url>jdbc:derby:testdb;create=true</url>
                                       <!--all executions are ignored if -
Dmaven.test.skip=true-->
                                       <skip>${maven.test.skip}</skip>
                               </configuration>
                               <executions>

                                       <execution>
                                               <id>drop tables and
recreate</id>

<phase>process-test-resources</phase>
                                               <goals>

<goal>execute</goal>
                                               </goals>
                                               <configuration>

<autocommit>true</autocommit>
                                                       <srcFiles>
                                                               <srcFile>

datamodel/pid-snapshot.sql
                                                               </srcFile>
                                                       </srcFiles>

<onError>continue</onError>
                                               </configuration>
                                       </execution>
                               </executions>


When my test cases try to run and connect to the derby instance, they
receive the following failure:



-------------------------------------------------------------------------------
Test set: com.test.pid.model.PidpdtcaPidSnapshotTest

-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 3.635 sec
<<< FAILURE!
testGetPidpdtca(com.test.pid.model.PidpdtcaPidSnapshotTest)  Time elapsed:
3.585 sec  <<< ERROR!
org.springframework.transaction.CannotCreateTransactionException: Could
not
open JDBC Connection for transaction; nested exception is
java.sql.SQLException: Failed to start database 'testdb', see the next
exception for details.
Caused by: java.sql.SQLException: Failed to start database 'testdb', 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.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.bootDatabase(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.AutoloadedDriver.connect(Unknown Source)
       at java.sql.DriverManager.getConnection(DriverManager.java:582)
       at java.sql.DriverManager.getConnection(DriverManager.java:154)
       at

org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager
(DriverManagerDataSource.java:291)
       at

org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager
(DriverManagerDataSource.java:277)
       at

org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager
(DriverManagerDataSource.java:259)
       at
org.springframework.jdbc.datasource.DriverManagerDataSource.getConnection(
DriverManagerDataSource.java:240)
       at
org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(
DataSourceTransactionManager.java:182)
       at

org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction
(AbstractPlatformTransactionManager.java:349)
       at

org.springframework.test.AbstractTransactionalSpringContextTests.startNewTransaction
(AbstractTransactionalSpringContextTests.java:313)
       at
org.springframework.test.AbstractTransactionalSpringContextTests.onSetUp(
AbstractTransactionalSpringContextTests.java:168)
       at
org.springframework.test.AbstractSingleSpringContextTests.setUp(
AbstractSingleSpringContextTests.java:85)
       at junit.framework.TestCase.runBare(TestCase.java:128)
       at
org.springframework.test.ConditionalTestCase.runBare(
ConditionalTestCase.java:69)
       at junit.framework.TestResult$1.protect(TestResult.java:110)
       at junit.framework.TestResult.runProtected(TestResult.java:128)
       at junit.framework.TestResult.run(TestResult.java:113)
       at junit.framework.TestCase.run(TestCase.java:120)
       at junit.framework.TestSuite.runTest(TestSuite.java:228)
       at junit.framework.TestSuite.run(TestSuite.java:223)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java
:39)
       at
sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at
org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java
:210)
       at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(
AbstractDirectoryTestSuite.java:135)
       at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(
AbstractDirectoryTestSuite.java:122)
       at org.apache.maven.surefire.Surefire.run(Surefire.java:129)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java
:39)
       at
sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(
SurefireBooter.java:225)
       at
org.apache.maven.surefire.booter.SurefireBooter.run(SurefireBooter.java
:139)
       at
org.apache.maven.plugin.surefire.SurefirePlugin.execute(
SurefirePlugin.java:376)
       at
org.apache.maven.plugin.DefaultPluginManager.executeMojo(
DefaultPluginManager.java:420)
       at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(
DefaultLifecycleExecutor.java:539)
       at

org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle
(DefaultLifecycleExecutor.java:480)
       at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(
DefaultLifecycleExecutor.java:459)
       at

org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures
(DefaultLifecycleExecutor.java:311)
       at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(
DefaultLifecycleExecutor.java:278)
       at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(
DefaultLifecycleExecutor.java:143)
       at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:330)
       at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:123)
       at org.apache.maven.cli.MavenCli.main(MavenCli.java:272)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java
:39)
       at
sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java
:315)
       at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
       at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java
:430)
       at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: java.sql.SQLException: Failed to start database 'testdb', 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)
       ... 64 more


I don't see the actual failure, but I suspect it's similar to the
following:

SQL Exception: Failed to start database 'testDB', see the next exception
for
details.
SQL Exception: Another instance of Derby may have already booted the
database testDB.

Any ideas on how I can identify the full error message?
And better yet, any ideas on what I can do to better create a testdb with
derby that I can run in my sql tests?

Brian





--
View this message in context:
http://www.nabble.com/sql-maven-plugin%2C-derby%2C-and-test-cases--%3E-failed-to-start-database-tf3263205s177.html#a9070373
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to