Hello,
I have a problem in my web project. I’m using JSF mojarra 2.0 with Facelets and its template system, JDK 1.6, Hibernate 3.2.5, Primefaces 2.0.0, all of it running in a Tomcat 6.0.24, developing in Netbeans 6.8 and deploying in an HP-UX machine. The problem: I get residual code in the page. That is, if I have an EL expression like
#{myBean.myMethod}
in my. xhtml page, when I render it in the browser I get something like
yBean.myM
in the middle of the page. Sometimes I also get something like
<h:commandLink id="sortHic" styleC
but when I see the code it is rendered like
<h:commandLink id="sortHic" styleC
what leads me to think it is generated by JSF. I also get this problem with HTML tags like
div class=”
We even get a general XML parsing errors sometimes. When I get this error, I get a Java error like
“EL Unbalanced expression #{myBean.my”
(and the expression is perfectly closed)
This problem occurs in every browser (FF, IE7 and IE8). From time to time, this can be easily solved by adding a line inside the affected page before the <?xml... tag in the beginning and deleting it afterwards, but sometimes not. We get the error again a couple of days later, even when restarting the application or the Tomcat instance. Every time we make a deployment with changes in the pages, these residual apparatus changes of content and position. We have removed the HTML comments when making a deployment to the HP-UX machine. That helped, but not solved the problem.
The thing is, we develop in a Windows environment and we don’t get this error. It does only occur in the HP-UX environment.
I would appreciate any hepl in this. I am really at my wit's end.
This is my faces-config.xml configuration file:
<?xml version='1.0' encoding='UTF-8'?>
<!-- =========== FULL CONFIGURATION FILE ================================== -->
<faces-config version="2.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/web-facesconfig_2_0.xsd">
<application>
<message-bundle>application</message-bundle>
<message-bundle>bundle</message-bundle>
<locale-config>
<default-locale>en</default-locale>
<supported-locale>en</supported-locale>
</locale-config>
</application>
<component>
</component>
<render-kit>
<renderer>
</renderer>
</render-kit>
<navigation-rule>
<from-view-id>*</from-view-id>
<navigation-case>
<from-outcome>logout</from-outcome>
<to-view-id>/index.xhtml</to-view-id>
</navigation-case>
<converter>
<converter-class>selectItemConverter</converter-class>
</converter>
<lifecycle>
<phase-listener>...</phase-listener>
</lifecycle>
<factory>
<exception-handler-factory>
...
</exception-handler-factory>
</factory>
[b]This is my web.xml file:[/b]
<?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">
<description>Developed by: edatasystems GmbH, 2010</description>
<display-name>m/reliability/fleet - DEV</display-name>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Production</param-value>
</context-param>
<context-param>
<description>Facelets additional taglibs</description>
<param-name>javax.faces.FACELETS_LIBRARIES</param-name>
<param-value>/WEB-INF/tlds/custom-taglib.tld.xml</param-value>
</context-param>
<context-param>
<description>Don't render show html commernts</description>
<param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.allowTextChildren</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<filter>
<filter-name>File Upload Filter</filter-name>
<filter-class>...</filter-class>
</filter>
<filter>
<filter-name>HibernateTransactionFilter</filter-name>
<filter-class>...</filter-class>
</filter>
<filter-mapping>
<filter-name>File Upload Filter</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
<filter-mapping>
<filter-name>HibernateTransactionFilter</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
<listener>
<listener-class>”A Session Listener</listener-class>
</listener>
<listener>
<listener-class>A Context Listener</listener-class>
</listener>
<listener>
<listener-class>org.apache.commons.fileupload.servlet.FileCleanerCleanup</listener-class>
</listener>
<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>
<servlet>
<servlet-name>Resource Servlet</servlet-name>
<servlet-class>org.primefaces.resource.ResourceServlet</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Resource Servlet</servlet-name>
<url-pattern>/primefaces_resource/*</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>ImageServlet</servlet-name>
<servlet-class>...</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ImageServlet</servlet-name>
<url-pattern>/ImageServlet/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>faces/index.xhtml</welcome-file>
</welcome-file-list>
<!-- We don't allow any URL here -->
<security-constraint>
<web-resource-collection>
<web-resource-name>Default</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint/>
</security-constraint>
<!-- We now specify which URL are allowed -->
<security-constraint>
<web-resource-collection>
<web-resource-name>Faces Context</web-resource-name>
<url-pattern>/</url-pattern>
<url-pattern>/faces/*</url-pattern>
<url-pattern>/resources/*</url-pattern>
<url-pattern>/primefaces_resource/*</url-pattern>
<url-pattern>/primefaces_comet/*</url-pattern>
</web-resource-collection>
</security-constraint>
<error-page>
<error-code>403</error-code>
<location>/faces/noaccess.xhtml? </location>
</error-page>
<error-page>
<exception-type>java.lang.Throwable</exception-type>
<location>/faces/noaccess.xhtml </location>
</error-page>
</web-app>
This is my hibernate configuration file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "
http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>
<property name="hibernate.connection.driver_class">oracle.jdbc.OracleDriver</property>
<property name="hibernate.connection.url">...</property>
<property name="hibernate.connection.username">...</property>
<property name="hibernate.connection.password">...</property>
<property name="hibernate.connection.c3pO.min_size">1</property>
<property name="hibernate.connection.c3pO.max_size">5</property>
<property name="hibernate.connection.c3pO.initial_pool_size">
1
</property>
<property name="hibernate.connection.c3pO.max_statements">
20
</property>
<property name="hibernate.connection.c3p0.maxIdleTime">
1000
</property>
<property name="hibernate.connection.c3p0.maxConnectionAge">
1000
</property>
<property
name="hibernate.connection.c3p0.maxIdleTimeExcessConnections">
300
</property>
<mapping resource="......" />
.
.
.
..
</session-factory>
</hibernate-configuration>
The context.xml file in the tomcat/conf/Catalina/machine/ directory is this:
<?xml version="1.0" encoding="UTF-8"?>
<Context debug="true"
docBase="... /webapps/application"
path="/application "
reloadable="true"
crossContext="true" >
<WatchedResource>WEB-INF/web.xml</WatchedResource>
</Context>
I have a facelets template file, which looks like this:
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml"
xmlns:ui="
http://java.sun.com/jsf/facelets"
xmlns:h="
http://java.sun.com/jsf/html"
xmlns:f="
http://java.sun.com/jsf/core"
xmlns:ezcomp="
http://java.sun.com/jsf/composite/ezcomp"
xmlns:p="
http://primefaces.prime.com.tr/ui">
<f:view>
<f:loadBundle var="bundle" basename="bundle" />
<h:head>
<title><h:outputText value="#{ApplicationBean.appLongName}"/></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="Cache-Control" content="no-cache, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta name="MSSmartTagsPreventParsing" content="true" />
<meta http-equiv="imagetoolbar" content="no" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<script type="text/javascript">
//<![CDATA[
.
.
.
.
.
.
.
//]]>
</script>
<ezcomp:headLink href="#{ApplicationBean.applicationPath}resources/css/..." rel="stylesheet" type="text/css" />
<style type="text/css">
.yui-skin-sam .mask {
...
}
/** Override for default primefaces autcomplete components **/
.yui-skin-sam .yui-ac-bd{
...
}
/* styles for results list */
...
}
/* styles for result item */
.yui-skin-sam .yui-ac-content li {
...
}
/**move the list closer to input autocomplete **/
.yui-skin-sam .yui-ac-content{
...
}
</style>
</h:head>
<h:body onload="pageLoaded()" onkeypress="keyPressHandler(event);">
<h:form id="contentForm" prependId="false" enctype="multipart/form-data">
<div id="header">
<ui:insert id="headerInsert" name="header">Header</ui:insert>
</div>
<div id="navigationPath">
<ui:insert id="navigationInsert" name="navigationPath">NavigationPath</ui:insert>
</div>
<div id="news">
<ui:insert id="" name="news">News</ui:insert>
</div>
<div id="headline">
<ui:insert name="headline">headline</ui:insert>
</div>
<div class="ContentLayer" style="z-index: 130; height: 100%" >
<div id="ErrorLayer" class="ErrorLayer error"
style="display: none;">
Login failed. Please try again.
</div>
<div id="mainContent" class="mainContentDiv">
<div id="contentsubView">
<ui:insert id="contentInsert" name="content">content</ui:insert>
</div>
</div>
<div id="footerLayer" style="position: relative">
<div id="footer">
<ui:insert id="foterInsert" name="footer">footer</ui:insert>
</div>
</div>
</div>
<div id="mainMenu">
<ui:insert id="mainMenuInsert" name="mainMenu">mainmenu</ui:insert>
</div>
<ui:insert id="dialogsInsert" name="dialogs">
</ui:insert>
<p:dialog...>
.
.
.
</p:dialog>
<script type="text/javascript">
//<![CDATA[
//]]>
</script>
</h:form>
</h:body>
</f:view>
</html>
In the content section I would include a page like this:
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="
http://java.sun.com/jsf/facelets"
xmlns:p="
http://primefaces.prime.com.tr/ui"
xmlns:h="
http://java.sun.com/jsf/html"
xmlns:f="
http://java.sun.com/jsf/core"
xmlns:lht="
http://lht.com/custom-taglib"
template="../template.xhtml"
xmlns:c="
http://java.sun.com/jsp/jstl/core">
<ui:define name="header">
<ui:include src="header.xhtml" />
<script type="text/javascript">
//<![CDATA[
.
.
.
.
//]]>
</script>
</ui:define>
<ui:define name="navigationPath">
</ui:define>
<ui:define name="news">
</ui:define>
<ui:define name="headline">
<ui:include src="headline_.xhtml" />
</ui:define>
<ui:define name="content">
.
.
here goes the page code.
.
.
.
</ui:define>
<ui:define name="footer">
<ui:include src="footer.xhtml" />
</ui:define>
<ui:define name="mainMenu">
<ui:include src="mainMenu.xhtml" />
</ui:define>
<ui:define name="dialogs">
</ui:define>
</ui:composition>
Any ideas?
[Message sent by forum member 'raulpalma']
http://forums.java.net/jive/thread.jspa?messageID=486032