6 Replies Latest reply on Oct 25, 2012 8:55 PM by snjeza

    Referencing an EJB project from a dynamic web project

    cstogian

      I have created an EAR application, that contains a JPA project for the data, and a EJB project for the business logic.

       

      I want to expose my EJBs from a REST web service, so I added a dynamic web project with a REST web service, and added a reference to the JPA and EJB projects (from "Project References" in the dynamic web project's properties). But although I can access the classes of the JPA project, I have no access to the EJB classes. Is there something else I need to do other than the reference?

       

      I have version 5.0.0.GA of the developer studio.

       

      Thank you,

      Christos.

        • 1. Re: Referencing an EJB project from a dynamic web project
          snjeza

          Could you check .classpath in your web project?

          It would need to contain a entry like the following:

           

          <classpathentry kind="src" path="/ejbproject"/>

           

          It is possible that the entry doesn't exist or it contains some access rules.

           

          Could you attach your .project and .classpath files?

          • 2. Re: Referencing an EJB project from a dynamic web project
            cstogian

            When I create a dynamic web project that belongs to the same EAR and workset as the JPA and EJB projects, I have access to the classes in my JPA project even if I don't specify a reference to the project.

             

            If I go and specify a reference for the JPA and EJB projects from the Properties page, the .project is updated to reflect this, but the .classpath is not.

             

            I manually edited the .classpath as you suggested, and it now works, I can use the classes of the EJB project. I can also still use the classes in my JPA project, even though there is no reference to it in the .classpath file.

             

            Full info for my JBoss Developer Studio version:

             

            Version: 5.0.0.GA

            Build id: v20120615-1714-H213-GA

            Build date: 20120615-1714

             

            Thank you.

            • 3. Re: Referencing an EJB project from a dynamic web project
              cstogian

              Looks like I was too hasty. Now the developer studio allows me to use the classes, but when I build I get a red x on my project (but not any of my files) if I include any reference to one of the classes in the EJB project.

              And I get the following error:

               

              JBAS014777:   Services which failed to start:  service jboss.web.deployment.default-host./PassiasWeb: org.jboss.msc.service.StartException in service jboss.web.deployment.default-host./PassiasWeb: JBAS018040: Failed to start context

               

              20:21:54,115 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014671: Failed services" => {"jboss.web.deployment.default-host./PassiasWeb" => "org.jboss.msc.service.StartException in service jboss.web.deployment.default-host./PassiasWeb: JBAS018040: Failed to start context"}}}}

              • 4. Re: Referencing an EJB project from a dynamic web project
                snjeza

                What build error do you get?

                This error can be seen in the Problems view.

                • 5. Re: Referencing an EJB project from a dynamic web project
                  cstogian

                  I get "The project cannot be built until its prerequisite {EJB project} is built. Cleaning and building all projects is recomended."

                   

                  I always do a clean build, but still get the same error.

                   

                  I also altered the build class path order of the web project so the EJB project appears above the web project, but it still gives me this error.

                   

                  Thanks.

                  • 6. Re: Referencing an EJB project from a dynamic web project
                    snjeza

                    You are getting those errors although your EJB project is built correctly?

                    Could you attach your projects or at least their .classpath and .project files?