javamaventomcatjpaobjectdb

Open ObjectDB explorer whilst running the tomcat server / instance


I'm new to ObjectDB and not sure if I've done something wrong here but I'm getting a couple of issues I'm hoping the community can help me with.

First is this annoying inability to view the db in the explorer when the server is running. If the explorer is open first then the tomcat/server/idea will crash and burn.

I get this: rage

If on the other hand Explorer is open and I try to restart the server :

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is com.objectdb.o._PersistenceException: Attempt to open a database file '/Users/SteveGreen/Development/Dev Workspace/RatedPlate_Java/RatedPlate/target/RatedPlate/WEB-INF/db/ratedplate.odb' that is currently in use by another process
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:978)

I then need to close connection in explorer and restart the server, however the saga continues as now I receive:

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is com.objectdb.o._PersistenceException: Attempt to open a database file '/Users/SteveGreen/Development/Dev Workspace/RatedPlate_Java/RatedPlate/target/RatedPlate/WEB-INF/db/ratedplate.odb' with an old unsupported format
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:978)

and I need to clean install the mV build before continuing again.

I'm using version 2.2.5 as per the pom, the explorer is from version 2.6.3 as the earlier jar that I downloaded that mapped to my version was not displaying the query option. If I suggest to the IDE that I now use a version other than 2.2.5 then all hell breaks loose and I'm not sure what the best course of action is. As you can imagine, it makes for a pretty shitty debug environment.

Any help is hugely appreciated, thanks!

From my pom: com.objectdb objectdb 2.2.5

Persistence:

<?xml version="1.0" encoding="UTF-8"?>

http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">

<persistence-unit name="RatedPlateDB" transaction-type="RESOURCE_LOCAL">
    <provider>com.objectdb.jpa.Provider</provider>
    <properties>
        <property name="javax.persistence.jdbc.url" value="$objectdb/db/ratedplate.odb"/>
        <property name="javax.persistence.jdbc.user" value="admin"/>
        <property name="javax.persistence.jdbc.password" value="admin"/>
    </properties>
</persistence-unit>

EDIT: I believe I've found and fixed the upgrade issue - 2.6.3 does not come with Jta or persistence

details: http://m2.objectdb.com

Updated pom:

  <dependency>
        <groupId>com.objectdb</groupId>
        <artifactId>objectdb</artifactId>
        <version>2.6.3</version>
    </dependency>
    <dependency>
        <groupId>org.eclipse.persistence</groupId>
        <artifactId>javax.persistence</artifactId>
        <version>2.1.0</version>
    </dependency>
    <dependency>
        <groupId>javax.transaction</groupId>
        <artifactId>jta</artifactId>
        <version>1.1</version>
    </dependency>

Solution

  • In embedded mode the database file is locked by one process, so you cannot access the same database (in embedded mode) concurrently in the Explorer and in your application.

    To access a database by more than one process at the same time use either client-server mode or embedded-server mode.