288 words

InternalError on query of empty database

#1
2011-07-21 01:39

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.

pedwards
pedwards's picture
Joined on 2011-06-06
User Post #7
#2
2011-07-21 07:00

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)
support
support's picture
Joined on 2010-05-03
User Post #463
#3
2011-07-21 07:48

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)

 

pedwards
pedwards's picture
Joined on 2011-06-06
User Post #9
#4
2011-07-24 01:21

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)
support
support's picture
Joined on 2010-05-03
User Post #470
#5
2011-07-25 01:05

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

pedwards
pedwards's picture
Joined on 2011-06-06
User Post #13

Post Reply

Please read carefully the posting instructions - before posting to the ObjectDB website.

  • You may have to disable pop up blocking in order to use the toolbar (e.g. in Chrome).
  • Use ctrl + right click to open the browser context menu in the editing area (e.g. for using a browser spell checker).
  • To insert formatted lines (e.g. Java code, stack trace) - select a style in the toolbar and then insert the text in the new created block.
  • Avoid overflow of published source code examples by breaking long lines.
  • You may mark in paragraph code words (e.g. class names) with the code style (can be applied by ctrl + D).
  • Long stack traces (> 50 lines) and complex source examples (> 100 lines) should be posted as attachments.
Attachments:
Maximum file size: 32 MB
Cancel