jonas456
jonas456

Reputation: 33

JSF Tomcat 7 PropertyNotFoundException

I encounter a PropertyNotFoundException after upgrading from tomcat 6 to tomcat 7. This is the message I get:

value="#{someHandler.result.someList[1].doSomething(someDTO.id).value}": Property 'doSomething' not found on type com.someproject.SomeClass

Can anyone explain why? I'm using jsf 2 (myfaces implementation), and yes, doSomething is no property, but value is. It works fine with tomcat 6. I get this exception after pressing a button (which would make the page refresh after doing some database access). The form is rendered fine the first time it is invoked!

Thank you!

Upvotes: 0

Views: 528

Answers (1)

BalusC
BalusC

Reputation: 1108722

doSomething(someDTO.id)

EL prior 2.2 does by default not support method invocations like that. So why it works on Tomcat 6 which uses EL 2.1 is beyond me. Probably it had a custom EL implementation in its /lib folder.

However, since Tomcat 7.0 support EL 2.2, it should definitely work fine out the box on Tomcat 7.0. The only prerequirement is that your web.xml is declared conform the Servlet 3.0 spec so that EL 2.2 features will be triggered.

Ensure that your web.xml complies Servlet 3.0 and not 2.5 or older:

<?xml version="1.0" encoding="UTF-8"?>
<web-app
    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_3_0.xsd"
    version="3.0">

    <!-- config here -->
</web-app>

Upvotes: 1

Related Questions