9 Replies Latest reply on Aug 10, 2007 1:28 PM by samdoyle

    EJB 3.0 Seam Component Not Found

    birwin

      I have an EJB 3.0 Stateful Session Bean that I am unable to see from my web page (JSP at the moment). From the log files it is apparent the bean is not being detected by the seam deployment scanner.

      My EJB:

      @Stateful
      @Scope(CONVERSATION)
      @Name("divisionListener")
      public class DivisionListenerBean implements DivisionListener
      {
       @PersistenceContext (unitName="spike")
       private EntityManager em;
      
       @Logger
       private Log log;
      
       private int clientID = 5133;
      
       public void setClientID(int clientID)
       {
       this.clientID = clientID;
       }
      
       public int getClientID()
       {
       return this.clientID;
       }
      
      }



      My ejb-jar.xml file:
      <ejb-jar>
       <interceptors>
       <interceptor>
       <interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
       </interceptor>
       </interceptors>
       <assembly-descriptor>
       <interceptor-binding>
       <ejb-name>*</ejb-name>
       <interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
       </interceptor-binding>
       </assembly-descriptor>
      </ejb-jar>





      On the web client:
      my web.xml:
      <web-app>
       <!-- Listeners -->
       <listener>
       <!-- Seam -->
       <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
       </listener>
       <listener>
       <!-- JSF -->
       <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
       </listener>
       <!-- Faces Servlet -->
       <servlet>
       <servlet-name>Faces Servlet</servlet-name>
       <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
       <load-on-startup>1</load-on-startup>
       </servlet>
       <servlet-mapping>
       <servlet-name>Faces Servlet</servlet-name>
       <url-pattern>/faces/*</url-pattern>
       </servlet-mapping>
       <taglib>
       <taglib-uri>http://java.sun.com/jsf/core</taglib-uri>
       <taglib-location>/WEB-INF/jsf_core.tld</taglib-location>
       </taglib>
       <taglib>
       <taglib-uri>http://java.sun.com/jsf/html</taglib-uri>
       <taglib-location>/WEB-INF/html_basic.tld</taglib-location>
       </taglib>
       <taglib>
       <taglib-uri>http://java.sun.com/jsp/jstl/core </taglib-uri>
       <taglib-location>/WEB-INF/c.tld</taglib-location>
       </taglib>
       <context-param>
       <param-name>org.jboss.seam.core.init.jndiPattern</param-name>
       <param-value>/spike-ear-0.1.0/#{ejbName}/local</param-value>
       </context-param>
      </web-app>


      My Faces-Config file:
      <faces-config>
      
       <lifecycle>
       <phase-listener>org.jboss.seam.jsf.SeamPhaseListener</phase-listener>
       </lifecycle>
      </faces-config>


      My Components.xml file:
      <components xmlns="http://jboss.com/products/seam/components"
       xmlns:core="http://jboss.com/products/seam/core">
       <core:init jndi-name="spike-ear-0.1.0/#{ejbName}/local" />
      </components>



      My JSP file:
      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
      
      <html>
       <head>
       <title>SOS Trax</title>
       <link href="../../css/trax.css" rel="stylesheet" type="text/css" />
       </head>
       <body>
       <h2>Payroll Export Parameters</h2>
       <f:view>
       <h:form>
       <h:inputText value="#{divisionListener.clientID}" />
       </h:form>
       </f:view>
       </body>
      </html>


      My log file indicates the EJB is not detected and deployed and when I hit the JSP I get this in my log file:
      DEBUG [org.jboss.seam.Component] seam component not found: divisionListener


      I have verified that my EJB is available as an ejb with the JNDI name: "spike-ear-0.1.0/DivisionListenerBean/local". This is displayed in my Global JNDI Namespace section of the JBoss JMX Console. I also wrote an application that used this EJB as a plain EJB and I had no problems.

      Any ideas what I have done wrong?

        • 1. Re: EJB 3.0 Seam Component Not Found
          nickarls

          Has the build script filtered your components.xml incorrectly?

          <core:init jndi-name="spike-ear-0.1.0/#{ejbName}/local" />
          



          • 2. Re: EJB 3.0 Seam Component Not Found
            nickarls

            Umm, never mind previous post.

            Does it find *any* EJBs or is just a new one that isn't found?

            • 3. Re: EJB 3.0 Seam Component Not Found
              pmuir

              Seam version?

              • 4. Re: EJB 3.0 Seam Component Not Found
                birwin

                First of all, thank you to everyone who responded to my question. It makes one a little more comfortable when there is good peer support from a community as there is for SEAM. Here is the information you asked for:

                Seam version is 2.0.0-Beta1. No EJBs are found (This is actually the only EJB as I am just learning SEAM and this is my first attempt at an EJB). And finally, it appears that the build script has not filtered the components.xml file. It is deployed as it is displayed in this document.

                I did not know the build script was supposed to replace the components.xml with the actual EJB declarations. I am using Maven and so I will have to investigate how to do this. Probably this is my issue.

                I will look into this and let you know what I find.

                • 5. Re: EJB 3.0 Seam Component Not Found
                  pmuir

                  It should be

                  <core:init jndi-pattern="spike-ear-0.1.0/#{ejbName}/local" />


                  • 6. Re: EJB 3.0 Seam Component Not Found
                    birwin

                    OK.. I have left the configuration file as it is. I decided to roll my version of SEAM back to the stable version. I am using 1.2.1 and I have made more progress.

                    I placed a seam.properties file at the root of my EJB-JAR file and it appeared to attempt to deploy the EJB as a SEAM component, but there was a new error. Exception sending context initiailized event to listener instance of class org.jboss.seam.servlet.SeamListener Caused by no method having a @Destroy and @Remove annotations.

                    At this point, I felt like I was getting close. I added an empty method and labeled it with these annotations and then the EJB deployed and worked fine. My JSP file saw it and was able to display data from the EJB.

                    If someone from JBoss-SEAM wants me to try to duplicate my issues on the Beta version of the product, I am happy to. It seemed like I was stuck until I installed the stable version. I can leave my configuration as is and place the beta version of SEAM back on my machine and see if it deploys correctly... Let me know... Thanks for all of your help on this one. It had me stumped for a day.

                    • 7. Re: EJB 3.0 Seam Component Not Found
                      samdoyle

                      What server are deploying into?

                      • 8. Re: EJB 3.0 Seam Component Not Found
                        birwin

                        JBoss 4.2.1.GA

                        • 9. Re: EJB 3.0 Seam Component Not Found
                          samdoyle

                          Was just curious in the case you were using a JEE5 app server. If that was the case the jndi pattern would be different from what you are using.