InternalError on query of empty database

#1

Hi,

I have reasons for sometimes trying to query the database before anything has been created. The problem is the database throws a InternalException when that happens. Is it possible to throw something that identifies that that is the issue, say something like "MissingSchemaException", ie something that clearly shows its because no data of that type has been added? This just makes the exception catching cleaner. Thought thinking about it, it probably needs to be a JPA exception, maybe something like javax.persistence.EntityNotFoundException?

Either that, or is there some way to query the database about its current schema?

Thanks

P.

#2

Sure. Usually a more appropriate exception is thrown in this case (see this forum thread for example). An internal exception should never be thrown.

Please post the complete stack trace of the exception that you get.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
#3

Hi,

Query I'm running is: SELECT DISTINCT $1 FROM CDI $1 JOIN $1.attributeList $2 JOIN $1.attributeList $3 WHERE ((($2.name='firstname') AND ($2.valueAsString='Alex')) AND (($3.name='lastname') AND ($3.valueAsString='Baldwin')))

There is nothing in the database at this point. I was capturing the exception, and doing a create, and then the next query is happy. Exception thrown is:

[ObjectDB 2.2.8_06] Unexpected exception (Error 990)
  Generated by Java HotSpot(TM) 64-Bit Server VM 1.6.0_20 (on Linux 2.6.38-10-generic).
Please report this error on http://www.objectdb.com/database/issue/new
com.objectdb.o.InternalException: java.lang.NullPointerException: null
java.lang.NullPointerException
at com.objectdb.o.SQI.Uo(SQI.java:168)
at com.objectdb.o.RQI$h._j(RQI.java:316)
at com.objectdb.o.RQI.Uo(RQI.java:202)
at com.objectdb.o.MQI.Uo(MQI.java:161)
at com.objectdb.o.MQI.Uo(MQI.java:160)
at com.objectdb.o.PRG.ao(PRG.java:1110)
at com.objectdb.o.PRG.ab(PRG.java:640)
at com.objectdb.o.QRM.US(QRM.java:259)
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.getResultList(JpaQuery.java:627)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.orm.jpa.SharedEntityManagerCreator$DeferredQueryInvocationHandler.invoke(SharedEntityManagerCreator.java:310)
at $Proxy74.getResultList(Unknown Source)
at com.contextspace.dao.impl.BaseDAOImpl.SearchByLdapFilter(BaseDAOImpl.java:491)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:196)
at $Proxy22.SearchByLdapFilter(Unknown Source)
at com.contextspace.handlers.BaseTestHandler.createCDI(BaseTestHandler.java:238)
at com.contextspace.handlers.SearchRequestHandlerTest.testSearchSingleAttribute(SearchRequestHandlerTest.java:94)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

 

#4

Build 2.2.8_07 includes an attempt to fix this bug. Please try it.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
#5

I'm now getting an empty set returned on empty database. Thanks!!!!


Post Reply

To post a reply and/or subscribe to update notifications - please login