h1

JSF with JSP 2.1 on Sun App Server 9.1

06/24/2008

Wizdoc [Icon By Buuf]

 Tips & Tricks

SP

Versión en Español

Otra vez la burra al trigo[1]. Now, a user needs to publish a web service implemented in XFire and two Web applications that include Java Server Faces, Spring and Hibernate on an application server; As we were originally asked for Weblogic licenses, we said to ourselves "ummm… we should include a Sun Application Server quotation instead, to see if they like it". Of course, considering they needed 10 licenses, the amount saved by our customers is pretty step (more than US$100,000 in savings) and we were asked for a small proof of concept (POC) that included load testing to see if the App Server was well suited to their needs.

As I had to do some juggling bringing together people from development, application support and infrastructure, I could not perform the tests as I wanted and I opted instead for the installation of two working instances of the last versions of the Application Server (8.2 and 9.1), in such way that they will eventually perform their own tests. I hope that by speaking with the department manager it is easier to close the deal, and I no longer have to be dealing with these boys. This is because every minute they keep annoying me with comments like "hey, I can do this with Weblogic, you can’t do it with your application server, do you?" and obviously I have to show them you can – as a reference, the Sun Application Server 9.1 is the equivalent in almost all functionality aspects to the Weblogic 9 – but the explanations consume a lot of my time and we can’t move forward with the installation and testing.

The technicalities

When deploying the web application on the Sun Application Server 9.1 it throws the following error:

[#| 2008-03-11T19:11:19.343+0000 | SEVERE | sun-appserver9.1 | javax.enterprise.system.container.web | _ThreadID=21;_ThreadName=httpSSLWorkerThread-8080-0;_RequestID=5b0615d8-92de-49d1-b74a-c07777fc1175; | StandardWrapperValve[jsp]: PWC1406: Servlet.service() para el servlet jsp desencadenó una excepción

org.apache.jasper.JasperException: /WEB-INF/tags/ext/body.tag(104,4) PWC6038: "${empty(extLocation)?"js/ext-2.0":extLocation}" contiene expresiones no válidas: javax.el.ELException: Error Parsing: ${empty(extLocation)?"js/ext-2.0":extLocation}

at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:62)
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:357)
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:169)

Where the code snippet that is the root of the problem is as follows:


 98 <%@ include file="inc/taglibs.jsp" %>
 99 <%@ tag import="org.apache.commons.beanutils.BeanUtils, java.util.Scanner"
100   dynamic-attributes="dynamicAttributes"
101   description="" %>
102
103 <c:set var="extLocation">
104   ${empty(extLocation)?"js/ext-2.0":extLocation}
105 </c:set>
106
107 <link rel="stylesheet" type="text/css" href="${extLocation} /resources/css/ext-all.css" />

And although at first glance there is nothing wrong with it and in some forums it is recommended to configure the web.xml to prevent expression parsing among the jsp tags, the real source of the problem has to do with the JSP specification, which is the version 2.1 for the Sun Application Server 9.1; the libraries that throw this kind of errors are written with the JSP 2.0 Specification.

The solution

The amazing news is, the new JSP Specification for JEE 5 requires spaces for the ternary operator (<expression> ? <if true> : <if false>). Therefore, if we change the previous code snippet with the following:


 98 <%@ include file="inc/taglibs.jsp" %>
 99 <%@ tag import="org.apache.commons.beanutils.BeanUtils, java.util.Scanner"
100   dynamic-attributes="dynamicAttributes"
101   description="" %>
102
103 <c:set var="extLocation">
104   ${empty(extLocation) ? "js/ext-2.0" : extLocation}
105 </c:set>
106
107 <link rel="stylesheet" type="text/css" href="${extLocation} /resources/css/ext-all.css" />

The application should work correctly. Note: You may need to do the same "space adding" scheme in more than one configuration file in order to prevent any error of this kind from happening again.

Conclusions

Although I do not know the JEE 5 Specification cin all its extent, it is unusual that it has problems with the OGNL libraries such as this, which are practically the base of any web framework like Struts or Tapestry. In the meantime, I am waiting for these "kids" to end up their load tests successfully so I can go with the Head Honcho to tell him "Did you see? Everything works just as fine; please sign this cheque here."

Responder

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión / Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión / Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión / Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión / Cambiar )

Conectando a %s

A %d blogueros les gusta esto: