openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nolan, Edell" <Edell.No...@iona.com>
Subject Question on sharing a derby db with OpenJpa
Date Tue, 27 May 2008 10:29:48 GMT
Hi,

 

I am trying to fix a demo that demonstrates using OpenJpa and I hand I
have tried several solutions. I basically have two web services and each
are deployed in separate service units to Servicemix.

 

The idea here is that the first Service will persist an order to the db
and returns to the client. Then asynchronously the second service will
update the database once it processes the order. The client will later
do a ping to see what the Status of the order is. 

 

It all works fine but when I attempt to place my next order I get the
following error.

 

27-May-2008 10:31:55 org.apache.cxf.phase.PhaseInterceptorChain
doInterceptINFO: Application has thrown exception, unwinding now:
org.apache.openjpa.persistence.PersistenceException: There were errors
initializing your configuration: <

openjpa-1.0.2-r420667:627158 fatal store error>
org.apache.openjpa.util.StoreException: Failed to start database
target/data/derby, see the next exception for details.

        at
org.apache.openjpa.jdbc.schema.DataSourceFactory.installDBDictionary(Dat
aSourceFactory.java:234)

        at
org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFactory(
JDBCConfigurationImpl.java:709)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)

 

Caused by: java.sql.SQLException: Another instance of Derby may have
already booted the database
C:\servicemix-4.0-m3\data\derby\target\data\derby.

        at
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown
Source)

        at
org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)

        ... 49 more

Caused by: ERROR XSDB6: Another instance of Derby may have already
booted the database C:\servicemix-4.0-m3\data\derby\target\data\derby.

        at
org.apache.derby.iapi.error.StandardException.newException(Unknown
Source)

 

The following is my persistence.xml file. I know I have the
transaction-type="RESOURCE_LOCAL" and from reading around I can see that
you will get this error if you are trying to access the same db from
different jvms but I deploy to Servicemix 

 

<persistence xmlns="http://java.sun.com/xml/ns/persistence"

             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

             version="1.0">

 

  <persistence-unit name="order-processor"
transaction-type="RESOURCE_LOCAL">

    <provider>

      org.apache.openjpa.persistence.PersistenceProviderImpl

    </provider>

 

    <class>com.iona.fuse.demo.logisticx.model.Order</class>

    <class>com.iona.fuse.demo.logisticx.model.LineItem</class>

    <class>com.iona.fuse.demo.logisticx.model.OrderStatus</class>

 

    <properties>

      <property name="openjpa.ConnectionURL"
value="jdbc:derby:target/data/derby;create=true"/>

      <property name="openjpa.ConnectionDriverName"
value="org.apache.derby.jdbc.EmbeddedDriver"/>

      <property name="openjpa.jdbc.SynchronizeMappings"
value="buildSchema"/>

      <property name="openjpa.Log" value="DefaultLevel=WARN, Tool=INFO,
SQL=TRACE"/>

      <!-- <property name="openjpa.RuntimeUnenhancedClasses"
value="warn"/>  -->

    </properties>

  </persistence-unit>

 

</persistence>

 

So my question is - is there a way to get around this with my current
configuration ?

 

Or 

 

Can anyone point me to a location where there is an example of using
OpenJpa with sharing a derby db. 

 

Thanks, Edell.


----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message