5 Replies Latest reply on Oct 23, 2008 10:14 PM by deanhiller2000

    Get a Seam in an EJB module From a WAR module

    sebdoncker

      Hi,


      I'm trying to develop 2 Web-Apps. Each should access the same bean then I put my bean in an EJB-module.


      So, I'll have 2 WAR-modules and 1 EJB-module running on the same JBoss server.


      I'm trying to access the beans (in the EJB Module) with Seam name from a web page (in the WAR Module).


      But When I try this (a simple Seam action), the WAR module can't find my seam declared outside the war. I obtain a Target Unreachable, identifier 'test' resolved to null.


      In fact, I love this should be possible but I can't see in which context the war module could find the bean seam ???


      I'm afraid, I can't do what I'm expecting without put all my modules in one EAR.


      Does one of you can confirm my feeling ? Or Does anybody have a solution to my problem ?


      Thanks a lot,


      Seb

        • 1. Re: Get a Seam in an EJB module From a WAR module
          hasan_muhstaq

          can u please provide more details


          - stacktrace
          - seam version
          - jboss as version
          - using jboss tools??


          are u sure ur application is correctly deployed on the server?

          • 2. Re: Get a Seam in an EJB module From a WAR module
            sebdoncker

            I use JBoss 4.2.2.GA and Seam 2.0.1.GA (and JBoss Tools 2.0.0.GA).


            My apps seam well deployed because I can access my Stateless Session Bean with a

            <jsp:useBean>

            tag (without use Seam).


            My problem is to access my stateless session using Seam with a

            #{test.action}

            EL code.


            Here is my code :


            In an EJB module (deployed as a jar archive in JBoss), I have the following very simple session bean :


            @Stateless
            @Name("test")
            public class TestBean implements Test {
                public void action() {
                    System.out.println("action called !");
                }
            }
            



            And in a web module (deployed as a war archive in JBoss), I have an xhtml page (generated by JBoss Tools New Action Seam dialog) with this tag :


            <h:commandButton id="test" value="test!" action="#{test.action}"/> 
            



            When I deploy and execute this xhtml page and when I click on the button, Seam generate an Exception with the following explanation :


            Target Unreachable, identifier 'test' resolved to null
            



            If I compound the ejb module and the web module in an EAR archive, the code works well but I loved to get independant modules (EJB or Web) communicates themselves via Seam...


            Do you think it's possible ?


            My both modules use the same persistence context but I haven't Entity bean in this example so I think this is not involved in the problem.

            • 3. Re: Get a Seam in an EJB module From a WAR module
              bje990

              I'm wondering if anybody had figured this out yet?

              • 4. Re: Get a Seam in an EJB module From a WAR module
                pmuir

                Please clarify the packaging structure used. Seam uses JNDI to lookup the EJB3, and additionally needs the class on the classpath. If you provide the correct jndiPattern or @JndiName it should then work. N.B. Seam has no support for remote EJBs

                • 5. Re: Get a Seam in an EJB module From a WAR module
                  deanhiller2000

                  Are there instructions for this anywhere?  I have a war file that I deploy to tomcat today, and that war file currently has my EJB3 jar file(which has it's seam.properties in it so seam finds the components in that jar file as well as the WEB-INF/classes).


                  I now want to do exactly the same thing.  I want to rip that jar file out of my WEB-INF, move to JBoss, deploy my jar file as a service to two war files.


                  Are there instructions for this anywhere on how this all works?  I am going to read the EJB3 TrailBlazer here
                  TRAIL BLAZER


                  but what about deployment of war files.  What do I change in those guys to make them lookup the EJB3 now?  Are there any examples that have this working?


                  thanks,
                  Dean