4 Replies Latest reply on Jun 9, 2005 4:38 AM by svandenbussche

    Deployment problem due to session facade

    maruthi_cse

      Hi
      I have a doube.In our project we are using struts framework with jboss.Our project flow is
      jsp to strtus form to struts action to session facade to ejb.
      Now I tried to pass the form bean to a function in my session facade.
      When i start the jboss it post the following error as Noclassdeffounderror due to the use of import statements which refer that form bean.I tried to move the form bean to some packages also but it still shows the same error(Alos,The class file is placed in the correct package).Can any one know the reason?

      10:34:51,515 WARN [EJBDeployer] Verify failed; continuing
      java.lang.NoClassDefFoundError: com/dhyan/erp/stores/accountmanagement/ejb/TransactionForm

      Thanks
      maruthi

        • 1. Re: Deployment problem due to session facade
          maruthi_cse

           

          "maruthi_cse" wrote:
          Hi
          I have a doubt.In our project we are using struts framework with jboss.Our project flow is
          jsp to strtus form to struts action to session facade to ejb.
          Now I tried to pass the form bean to a function in my session facade.
          When i start the jboss it post the following error as Noclassdeffounderror due to the use of import statements which refer that form bean.I tried to move the form bean to some packages also but it still shows the same error(Alos,The class file is placed in the correct package).Can any one know the reason?

          10:34:51,515 WARN [EJBDeployer] Verify failed; continuing
          java.lang.NoClassDefFoundError: com/dhyan/erp/stores/accountmanagement/ejb/TransactionForm

          Thanks
          maruthi


          • 2. Re: Deployment problem due to session facade

            Hi,
            Really, you shouldn't be passing Struts forms to your ejbs.
            Use Value Objects (aka Data Transfer Objects) instead to decouple both sides (see the VO design pattern).
            Deploy your VOs in your ejb module as well as in your war module.

            • 3. Re: Deployment problem due to session facade
              maruthi_cse

              Hi svandenbussche,
              Thank u for ur reply.So u mean to say that we must use value objects in between struts form and session facade?. Is there exist an example for using this along with struts and session facade?

              Thanks
              maruthi

              • 4. Re: Deployment problem due to session facade

                 

                "maruthi_cse" wrote:
                Hi svandenbussche,
                Thank u for ur reply.So u mean to say that we must use value objects in between struts form and session facade?. Is there exist an example for using this along with struts and session facade?

                Thanks
                maruthi


                Using Struts formbeans within Ejbs means you'll have to deploy the Struts jar, as well as your formbeans, in your ejb module thus in the Ejb container. The exception you have is probably because you deployed your formbeans in your .war module but not in your ejb module.

                However doing so is not a good idea: what if the project changes and you guys want to use JSF or Spring MVC instead of Struts? You have tied your ejbs to Struts and you then have to modify both your JSPs _and_ your ejbs. Don't do that unless you expect your project to be thrown away within 6 months.

                That's why a "best practice" suggests using Value Objects (which is just a simple POJO) in between to have both sides properly decoupled.

                To do so you can either replace your formbean's member variables by one Value Object (VO) that has the same properties and have its get/set methods use the VO's properties; or you can use org.apache.commons.beanutils.BeanUtils to copy properties back and forth between your formbean and your VO.

                Cheers,
                Stephane