6 Replies Latest reply on Aug 16, 2007 4:11 AM by vprasanx

    Jboss Seam+Facelet!

    vprasanx

      Hi,

      I'm creating a reference application for a project with Jboss Seam. I'm using Seam2.0 beta & Glassfish server 9.1. I'm using Netbeans IDE5.5.1.
      I'd created a sample application with Jboss Seam, JSF & EJB3.0 & it works fine. But I need to render Facelet & Ajax4Jsf support to my application. I searched for support documents, but nothing worked. When I add facelet & Seam, I always get,

      WebModule[/SVPSeam-war]PWC1275: Exception sending context initialized event to listener instance of class org.jboss.seam.servlet.SeamListener
      java.lang.NullPointerException
      at org.jboss.seam.contexts.ServletLifecycle.endInitialization(ServletLifecycle.java:100)............


      error.
      Kindly provide me exact procedure for creating Jboss Seam Application with Facelet.

      My faces-config.xml looks like this,

      <?xml version='1.0' encoding='UTF-8'?>

      <!-- =========== FULL CONFIGURATION FILE ================================== -->

      <faces-config version="1.2"
      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-facesconfig_1_2.xsd">


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



      <view-handler>
      com.sun.facelets.FaceletViewHandler
      </view-handler>


      <!-- seam on JSF 1.2 -->
      <!--

      <el-resolver>
      org.jboss.seam.jsf.SeamELResolver
      </el-resolver>

      -->

      </faces-config>


      & my web.xml is like this,

      <?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">


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


      <context-param>
      <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
      <param-value>com.sun.facelets.FaceletViewHandler</param-value>
      </context-param>

      <context-param>
      <param-name>org.ajax4jsf.SKIN</param-name>
      <param-value>blueSky</param-value>
      </context-param>

      <context-param>
      <param-name>com.sun.faces.verifyObjects</param-name>
      <param-value>true</param-value>
      </context-param>
      <context-param>
      <param-name>com.sun.faces.validateXml</param-name>
      <param-value>true</param-value>
      </context-param>
      <context-param>
      <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
      <param-value>.xhtml</param-value>
      </context-param>
      <context-param>
      <param-name>facelets.DEVELOPMENT</param-name>
      <param-value>false</param-value>
      </context-param>
      <context-param>
      <param-name>facelets.SKIP_COMMENTS</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>

      <servlet-mapping>
      <servlet-name>Faces Servlet</servlet-name>
      <url-pattern>*.jsf</url-pattern>
      </servlet-mapping>
      <session-config>
      <session-timeout>
      30
      </session-timeout>
      </session-config>
      <welcome-file-list>
      <welcome-file>
      index.jsp
      </welcome-file>
      </welcome-file-list>

      <context-param>


      <param-name>org.jboss.seam.core.init.jndiPattern</param-name>
      <param-value>java:comp/env/SVPSeam/#{ejbName}/local</param-value>
      </context-param>



      <ejb-local-ref>
      <ejb-ref-name>SVPSeam/SVPHelloBean/local</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      com.java.SVPHelloLocal
      <ejb-link>SVPHelloBean</ejb-link>
      </ejb-local-ref>


      <!--<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>-->
      <listener-class>com.sun.faces.config.ConfigureListener</listener-class>



      </web-app>


      Thanks,
      Venkates

        • 1. Re: Jboss Seam+Facelet!
          samdoyle

          Do you have the required jars deployed properly? Your best bet is to use seam-gen or one of the examples and then compare the exploded ear to the one you are generating.

          I'm using the same configuration you are

          "I'm using Seam2.0 beta & Glassfish server 9.1. I'm using Netbeans IDE5.5.1. "

          and it took a bit of tweaking to get it to work properly.

          • 2. Re: Jboss Seam+Facelet!
            vprasanx

            Hi Samdoyle,

            Thanks for ur prompt reply.....
            But I'm yet to crack it down......

            I'd successfully created & deployed a Jboss seam app with Jsf+EJB3.0.

            But when it comes to implementing facelet framework into the abovesaid I'm not getting the app deployed.

            I'd used nbfaceletssupport-0-5 for rendering Facelet dev support into NB5.5.1 IDE....
            Here it adds the facelets library into war. I've done the same config to this app as before, but in vain.

            Could U tell me exactly the libs to add to EJB & WAR modules & the config changes into web.xml & faces-config.xml?

            Since u'd already succeeded in this, u cud really help me out with this.....

            Thanks,
            Venkates

            • 3. Re: Jboss Seam+Facelet!
              samdoyle

              In NB I created a new Enterprise Application.

              Under the EJB component's configuration files I created an ejb-jar.xml file from what I had noticed in some of the examples. Here is the contents.

              <?xml version="1.0" encoding="UTF-8"?>
              <ejb-jar version="3.0" 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">
              
               <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>
              


              The empty seam.properties file also goes here to.

              For building the ejb portion of the application I have the following required libs. that is set in the properties section of that project.

              commons-beansutils-1.7.0.jar
              commons-digester-1.6.jar
              hibernate-all.jar
              jboss-archive-browsing.jar
              jboss-common.jar
              jboss-seam.jar
              jpm-jpdl.jar
              thirdparty-all.jar
              


              I don't know if they are all needed or not. I was just adding and removing libs at one point trying to get it to work. The hibernate stuff I know gives you the validators and if you want to use Hibernate for your persistence provider. The commons-*.jar and jboss-seam.jar are def. needed.

              For the war project I have added the components.xml and pages.xml to the WEB-INF section. You should also see the faces-config.xml there to.

              For the libs for the war project I have the following. Some of them you might need such if you are using richfaces or remoting for instance.

              ajax4jsf-1.1.1.jar
              jboss-cache-jdk50.jar
              jboss-el.jar
              jboss-seam-debug.jar
              jboss-seam-remoting.jar
              jboss-seam-ui.jar
              richfaces-3.0.1.jar
              
              And of course the facelets.jar
              


              As I mentioned your best bet is probably to start with a seam-gen application. Then create a new Enterprise Application in NB. Take the seam generated files I mentioned previously and place them in those locations I mentioned. Then configure both the ejb and war projects with those required jars I mentioned. If you can get that up and running you are on your way.

              Good Luck

              S.D.

              • 4. Re: Jboss Seam+Facelet!
                samdoyle

                Oh one more thing I have been building on the latest CVS of Seam 2.0 not the package you download.

                • 5. Re: Jboss Seam+Facelet!
                  samdoyle

                  And one more very important thing.

                  The jndi-pattern that you might see in the examples or seam-gen applications need to be changed to.

                  java:comp/env/<your ear name>/#{ejbName}/local
                  


                  The JEE5 examples have this set properly.

                  • 6. Re: Jboss Seam+Facelet!
                    vprasanx

                    Hi Sam,

                    Thanks for the reply. Now I managed to get rid of that error. But, after deploying the app, when I try to load the .xhtml file from the index page, I get the following error.

                    Error Loading Library: jar:file:/C:/Program%20Files/glassfish-v2-b53/domains/domain1/applications/j2ee-apps/SVPSeam/SVPSeam-war_war/WEB-INF/lib/ajax4jsf-1.1.1.jar!/META-INF/a4j.taglib.xml
                    java.io.FileNotFoundException: C:\Program%20Files\glassfish-v2-b53\domains\domain1\applications\j2ee-apps\SVPSeam\jsf-facelets.jar (The system cannot find the path specified)
                    at java.util.zip.ZipFile.open(Native Method)
                    at java.util.zip.ZipFile.(ZipFile.java:114)
                    at java.util.jar.JarFile.(JarFile.java:133)
                    at java.util.jar.JarFile.(JarFile.java:70)
                    at sun.net.www.protocol.jar.URLJarFile.(URLJarFile.java:72)
                    at sun.net.www.protocol.jar.URLJarFile.getJarFile(URLJarFile.java:48)
                    at sun.net.www.protocol.jar.JarFileFactory.get(JarFileFactory.java:78)
                    at sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:104)
                    at sun.net.www.protocol.jar.JarURLConnection.getInputStream(JarURLConnection.java:132)
                    at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
                    at org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown Source)
                    at org.apache.xerces.impl.XMLEntityManager.startDTDEntity(Unknown Source)
                    at org.apache.xerces.impl.XMLDTDScannerImpl.setInputSource(Unknown Source)
                    at org.apache.xerces.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(Unknown Source)
                    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
                    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
                    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
                    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
                    at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
                    at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
                    at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
                    at javax.xml.parsers.SAXParser.parse(SAXParser.java:198)
                    at com.sun.facelets.compiler.TagLibraryConfig.create(TagLibraryConfig.java:395)
                    at com.sun.facelets.compiler.TagLibraryConfig.loadImplicit(TagLibraryConfig.java:419)
                    at com.sun.facelets.compiler.Compiler.initialize(Compiler.java:87)
                    at com.sun.facelets.compiler.Compiler.compile(Compiler.java:104)
                    at com.sun.facelets.impl.DefaultFaceletFactory.createFacelet(DefaultFaceletFactory.java:197)
                    at com.sun.facelets.impl.DefaultFaceletFactory.getFacelet(DefaultFaceletFactory.java:144)
                    at com.sun.facelets.impl.DefaultFaceletFactory.getFacelet(DefaultFaceletFactory.java:95)
                    at com.sun.facelets.FaceletViewHandler.buildView(FaceletViewHandler.java:496)
                    at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:546)
                    at org.ajax4jsf.framework.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
                    at org.ajax4jsf.framework.ajax.AjaxViewHandler.renderView(AjaxViewHandler.java:233)
                    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
                    at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
                    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
                    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
                    at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
                    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:317)
                    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
                    at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
                    at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:87)
                    at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                    at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:63)
                    at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                    at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:46)
                    at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                    at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:127)
                    at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:277)
                    at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:40)
                    at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                    at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:140)
                    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
                    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
                    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:288)
                    at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
                    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
                    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:624)
                    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
                    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
                    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
                    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:624)
                    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
                    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
                    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
                    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
                    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:624)
                    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
                    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
                    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
                    at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:268)
                    at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:631)
                    at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:562)
                    at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:803)
                    at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:339)
                    at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:261)
                    at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:212)
                    at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
                    at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
                    Missing Built-in Tag Libraries! Make sure they are included within the META-INF directory of Facelets' Jar
                    /template-client.xhtml not found at jndi:/server/SVPSeam-war/template-client.xhtml


                    I have not used the seam-gen app. I'm trying to setup development framework with Jboss-seam.jar & also have facelet incorporated. Netbeans IDE 5.5.1 does support facelet framework. I have added the required jars.
                    This jsf-facelets.jar, I have added in .war section. But still the app says the jar is not found. And when I trace the path C:\Program%20Files\glassfish-v2-b53\domains\domain1\applications\j2ee-apps\SVPSeam\jsf-facelets.jar (The system cannot find the path specified) - the jar is present. Also I notice a peculiar thing. With Sun Java App server 9.1(Glassfishv53) if application.xml is present, the application doesn't deploy.

                    Please throw some insight/insinuation to the above problem as I'm moving nowhere with that.

                    Thanks,
                    Venkates