3 Replies Latest reply on Nov 26, 2008 4:54 PM by ohughes

    Newbie Headache For First SEAM Implementation

    ohughes

      Hi All,


      Thanks for taking some time to read this post.


      I am new to JSF, Seam, Icefaces, etc., and I want to build a very simple HelloWorld application but I keep on getting an error in the log file saying that my component cannot be found: seam component not found.


      I was initially trying to create a complex project, but I thought I'd better get the basics in first.


      Below is my code and configuration, and any help as to why it is not displaying 'Hello World' would be greatfully appreciated.


      JBoss-4.2.3.GA
      Java 1.5 (have also tested with 1.6)
      SEAM 2.1.0.SP1
      Icefaces 1.7.2



      HelloWorld



      package test;
      
      import javax.ejb.Local;
      
      /**
       * @author hugheos
       *
       */
      @Local
      public interface HelloWorld {
      
           
           public String getMessage();
           
      }



      HelloWorldImpl



      package test;
      
      import javax.ejb.Stateless;
      
      import org.jboss.seam.ScopeType;
      import org.jboss.seam.annotations.Name;
      import org.jboss.seam.annotations.Scope;
      
      /**
       * @author hugheos
       *
       */
      @Stateless
      @Name("helloWorldTest")
      @Scope(ScopeType.PAGE)
      public class HelloWorldImpl implements HelloWorld {
      
           /**
            * 
            */
           public HelloWorldImpl() {
                // TODO Auto-generated constructor stub
           }
      
           public String getMessage() {
                return "Hello World!";
           }
      }



      Components.xml


      <?xml version="1.0" encoding="UTF-8"?>
      
      <components xmlns="http://jboss.com/products/seam/components"
                  xmlns:core="http://jboss.com/products/seam/core"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      
           <core:init jndi-pattern="test/#{ejbName}/local"/>
      
      </components>



      faces-config.xml


      <?xml version='1.0' encoding='UTF-8'?>
      <!DOCTYPE faces-config PUBLIC
                "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
                "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
      <faces-config>
      
         <application>
            <view-handler>com.icesoft.faces.facelets.D2DSeamFaceletViewHandler</view-handler>
         </application>
      
      </faces-config>
      



      web.xml


      <?xml version="1.0" encoding="UTF-8"?>
      <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>
              <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
          </listener>
      
          <!-- JSF -->
          <listener>
              <!-- <listener-class>com.sun.faces.config.ConfigureListener</listener-class> -->
              <listener-class>com.icesoft.faces.util.event.servlet.ContextEventRepeater</listener-class>
          </listener>
      
           <!-- Begin IceFaces Config -->
      
           <context-param>
              <param-name>com.icesoft.faces.actionURLSuffix</param-name>
              <param-value>.seam</param-value>
          </context-param>
          
          <context-param>
              <param-name>com.icesoft.faces.synchronousUpdate</param-name>
              <param-value>false</param-value>
          </context-param>
      
          <context-param> 
              <param-name>com.icesoft.faces.doJSFStateManagement</param-name>
           <param-value>true</param-value>
          </context-param> 
      
          <context-param>
              <param-name>org.icesoft.examples.serverClock</param-name>
              <param-value>false</param-value>
          </context-param>
      
          <context-param>
              <param-name>com.icesoft.faces.standardRequestScope</param-name>
              <param-value>true</param-value>
          </context-param>
          
           <servlet>
              <servlet-name>Persistent Faces Servlet</servlet-name>
              <servlet-class>com.icesoft.faces.webapp.xmlhttp.PersistentFacesServlet</servlet-class>
              <load-on-startup> 1 </load-on-startup>
          </servlet>
          <servlet>
              <servlet-name>Blocking Servlet</servlet-name>
              <servlet-class>com.icesoft.faces.webapp.xmlhttp.BlockingServlet</servlet-class>
              <load-on-startup> 1 </load-on-startup>
          </servlet>
          
           <servlet-mapping>
              <servlet-name>Persistent Faces Servlet</servlet-name>
              <url-pattern>*.seam</url-pattern>
          </servlet-mapping>
           <servlet-mapping>
              <servlet-name>Persistent Faces Servlet</servlet-name>
              <url-pattern>/xmlhttp/*</url-pattern>
          </servlet-mapping>
          
          <servlet-mapping>
              <servlet-name>Blocking Servlet</servlet-name>
              <url-pattern>/block/*</url-pattern>
          </servlet-mapping> 
      
           <!-- End IceFaces Config -->
      
          <context-param>
              <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
              <param-value>.jspx</param-value>
          </context-param>
      
          <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>*.seam</url-pattern>
          </servlet-mapping>
       -->
          <session-config>
              <session-timeout>10</session-timeout>
          </session-config>
      
      </web-app>
      



      And finally the jspx page to actually display the output of Hello World! from the bean:



      <html xmlns="http://www.w3.org/1999/xhtml"
            xmlns:f="http://java.sun.com/jsf/core"
            xmlns:ice="http://www.icesoft.com/icefaces/component">
         <head>
            <title>Hello World Test</title>
         </head>
         <body>
                <f:view>
                     <ice:outputText value="#{helloWorldTest.message}"/>
                     
                     <ice:outputText>Testing 123</ice:outputText>
                </f:view>
      </body>
      </html>



      This has been causing me a headache for a few days now, and I know it must be something very simple, but I cant for the life of me figure it out.


      Many thanks in advance,


      Osian


        • 1. Re: Newbie Headache For First SEAM Implementation

          Do you have a seam.properties file in your class path?

          • 2. Re: Newbie Headache For First SEAM Implementation
            ohughes

            Hi Binny,


            Yes I have an empty seam.properties file contained in the base of the jar that contains the 2 classes mentioned above, and I know this class is being loaded (or at least I think I do) from the server.log file:



            2008-11-26 13:57:30,420 DEBUG [org.jboss.system.ServiceController] starting service jboss.j2ee:service=EJB3,module=test.jar
            2008-11-26 13:57:30,420 DEBUG [org.jboss.ejb3.Ejb3Module] Starting jboss.j2ee:service=EJB3,module=test.jar
            2008-11-26 13:57:30,420 DEBUG [org.jboss.ejb3.EJBContainer] Initialising interceptors for HelloWorldImpl...
            2008-11-26 13:57:30,420 DEBUG [org.jboss.ejb3.EJBContainer] Default interceptors: [InterceptorInfo{class=class org.jboss.seam.ejb.SeamInterceptor}]
            2008-11-26 13:57:30,420 DEBUG [org.jboss.ejb3.EJBContainer] Class interceptors: []
            2008-11-26 13:57:30,420 DEBUG [org.jboss.ejb3.EJBContainer] All applicable interceptor classes: [InterceptorInfo{class=class org.jboss.seam.ejb.SeamInterceptor}]
            2008-11-26 13:57:30,420 DEBUG [org.jboss.ejb3.interceptor.EJB3InterceptorsFactory] Bound interceptors for joinpoint: public java.lang.String test.HelloWorldImpl.getMessage() - [Lorg.jboss.ejb3.interceptor.InterceptorInfo;@b71fa5
            2008-11-26 13:57:30,420 INFO  [org.jboss.ejb3.JmxKernelAbstraction] creating wrapper delegate for: org.jboss.ejb3.stateless.StatelessContainer
            2008-11-26 13:57:30,420 INFO  [org.jboss.ejb3.JmxKernelAbstraction] installing MBean: jboss.j2ee:ear=test.ear,jar=test.jar,name=HelloWorldImpl,service=EJB3 with dependencies:
            2008-11-26 13:57:30,420 DEBUG [org.jboss.system.ServiceController] Creating service jboss.j2ee:ear=test.ear,jar=test.jar,name=HelloWorldImpl,service=EJB3
            2008-11-26 13:57:30,420 DEBUG [org.jboss.system.ServiceController] adding depends in ServiceController.register: []
            2008-11-26 13:57:30,420 DEBUG [org.jboss.ejb3.stateless.StatelessDelegateWrapper] Creating jboss.j2ee:ear=test.ear,jar=test.jar,name=HelloWorldImpl,service=EJB3
            2008-11-26 13:57:30,420 DEBUG [org.jboss.ejb3.ProxyDeployer] no declared remote bindings for : HelloWorldImpl
            2008-11-26 13:57:30,420 DEBUG [org.jboss.ejb3.stateless.StatelessDelegateWrapper] Created jboss.j2ee:ear=test.ear,jar=test.jar,name=HelloWorldImpl,service=EJB3
            2008-11-26 13:57:30,420 DEBUG [org.jboss.system.ServiceController] Creating dependent components for: jboss.j2ee:ear=test.ear,jar=test.jar,name=HelloWorldImpl,service=EJB3 dependents are: []
            2008-11-26 13:57:30,420 DEBUG [org.jboss.system.ServiceController] starting service jboss.j2ee:ear=test.ear,jar=test.jar,name=HelloWorldImpl,service=EJB3
            2008-11-26 13:57:30,420 DEBUG [org.jboss.ejb3.stateless.StatelessDelegateWrapper] Starting jboss.j2ee:ear=test.ear,jar=test.jar,name=HelloWorldImpl,service=EJB3
            2008-11-26 13:57:30,435 DEBUG [org.jboss.ejb3.tx.UserTransactionImpl] new UserTx: org.jboss.ejb3.tx.UserTransactionImpl@7ecaa1
            2008-11-26 13:57:30,435 DEBUG [org.jboss.ejb3.interceptor.EJB3InterceptorsFactory] Bound interceptors for joinpoint: public java.lang.String test.HelloWorldImpl.getMessage() - [Lorg.jboss.ejb3.interceptor.InterceptorInfo;@2924cc
            2008-11-26 13:57:30,435 INFO  [org.jboss.ejb3.EJBContainer] STARTED EJB: com.nexus.ui.test.pojo.HelloWorldImpl ejbName: HelloWorldImpl
            2008-11-26 13:57:30,435 DEBUG [org.jboss.ejb3.stateless.BaseStatelessProxyFactory] Binding proxy for HelloWorldImpl in JNDI at test/HelloWorldImpl/local
            2008-11-26 13:57:30,435 DEBUG [org.jboss.ejb.txtimer.EJBTimerServiceImpl] createTimerService: org.jboss.ejb.txtimer.TimerServiceImpl@1b993d6
            2008-11-26 13:57:30,435 DEBUG [org.jboss.ejb3.stateless.StatelessDelegateWrapper] Started jboss.j2ee:ear=test.ear,jar=test.jar,name=HelloWorldImpl,service=EJB3
            2008-11-26 13:57:30,435 DEBUG [org.jboss.system.ServiceController] Starting dependent components for: jboss.j2ee:ear=test.ear,jar=test.jar,name=HelloWorldImpl,service=EJB3 dependent components: []
            2008-11-26 13:57:30,435 DEBUG [org.jboss.ejb3.Ejb3Deployment] Bound ejb3 container jboss.j2ee:ear=test.ear,jar=test.jar,name=HelloWorldImpl,service=EJB3
            2008-11-26 13:57:30,435 DEBUG [org.jboss.ejb3.Ejb3Module] Started jboss.j2ee:service=EJB3,module=test.jar




            Thanks again,
            Osian

            • 3. Re: Newbie Headache For First SEAM Implementation
              ohughes

              Fantastic,


              I have now placed the empty seam.properties file into the META-INF of the ejb jar and I can now see the good old Hello World,


              Thanks again,


              Osian