5 Replies Latest reply on Nov 3, 2002 7:41 PM by Roger

    "Must Implement Entity Bean Interface", Error

    Roger Newbie

      When JBoss is started up with a particular application in the deploy directory the application is deployed successfully and runs correctly. However, if that same application (EAR file) is removed from the deploy directory and then copied back without any changes being made to it, JBoss generates an error message when deploying the Entity EJBs that are within the application. This occurs even if the application has not been run after it was first deployed. The error message for each Entity EJB is:


      " Section: 10.6.2
      Warning: The entity bean's class must implement, directly or indirectly, the javax.ejb.EntityBean interface."


      I have checked Section 10.6.2 of the EJB 2.0 spec against the code of the bean classes. I have made one exactly as the spec requires, but it appears to make no difference. The error message is generated for it in exactly the same as for the others. (As far as I can tell the only non-conformance in the others is the lack of a "throws EJBException" for the EJB required methods.)

      What is further perplexing for me is that this application has been working fine and has not had these deployment problems in the recent past. The application is subject to on-going development, but I am unclear as to what has changed to create the error. I have created a class to directly access the database through JDBC, but have not knowingly altered my Entity EJBs. I am using JBuilder 7 with the latest Protegra add-in for JBoss. I am wondering if this has performed some automatic generation operation that has altered the deployment descriptors or some other part of the code.

      Please, can anyone give me a lead as to what is going on, as I have run out of ideas? Is there possibly something wrong with some part of the deployment descriptors or at the other extreme is this a bug in JBoss?

      Thanks in anticipation,
      Roger

        • 1. Re: "Must Implement Entity Bean Interface", Error
          Alexey Loubyansky Master

          Are you really sure the bean's class does implement javax.ejb.EntityBean?
          Does it implement it directly or indirectly?
          The code seems to be clear for it:
          /**
          * Finds java.ejb.EntityBean interface from the class
          */
          public boolean hasEntityBeanInterface( Class c )
          {
          return javax.ejb.EntityBean.class.isAssignableFrom(c);
          }

          • 2. Re: "Must Implement Entity Bean Interface", Error
            Roger Newbie

            Thank you for your reply.

            The classes implement the interface directly.

            I will have another look at the classes. If I understand the code you included, the deployment descriptors are irrelevant to this problem. So I should concentrate on the classes themselves. Is this correct?

            Regards,
            Roger

            • 3. Re: "Must Implement Entity Bean Interface", Error
              Alexey Loubyansky Master

              Not at all. DDs do matter. The classes that specified in ejb-jar.xml are read, loaded and assigned to the bean. And then the check for needed interfaces implementation is made. i.e. the classes you specified in ejb-jar.xml are verified.

              • 4. Re: "Must Implement Entity Bean Interface", Error
                Roger Newbie

                I have checked and re-checked the class files and deployment descriptors and I can see no problem with them.
                I think this problem is more subtle than not having the classes or descriptors defined correctly. In fact I believe that they are defined correctly, but that for some reason the link between the bean and the interface it implements is being broken. I think it is related to serialisation because when I start up JBoss with the EAR file deployed prior to start up, no error messages appear and the program runs correctly. However, when the program is undeployed and deployed again, keeping JBoss running the whole time the above error occurs when the EAR file is redeployed. This occurs even if the application is not run at all after it was deployed for the first time. I have removed all the explicit serializations and while this does have some effect on the nature of the problem, it does not cure it. Can any one give me any suggestions please?

                Thanks
                Roger

                • 5. Re: "Must Implement Entity Bean Interface", Error
                  Roger Newbie

                  The basic problem was that the javax package was included in the same JAR file as the EJBs that produced the warning messages. When the javax package was removed from the JAR file the problem disappeared.

                  Can anyone explain why this should be, please? Is it due to some class loading function? The aspect that is most difficult to understand, is why the warning message should appear only when the EAR was redeployed?

                  Thanks
                  Roger