3 Replies Latest reply on Nov 8, 2006 12:44 PM by maek1975

    Integrating Seam with EJB container

    maek1975

      Hi

      I have two modules, a web-module and an ejb-module. In the web-module I have some @Stateless annotated Action classes. In the ejb-module I have a number of stateless session beans etc. I also have a j2ee-module that used for deployment.

      The problem is that JBOSS finds and registers/starts my ejb's that resides under the ejb-module, but not those actions that resides under web-module. How do I tell JBoss to look for @Stateless under the web-module as well.

      In the ejb-module (under meta-inf), I have ejb-jar.xml, persistendce.xml etc.

      My ejb jar looks like the following:
      <ejb-jar xmlns="http://java.sun.com/xml/ns/javaee"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
      version="3.0">



      <interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>



      <assembly-descriptor>
      <interceptor-binding>
      <ejb-name>*</ejb-name>
      <interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
      </interceptor-binding>
      </assembly-descriptor>

      </ejb-jar>



      In the web-module (under web-inf), I have components.xml, faces-config.xml, web.xml etc.

      components.xml:



      true
      #{ejbName}/local



      <!-- half second wait for conversation lock on concurrent requests -->
      500
      <!-- 120 second conversation timeout -->
      120000
      cid
      clr


      <!--

      /main.xhtml

      -->





      faces-config.xml:

      <faces-config>
      <!-- Phase listener needed for all Seam applications -->


      <phase-listener>org.jboss.seam.jsf.SeamPhaseListener</phase-listener>


      </faces-config>



      web.xml:

      <web-app version="2.5"
      xmlns="http://java.sun.com/xml/ns/javaee"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

      <!-- Seam -->


      <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>


      <!-- MyFaces -->


      <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>


      <context-param>
      <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
      <param-value>client</param-value>
      </context-param>

      <context-param>
      <param-name>facelets.DEVELOPMENT</param-name>
      <param-value>true</param-value>
      </context-param>


      <servlet-name>Faces Servlet</servlet-name>
      <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
      <load-on-startup>1</load-on-startup>


      <!-- Faces Servlet Mapping -->
      <servlet-mapping>
      <servlet-name>Faces Servlet</servlet-name>
      <url-pattern>*.seam</url-pattern>
      </servlet-mapping>

      <!-- JSP -->
      <jsp-config>
      <jsp-property-group>
      <url-pattern>*.jsp</url-pattern>
      <is-xml>true</is-xml>
      </jsp-property-group>
      </jsp-config>

      </web-app>



      In j2ee-application-module, under meta-inf, I have the application.xml which contains:

      <display-name>Ratten</display-name>

      RattenBusiness.jar



      <web-uri>RattenWeb.war</web-uri>
      <context-root>/</context-root>





      I also have an empty jboss-app.xml.

        • 1. Re: Integrating Seam with EJB container
          maek1975

          the components.xml contains the row:
          TheNameOfMyEar/#{ejbName}/local

          • 2. Re: Integrating Seam with EJB container
            gavin.king

            Right, session beans have to go in ejb jars according to the java ee 5 spec, not in wars.

            • 3. Re: Integrating Seam with EJB container
              maek1975

              ok thanks.

              I moved my action classes (ie seam components defined in component.xml as MyEarApp/#{ejbName}/local) into the ejb-module, the component is now found/started by the jboss ejb container.

              I can access the session beans like this: ctx.lookup("MyEarApp/MyEJB/local") from a jsp-file.

              But when trying to load a .jsp/seam file containg seam specific code (the file is identical to seamInstallDir/examples/registration/register.jsp), the only things that are displayed is text, nighter the corresponding textfields nor the register-button.

              My question is then, are there any jars that i MIGHT BE MISSING OR IS it really possible to have the component.xml and faces-config.xml residing under web-inf in my war-file. Ie. should I move these into my ejb-jar (meta-inf)?