db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "KARR, DAVID (ATTCINW)" <dk0...@att.com>
Subject Just starting with Derby: Getting "Another instance of Derby may have already booted the database" with embedded db
Date Wed, 16 Dec 2009 21:11:21 GMT
I'm trying to set up Derby for some unit tests with OpenJPA.  I'm trying
to use the "embedded" server instead of the "network server" because it
seems a little easier to use.  In my unit test setup, I have to create
the database, then run my test class.  The setup method for this runs
some inserts.  The test method tries to connect to Derby indirectly
through OpenJPA.

When I run the Ant task to do all of this, it appears to create the
database, but when it tries to run the test, I get a failure about
"Another instance of Derby may have already booted the database".  From
my searches for this error message, it appears to happen when using the
embedded server instead of the network server.  Is it practical to use
the embedded server for what I'm trying to do, if my "test" Ant task
first runs some sql through the "sql" task, then runs JUnit to run my
test class?

If it matters, here is my "test-jpa" target that I'm using:

      <target name="test-jpa">
		<delete dir="build/db"/>
		<sql driver="${test.dbdriver}" url="${test.dburl}"
userid="${test.dbuser}" password="${test.dbpassword}"
		     classpathref="test.classpath">
		    <transaction src="etc/test/db/catalogSchema.sql"/>
		</sql>
		<junit fork="true" printsummary="true">
			<syspropertyset id="openjpa.properties">
				<propertyref prefix="openjpa"/>
			</syspropertyset>
			<classpath refid="test.classpath"/>
			<formatter type="plain"/>
			<batchtest fork="true" todir="build/test">
				<fileset dir="build/testclasses">
					<include name="**/*Test.class"/>
				</fileset>
			</batchtest>
		</junit>
	</target>

Mime
View raw message