db4o Developer Community

db4o open source object database, native to Java and .NET
Welcome to db4o Developer Community Sign in | Join
in Search
More Search Options

DatabaseReadOnlyException when querying remote database

Last post 09-02-2008, 05:40 PM by Peter Schübel. 0 replies.
Sort Posts: Previous Next
  •  09-02-2008, 05:40 PM 50880

    DatabaseReadOnlyException when querying remote database

    Hi,

    I've been evaluating db4o for a client-server environment for the last few weeks. I've been running into a few problems, but could solve most of them using the tutorial, the db4o reference or by looking up in the forum. But I now have an issue that may or may not be a bug, so I thought I'd ask directly for some advice. Of course it could very well be that I'm just using something in the wrong way...

    I have a Java client that stores and updates objects in a remote server database. The database server is also accessed by a couple of web applications (Java Servlets) that enable database queries using HTTP GET requests. I thought that, as these Servlets don't need to modify any data, I might as well configure the db4o container object in the Servlets as "read-only". But unfortunately the Servlet throws a com.db4o.DatabaseReadOnlyException whenever I try to query any data from it! This happened both for a query based on the object class (all "Result" objects from database) and a native query.

    I'd like to point out that I'm using the same configuration on all the clients and on the server. I'm actually using the same helper class to create the Configuration object on the Servlets and on the database server. The only difference is, that the Servlets set the readOnly flag to true. I really don't know why this exception is thrown, it certainly isn't what I expected. It's not a big problem for me, as I could just not use the "read only" switch, but I wanted to know about this anyway.

    I'm using db4o version 6.4.48.10991 for Java, all programs use Sun JDK1.6 / JavaEE5. If this is issue is fixed in a later version of db4o, I'm happy to upgrade, as I'm still in the evaluation phase...

     

    Any help or advice on this would be appreciated.

    Many Thanks,

    Peter

     

    This is the full log of the exception:

     01-Sep-2008 18:22:37 org.apache.catalina.core.StandardWrapperValve invoke
    SEVERE: Servlet.service() for servlet HttpCriDatabaseServlet threw exception
    com.db4o.DatabaseReadOnlyException
        at com.db4o.internal.PartialObjectContainer.checkReadOnly(Unknown Source)
        at com.db4o.internal.PartialObjectContainer.setInternal(Unknown Source)
        at com.db4o.internal.PartialObjectContainer.set(Unknown Source)
        at com.db4o.internal.ExternalObjectContainer.set(Unknown Source)
        at com.db4o.internal.ExternalObjectContainer.set(Unknown Source)
        at com.db4o.internal.Serializer.marshall(Unknown Source)
        at com.db4o.internal.Serializer.marshall(Unknown Source)
        at com.db4o.internal.cs.ClientObjectContainer.executeQuery(Unknown Source)
        at com.db4o.internal.PartialObjectContainer.getInternal(Unknown Source)
        at com.db4o.internal.PartialObjectContainer.get(Unknown Source)
        at com.db4o.internal.ExternalObjectContainer.get(Unknown Source)
        at com.db4o.internal.ExternalObjectContainer.query(Unknown Source)
        at bbc.rd.tvadb.webservices.HttpCriDatabaseServlet.processRequest(HttpCriDatabaseServlet.java:87)
        at bbc.rd.tvadb.webservices.BaseHttpServlet.doGet(BaseHttpServlet.java:75)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
        at bbc.rd.tvadb.webservices.BaseHttpServlet.service(BaseHttpServlet.java:56)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
        at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:852)
        at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:584)
        at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1508)
        at java.lang.Thread.run(Thread.java:675)

    I use the following code:

    ...

    protected final Configuration mDb4oCfg = Db4oConfigurationForTVAnytimeCRI.getConfiguration();

    ...

    mDb4oCfg.readOnly(true);

    mDB = Db4o.openClient(mDb4oCfg, smDb4oHost, smDb4oPort, smDb4oUser, smDb4oPassword);

    ...

    final ObjectSet<Result> results = mDB.query(Result.class); //this is line 87, where the exception occurs (see above)

     ...

View as RSS news feed in XML