Seam + PrimeFaces --> Stuck on "javax.faces.FacesException"

UI Components for JSF
User avatar
chec69
Posts: 9
Joined: 29 Jan 2010, 21:42

25 Feb 2010, 17:52

Using netbeans 6.8 to make the code and jboss-5.1.0.GA server with Seam Framework.
im using jsf 1.2

i have included
primefaces-1.0.0.jar on the .war directory of the .ear file

this is the jsf code:

Code: Select all

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:rich="http://richfaces.org/rich"
    xmlns:p="http://primefaces.prime.com.tr/ui"
    template="layout/template.xhtml">
// this  "ui:define name= "head" " tag is something im testing since in the getting started page it says to put this on the <head> tag if you are using //jsf 1.2 
    <ui:define name="head">
        <p:resources />
    </ui:define>

    <ui:define name="body">

  <h3>Simple Panel</h3>
  <p:panel header="About Barca" footer="Visca el Barca!">
    <h:outputText value="People behind PrimeFaces are hardcore F.C. Barcelona fans and many examples in the demo applications reflect this. Despite of this fact
     PrimeFaces library is open source and free to use, that means Real Madrid fans are also welcomed to use the library :)" />
 </p:panel>

  


    </ui:define>
</ui:composition>
but i keep getting the exception

so i took out the

Code: Select all

                                         <ui:define name="head">
                                         <p:resources />
                                         </ui:define>
                             
since it was me trying to make prime work
and instead i put
the

Code: Select all

<head>
<p:resources/>
</head>
after building and deploying
the "javax.faces.FacesException" :( appeared on the next primefaces component the one that i was trying to make it work
this is the code:

Code: Select all

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:rich="http://richfaces.org/rich"
    xmlns:p="http://primefaces.prime.com.tr/ui"
    template="layout/template.xhtml">

    <ui:define name="body">
 <head>
        <p:resources />
    </head>

    <ui:define name="body">

  <h3>Simple Panel</h3>
  <p:panel header="About Barca" footer="Visca el Barca!">
    <h:outputText value="People behind PrimeFaces are hardcore F.C. Barcelona fans and many examples in the demo applications reflect this. Despite of this fact
     PrimeFaces library is open source and free to use, that means Real Madrid fans are also welcomed to use the library :)" />
 </p:panel>
    </ui:define>
</ui:composition>
and this is the exception on the jboss log:

ERROR [compiler] Error Loading Library: vfszip:/opt/jboss-5.1.0.GA/server/default/deploy/testPrime.ear/testPrime.war/WEB-INF/lib/primefaces-1.0.0.jar/META-INF/primefaces-p.taglib.xml
java.io.IOException: Error parsing [vfszip:/opt/jboss-5.1.0.GA/server/default/deploy/testPrime.ear/testPrime.war/WEB-INF/lib/primefaces-1.0.0.jar/META-INF/primefaces-p.taglib.xml]:
at com.sun.facelets.compiler.TagLibraryConfig.create(TagLibraryConfig.java:410)
at com.sun.facelets.compiler.TagLibraryConfig.loadImplicit(TagLibraryConfig.java:431)
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:218)
at com.sun.facelets.impl.DefaultFaceletFactory.getFacelet(DefaultFaceletFactory.java:149)
and since i didnt got any exception with the <p:resources> because it was out of the <ui:define name="body"><ui:define> i did the same with the
<h3>Simple Panel</h3>
<p:panel header="About Barca" footer="Visca el Barca!">
<h:outputText value="People behind PrimeFaces are hardcore F.C. Barcelona fans and many examples in the demo applications reflect this. Despite of this fact
PrimeFaces library is open source and free to use, that means Real Madrid fans are also welcomed to use the library :)" />
</p:panel>
the page loaded, but i didnt saw the component showing
but i did got the same exception on the jboss server, just that this time it wasnt showing on the browser

any Help?
Last edited by chec69 on 25 Feb 2010, 19:00, edited 1 time in total.

User avatar
chec69
Posts: 9
Joined: 29 Jan 2010, 21:42

25 Feb 2010, 18:58

Even do i should have know this before, and i did, but wasn't considering it since I'm using the
<head>
<p:resources>
</head>
from the getting started page, i thought that using it plus the jsf page normal structure could work but its not.

Seam 2.2 doesn't have support for jsf 2.0 ill probably have to wait for Seam 3 to see that, until that i still have stuff to do
i have read that primefaces can be use with Seam
if anyone have any guideline to correctly make a simple jsf with primefaces component over the Seam framework to work please let me know :)

jsfcoder
Posts: 17
Joined: 08 Feb 2010, 08:31

26 Feb 2010, 15:18

I'm using seam 2.1.2 + jbossas 4.2.3 package with war, and seam-gen ...
so far ok.

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

02 Mar 2010, 15:17

I remember an issue with JBOSS 5, can you try with other servers to help us identify the root of the problem. Maybe JBOSS 4 or tomcat, jetty?

Thanks.

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

02 Mar 2010, 15:35


rafaelri
Posts: 17
Joined: 01 Mar 2010, 15:05

02 Mar 2010, 15:56

Hi!

As I saw you are running JB 5.1.0 try packaging your application as I described on this post (since it is working) http://primefaces.prime.com.tr/forum/vi ... f=3&t=1504 (also note that this application was deployed as an exploded ear/war).
Could you also please paste the rest of the stacktrace (if there were any rest) since it seems like this is the uppermost exception we may have a lot of "caused by" below.

User avatar
chec69
Posts: 9
Joined: 29 Jan 2010, 21:42

09 Mar 2010, 18:06

Thanks jsfcoder, cagatay.civici and rafaelri for the reply: i found a solution to that problem. It was mainly a configuration problem.
and this its how i did it, for anyone who needs to run PrimeFaces + Seam in eclipse using the plugin.

this is my workspace configuration

jboss-5.1.0.GA
jboss-seam-2.2.0.GA
Eclipse-Galileo + jboss tools plug in.
postgres 8



First create your project an assure that the home.xhtml its rendering and showing everything after deployment.
i did had an issue before deploying successfully, it was with the persistence.xml file that had the property set to the hibernate default
in case u have this problem too this is how i fixed it.

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!-- Persistence deployment descriptor for dev profile -->
<persistence xmlns="http://java.sun.com/xml/ns/persistence" 
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" 
             version="1.0">
             
   <persistence-unit name="SeamPrimeTest">
      <provider>org.hibernate.ejb.HibernatePersistence</provider>
      <jta-data-source>java:/SeamPrimeTestDatasource</jta-data-source>
      <!-- The <jar-file> element is necessary if you put the persistence.xml in the WAR and the classes in the JAR -->
      <!--
      <jar-file>../../vehicles.jar</jar-file>
      
 
   
   
   <properties>
      <property name="hibernate.hbm2ddl.auto" value="" /> <!-- drop/create tables @startup, drop tables @shutdown -->


                <!-- Database Connection Settings -->
      
                <property name="hibernate.connection.driver_class" value="org.postgresql.Driver" />
                <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
                <property name="hibernate.show_sql" value="true"/>
         <property name="hibernate.format_sql" value="true"/>
         <property name="jboss.entity.manager.factory.jndi.name" value="java:/SeamPrimeTestEntityManagerFactory"/>
                <property name="hibernate.connection.username" value="sitmobb" />
                <property name="hibernate.connection.password" value="sitmobb" />
                <property name="hibernate.connection.url" value="jdbc:postgresql://177.26.14.3:5432/Testseam" />
      
      
      </properties>
   
   
   
   
   
   
   </persistence-unit>
    
</persistence>
Next add this libraries to the web-inf/lib folder of the "Web app Libraries" folder, not with eclipse, but manually in the folders path
the libraries are
primefaces-1.0.0.jar
slf4-api-1.5.8.jar
slf4-simple-1.4.8.jar

after that make shure the libraries are in the buildpath, if necesary close eclipse and reopen it, the libraries should appear in the WEB-INF/lib folder o "Web app Libraries" in eclipse

after that you must modify the template.xhtml file in the layout folder
you have to add these lines of code to make Prime components work


and the
<p:resources />
the template.xhtml should look like this

Code: Select all


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<f:view xmlns="http://www.w3.org/1999/xhtml"
   xmlns:ui="http://java.sun.com/jsf/facelets"
   xmlns:f="http://java.sun.com/jsf/core"
   xmlns:h="http://java.sun.com/jsf/html"
   xmlns:a="http://richfaces.org/a4j"
   xmlns:s="http://jboss.com/products/seam/taglib"
!---  xmlns:p="http://primefaces.prime.com.tr/ui"  ---!
   contentType="text/html">
<html>
  <head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
      <title>SeamPrimeTest</title>
      <link rel="shortcut icon" href="#{request.contextPath}/favicon.ico"/>
      <a:loadStyle src="resource:///stylesheet/theme.xcss"/>
      <a:loadStyle src="/stylesheet/theme.css"/>
      <ui:insert name="head"/>
      !--- <p:resources /> ---!
   </head>
   <body>
      <ui:include src="menu.xhtml">
         <ui:param name="projectName" value="SeamPrimeTest"/>
      </ui:include>
      <div class="body">
         <h:messages id="messages" globalOnly="true" styleClass="message"
            errorClass="errormsg" infoClass="infomsg" warnClass="warnmsg"
            rendered="#{showGlobalMessages != 'false'}"/>
         <ui:insert name="body"/>
      </div>
      <div class="footer">
         <p>Powered by <a href="http://seamframework.org">Seam</a> #{org.jboss.seam.version} and <a href="http://www.jboss.org/jbossrichfaces">RichFaces</a>. Generated by seam-gen.</p>
         <s:fragment rendered="#{init.debug}">
         <a:log hotkey="D"/>
         <p style="margin-top: -0.5em;">
            Conversation: id = #{conversation.id}, #{conversation.longRunning ? 'long running' : 'temporary'}#{conversation.nested ? ', nested, parent id = '.concat(conversation.parentId) : ''}
            #{' - '}
            Ajax4jsf Log (Ctrl+Shift+D)
            #{' - '}
            <s:link id="debugConsole" view="/debug.xhtml" value="Debug console" target="debugConsole"/>
            #{' - '}
            <s:link id="resetSession" view="/home.xhtml" action="#{org.jboss.seam.web.session.invalidate}" propagation="none" value="Terminate session"/>
         </p>
         </s:fragment>
      </div>
   </body>
</html>
</f:view>


(this is from the getting started page http://www.primefaces.org/gettingStarted.html)
oh and dont forget to set the resource servlet in the web.xml file


after that create a .xhtml file or as i did modify the home.xhtml file that the plugins generates by default
ex:

Code: Select all

<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:rich="http://richfaces.org/rich"
    xmlns:a4j="http://richfaces.org/a4j"
   
    xmlns:p="http://primefaces.prime.com.tr/ui"  
  
    template="layout/template.xhtml">
        <!-- xmlns:p="http://primefaces.prime.com.tr/ui"  --> 
<ui:define name ="head">

</ui:define>
    <ui:define name="body">


 
    
    <p:panel id="anyPanle" header="The Prime Panel">
    And it Works !!
    </p:panel>
        
  
       
       
        


    


   </ui:define>
</ui:composition>



after that, save it and deploy. Now you can play with the primeFaces components wich are really sweet :D among other stuff it can be done..
hope it helps you
if anything post a message or send me a P.M.

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

09 Mar 2010, 18:24

Thanks for sharing your solution. Just one note, PrimeFaces does not use slf4j so if you've added slf4j for PrimeFaces it is safe to remove it.

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

09 Mar 2010, 18:25

Also for JSF 2.0 and PrimeFaces 2.x make sure you don't have FaceletViewHandler defined in faces-config.xml as PrimeFaces 2 runs on JSF2's standard Facelets not the old one. That might cause create taglibrary exceptions.

kvic
Posts: 4
Joined: 11 Mar 2010, 04:33

11 Mar 2010, 04:42

Dear chec69,

i follow your guide still error

Code: Select all

...primefaces-p.taglib.xml]: 
same your first error.

i remove FaceletViewHandler defined in faces-config.xml. still the same error.

Using seam 2.2.0.GA(create project from seam-gen)
primeface 2.0.0
jboss 5

template.xhtml should be set taglib or not?? see your look like comment.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 51 guests