3 Replies Latest reply on Jan 21, 2010 8:21 AM by Ronald van Kuijk

    org.hibernate.MappingException: Named query not known: findP

    Dominic Umbeer Newbie

      === Environment ==============================
      - jBPM Version : 4.1
      - JBOSS Version: 5.0.0.GA
      - Database : Oracle 11g
      - JDK : java version "1.6.0_12"
      - Configuration : original jbpm.cfg.xml
      - Libraries : no additional libs

      === API ===================================

      public static void main(String[] args) {
       Properties p = new Properties();
       p.put("java.naming.factory.initial",
       "org.jnp.interfaces.NamingContextFactory");
       p.put("java.naming.provider.url", "jnp://localhost:1099");
       p.put("java.naming.factory.url.pkgs",
       "org.jboss.naming:org.jnp.interfaces");
       try {
       InitialContext initial = new InitialContext(p);
       Object ref = initial.lookup("jbpm/CommandExecutor");
      
       RemoteCommandExecutorHome comServiceHome = (RemoteCommandExecutorHome) PortableRemoteObject.narrow(ref, RemoteCommandExecutorHome.class);
      
       RemoteCommandExecutor jbpm4 = comServiceHome.create();
      
       FindLatestProcessDefinitionByKeyCmd cmd = new
       FindLatestProcessDefinitionByKeyCmd("processkey");
      
       Object def = jbpm4.execute(cmd);
      
       } catch (Exception e) {
       e.printStackTrace();
       }
      }


      === Stacktrace ==============================
      15:08:41,784 INFO [DefaultCommandService] exception while executing command org.jbpm.pvm.internal.cmd.FindLatestProcessDefinitionByKeyCmd@8a0821
      org.hibernate.MappingException: Named query not known: findProcessDefinitionsByKey
       at org.hibernate.impl.AbstractSessionImpl.getNamedQuery(AbstractSessionImpl.java:93)
       at org.hibernate.impl.SessionImpl.getNamedQuery(SessionImpl.java:1287)
       at org.jbpm.pvm.internal.hibernate.DbSessionImpl.findLatestProcessDefinitionByKey(DbSessionImpl.java:114)
       at org.jbpm.pvm.internal.cmd.FindLatestProcessDefinitionByKeyCmd.execute(FindLatestProcessDefinitionByKeyCmd.java:44)
       at org.jbpm.pvm.internal.cmd.FindLatestProcessDefinitionByKeyCmd.execute(FindLatestProcessDefinitionByKeyCmd.java:33)
       at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
       at org.jbpm.pvm.internal.tx.jta.JtaTransactionInterceptor.executeInNewTx(JtaTransactionInterceptor.java:79)
       at org.jbpm.pvm.internal.tx.jta.JtaTransactionInterceptor.execute(JtaTransactionInterceptor.java:61)
       at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:55)
       at org.jbpm.pvm.internal.tx.jta.JtaRetryInterceptor.executeWithRetry(JtaRetryInterceptor.java:52)
       at org.jbpm.pvm.internal.tx.jta.JtaRetryInterceptor.execute(JtaRetryInterceptor.java:45)
       at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:46)
       at org.jbpm.enterprise.internal.ejb.CommandExecutorSLSB.execute(CommandExecutorSLSB.java:102)
       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.invocation.Invocation.performCall(Invocation.java:386)
       at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:228)
       at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:156)
       at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
       at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
       at org.jboss.ejb.plugins.AbstractTxInterceptorBMT.invokeNext(AbstractTxInterceptorBMT.java:173)
       at org.jboss.ejb.plugins.TxInterceptorBMT.invoke(TxInterceptorBMT.java:77)
       at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:173)
       at org.jboss.ejb.plugins.SecurityInterceptor.process(SecurityInterceptor.java:228)
       at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:211)
       at org.jboss.ejb.plugins.security.PreSecurityInterceptor.process(PreSecurityInterceptor.java:97)
       at org.jboss.ejb.plugins.security.PreSecurityInterceptor.invoke(PreSecurityInterceptor.java:81)
       at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
       at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:138)
       at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:650)
       at org.jboss.ejb.Container.invoke(Container.java:1029)
       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.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
       at org.jboss.invocation.unified.server.UnifiedInvoker.invoke(UnifiedInvoker.java:232)
       at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:908)
       at org.jboss.remoting.transport.socket.ServerThread.completeInvocation(ServerThread.java:742)
       at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:695)
       at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:549)
       at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:230)
      15:08:41,790 ERROR [LogInterceptor] RuntimeException in method: public abstract java.lang.Object org.jbpm.enterprise.internal.ejb.RemoteCommandExecutor.execute(org.jbpm.api.cmd.Command) throws java.rmi.RemoteException:
      org.hibernate.MappingException: Named query not known: findProcessDefinitionsByKey
       at org.hibernate.impl.AbstractSessionImpl.getNamedQuery(AbstractSessionImpl.java:93)
       at org.hibernate.impl.SessionImpl.getNamedQuery(SessionImpl.java:1287)
       at org.jbpm.pvm.internal.hibernate.DbSessionImpl.findLatestProcessDefinitionByKey(DbSessionImpl.java:114)
       at org.jbpm.pvm.internal.cmd.FindLatestProcessDefinitionByKeyCmd.execute(FindLatestProcessDefinitionByKeyCmd.java:44)
       at org.jbpm.pvm.internal.cmd.FindLatestProcessDefinitionByKeyCmd.execute(FindLatestProcessDefinitionByKeyCmd.java:33)
       at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
       at org.jbpm.pvm.internal.tx.jta.JtaTransactionInterceptor.executeInNewTx(JtaTransactionInterceptor.java:79)
       at org.jbpm.pvm.internal.tx.jta.JtaTransactionInterceptor.execute(JtaTransactionInterceptor.java:61)
       at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:55)
       at org.jbpm.pvm.internal.tx.jta.JtaRetryInterceptor.executeWithRetry(JtaRetryInterceptor.java:52)
       at org.jbpm.pvm.internal.tx.jta.JtaRetryInterceptor.execute(JtaRetryInterceptor.java:45)
       at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:46)
       at org.jbpm.enterprise.internal.ejb.CommandExecutorSLSB.execute(CommandExecutorSLSB.java:102)
       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.invocation.Invocation.performCall(Invocation.java:386)
       at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:228)
       at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:156)
       at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
       at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
       at org.jboss.ejb.plugins.AbstractTxInterceptorBMT.invokeNext(AbstractTxInterceptorBMT.java:173)
       at org.jboss.ejb.plugins.TxInterceptorBMT.invoke(TxInterceptorBMT.java:77)
       at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:173)
       at org.jboss.ejb.plugins.SecurityInterceptor.process(SecurityInterceptor.java:228)
       at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:211)
       at org.jboss.ejb.plugins.security.PreSecurityInterceptor.process(PreSecurityInterceptor.java:97)
       at org.jboss.ejb.plugins.security.PreSecurityInterceptor.invoke(PreSecurityInterceptor.java:81)
       at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
       at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:138)
       at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:650)
       at org.jboss.ejb.Container.invoke(Container.java:1029)
       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.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
       at org.jboss.invocation.unified.server.UnifiedInvoker.invoke(UnifiedInvoker.java:232)
       at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:908)
       at org.jboss.remoting.transport.socket.ServerThread.completeInvocation(ServerThread.java:742)
       at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:695)
       at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:549)
       at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:230)

      === Problem description =========================
      jbpm4.execute(cmd) throws Exception. You can see in printed stacktrace (jboss) that there are problems with
      named queries. Did have someone else this problem? The Exception occured when I execute the different FindProcessDefinition commands.

      I searched in the *.hbm.xml files after this query but it is not available. Can someone else try to execute this command?