Issue #412: Can't open replicated database

Type: Bug ReoprtVersion: 1.4.0Priority: NormalStatus: ActiveReplies: 8
#1

I have a database running in server mode on port 6136 on server1 and server2. Each server has a replicated copy of the other servers database.

I try to open the replicated on one database for a query (just read, no update) but it fails with the error below. The code I'm using is (user & password has been deliberately removed):

EntityManagerFactory emf = Persistence.createEntityManagerFactory(
     "objectdb://SE101388:6136//SE101352:6136/WorkflowHistory.odb;user=...;password=...");

EntityManager em = emf.createEntityManager();

The exception is thrown by the createEntityManager call.

The exception is:

[ObjectDB 2.2.8] javax.persistence.PersistenceException
Attempt to update types in read only mode (error 614)
at com.objectdb.jpa.EMF.createEntityManager(EMF.java:163)
at rbccm.felix.gridservice.admin.dao.ConnectionManagerFactory.createEntityManager(Unknown Source)
at rbccm.felix.gridservice.admin.dao.SimpleWorkflowInstanceQueryDao.queryInstance(Unknown Source)
at rbccm.felix.gridservice.admin.dao.SimpleWorkflowInstanceQueryDao.queryComplete(Unknown Source)
at rbccm.felix.gridservice.admin.AdminQueryService.process(Unknown Source)
at rbccm.felix.framework.service.ServiceRunner.run(Unknown Source)
at java.lang.Thread.run(Thread.java:595)
Caused by: com.objectdb.o.UserException: Attempt to update types in read only mode
at com.objectdb.o.MSG.d(MSG.java:61)
at com.objectdb.o.SHN.ab(SHN.java:364)
at com.objectdb.o.SHN.J(SHN.java:124)
at com.objectdb.o.HND.run(HND.java:133)
... 1 more
#2

On further investigation it looks like this may be related to the initial empty state of the database. I inserted a few rows into the databases and still got the error but when I restarted the objectdb servers and the application clients it seems to be working ok.

#3

On further further investigation I'm still seeing the problem but I'm not having much joy replicating the exact circumstances which cause it. I'll send an update if I can track it down but if ther's any insight you can provide in the meantime it'd be much appreciated!

#4

Not sure if its related but I'm also getting the following null pointer exception

[2011-07-23 17:38:51 #14 *]
java.lang.NullPointerException
at com.objectdb.o.MST.US(MST.java:884)
at com.objectdb.o.WRA.US(WRA.java:286)
at com.objectdb.o.WSM.US(WSM.java:113)
at com.objectdb.o.QRR.g(QRR.java:225)
at com.objectdb.o.QRR.b(QRR.java:144)
at com.objectdb.jpa.JpaQuery.getSingleResult(JpaQuery.java:654)
at rbccm.felix.objectdb.messaging.ObjectDbMessagePipe.getMessage(Unknown Source)
at rbccm.felix.objectdb.messaging.ObjectDbMessagePipe.take(Unknown Source)
at rbccm.felix.objectdb.messaging.ObjectDbMessagePipe.take(Unknown Source)
at rbccm.felix.framework.service.ServiceRunner.run(Unknown Source)
at java.lang.Thread.run(Thread.java:595)
#5

The first stack trace indicates an attempt to update a type schema in the replicated database, which is read only. This happens automatically if you try to access the replicated database with new or modified classes that are unknown yet in the database (therefore, with an almost empty database this is more likely to happen frequently).

It is unclear if the other exception is related.

ObjectDB Support
#6

Ok, that would explain it. Is there any way around this, i.e. can it tell that a replicated database is being used and not touch the schema?

I guess I can catch the exception and skip the query as I'll know the database is empty but this would be a bit messy as it is defined by UserException + message text.

I think the second stack trace is closer related to the other issue I posted (Issue 58) so I'll continue that discussion on that thread.

#7

Yes, this should be fixed in one of the next builds.

ObjectDB Support
#8

Any idea when this will be fixed?

#9

No immediate fix is currently planned.

The workaround is to make sure that every new (or modified) type is first registered with the master database, e.g. by running a query that uses that type against the master database.

ObjectDB Support

Reply