Hi everyone. First of all, I'm sorry for my bad english...
We are having a problem in our testing server. When we execute em.createQuery, it throws a NullPointerException. Below is the full stack trace. The EntityManager is injected, and it's not null. The HQL query looks good. And in our development machines, it works without any problem...
MySQL: 5.0.45
JBoss: 5.0.1 GA
Thanks!
StacktraceCode:
java.lang.NullPointerException
at org.hibernate.hql.ast.util.ASTPrinter.appendEscapedMultibyteChars(ASTPrinter.java:267)
at org.hibernate.hql.ast.util.ASTPrinter.nodeToString(ASTPrinter.java:255)
at org.hibernate.hql.ast.util.ASTPrinter.showNode(ASTPrinter.java:239)
at org.hibernate.hql.ast.util.ASTPrinter.showAst(ASTPrinter.java:228)
at org.hibernate.hql.ast.util.ASTPrinter.showAst(ASTPrinter.java:233)
at org.hibernate.hql.ast.util.ASTPrinter.showAst(ASTPrinter.java:233)
at org.hibernate.hql.ast.util.ASTPrinter.showAst(ASTPrinter.java:98)
at org.hibernate.hql.ast.util.ASTPrinter.showAst(ASTPrinter.java:87)
at org.hibernate.hql.ast.util.ASTPrinter.showAsString(ASTPrinter.java:113)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:255)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:183)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:134)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:101)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:80)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:94)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:156)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:135)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1650)
at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:93)
at org.jboss.jpa.tx.TransactionScopedEntityManager.createQuery(TransactionScopedEntityManager.java:139)
at reportes.AuxiliarReporteOficina.obtenerCantidad(AuxiliarReporteOficina.java:109)
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.jboss.aop.joinpoint.MethodInvocation.invokeTarget(MethodInvocation.java:122)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:111)
at org.jboss.ejb3.EJBContainerInvocationWrapper.invokeNext(EJBContainerInvocationWrapper.java:69)
at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.invoke(InterceptorSequencer.java:73)
at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.aroundInvoke(InterceptorSequencer.java:59)
at sun.reflect.GeneratedMethodAccessor422.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.aop.advice.PerJoinpointAdvice.invoke(PerJoinpointAdvice.java:174)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor.fillMethod(InvocationContextInterceptor.java:72)
at org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor_z_fillMethod_1308738034.invoke(InvocationContextInterceptor_z_fillMethod_1308738034.java)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor.setup(InvocationContextInterceptor.java:88)
at org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor_z_setup_1308738034.invoke(InvocationContextInterceptor_z_setup_1308738034.java)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.ejb3.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:62)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:56)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:68)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:194)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:186)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:41)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:67)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.ejb3.session.SessionSpecContainer.invoke(SessionSpecContainer.java:219)
at org.jboss.ejb3.proxy.handler.ProxyInvocationHandlerBase.invoke(ProxyInvocationHandlerBase.java:261)
at org.jboss.ejb3.proxy.handler.session.SessionSpecProxyInvocationHandlerBase.invoke(SessionSpecProxyInvocationHandlerBase.java:101)
at $Proxy471.obtenerCantidad(Unknown Source)
HQL QueryCode:
SELECT SUM(OficinaCargoFuncion.cantCargos)
FROM LOVOficinaLetrada oficina
INNER JOIN oficina.cargosDeOficina OficinaCargo
INNER JOIN OficinaCargo.cargosDeFuncion OficinaCargoFuncion
INNER JOIN OficinaCargoFuncion.id.funcionTrabajo LOVFuncionTrabajo
INNER JOIN OficinaCargo.id.cargo LOVCargo
WHERE oficina = :oficina
AND OficinaCargo.borrado = FALSE
AND OficinaCargo.id.relevamiento.id =
(SELECT MAX(OficinaCargo_1.id.relevamiento.id)
FROM OficinaCargo OficinaCargo_1
WHERE OficinaCargo_1.id.cargo = OficinaCargo.id.cargo
AND OficinaCargo_1.id.oficina = OficinaCargo.id.oficina
)
AND OficinaCargoFuncion.borrado = FALSE
AND OficinaCargoFuncion.id.relevamiento.id =
(SELECT MAX(OficinaCargoFuncion_1.id.relevamiento.id)
FROM OficinaCargoFuncion OficinaCargoFuncion_1
WHERE OficinaCargoFuncion_1.id.funcionTrabajo = OficinaCargoFuncion.id.funcionTrabajo
AND OficinaCargoFuncion_1.id.oficinaCargo = OficinaCargoFuncion.id.oficinaCargo
)
AND LOVFuncionTrabajo = :LOVFuncionTrabajo
AND LOVCargo = :LOVCargo
GROUP BY LOVFuncionTrabajo, LOVCargo;