aspose file tools*
The moose likes JSF and the fly likes Moving from GlassFish V3 to JBoss AS7: JasperException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Moving from GlassFish V3 to JBoss AS7: JasperException "#{..} is not allowed in template text"" Watch "Moving from GlassFish V3 to JBoss AS7: JasperException "#{..} is not allowed in template text"" New topic
Author

Moving from GlassFish V3 to JBoss AS7: JasperException "#{..} is not allowed in template text"

Jorge Campins
Greenhorn

Joined: Nov 04, 2012
Posts: 2
I'm moving a JEE application from GlassFish V3 to JBoss AS 7. First problem I had was that init() and destroy() methods of my JSF managed beans were not been invoked. I added @PostConstruct and @PreDestroy annotations to those methods and that solved the problem. Just out of curiosity, I did the same thing in my GlassFish platform and both init() and destroy() methods were executed twice.

Now I'm stuck with a JasperException. JSP pages are not rendered. I'm getting a JasperException that says "#{..} is not allowed in template text". I googled it and I came up with a bunch of recommendations to move to Facelets. The application is using old-style jsp files with woodsotck visual components. Given the project deadline, moving it to Facelets doesn't seem feasible.

My GlassFish V3 platform has Mojarra 2.1.6 and my JBoss AS 7 platform has Mojarra 2.1.7.

So far I haven't been able to determine the reason for all these problems. I hope someone can point me in the right direction.

This is the exception (you will find the jsp file, the web.xml file and the faces-config.xml file after the exception):

org.apache.jasper.JasperException: /Menu.jsp(6,59) #{..} is not allowed in template text
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40) [jbossweb-7.0.13.Final.jar:]
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407) [jbossweb-7.0.13.Final.jar:]
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:102) [jbossweb-7.0.13.Final.jar:]
at org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:756) [jbossweb-7.0.13.Final.jar:]
at org.apache.jasper.compiler.Node$UninterpretedTag.accept(Node.java:1246) [jbossweb-7.0.13.Final.jar:]
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2377) [jbossweb-7.0.13.Final.jar:]
at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2427) [jbossweb-7.0.13.Final.jar:]
at org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:881) [jbossweb-7.0.13.Final.jar:]
at org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1530) [jbossweb-7.0.13.Final.jar:]
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2377) [jbossweb-7.0.13.Final.jar:]
at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2427) [jbossweb-7.0.13.Final.jar:]
at org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:518) [jbossweb-7.0.13.Final.jar:]
at org.apache.jasper.compiler.Node$JspRoot.accept(Node.java:584) [jbossweb-7.0.13.Final.jar:]
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2377) [jbossweb-7.0.13.Final.jar:]
at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2427) [jbossweb-7.0.13.Final.jar:]
at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2433) [jbossweb-7.0.13.Final.jar:]
at org.apache.jasper.compiler.Node$Root.accept(Node.java:495) [jbossweb-7.0.13.Final.jar:]
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2377) [jbossweb-7.0.13.Final.jar:]
at org.apache.jasper.compiler.Validator.validateExDirectives(Validator.java:1793) [jbossweb-7.0.13.Final.jar:]
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:211) [jbossweb-7.0.13.Final.jar:]
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:360) [jbossweb-7.0.13.Final.jar:]
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:340) [jbossweb-7.0.13.Final.jar:]
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:327) [jbossweb-7.0.13.Final.jar:]
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:607) [jbossweb-7.0.13.Final.jar:]
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:312) [jbossweb-7.0.13.Final.jar:]
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326) [jbossweb-7.0.13.Final.jar:]
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253) [jbossweb-7.0.13.Final.jar:]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:840) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:622) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:560) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:488) [jbossweb-7.0.13.Final.jar:]
at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:546) [jsf-impl-2.1.7-jbossorg-2.jar:]
... 28 more



This is the jsp file:

<?xml version="1.0" encoding="UTF-8"?>
<jsp:root version="2.1" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:webuijsf="http://www.sun.com/webui/webuijsf">
<!-- Menu.jsp -->
<jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
<f:view>
<webuijsf:page binding="#{Menu.page1}" id="page1">
<webuijsf:html binding="#{Menu.html1}" id="html1">
<webuijsf:head binding="#{Menu.head1}" id="head1" title="#{ApplicationBean1.nombreAplicacion}">
<webuijsf:link binding="#{Menu.link1}" id="link1" url="/resources/stylesheet.css"/>
<webuijsf:script binding="#{Menu.script1}" id="script1" url="/resources/javascript1.js"/>
</webuijsf:head>
<webuijsf:body binding="#{Menu.body1}" id="body1" onClick="#{ApplicationBean1.contextoAplicacion.onClickJavaScript}"
onDblClick="#{ApplicationBean1.contextoAplicacion.onDblClickJavaScript}"
onKeyPress="#{ApplicationBean1.contextoAplicacion.onKeyPressJavaScript}" onLoad="#{ApplicationBean1.contextoAplicacion.onLoadJavaScript}"
onUnload="#{ApplicationBean1.contextoAplicacion.onUnloadJavaScript}" styleClass="pdq-body-1">
<webuijsf:form binding="#{Menu.form1}" id="form1" virtualFormsConfig="virtualForm1 | | , virtualForm2 | listaOpcionZum1 | botonAplicarZum1 botonQuitarZum1 , virtualForm3 | | , virtualForm4 | |">
<div class="pos-div-cab-1">
<jsp:directive.include file="FragmentoCabeza1.jspf"/>
</div>
<div class="pos-div-cab-2">
<jsp:directive.include file="FragmentoCabeza2M.jspf"/>
</div>
<div class="pos-div-fork">
<div class="pos-div-col-izq">
<jsp:directive.include file="FragmentoColumnaIzquierda.jspf"/>
</div>
<div class="pos-div-col-der">
<div class="pos-div-cab-3">
<jsp:directive.include file="FragmentoCabeza3.jspf"/>
<webuijsf:breadcrumbs binding="#{Menu.breadcrumbs1}" id="breadcrumbs1" rendered="false" styleClass="pdq-breadcrumbs-1"/>
</div>
<div class="pdq-div-filtro-1">
<h:panelGrid binding="#{Menu.gridPanel7}" columns="10" id="gridPanel7" rendered="#{Menu.gestor.designing}" style="height: 36px">
<webuijsf:label binding="#{Menu.etiquetaListaOpcionZum1}" for="listaOpcionZum1" id="etiquetaListaOpcionZum1" text="Zum"/>
<webuijsf:dropDown binding="#{Menu.listaOpcionZum1}" converter="#{Menu.integerConverter1}" id="listaOpcionZum1"
items="#{Menu.gestor.opcionesZumNodo}" required="true" selected="#{Menu.opcionZumSeleccionada}"/>
<webuijsf:button actionExpression="#{Menu.botonAplicarZum1_action}" binding="#{Menu.botonAplicarZum1}"
id="botonAplicarZum1" styleClass="pdq-button-1" text="Aplicar"/>
<webuijsf:button actionExpression="#{Menu.botonQuitarZum1_action}" binding="#{Menu.botonQuitarZum1}"
id="botonQuitarZum1" styleClass="pdq-button-1" text="Quitar"/>
</h:panelGrid>
</div>
<div class="pos-div-detalle">
<h:panelGrid binding="#{Menu.gridPanel1}" id="gridPanel1">
<webuijsf:tree binding="#{Menu.tree1}" id="tree1" style="#{Menu.gestor.estiloArbol}" styleClass="pdq-body-1"/>
</h:panelGrid>
</div>
<div class="pos-div-pie-3">
<jsp:directive.include file="FragmentoPie3.jspf"/>
</div>
</div>
<div class="pos-div-join">
<jsp:directive.include file="FragmentoJoin.jspf"/>
</div>
</div>
<div class="pos-div-pie-2">
<jsp:directive.include file="FragmentoPie2.jspf"/>
</div>
<div class="pos-div-pie-1">
<jsp:directive.include file="FragmentoPie1.jspf"/>
</div>
<webuijsf:anchor binding="#{Menu.anclaPie1}" id="anclaPie1"/>
</webuijsf:form>
</webuijsf:body>
</webuijsf:html>
</webuijsf:page>
</f:view>
</jsp:root>



This is the web.xml file:

<?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">
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.numberOfLogicalViews </param-name>
<param-value>45</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.numberOfViewsInSession</param-name>
<param-value>45</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>com.sun.faces.verifyObjects</param-name>
<param-value>false</param-value>
</context-param>
<filter>
<filter-name>UploadFilter</filter-name>
<filter-class>com.sun.webui.jsf.util.UploadFilter</filter-class>
<init-param>
<description>The maximum allowed upload size in bytes. If this is set to a negative value, there is no maximum. The default value is 1000000.</description>
<param-name>maxSize</param-name>
<param-value>2000000</param-value>
</init-param>
<init-param>
<description>The size (in bytes) of an uploaded file which, if it is exceeded, will cause the file to be written directly to disk instead of stored in memory. Files smaller than or equal to this size will be stored in memory. The default value is 4096.</description>
<param-name>sizeThreshold</param-name>
<param-value>4096</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>UploadFilter</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<init-param>
<param-name>javax.faces.LIFECYCLE_ID</param-name>
<param-value>com.sun.faces.lifecycle.PARTIAL</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>ExceptionHandlerServlet</servlet-name>
<servlet-class>com.sun.errorhandler.ExceptionHandler</servlet-class>
<init-param>
<param-name>errorHost</param-name>
<param-value>localhost</param-value>
</init-param>
<init-param>
<param-name>errorPort</param-name>
<param-value>24444</param-value>
</init-param>
</servlet>
<servlet>
<servlet-name>ThemeServlet</servlet-name>
<servlet-class>com.sun.webui.theme.ThemeServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>ExceptionHandlerServlet</servlet-name>
<url-pattern>/error/ExceptionHandler</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>ThemeServlet</servlet-name>
<url-pattern>/theme/*</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>
<error-page>
<exception-type>javax.servlet.ServletException</exception-type>
<location>/error/ExceptionHandler</location>
</error-page>
<error-page>
<exception-type>java.io.IOException</exception-type>
<location>/error/ExceptionHandler</location>
</error-page>
<error-page>
<exception-type>javax.faces.FacesException</exception-type>
<location>/error/ExceptionHandler</location>
</error-page>
<error-page>
<exception-type>com.sun.rave.web.ui.appbase.ApplicationException</exception-type>
<location>/error/ExceptionHandler</location>
</error-page>
<jsp-config>
<jsp-property-group>
<url-pattern>*.jspf</url-pattern>
<is-xml>true</is-xml>
</jsp-property-group>
</jsp-config>
<security-constraint>
<web-resource-collection>
<web-resource-name>Area Publica</web-resource-name>
<description>Hojas de Estilo, Imagenes, etc</description>
<url-pattern>/resources/*</url-pattern>
</web-resource-collection>
</security-constraint>
<security-constraint>
<web-resource-collection>
<web-resource-name>Area Privada</web-resource-name>
<description>Gestion del Programa de Pension Alimentaria</description>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>SuperGestor</role-name>
<role-name>SuperLector</role-name>
<role-name>Operador</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<realm-name/>
<form-login-config>
<form-login-page>/login.jsp</form-login-page>
<form-error-page>/error.jsp</form-error-page>
</form-login-config>
</login-config>
<ejb-local-ref>
<description>FacadeBeanLocator EJB Local Reference</description>
<ejb-ref-name>ejb/FacadeBeanLocator</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local>com.egt.ejb.persistence.FacadeBeanLocatorLocal</local>
<ejb-link>mhzap201-ejb-persistence.jar#FacadeBeanLocatorBean</ejb-link>
</ejb-local-ref>
<resource-ref>
<description>Visual Web generated DataSource Reference</description>
<res-ref-name>jdbc/mhzap201</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</web-app>



This is the faces-config.xml 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>
<resource-bundle>
<base-name>com.egt.web.Bundle</base-name>
<var>bundle</var>
</resource-bundle>
</application>
<managed-bean>
<managed-bean-name>ApplicationBean1</managed-bean-name>
<managed-bean-class>com.egt.web.ApplicationBean1</managed-bean-class>
<managed-bean-scope>application</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>SessionBean1</managed-bean-name>
<managed-bean-class>com.egt.web.SessionBean1</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>RequestBean1</managed-bean-name>
<managed-bean-class>com.egt.web.RequestBean1</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>FragmentoCabeza1</managed-bean-name>
<managed-bean-class>com.egt.web.FragmentoCabeza1</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>FragmentoCabeza2</managed-bean-name>
<managed-bean-class>com.egt.web.FragmentoCabeza2</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>FragmentoCabeza2A</managed-bean-name>
<managed-bean-class>com.egt.web.FragmentoCabeza2A</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>FragmentoCabeza2I</managed-bean-name>
<managed-bean-class>com.egt.web.FragmentoCabeza2I</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>FragmentoCabeza2M</managed-bean-name>
<managed-bean-class>com.egt.web.FragmentoCabeza2M</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>FragmentoCabeza2P</managed-bean-name>
<managed-bean-class>com.egt.web.FragmentoCabeza2P</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>FragmentoCabeza3</managed-bean-name>
<managed-bean-class>com.egt.web.FragmentoCabeza3</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>FragmentoColumnaIzquierda</managed-bean-name>
<managed-bean-class>com.egt.web.FragmentoColumnaIzquierda</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>FragmentoDetalle</managed-bean-name>
<managed-bean-class>com.egt.web.FragmentoDetalle</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>FragmentoFiltro</managed-bean-name>
<managed-bean-class>com.egt.web.FragmentoFiltro</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>FragmentoFiltro_1</managed-bean-name>
<managed-bean-class>com.egt.web.FragmentoFiltro_1</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>FragmentoJoin</managed-bean-name>
<managed-bean-class>com.egt.web.FragmentoJoin</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>FragmentoMenuVertical</managed-bean-name>
<managed-bean-class>com.egt.web.FragmentoMenuVertical</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>FragmentoPie1</managed-bean-name>
<managed-bean-class>com.egt.web.FragmentoPie1</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>FragmentoPie2</managed-bean-name>
<managed-bean-class>com.egt.web.FragmentoPie2</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>FragmentoPie3</managed-bean-name>
<managed-bean-class>com.egt.web.FragmentoPie3</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>Ayuda</managed-bean-name>
<managed-bean-class>com.egt.web.Ayuda</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>Inicio</managed-bean-name>
<managed-bean-class>com.egt.web.Inicio</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>Menu</managed-bean-name>
<managed-bean-class>com.egt.web.Menu</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>Favoritos</managed-bean-name>
<managed-bean-class>com.egt.web.Favoritos</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>Password</managed-bean-name>
<managed-bean-class>com.egt.web.Password</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
</faces-config>
Jorge Campins
Greenhorn

Joined: Nov 04, 2012
Posts: 2
I've found a solution for the JasperException. It seems that JBoss cannot find the TLD file of the woodstock components tag library unless it is placed on WEB-INF/tld.

So I extracted the webui-jsf.tld file from the webui-jsf.jar and put it there. Now my application seems to be working fine.

I still don't understand why these differences between two "standard" JSF implementations.

Perhaps someone could explain it to me. I would really appreciate it.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16137
    
  21

JBoss 5 and later (approximately) are not J2EE servers, they are JEE servers. What this primarily means for you is that JSF2.0 is an integral part of the servers. And in JSF2. the JSP View Definition Language is deprecated - you should be using the Facelets VDL (.xhtml). The Jasper compiler compiles JSPs, and in JSF2, that mechanism is not used with Faces View Definitions.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Moving from GlassFish V3 to JBoss AS7: JasperException "#{..} is not allowed in template text"