1 Reply Latest reply on Sep 3, 2002 12:05 AM by Felipe Saint-Jean

    Query method not found: findByName

    Jonathan Ekwempu Newbie

      What can cause this error?

      org.jboss.deployment.DeploymentException: Query method not found: findByName
      at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCQueryMetaDataFactory.getQ
      ueryMethods(JDBCQueryMetaDataFactory.java:206)
      at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCQueryMetaDataFactory.getQ
      ueryMethods(JDBCQueryMetaDataFactory.java:169)
      at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCQueryMetaDataFactory.crea
      teJDBCQueryMetaData(JDBCQueryMetaDataFactory.java:40)
      at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCEntityMetaData.(JDB
      CEntityMetaData.java:291)
      at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCApplicationMetaData.(JDBCApplicationMetaData.java:117)
      at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCXmlFileLoader.load(JDBCXm
      lFileLoader.java:52)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.loadJDBCEntityMetaDat
      a(JDBCStoreManager.java:601)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.create(JDBCStoreManag
      er.java:321)
      at org.jboss.ejb.plugins.CMPPersistenceManager.create(CMPPersistenceMana
      ger.java:155)
      at org.jboss.ejb.EntityContainer.create(EntityContainer.java:337)
      at org.jboss.ejb.Container.invoke(Container.java:789)
      at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:1055)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceControl
      ler.java:894)
      at $Proxy6.create(Unknown Source)
      at org.jboss.system.ServiceController.create(ServiceController.java:272)

      at sun.reflect.GeneratedMethodAccessor25.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBea
      nDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491)
      at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
      at $Proxy41.create(Unknown Source)
      at org.jboss.ejb.EjbModule.createService(EjbModule.java:392)
      at org.jboss.system.ServiceMBeanSupport.create(ServiceMBeanSupport.java:
      134)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
      java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBea
      nDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceControl
      ler.java:894)


      The definition of my query in ejb-jar.xml is follows:



      Find Products by Name

      <query-method>
      <method-name>findByName</method-name>
      <method-params>java.lang.String</method-params>
      </query-method>
      <result-type-mapping>Remote</result-type-mapping>
      <ejb-ql>
      SELECT OBJECT(p)
      FROM MyProduct p
      WHERE p.name = ?1
      </ejb-ql>


      The definition of the query in my home interface is as follows:

      public Collection findByName(String name) throws FinderException, RemoteException;

      I am using JBoss 3.0 and my bean is CMP. Any help would be appreciated.

        • 1. Re: Query method not found: findByName
          Felipe Saint-Jean Newbie

          I see two possible problems ...
          1st, you are missing a tag in the descriptor
          &lt;method-param&gt;

          Should look like

          &lt;method-params&gt; &lt;method-param&gt;java.lang.String&lt;/method-param&gt;
          &lt;/method-params&gt;

          Second if you are ussing Xdoclet (you really should!), class
          names must be fully quialified names
          like
          java.lang.String
          instead of
          String

          Felipe Saint-Jean