[GLASSFISH-19316] Eclipselink 2.5 fails to parse JPQL query involving embedded maps Created: 10/Nov/12  Updated: 20/Dec/16  Resolved: 15/Jan/13

Status: Resolved
Project: glassfish
Component/s: entity-persistence
Affects Version/s: 4.0_dev
Fix Version/s: 4.0_dev

Type: Bug Priority: Critical
Reporter: pdudits Assignee: Mitesh Meswani
Resolution: Fixed Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Nightly build glassfish-4.0-b63-11_09_2012


Attachments: Java Archive File jpql-map-1.0-SNAPSHOT.jar     Zip Archive jpql-map.zip    

 Description   

Deployment of entity with named query that accesses @ElementCollection Map fails with NullPointerException originating in EclipseLink query parser code. I will also report this to Eclipselink, but from Glassfish point of view this is breaking compatibility with JPA 2.0, as attached code works with 3.1.2.

Code for reproducing bug is attached.

[#|2012-11-10T15:15:15.928+0100|SEVERE|44.0|javax.enterprise.system.tools.admin.org.glassfish.deployment.admin|_ThreadID=56;_ThreadName=admin-listener(1);_TimeMillis=1352556915928;_LevelValue=1000;|Exception while preparing the app : Exception [EclipseLink-28019] (Eclipse Persistence Services - 2.5.0.v20121016-ab08992): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Deployment of PersistenceUnit [testpu] failed. Close all factories for this PersistenceUnit.
Internal Exception: Exception [EclipseLink-0] (Eclipse Persistence Services - 2.5.0.v20121016-ab08992): org.eclipse.persistence.exceptions.JPQLException
Exception Description: Internal problem encountered while compiling [select c from Charger c join c.locationAttributes cc where key(cc) = :attrKey and value(cc) = :attrValue].
Internal Exception: java.lang.NullPointerException
Local Exception Stack: 
Exception [EclipseLink-28019] (Eclipse Persistence Services - 2.5.0.v20121016-ab08992): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Deployment of PersistenceUnit [testpu] failed. Close all factories for this PersistenceUnit.
Internal Exception: Exception [EclipseLink-0] (Eclipse Persistence Services - 2.5.0.v20121016-ab08992): org.eclipse.persistence.exceptions.JPQLException
Exception Description: Internal problem encountered while compiling [select c from Charger c join c.locationAttributes cc where key(cc) = :attrKey and value(cc) = :attrValue].
Internal Exception: java.lang.NullPointerException
	at org.eclipse.persistence.exceptions.EntityManagerSetupException.deployFailed(EntityManagerSetupException.java:229)
	at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.createDeployFailedPersistenceException(EntityManagerSetupImpl.java:713)
	at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:653)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getAbstractSession(EntityManagerFactoryDelegate.java:197)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.createEntityManagerImpl(EntityManagerFactoryDelegate.java:289)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:305)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:283)
	at org.glassfish.persistence.jpa.PersistenceUnitLoader.loadPU(PersistenceUnitLoader.java:211)
	at org.glassfish.persistence.jpa.PersistenceUnitLoader.<init>(PersistenceUnitLoader.java:120)
	at org.glassfish.persistence.jpa.JPADeployer$1.visitPUD(JPADeployer.java:221)
	at org.glassfish.persistence.jpa.JPADeployer$PersistenceUnitDescriptorIterator.iteratePUDs(JPADeployer.java:492)
	at org.glassfish.persistence.jpa.JPADeployer.createEMFs(JPADeployer.java:230)
	at org.glassfish.persistence.jpa.JPADeployer.prepare(JPADeployer.java:165)
	at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:932)
	at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:441)
	at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:229)
	at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:489)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:539)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:535)
	at java.security.AccessController.doPrivileged(Native Method)
	at javax.security.auth.Subject.doAs(Subject.java:356)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:534)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:565)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1448)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1500(CommandRunnerImpl.java:119)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1758)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1708)
	at org.glassfish.admin.rest.resources.admin.CommandResource.executeCommand(CommandResource.java:487)
	at org.glassfish.admin.rest.resources.admin.CommandResource.execCommandSimpInMultOut(CommandResource.java:255)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:601)
	at org.glassfish.jersey.server.model.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:80)
	at org.glassfish.jersey.server.model.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:107)
	at org.glassfish.jersey.server.model.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:146)
	at org.glassfish.jersey.server.model.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:80)
	at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:354)
	at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:349)
	at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:97)
	at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:204)
	at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:316)
	at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:180)
	at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:796)
	at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:306)
	at org.glassfish.admin.rest.adapter.RestAdapter$1.service(RestAdapter.java:327)
	at org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:189)
	at com.sun.enterprise.v3.server.HK2Dispatcher.dispatch(HK2Dispatcher.java:113)
	at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:236)
	at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:164)
	at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:175)
	at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:265)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:200)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:134)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
	at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
	at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:781)
	at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:578)
	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:558)
	at java.lang.Thread.run(Thread.java:722)
Caused by: Exception [EclipseLink-0] (Eclipse Persistence Services - 2.5.0.v20121016-ab08992): org.eclipse.persistence.exceptions.JPQLException
Exception Description: Internal problem encountered while compiling [select c from Charger c join c.locationAttributes cc where key(cc) = :attrKey and value(cc) = :attrValue].
Internal Exception: java.lang.NullPointerException
	at org.eclipse.persistence.internal.jpa.jpql.HermesParser.buildUnexpectedException(HermesParser.java:201)
	at org.eclipse.persistence.internal.jpa.jpql.HermesParser.populateQueryImp(HermesParser.java:290)
	at org.eclipse.persistence.internal.jpa.jpql.HermesParser.buildQuery(HermesParser.java:157)
	at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:138)
	at org.eclipse.persistence.internal.jpa.JPAQuery.processJPQLQuery(JPAQuery.java:200)
	at org.eclipse.persistence.internal.jpa.JPAQuery.prepare(JPAQuery.java:163)
	at org.eclipse.persistence.queries.DatabaseQuery.checkPrepare(DatabaseQuery.java:616)
	at org.eclipse.persistence.queries.DatabaseQuery.checkPrepare(DatabaseQuery.java:577)
	at org.eclipse.persistence.internal.sessions.AbstractSession.processJPAQueries(AbstractSession.java:2320)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:470)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.postConnectDatasource(DatabaseSessionImpl.java:707)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:652)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:215)
	at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:599)
	... 62 more
Caused by: java.lang.NullPointerException
	at org.eclipse.persistence.internal.jpa.jpql.TypeResolver.visit(TypeResolver.java:1435)
	at org.eclipse.persistence.jpa.jpql.parser.ValueExpression.accept(ValueExpression.java:42)
	at org.eclipse.persistence.internal.jpa.jpql.TypeResolver.resolve(TypeResolver.java:399)
	at org.eclipse.persistence.internal.jpa.jpql.JPQLQueryContext.getType(JPQLQueryContext.java:799)
	at org.eclipse.persistence.internal.jpa.jpql.ParameterTypeVisitor.getType(ParameterType.java:165)
	at org.eclipse.persistence.internal.jpa.jpql.JPQLQueryContext.getParameterType(JPQLQueryContext.java:743)
	at org.eclipse.persistence.internal.jpa.jpql.ExpressionBuilderVisitor.visit(ExpressionBuilderVisitor.java:1270)
	at org.eclipse.persistence.jpa.jpql.parser.InputParameter.accept(InputParameter.java:44)
	at org.eclipse.persistence.internal.jpa.jpql.ExpressionBuilderVisitor.visit(ExpressionBuilderVisitor.java:732)
	at org.eclipse.persistence.jpa.jpql.parser.ComparisonExpression.accept(ComparisonExpression.java:71)
	at org.eclipse.persistence.internal.jpa.jpql.ExpressionBuilderVisitor.visit(ExpressionBuilderVisitor.java:485)
	at org.eclipse.persistence.jpa.jpql.parser.AndExpression.accept(AndExpression.java:61)
	at org.eclipse.persistence.internal.jpa.jpql.ExpressionBuilderVisitor.visit(ExpressionBuilderVisitor.java:2106)
	at org.eclipse.persistence.jpa.jpql.parser.WhereClause.accept(WhereClause.java:59)
	at org.eclipse.persistence.internal.jpa.jpql.ExpressionBuilderVisitor.buildExpression(ExpressionBuilderVisitor.java:269)
	at org.eclipse.persistence.internal.jpa.jpql.JPQLQueryContext.buildExpression(JPQLQueryContext.java:326)
	at org.eclipse.persistence.internal.jpa.jpql.AbstractObjectLevelReadQueryVisitor.visit(AbstractObjectLevelReadQueryVisitor.java:278)
	at org.eclipse.persistence.jpa.jpql.parser.WhereClause.accept(WhereClause.java:59)
	at org.eclipse.persistence.internal.jpa.jpql.AbstractObjectLevelReadQueryVisitor.visitAbstractSelectStatement(AbstractObjectLevelReadQueryVisitor.java:344)
	at org.eclipse.persistence.internal.jpa.jpql.AbstractObjectLevelReadQueryVisitor.visit(AbstractObjectLevelReadQueryVisitor.java:197)
	at org.eclipse.persistence.jpa.jpql.parser.SelectStatement.accept(SelectStatement.java:115)
	at org.eclipse.persistence.internal.jpa.jpql.HermesParser$DatabaseQueryVisitor.visit(HermesParser.java:433)
	at org.eclipse.persistence.jpa.jpql.parser.SelectStatement.accept(SelectStatement.java:115)
	at org.eclipse.persistence.internal.jpa.jpql.HermesParser$DatabaseQueryVisitor.visit(HermesParser.java:413)
	at org.eclipse.persistence.jpa.jpql.parser.JPQLExpression.accept(JPQLExpression.java:136)
	at org.eclipse.persistence.internal.jpa.jpql.HermesParser.populateQueryImp(HermesParser.java:276)
	... 74 more



 Comments   
Comment by pdudits [ 10/Nov/12 ]

Eclipselink Bugzilla issue 394033

Comment by Hong Zhang [ 12/Nov/12 ]

assign to mitesh for evaluation

Comment by pdudits [ 20/Nov/12 ]

Issue has been fixed upstream today, so upgrade of eclipselink will likely resolve it.

Comment by Mitesh Meswani [ 15/Jan/13 ]

Marking as fixed with new EclipseLink integration

Comment by pdudits [ 03/May/13 ]

The bug is still present in b87. Will create another issue for that.

Generated at Thu Jan 19 00:40:26 UTC 2017 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.