Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Getting NullPointerException in FullIdentityMap.getCacheKey() upon query.getResultList()(Getting NullPointerException at FullIdentityMap.getCacheKey(FullIdentityMap.java:100))
Getting NullPointerException in FullIdentityMap.getCacheKey() upon query.getResultList() [message #1770338] Thu, 10 August 2017 07:16 Go to next message
Jacob Kjome is currently offline Jacob KjomeFriend
Messages: 3
Registered: August 2017
Junior Member
I'm using EclipseLink in "WebSphere Application Server 17.0.0.2/wlp-1.0.17.cl170220170523-1818" (Liberty edition - latest currently available). I'm getting a NullPointerException at...
Caused by: java.lang.NullPointerException
	at java.util.concurrent.ConcurrentHashMap.get(Unknown Source) ~[?:1.8.0_72]
	at org.eclipse.persistence.internal.identitymaps.FullIdentityMap.getCacheKey(FullIdentityMap.java:100) ~[org.eclipse.persistence.core_2.7.0.v20170701-882318f.jar:?]
	at org.eclipse.persistence.internal.identitymaps.AbstractIdentityMap.acquireDeferredLock(AbstractIdentityMap.java:69) ~[org.eclipse.persistence.core_2.7.0.v20170701-882318f.jar:?]
	at org.eclipse.persistence.internal.identitymaps.IdentityMapManager.acquireDeferredLock(IdentityMapManager.java:146) ~[org.eclipse.persistence.core_2.7.0.v20170701-882318f.jar:?]
	at org.eclipse.persistence.internal.sessions.IdentityMapAccessor.acquireDeferredLock(IdentityMapAccessor.java:81) ~[org.eclipse.persistence.core_2.7.0.v20170701-882318f.jar:?]
	at org.eclipse.persistence.internal.sessions.AbstractSession.retrieveCacheKey(AbstractSession.java:5332) ~[org.eclipse.persistence.core_2.7.0.v20170701-882318f.jar:?]
	at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:969) ~[org.eclipse.persistence.core_2.7.0.v20170701-882318f.jar:?]
	at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildWorkingCopyCloneNormally(ObjectBuilder.java:903) ~[org.eclipse.persistence.core_2.7.0.v20170701-882318f.jar:?]
	at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObjectInUnitOfWork(ObjectBuilder.java:856) ~[org.eclipse.persistence.core_2.7.0.v20170701-882318f.jar:?]
	at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:739) ~[org.eclipse.persistence.core_2.7.0.v20170701-882318f.jar:?]
	at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:693) ~[org.eclipse.persistence.core_2.7.0.v20170701-882318f.jar:?]
	at org.eclipse.persistence.queries.ReportQueryResult.processItem(ReportQueryResult.java:218) ~[org.eclipse.persistence.core_2.7.0.v20170701-882318f.jar:?]
	at org.eclipse.persistence.queries.ReportQueryResult.buildResult(ReportQueryResult.java:110) ~[org.eclipse.persistence.core_2.7.0.v20170701-882318f.jar:?]
	at org.eclipse.persistence.queries.ReportQueryResult.<init>(ReportQueryResult.java:79) ~[org.eclipse.persistence.core_2.7.0.v20170701-882318f.jar:?]
	at org.eclipse.persistence.queries.ReportQuery.buildObject(ReportQuery.java:598) ~[org.eclipse.persistence.core_2.7.0.v20170701-882318f.jar:?]
	at org.eclipse.persistence.queries.ReportQuery.buildObjects(ReportQuery.java:649) ~[org.eclipse.persistence.core_2.7.0.v20170701-882318f.jar:?]
	at org.eclipse.persistence.queries.ReportQuery.executeDatabaseQuery(ReportQuery.java:852) ~[org.eclipse.persistence.core_2.7.0.v20170701-882318f.jar:?]
	at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:911) ~[org.eclipse.persistence.core_2.7.0.v20170701-882318f.jar:?]
	at org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:1180) ~[org.eclipse.persistence.core_2.7.0.v20170701-882318f.jar:?]
	at org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAllQuery.java:464) ~[org.eclipse.persistence.core_2.7.0.v20170701-882318f.jar:?]
	at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeInUnitOfWork(ObjectLevelReadQuery.java:1268) ~[org.eclipse.persistence.core_2.7.0.v20170701-882318f.jar:?]
	at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2979) ~[org.eclipse.persistence.core_2.7.0.v20170701-882318f.jar:?]
	at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1892) ~[org.eclipse.persistence.core_2.7.0.v20170701-882318f.jar:?]
	at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1874) ~[org.eclipse.persistence.core_2.7.0.v20170701-882318f.jar:?]
	at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1839) ~[org.eclipse.persistence.core_2.7.0.v20170701-882318f.jar:?]
	at org.eclipse.persistence.internal.jpa.QueryImpl.executeReadQuery(QueryImpl.java:260) ~[org.eclipse.persistence.jpa_2.7.0.v20170701-882318f.jar:?]
	at org.eclipse.persistence.internal.jpa.QueryImpl.getResultList(QueryImpl.java:480) ~[org.eclipse.persistence.jpa_2.7.0.v20170701-882318f.jar:?]
	at com.acme.service.nb.CaseServiceBean.getCaseList(CaseServiceBean.java:239) ~[classes/:?]


I get this same error whether using the built-in EclipseLink version using the "jpa-2.1" feature or using the "jpaContainer-2.1" version and supplying my own version of EclipseLink. For the latter, I've tried versions 2.6.4, 2.6.5RC2, and 2.7.0RC1. In all cases, I end up with an identical stacktrace (at least for the root cause).

The last thing my code does before it hands off to EclipseLink is call "query.getResultList()". The query is a named query that is written in JPQL. The one, possibly unique, thing it does is use a constructor to populate data. This works fine using the "jpa-2.0" feature, which is backed by OpenJPA. But I don't have the option of doing that in Websphere 9 Traditional, since I can't choose features there (or, at least, I'm not aware how to) and Websphere 9 Traditional is what is deployed in all our non-local environments. So, I need "jpa-2.1" with EclipseLink to work.

Below is generally what the named query looks like. I created a fairly involved constructor specifically for this query. It actually contains more parameters than I'm listing below, but I figured I'd keep the example short and sweet. I'm not sure if this is the best way to do it, but it worked fine under Websphere 8 (OpenJPA internally) and also works fine under Websphere 9 Liberty edition downgrading to the "jpa-2.0" feature (also OpenJPA internally, though newer version)...

"SELECT DISTINCT NEW com.acme.model.nb.CaseMetadata(cmd.caseId, cmd.caseOwnerId, cmd.firstName, cmd.lastName, p) FROM CaseMetadata cmd LEFT JOIN cmd.perms p WHERE cmd.lastUpdateDateTime >= :compareDate AND cmd.caseState <> com.acme.enums.CaseState.DELETED AND (cmd.caseOwnerId = :compareId OR p.id = :compareId)"


Is this query simply too complex for EclipseLink to handle? What exactly does EclipseLink not like about this query? It seems to me that the only way this NullPointerException could be generated is if FullIdentityMap was instantiated with the default constructor (where no field initialization is performed), such that the protected "cacheKeys" field is left null. since line 100 is simply...

return this.cacheKeys.get(searchKey);


In any case, this seems like a bug, but I don't understand why it would be unique to my situation? Can someone more familiar with EclipseLink confirm? I searched to see if others were having the same problem, but I have yet to find any similar reports.

Below is the full stacktrace. Interestingly, Websphere 9 Liberty edition includes the jar file from which a given class in the stack trace was loaded. So, as you'll see, this particular stack trace was generated while using EclipseLink 2.7.0RC1....

javax.ejb.EJBTransactionRolledbackException: nested exception is: javax.ejb.EJBException: See nested exception; nested exception is: javax.persistence.PersistenceException: java.lang.NullPointerException
	at com.ibm.ejs.container.BusinessExceptionMappingStrategy.mapCSIException(BusinessExceptionMappingStrategy.java:124) ~[com.ibm.ws.ejbcontainer_1.0.17.jar:?]
	at com.ibm.ejs.container.BusinessExceptionMappingStrategy.mapCSITransactionRolledBackException(BusinessExceptionMappingStrategy.java:584) ~[com.ibm.ws.ejbcontainer_1.0.17.jar:?]
	at com.ibm.ejs.container.EJSDeployedSupport.mapCSITransactionRolledBackException(EJSDeployedSupport.java:600) ~[com.ibm.ws.ejbcontainer_1.0.17.jar:?]
	at com.ibm.ejs.container.EJSContainer.postInvokeRolledbackException(EJSContainer.java:4378) ~[com.ibm.ws.ejbcontainer_1.0.17.jar:?]
	at com.ibm.ejs.container.EJSContainer.postInvoke(EJSContainer.java:4069) ~[com.ibm.ws.ejbcontainer_1.0.17.jar:?]
	at com.acme.service.nb.EJSLocal0SLCaseServiceBean_90a94ac6.getCaseList(EJSLocal0SLCaseServiceBean_90a94ac6.java) ~[?:?]
	at com.acme.api.CaseFacade.getCaseList(CaseFacade.java:159) [classes/:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_72]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_72]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_72]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_72]
	at com.ibm.ejs.container.EJSContainer.invokeProceed(EJSContainer.java:5317) [com.ibm.ws.ejbcontainer_1.0.17.jar:?]
	at com.ibm.ejs.container.interceptors.InvocationContextImpl.proceed(InvocationContextImpl.java:652) [com.ibm.ws.ejbcontainer_1.0.17.jar:?]
	at com.acme.api.AbstractJAXRSFacade.setUpRequestContext(AbstractJAXRSFacade.java:499) [classes/:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_72]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_72]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_72]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_72]
	at com.ibm.ejs.container.interceptors.InterceptorProxy.invokeInterceptor(InterceptorProxy.java:201) [com.ibm.ws.ejbcontainer_1.0.17.jar:?]
	at com.ibm.ejs.container.interceptors.InvocationContextImpl.proceed(InvocationContextImpl.java:632) [com.ibm.ws.ejbcontainer_1.0.17.jar:?]
	at com.ibm.ws.cdi.ejb.impl.InterceptorChain.proceed(InterceptorChain.java:120) [com.ibm.ws.cdi.1.2.ejb_1.0.17.jar:?]
	at com.ibm.ws.cdi.ejb.impl.EJBCDIInterceptorWrapper.invokeInterceptors(EJBCDIInterceptorWrapper.java:140) [com.ibm.ws.cdi.1.2.ejb_1.0.17.jar:?]
	at com.ibm.ws.cdi.ejb.impl.EJBCDIInterceptorWrapper.aroundInvoke(EJBCDIInterceptorWrapper.java:56) [com.ibm.ws.cdi.1.2.ejb_1.0.17.jar:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_72]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_72]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_72]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_72]
	at com.ibm.ejs.container.interceptors.InterceptorProxy.invokeInterceptor(InterceptorProxy.java:201) [com.ibm.ws.ejbcontainer_1.0.17.jar:?]
	at com.ibm.ejs.container.interceptors.InvocationContextImpl.proceed(InvocationContextImpl.java:632) [com.ibm.ws.ejbcontainer_1.0.17.jar:?]
	at org.jboss.weld.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:64) [com.ibm.ws.org.jboss.weld.2.4.3_1.0.17.jar:2.4.3.Final]
	at com.ibm.ws.cdi.ejb.impl.WeldSessionBeanInterceptorWrapper.aroundInvoke(WeldSessionBeanInterceptorWrapper.java:58) [com.ibm.ws.cdi.1.2.ejb_1.0.17.jar:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_72]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_72]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_72]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_72]
	at com.ibm.ejs.container.interceptors.InterceptorProxy.invokeInterceptor(InterceptorProxy.java:201) [com.ibm.ws.ejbcontainer_1.0.17.jar:?]
	at com.ibm.ejs.container.interceptors.InvocationContextImpl.proceed(InvocationContextImpl.java:632) [com.ibm.ws.ejbcontainer_1.0.17.jar:?]
	at com.ibm.ejs.container.interceptors.InvocationContextImpl.doAroundInterceptor(InvocationContextImpl.java:306) [com.ibm.ws.ejbcontainer_1.0.17.jar:?]
	at com.ibm.ejs.container.interceptors.InvocationContextImpl.doAroundInvoke(InvocationContextImpl.java:273) [com.ibm.ws.ejbcontainer_1.0.17.jar:?]
	at com.ibm.ejs.container.EJSContainer.invoke(EJSContainer.java:5209) [com.ibm.ws.ejbcontainer_1.0.17.jar:?]
	at com.acme.api.EJSLocalNSLCaseFacade_783aeb54.getCaseList(EJSLocalNSLCaseFacade_783aeb54.java) [?:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_72]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_72]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_72]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_72]
	at com.ibm.ws.jaxrs20.ejb.JaxRsFactoryBeanEJBCustomizer.serviceInvoke(JaxRsFactoryBeanEJBCustomizer.java:345) [com.ibm.ws.jaxrs.2.0.ejb_1.0.17.jar:?]
	at com.ibm.ws.jaxrs20.server.LibertyJaxRsServerFactoryBean.performInvocation(LibertyJaxRsServerFactoryBean.java:617) [com.ibm.ws.jaxrs.2.0.server_1.0.17.jar:?]
	at com.ibm.ws.jaxrs20.server.LibertyJaxRsInvoker.performInvocation(LibertyJaxRsInvoker.java:118) [com.ibm.ws.jaxrs.2.0.server_1.0.17.jar:?]
	at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96) [cxf-core-3.1.11.jar:3.1.11]
	at com.ibm.ws.jaxrs20.server.LibertyJaxRsInvoker.invoke(LibertyJaxRsInvoker.java:252) [com.ibm.ws.jaxrs.2.0.server_1.0.17.jar:?]
	at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:189) [cxf-rt-frontend-jaxrs-3.1.11.jar:3.1.11]
	at com.ibm.ws.jaxrs20.server.LibertyJaxRsInvoker.invoke(LibertyJaxRsInvoker.java:423) [com.ibm.ws.jaxrs.2.0.server_1.0.17.jar:?]
	at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:99) [cxf-rt-frontend-jaxrs-3.1.11.jar:3.1.11]
	at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:61) [com.ibm.ws.jaxrs.2.0.common_1.0.17.jar:3.1.11]
	at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:99) [com.ibm.ws.jaxrs.2.0.common_1.0.17.jar:3.1.11]
	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) [cxf-core-3.1.11.jar:3.1.11]
	at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:124) [com.ibm.ws.jaxrs.2.0.common_1.0.17.jar:3.1.11]
	at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:274) [com.ibm.ws.jaxrs.2.0.common_1.0.17.jar:3.1.11]
	at com.ibm.ws.jaxrs20.endpoint.AbstractJaxRsWebEndpoint.invoke(AbstractJaxRsWebEndpoint.java:134) [com.ibm.ws.jaxrs.2.0.common_1.0.17.jar:?]
	at com.ibm.websphere.jaxrs.server.IBMRestServlet.handleRequest(IBMRestServlet.java:149) [com.ibm.ws.jaxrs.2.0.server_1.0.17.jar:?]
	at com.ibm.websphere.jaxrs.server.IBMRestServlet.doGet(IBMRestServlet.java:115) [com.ibm.ws.jaxrs.2.0.server_1.0.17.jar:?]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) [com.ibm.websphere.javaee.servlet.3.1_1.0.17.jar:?]
	at com.ibm.websphere.jaxrs.server.IBMRestServlet.service(IBMRestServlet.java:99) [com.ibm.ws.jaxrs.2.0.server_1.0.17.jar:?]
	at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1290) [com.ibm.ws.webcontainer_1.1.17.jar:?]
	at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:778) [com.ibm.ws.webcontainer_1.1.17.jar:?]
	at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:475) [com.ibm.ws.webcontainer_1.1.17.jar:?]
	at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:152) [com.ibm.ws.webcontainer_1.1.17.jar:?]
	at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:94) [com.ibm.ws.webcontainer_1.1.17.jar:?]
	at org.apache.logging.log4j.web.Log4jServletFilter.doFilter(Log4jServletFilter.java:71) [log4j-web-2.8.2.jar:2.8.2]
	at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:207) [com.ibm.ws.webcontainer_1.1.17.jar:?]
	at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91) [com.ibm.ws.webcontainer_1.1.17.jar:?]
	at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:1021) [com.ibm.ws.webcontainer_1.1.17.jar:?]
	at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1143) [com.ibm.ws.webcontainer_1.1.17.jar:?]
	at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:4983) [com.ibm.ws.webcontainer_1.1.17.jar:?]
	at com.ibm.ws.webcontainer31.osgi.webapp.WebApp31.handleRequest(WebApp31.java:528) [com.ibm.ws.webcontainer.servlet.3.1_1.0.17.jar:?]
	at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.handleRequest(DynamicVirtualHost.java:315) [com.ibm.ws.webcontainer_1.1.17.jar:?]
	at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1025) [com.ibm.ws.webcontainer_1.1.17.jar:?]
	at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.run(DynamicVirtualHost.java:280) [com.ibm.ws.webcontainer_1.1.17.jar:?]
	at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink$TaskWrapper.run(HttpDispatcherLink.java:967) [com.ibm.ws.transport.http_1.0.17.jar:?]
	at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink.wrapHandlerAndExecute(HttpDispatcherLink.java:359) [com.ibm.ws.transport.http_1.0.17.jar:?]
	at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink.ready(HttpDispatcherLink.java:318) [com.ibm.ws.transport.http_1.0.17.jar:?]
	at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:471) [com.ibm.ws.transport.http_1.0.17.jar:?]
	at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleNewRequest(HttpInboundLink.java:405) [com.ibm.ws.transport.http_1.0.17.jar:?]
	at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.processRequest(HttpInboundLink.java:285) [com.ibm.ws.transport.http_1.0.17.jar:?]
	at com.ibm.ws.http.channel.internal.inbound.HttpICLReadCallback.complete(HttpICLReadCallback.java:66) [com.ibm.ws.transport.http_1.0.17.jar:?]
	at com.ibm.ws.tcpchannel.internal.WorkQueueManager.requestComplete(WorkQueueManager.java:504) [com.ibm.ws.channelfw_1.0.17.jar:?]
	at com.ibm.ws.tcpchannel.internal.WorkQueueManager.attemptIO(WorkQueueManager.java:574) [com.ibm.ws.channelfw_1.0.17.jar:?]
	at com.ibm.ws.tcpchannel.internal.WorkQueueManager.workerRun(WorkQueueManager.java:929) [com.ibm.ws.channelfw_1.0.17.jar:?]
	at com.ibm.ws.tcpchannel.internal.WorkQueueManager$Worker.run(WorkQueueManager.java:1018) [com.ibm.ws.channelfw_1.0.17.jar:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:1.8.0_72]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:1.8.0_72]
	at java.lang.Thread.run(Unknown Source) [?:1.8.0_72]
Caused by: javax.ejb.EJBException: See nested exception; nested exception is: javax.persistence.PersistenceException: java.lang.NullPointerException
	at com.ibm.ejs.container.util.ExceptionUtil.EJBException(ExceptionUtil.java:461) ~[com.ibm.ws.ejbcontainer_1.0.17.jar:?]
	at com.ibm.ejs.container.util.ExceptionUtil.EJBException(ExceptionUtil.java:337) ~[com.ibm.ws.ejbcontainer_1.0.17.jar:?]
	at com.ibm.ejs.container.BusinessExceptionMappingStrategy.mapException(BusinessExceptionMappingStrategy.java:348) ~[com.ibm.ws.ejbcontainer_1.0.17.jar:?]
	at com.ibm.ejs.container.BusinessExceptionMappingStrategy.setUncheckedException(BusinessExceptionMappingStrategy.java:520) ~[com.ibm.ws.ejbcontainer_1.0.17.jar:?]
	at com.ibm.ejs.container.EJSDeployedSupport.setUncheckedLocalException(EJSDeployedSupport.java:468) ~[com.ibm.ws.ejbcontainer_1.0.17.jar:?]
	... 87 more
Caused by: javax.persistence.PersistenceException: java.lang.NullPointerException
	at org.eclipse.persistence.internal.jpa.QueryImpl.getResultList(QueryImpl.java:491) ~[org.eclipse.persistence.jpa_2.7.0.v20170701-882318f.jar:?]
	at com.acme.service.nb.CaseServiceBean.getCaseList(CaseServiceBean.java:239) ~[classes/:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_72]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_72]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_72]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_72]
	at com.ibm.ejs.container.EJSContainer.invokeProceed(EJSContainer.java:5317) ~[com.ibm.ws.ejbcontainer_1.0.17.jar:?]
	at com.ibm.ejs.container.interceptors.InvocationContextImpl.proceed(InvocationContextImpl.java:652) ~[com.ibm.ws.ejbcontainer_1.0.17.jar:?]
	at com.ibm.ws.cdi.ejb.impl.InterceptorChain.proceed(InterceptorChain.java:120) ~[?:?]
	at com.ibm.ws.cdi.ejb.impl.EJBCDIInterceptorWrapper.invokeInterceptors(EJBCDIInterceptorWrapper.java:140) ~[?:?]
	at com.ibm.ws.cdi.ejb.impl.EJBCDIInterceptorWrapper.aroundInvoke(EJBCDIInterceptorWrapper.java:56) ~[?:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_72]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_72]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_72]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_72]
	at com.ibm.ejs.container.interceptors.InterceptorProxy.invokeInterceptor(InterceptorProxy.java:201) ~[com.ibm.ws.ejbcontainer_1.0.17.jar:?]
	at com.ibm.ejs.container.interceptors.InvocationContextImpl.proceed(InvocationContextImpl.java:632) ~[com.ibm.ws.ejbcontainer_1.0.17.jar:?]
	at org.jboss.weld.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:64) ~[?:?]
	at com.ibm.ws.cdi.ejb.impl.WeldSessionBeanInterceptorWrapper.aroundInvoke(WeldSessionBeanInterceptorWrapper.java:58) ~[?:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_72]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_72]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_72]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_72]
	at com.ibm.ejs.container.interceptors.InterceptorProxy.invokeInterceptor(InterceptorProxy.java:201) ~[com.ibm.ws.ejbcontainer_1.0.17.jar:?]
	at com.ibm.ejs.container.interceptors.InvocationContextImpl.proceed(InvocationContextImpl.java:632) ~[com.ibm.ws.ejbcontainer_1.0.17.jar:?]
	at com.ibm.ejs.container.interceptors.InvocationContextImpl.doAroundInterceptor(InvocationContextImpl.java:306) ~[com.ibm.ws.ejbcontainer_1.0.17.jar:?]
	at com.ibm.ejs.container.interceptors.InvocationContextImpl.doAroundInvoke(InvocationContextImpl.java:273) ~[com.ibm.ws.ejbcontainer_1.0.17.jar:?]
	at com.ibm.ejs.container.EJSContainer.invoke(EJSContainer.java:5209) ~[com.ibm.ws.ejbcontainer_1.0.17.jar:?]
	... 87 more
Caused by: java.lang.NullPointerException
	at java.util.concurrent.ConcurrentHashMap.get(Unknown Source) ~[?:1.8.0_72]
	at org.eclipse.persistence.internal.identitymaps.FullIdentityMap.getCacheKey(FullIdentityMap.java:100) ~[org.eclipse.persistence.core_2.7.0.v20170701-882318f.jar:?]
	at org.eclipse.persistence.internal.identitymaps.AbstractIdentityMap.acquireDeferredLock(AbstractIdentityMap.java:69) ~[org.eclipse.persistence.core_2.7.0.v20170701-882318f.jar:?]
	at org.eclipse.persistence.internal.identitymaps.IdentityMapManager.acquireDeferredLock(IdentityMapManager.java:146) ~[org.eclipse.persistence.core_2.7.0.v20170701-882318f.jar:?]
	at org.eclipse.persistence.internal.sessions.IdentityMapAccessor.acquireDeferredLock(IdentityMapAccessor.java:81) ~[org.eclipse.persistence.core_2.7.0.v20170701-882318f.jar:?]
	at org.eclipse.persistence.internal.sessions.AbstractSession.retrieveCacheKey(AbstractSession.java:5332) ~[org.eclipse.persistence.core_2.7.0.v20170701-882318f.jar:?]
	at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:969) ~[org.eclipse.persistence.core_2.7.0.v20170701-882318f.jar:?]
	at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildWorkingCopyCloneNormally(ObjectBuilder.java:903) ~[org.eclipse.persistence.core_2.7.0.v20170701-882318f.jar:?]
	at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObjectInUnitOfWork(ObjectBuilder.java:856) ~[org.eclipse.persistence.core_2.7.0.v20170701-882318f.jar:?]
	at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:739) ~[org.eclipse.persistence.core_2.7.0.v20170701-882318f.jar:?]
	at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:693) ~[org.eclipse.persistence.core_2.7.0.v20170701-882318f.jar:?]
	at org.eclipse.persistence.queries.ReportQueryResult.processItem(ReportQueryResult.java:218) ~[org.eclipse.persistence.core_2.7.0.v20170701-882318f.jar:?]
	at org.eclipse.persistence.queries.ReportQueryResult.buildResult(ReportQueryResult.java:110) ~[org.eclipse.persistence.core_2.7.0.v20170701-882318f.jar:?]
	at org.eclipse.persistence.queries.ReportQueryResult.<init>(ReportQueryResult.java:79) ~[org.eclipse.persistence.core_2.7.0.v20170701-882318f.jar:?]
	at org.eclipse.persistence.queries.ReportQuery.buildObject(ReportQuery.java:598) ~[org.eclipse.persistence.core_2.7.0.v20170701-882318f.jar:?]
	at org.eclipse.persistence.queries.ReportQuery.buildObjects(ReportQuery.java:649) ~[org.eclipse.persistence.core_2.7.0.v20170701-882318f.jar:?]
	at org.eclipse.persistence.queries.ReportQuery.executeDatabaseQuery(ReportQuery.java:852) ~[org.eclipse.persistence.core_2.7.0.v20170701-882318f.jar:?]
	at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:911) ~[org.eclipse.persistence.core_2.7.0.v20170701-882318f.jar:?]
	at org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:1180) ~[org.eclipse.persistence.core_2.7.0.v20170701-882318f.jar:?]
	at org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAllQuery.java:464) ~[org.eclipse.persistence.core_2.7.0.v20170701-882318f.jar:?]
	at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeInUnitOfWork(ObjectLevelReadQuery.java:1268) ~[org.eclipse.persistence.core_2.7.0.v20170701-882318f.jar:?]
	at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2979) ~[org.eclipse.persistence.core_2.7.0.v20170701-882318f.jar:?]
	at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1892) ~[org.eclipse.persistence.core_2.7.0.v20170701-882318f.jar:?]
	at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1874) ~[org.eclipse.persistence.core_2.7.0.v20170701-882318f.jar:?]
	at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1839) ~[org.eclipse.persistence.core_2.7.0.v20170701-882318f.jar:?]
	at org.eclipse.persistence.internal.jpa.QueryImpl.executeReadQuery(QueryImpl.java:260) ~[org.eclipse.persistence.jpa_2.7.0.v20170701-882318f.jar:?]
	at org.eclipse.persistence.internal.jpa.QueryImpl.getResultList(QueryImpl.java:480) ~[org.eclipse.persistence.jpa_2.7.0.v20170701-882318f.jar:?]
	at com.acme.service.nb.CaseServiceBean.getCaseList(CaseServiceBean.java:239) ~[classes/:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_72]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_72]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_72]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_72]
	at com.ibm.ejs.container.EJSContainer.invokeProceed(EJSContainer.java:5317) ~[com.ibm.ws.ejbcontainer_1.0.17.jar:?]
	at com.ibm.ejs.container.interceptors.InvocationContextImpl.proceed(InvocationContextImpl.java:652) ~[com.ibm.ws.ejbcontainer_1.0.17.jar:?]
	at com.ibm.ws.cdi.ejb.impl.InterceptorChain.proceed(InterceptorChain.java:120) ~[?:?]
	at com.ibm.ws.cdi.ejb.impl.EJBCDIInterceptorWrapper.invokeInterceptors(EJBCDIInterceptorWrapper.java:140) ~[?:?]
	at com.ibm.ws.cdi.ejb.impl.EJBCDIInterceptorWrapper.aroundInvoke(EJBCDIInterceptorWrapper.java:56) ~[?:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_72]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_72]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_72]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_72]
	at com.ibm.ejs.container.interceptors.InterceptorProxy.invokeInterceptor(InterceptorProxy.java:201) ~[com.ibm.ws.ejbcontainer_1.0.17.jar:?]
	at com.ibm.ejs.container.interceptors.InvocationContextImpl.proceed(InvocationContextImpl.java:632) ~[com.ibm.ws.ejbcontainer_1.0.17.jar:?]
	at org.jboss.weld.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:64) ~[?:?]
	at com.ibm.ws.cdi.ejb.impl.WeldSessionBeanInterceptorWrapper.aroundInvoke(WeldSessionBeanInterceptorWrapper.java:58) ~[?:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_72]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_72]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_72]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_72]
	at com.ibm.ejs.container.interceptors.InterceptorProxy.invokeInterceptor(InterceptorProxy.java:201) ~[com.ibm.ws.ejbcontainer_1.0.17.jar:?]
	at com.ibm.ejs.container.interceptors.InvocationContextImpl.proceed(InvocationContextImpl.java:632) ~[com.ibm.ws.ejbcontainer_1.0.17.jar:?]
	at com.ibm.ejs.container.interceptors.InvocationContextImpl.doAroundInterceptor(InvocationContextImpl.java:306) ~[com.ibm.ws.ejbcontainer_1.0.17.jar:?]
	at com.ibm.ejs.container.interceptors.InvocationContextImpl.doAroundInvoke(InvocationContextImpl.java:273) ~[com.ibm.ws.ejbcontainer_1.0.17.jar:?]
	at com.ibm.ejs.container.EJSContainer.invoke(EJSContainer.java:5209) ~[com.ibm.ws.ejbcontainer_1.0.17.jar:?]
	... 87 more
Re: Getting NullPointerException in FullIdentityMap.getCacheKey() upon query.getResultList() [message #1770588 is a reply to message #1770338] Mon, 14 August 2017 16:39 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1275
Registered: July 2009
Senior Member
Try using an inner join over "cmd.perms p" to see if the issue is with null rows in that table.
Re: Getting NullPointerException in FullIdentityMap.getCacheKey() upon query.getResultList() [message #1770610 is a reply to message #1770588] Tue, 15 August 2017 06:03 Go to previous messageGo to next message
Jacob Kjome is currently offline Jacob KjomeFriend
Messages: 3
Registered: August 2017
Junior Member
Thank you for your response, Chris. However, the problem is that it is very much expected that the join to "cmd.perms p" will contain null rows. Were I to do an INNER join, rather than a LEFT join, I would exclude results that don't have associated permissions (or is it the other way around? - in any case, some results get excluded if I do INNER instead of LEFT join). Note the portion of the query that says...

 AND (cmd.caseOwnerId = :compareId OR p.id = :compareId)


A case always has a case owner, but it won't have any extra permissions unless some other user has explicitly been given read or write permissions to the case.

I've actually worked around this issue in two different ways...


  1. I added, in total, 3 strategic null checks in org.eclipse.persistence.internal.identitymaps.FullIdentityMap.java and org.eclipse.persistence.internal.descriptors.InstanceVariableAttributeAccessor.java and I was able to get my JPQL to work without error, providing exactly the results I expected. See below for the diff patches and see the fixed files attached. I hope someone can apply this to EclipseLink so that IBM can pick it up to use it in a future version of WAS9 (Standard and Liberty). But, for now, I have to go with #2 due to not being able to modify the EclipseLink version run in WAS9 Standard.
  2. I used the native query that was generated by OpenJPA under WAS8 (I had OpenJPA logging on so that I could capture the query). This works perfectly as well, and is what I will run with until EclipseLink is fixed to allow for the JPQL query to run without bombing. See the native query below.


Here are the diff patches...

--- C:\Dev\FullIdentityMap-Orig.java
+++ C:\Dev\FullIdentityMap.java
@@ -97,7 +97,7 @@
      */
     @Override
     public CacheKey getCacheKey(Object searchKey, boolean forMerge) {
-        return this.cacheKeys.get(searchKey);
+        return searchKey == null ? null : this.cacheKeys.get(searchKey);
     }
 
     /**
@@ -108,7 +108,7 @@
     @Override
     protected CacheKey putCacheKeyIfAbsent(CacheKey searchKey) {
         searchKey.setOwningMap(this);
-        return (CacheKey)((ConcurrentMap)this.cacheKeys).putIfAbsent(searchKey.getKey(), searchKey);
+        return searchKey.getKey() == null ? null : (CacheKey)((ConcurrentMap)this.cacheKeys).putIfAbsent(searchKey.getKey(), searchKey);
     }
 
     /**


--- C:\Dev\InstanceVariableAttributeAccessor-Orig.java
+++ C:\Dev\InstanceVariableAttributeAccessor.java
@@ -68,6 +68,7 @@
      */
     @Override
     public Object getAttributeValueFromObject(Object anObject) throws DescriptorException {
+        if (!this.isInitialized()) return null;
         try {
             // PERF: Direct variable access.
             if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()){


Here is the native query that works the way the JPQL query ought to...

SELECT DISTINCT t0.CASEID, t0.CASEOWNERID, t0.FIRSTNAME, t0.LASTNAME, t1.ACCESSLEVEL_CD, t1.ID
FROM CASE_METADATA t0, CASE_PERMISSIONS t1
WHERE (t0.LASTUPDATETIME >= ?compareDate
        AND t0.STATUS_CD <> 'DELETED'
        AND (t0.CASEOWNERID = ?compareId OR t1.ID = ?compareId)
  ) AND t0.CASEID = t1.CASEID(+)

Re: Getting NullPointerException in FullIdentityMap.getCacheKey() upon query.getResultList() [message #1770649 is a reply to message #1770610] Tue, 15 August 2017 14:43 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1275
Registered: July 2009
Senior Member
My comment was to verify and isolate the cause to the relationship, to help in filing a bug. Please file a bug at https://bugs.eclipse.org/bugs/
Re: Getting NullPointerException in FullIdentityMap.getCacheKey() upon query.getResultList() [message #1770860 is a reply to message #1770649] Fri, 18 August 2017 02:55 Go to previous message
Jacob Kjome is currently offline Jacob KjomeFriend
Messages: 3
Registered: August 2017
Junior Member
See bug 521090

https://bugs.eclipse.org/bugs/show_bug.cgi?id=521090
Previous Topic:Cannot remove an entity with @ManyToOne association without fetching its contents
Next Topic:Eclipselink reverts merged entities
Goto Forum:
  


Current Time: Fri Dec 15 00:33:33 GMT 2017

Powered by FUDForum. Page generated in 0.02216 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software