2 Replies Latest reply on Oct 24, 2004 10:51 PM by alexanderpetrous

    ejb home method doubt -- plz help -- urjent

    alexanderpetrous

      Dear friends, i get the following error when i try to deploy my .ear file on jboss 3.0 & tomcat!


      org.jboss.deployment.DeploymentException: Could not find matching method for public abstract java.util.Collection
      com.bussa.entities.interfaces.UserRemoteHome.getselectedusers() throws java.rmi.RemoteException


      the following is my home interface...please look at the home method getselectedusers()
      -------------------------------------


      public interface UserRemoteHome
      extends EJBHome
      {

      public UserRemote create(String s, String s1, String s2, int i, int j, int k)
      throws CreateException, RemoteException;

      public UserRemote findByPrimaryKey(String s)
      throws FinderException, RemoteException;

      public UserRemote findByIdentity(String s)
      throws FinderException, RemoteException;

      public Collection getselectedusers()
      throws RemoteException;


      }



      The relevant part of my bean implementation class
      --------------------------------------------------



      public Collection ejbHomegetselectedusers()
      throws RemoteException
      {

      try{
      Collection collection = ejbSelectUsers(1, 1, 1);
      return collection;
      }
      catch(FinderException fe)
      {

      return null;
      }

      }






      the relevant part of my ejb-jar.xml file
      -----------------------------------------


      <query-method>
      <method-name>ejbSelectUsers</method-name>
      <method-params>
      <method-param>int</method-param>
      <method-param>int</method-param>
      <method-param>int</method-param>
      </method-params>
      </query-method>
      <ejb-ql><![CDATA[
      SELECT user.userName
      FROM UserTable user
      WHERE user.controlUsersFlag = ?1
      AND user.controlCasesFlag = ?2
      AND user.createModeratorFlag = ?3]]>
      </ejb-ql>





      Thanks in advance!
      alex







        • 1. Re: ejb home method doubt -- plz help -- urjent
          raist_majere

          At first sight, I think your problem is on your naming convention used for that method. Instead of:

          public Collection getselectedusers()
          throws RemoteException;
          

          you should write:
          public Collection getSelectedUsers()
          throws RemoteException;
          

          in your home interface.
          And instead of:
          public Collection ejbHomegetselectedusers()
          throws RemoteException
          { ... }
          

          you should use:
          public Collection ejbHomeGetSelectedUsers()
          throws RemoteException
          { ... }
          


          If you don't want to change your Home interface name, then for this to work you must capitalize get on the bean class, like this:
          public Collection ejbHomeGetselectedusers()
          throws RemoteException
          { ... }
          


          I recommend you changing to the naming convention I proposed, but if you cannot change this one at this moment (because you use this name method in a lot of places, for example) you must capitalize Get on the bean class (not on the home interface).
          You should read some J2EE book about these and other conventions in method naming and so, because in all of them this kind of errors are normally advised most of the times... If you haven't any, you can take a look at this one, available as a free PDF download on TheServerSide:
          Mastering Enterprise JavaBeans (Second Edition)
          http://www.theserverside.com/books/wiley/masteringEJB/index.tss
          On this page you can download other J2EE related books (they are listed on the right side of the page).
          Hope this helps. Reply any feedback about it, please, just to know if I am right or not ;)

          • 2. Re: ejb home method doubt -- plz help -- urjent
            alexanderpetrous

            hey Raist_*

            the naming convention was indeed the thing that was creating the problem. I understand that the conventions are good but why enforce them mandatory:-)