If I understand you, you uses a Embedded Derby (org.apache.derby.jdbc.EmbeddedDriver). if you want share the db, you must use a client/server db, so you can connect to db from any client. You can start Derby as C/S Database.
Bye Marco ----- Original Message ----- Da : "Nolan, Edell" <[EMAIL PROTECTED]> A : <[email protected]> Oggetto : Question on sharing a derby db with OpenJpa Data : Tue, 27 May 2008 06:29:48 -0400 > 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.installDB > Dictionary(Dat aSourceFactory.java:234) > > at > org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConn > ectionFactory( JDBCConfigurationImpl.java:709) > > at > sun.reflect.NativeMethodAccessorImpl.invoke0(Native > Method) > > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAc > cessorImpl.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.getSQLExcep > tion(Unknown Source) > > at > org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unk > nown 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</cla > ss> > > > > <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 > ....
