ObjectDB throws `NullPointerException` in internal code (`com.objectdb.o.ENH.b`)

#1

Hi, I have a strange problem,

There was an exception while trying to navigate to 'Drivers' with the root cause 'java.lang.NullPointerException: Cannot invoke "com.objectdb.o.MMM.t()" because "<local2>" is null'

What does "com.objectdb.o.MMM.t.." mean? 

Attached is the detailed problem description (AI-assisted report)

#2

The attachment was not included. Please provide the full stack trace.

ObjectDB Support
#3

Hi, the upload feature is not working, tried in chrome and firefox. This is the stack trace (i can send by email more info)

There was an exception while trying to navigate to 'Drivers' with the root cause 'java.lang.NullPointerException: Cannot invoke "com.objectdb.o.MMM.t()" because "<local2>" is null'

java.lang.IllegalArgumentException: Unable to create an instance of 'hr.hydraorm.apps.workers.drivers.route.DriversRoute'. The constructor threw an exception.

    at com.vaadin.flow.internal.ReflectTools.convertInstantiationException(ReflectTools.java:540)

    at com.vaadin.flow.internal.ReflectTools.createProxyInstance(ReflectTools.java:497)

    at com.vaadin.flow.internal.ReflectTools.createInstance(ReflectTools.java:452)

    at com.vaadin.flow.di.DefaultInstantiator.create(DefaultInstantiator.java:198)

    at com.vaadin.flow.di.DefaultInstantiator.getOrCreate(DefaultInstantiator.java:72)

    at com.vaadin.flow.di.Instantiator.createRouteTarget(Instantiator.java:170)

    at com.vaadin.flow.router.internal.AbstractNavigationStateRenderer.lambda$getRouteTarget$1(AbstractNavigationStateRenderer.java:147)

    at java.base/java.util.Optional.orElseGet(Optional.java:364)

    at com.vaadin.flow.router.internal.AbstractNavigationStateRenderer.getRouteTarget(AbstractNavigationStateRenderer.java:146)

    at com.vaadin.flow.router.internal.AbstractNavigationStateRenderer.sendBeforeEnterEventAndPopulateChain(AbstractNavigationStateRenderer.java:681)

    at com.vaadin.flow.router.internal.AbstractNavigationStateRenderer.createChainIfEmptyAndExecuteBeforeEnterNavigation(AbstractNavigationStateRenderer.java:662)

    at com.vaadin.flow.router.internal.AbstractNavigationStateRenderer.handleBeforeNavigationEvents(AbstractNavigationStateRenderer.java:370)

    at com.vaadin.flow.router.internal.AbstractNavigationStateRenderer.handle(AbstractNavigationStateRenderer.java:208)

    at com.vaadin.flow.component.internal.JavaScriptNavigationStateRenderer.handle(JavaScriptNavigationStateRenderer.java:78)

    at com.vaadin.flow.component.UI.handleNavigation(UI.java:2060)

    at com.vaadin.flow.component.UI.renderViewForRoute(UI.java:2022)

    at com.vaadin.flow.component.UI.lambda$browserNavigate$3bdbbbb5$1(UI.java:1881)

    at com.vaadin.flow.component.UI.browserNavigate(UI.java:1892)

    at com.vaadin.flow.component.ComponentEventBus.fireEventForListener(ComponentEventBus.java:244)

    at com.vaadin.flow.component.ComponentEventBus.handleDomEvent(ComponentEventBus.java:501)

    at com.vaadin.flow.component.ComponentEventBus.lambda$addDomTrigger$dd1b7957$1(ComponentEventBus.java:303)

    at com.vaadin.flow.internal.nodefeature.ElementListenerMap.lambda$fireEvent$2(ElementListenerMap.java:475)

    at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)

    at com.vaadin.flow.internal.nodefeature.ElementListenerMap.fireEvent(ElementListenerMap.java:475)

    at com.vaadin.flow.server.communication.rpc.EventRpcHandler.handleNode(EventRpcHandler.java:62)

    at com.vaadin.flow.server.communication.rpc.AbstractRpcInvocationHandler.handle(AbstractRpcInvocationHandler.java:79)

    at com.vaadin.flow.server.communication.ServerRpcHandler.handleInvocationData(ServerRpcHandler.java:568)

    at com.vaadin.flow.server.communication.ServerRpcHandler.lambda$handleInvocations$6(ServerRpcHandler.java:549)

    at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)

    at com.vaadin.flow.server.communication.ServerRpcHandler.handleInvocations(ServerRpcHandler.java:549)

    at com.vaadin.flow.server.communication.ServerRpcHandler.handleRpc(ServerRpcHandler.java:376)

    at com.vaadin.flow.server.communication.UidlRequestHandler.synchronizedHandleRequest(UidlRequestHandler.java:136)

    at com.vaadin.flow.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:63)

    at com.vaadin.flow.server.VaadinService.handleRequest(VaadinService.java:1879)

    at com.vaadin.flow.server.VaadinServlet.service(VaadinServlet.java:398)

    at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:614)

    at org.eclipse.jetty.ee10.servlet.ServletHolder$NotAsync.service(ServletHolder.java:1385)

    at org.eclipse.jetty.ee10.servlet.ServletHolder.handle(ServletHolder.java:751)

    at org.eclipse.jetty.ee10.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1622)

    at org.eclipse.jetty.ee10.websocket.servlet.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:195)

    at org.eclipse.jetty.ee10.servlet.FilterHolder.doFilter(FilterHolder.java:205)

    at org.eclipse.jetty.ee10.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1594)

    at org.eclipse.jetty.ee10.servlet.ServletHandler$MappedServlet.handle(ServletHandler.java:1555)

    at org.eclipse.jetty.ee10.servlet.ServletChannel.dispatch(ServletChannel.java:822)

    at org.eclipse.jetty.ee10.servlet.ServletChannel.handle(ServletChannel.java:438)

    at org.eclipse.jetty.ee10.servlet.ServletHandler.handle(ServletHandler.java:470)

    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:575)

    at org.eclipse.jetty.ee10.servlet.SessionHandler.handle(SessionHandler.java:717)

    at org.eclipse.jetty.server.handler.ContextHandler.handle(ContextHandler.java:1102)

    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:151)

    at org.eclipse.jetty.server.Server.handle(Server.java:182)

    at org.eclipse.jetty.server.internal.HttpChannelState$HandlerInvoker.run(HttpChannelState.java:721)

    at org.eclipse.jetty.server.internal.HttpConnection.onFillable(HttpConnection.java:416)

    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:322)

    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)

    at org.eclipse.jetty.io.SelectableChannelEndPoint$1.run(SelectableChannelEndPoint.java:53)

    at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.runTask(AdaptiveExecutionStrategy.java:492)

    at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.epcRunTask(AdaptiveExecutionStrategy.java:428)

    at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.consumeTask(AdaptiveExecutionStrategy.java:401)

    at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.tryProduce(AdaptiveExecutionStrategy.java:255)

    at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.run(AdaptiveExecutionStrategy.java:204)

    at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:311)

    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:981)

    at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.doRunJob(QueuedThreadPool.java:1211)

    at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1166)

    at java.base/java.lang.Thread.run(Thread.java:842)

Caused by: java.lang.reflect.InvocationTargetException

    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)

    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

    at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)

    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)

    at com.vaadin.flow.internal.ReflectTools.createProxyInstance(ReflectTools.java:484)

    ... 64 more

Caused by: java.lang.RuntimeException: Operation failed after 3 retries: DriverDAO.getAll()

    at hr.hydra.framework.ObjectDBRecoveryUtil.executeWithRetry(ObjectDBRecoveryUtil.java:88)

    at hr.hydraorm.apps.workers.dao.DriverDAO.getAll(DriverDAO.java:51)

    at hr.hydraorm.apps.workers.drivers.main.DriversMain.<init>(DriversMain.java:71)

    at hr.hydraorm.apps.workers.drivers.route.DriversRoute.createContent(DriversRoute.java:31)

    at hr.hydraorm.apps.workers.drivers.route.DriversRoute.<init>(DriversRoute.java:26)

    ... 70 more

Caused by: com.objectdb.o.InternalException: Unexpected internal exception

    at com.objectdb.o.JPE.e(JPE.java:156)

    at com.objectdb.o.ERR.h(ERR.java:66)

    at com.objectdb.o.OBC.onObjectDBError(OBC.java:1596)

    at com.objectdb.jpa.JpaQuery.getResultList(JpaQuery.java:690)

    at hr.hydra.framework.MasterDAO.lambda$findAll$1(MasterDAO.java:318)

    at hr.hydra.framework.MasterDAO.ro(MasterDAO.java:224)

    at hr.hydra.framework.MasterDAO.findAll(MasterDAO.java:292)

    at hr.hydraorm.apps.workers.dao.DriverDAO.lambda$getAll$0(DriverDAO.java:52)

    at hr.hydra.framework.ObjectDBRecoveryUtil.executeWithRetry(ObjectDBRecoveryUtil.java:46)

    ... 74 more

Caused by: java.lang.NullPointerException: Cannot invoke "com.objectdb.o.MMM.t()" because "<local2>" is null

    at com.objectdb.o.ENH.b(ENH.java:414)

    at com.objectdb.o.OBC.ai(OBC.java:976)

    at com.objectdb.o.OBC.ZJ(OBC.java:800)

    at com.objectdb.o.SRB.a(SRB.java:162)

    at com.objectdb.o.QRR.h(QRR.java:567)

    at com.objectdb.o.QRR.i(QRR.java:225)

    at com.objectdb.jpa.JpaQuery.getResultList(JpaQuery.java:678)

    ... 79 more


#4

The stack trace appears to be related to a schema evolution failure. One possible cause is a type being changed from a non-entity class (for example, an enum, or a class that was missing the @Entity annotation by mistake) to a valid entity class, though this is not entirely clear.

There have been similar reports in the past, but more details are needed to identify the exact cause in this case. Have you changed your entity classes recently?

Assuming this issue is related to schema evolution, it typically occurs during development rather than in production. Is that true in your case? If so, starting with a fresh copy of the database may resolve the issue.

You should now be able to upload files if you have any additional relevant information to share.

ObjectDB Support
#5

Hi, your assumption is mostly correct. This is a snapshot of the production app, which we are upgrading. I understand the risk in changing the entities, but this is necessary for the app upgrade. 

If this is an internal limitation of Objectdb. Is there any design recommendation on how to change the entities? 

Thank you.

#6

At this time, the exact cause of the issue is unclear, even after reviewing the bug report and the log files. The schema evolution rules are described in the manual, for example, the server must be restarted after any schema change.

If possible, could you share additional details from your experience? For instance, was there a specific class whose modification consistently triggered the exception?

ObjectDB Support
#7

Hi, I have managed to resolve the problem (thanks to good old AI :)). Updated bug report attached.  ObjectDB throws a NullPointerException in com.objectdb.o.ENH.b() when resolving entity names in JPQL queries for entities with complex relationships, because the metadata model (MMM) object is null during entity name resolution.

We used fully qualified class names (e.g., hr.hydraorm.domain.entities.workforce.Driver) instead of entity names ("Driver") in JPQL queries to bypass the entity name resolution and avoid the null pointer.

I would like to hear from you about how to approach this in the future. 

Kind regards

Emil

Reply