2 Replies Latest reply on Nov 27, 2002 11:04 AM by schwarcz

    CMP home business method

    schwarcz

      Sorry to ask such a naive question, but I’m trying to do something I thought would be trivial, but JBoss doesn’t like it and I can’t figure it out…

      I have an cmp entity bean to which I want to add a home method that is not linked to a any EJB QL. I’ve reduced it to what should be a minimal example. Can anybody shed any light on this? The Sun verifier doesn’t have any specific complaints the way JBoss does.

      The local home interface (QuoteLocalHome) contains:

      public String xyz ();

      The bean implementation class (QuoteBean) contains:

      public String xyz () { return "oops"; }


      And yet JBoss is permanently unhappy about this:


      16:27:53,781 INFO [EJBDeployer]

      Bean : Carl/QuoteEJB
      Method : public abstract String xyz()
      Section: 12.2.11
      Warning: Each local home method must match a method defined in the entity bean class.

      16:27:53,828 INFO [EjbModule] Creating
      16:27:53,843 INFO [EjbModule] Deploying Carl/CustomerEJB
      16:27:53,843 INFO [EjbModule] Deploying Carl/QuoteEJB
      16:27:53,859 INFO [EjbModule] Deploying Carl/QuoteFacadeEJB
      16:27:53,859 INFO [EjbModule] Deploying Carl/DurationEJB
      16:27:53,875 INFO [EjbModule] Deploying Carl/DisplayEJB
      16:27:53,890 INFO [EjbModule] Deploying ChargeMDB
      16:27:53,906 WARN [ServiceController] Problem creating service jboss.j2ee:service=EJB,jndiName=local/Carl/QuoteEJB

      org.jboss.deployment.DeploymentException: Could not find matching method for public abstract java.lang.String carl.ejbLayer.QuoteLocalHome.xyz()

      at org.jboss.ejb.EntityContainer.setupHomeMappingImpl(EntityContainer.java:832)

      at org.jboss.ejb.EntityContainer.setupHomeMapping(EntityContainer.java:849

        • 1. Re: CMP home business method
          minamoto

          You need ejbHomeXyz() in the QuoteBean.

          >Method : public abstract String xyz()
          >Section: 12.2.11
          >Warning: Each local home method must match a method defined in the entity bean class.

          The section 12.2.11 of the ejb 2.0 spec states as follows:

          Home methods can have arbitrary names, provided that they do not clash with create, find and
          remove method names. The matching ejbHome method specified in the entity bean class must have
          the same number and types of arguments and must return the same type as the home method as specified
          in the local home interface of the bean.

          And the ejbHome is defined in 12.2.6.

          An ejbHome(...) method must exist for every home (...) method on the
          entity bean's remote home or local home interface. The method name must have ejbHome as its prefix
          followed by the name of the method in which the first character has been uppercased.

          Miki

          • 2. Re: CMP home business method
            schwarcz

            Thanks so much for dragging back into reallity. Now i'm back on track.