1

I am using hashset.toArray()[x] to display a element in the jsf view, and this is working fine in my machine. But when I move this on to test server, the above error is thrown.

Both machines are running tomcat 7.

what is causing this error?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Ssv
  • 1,059
  • 4
  • 14
  • 25
  • version of Hibernate on local and on Test server? Also JSF version on local and on test? – rahul maindargi Apr 24 '13 at 15:26
  • It's weird, because the message is correct. A `PersistentSet` has a *method* `toArray`, not a *property*. The EL is actually trying to access the property `getToArray()` and the result is an exception. Please show us the code that's working on your machine (jsf + bean). Using it in a display tag shouldn't actually work AFAIK. – Fritz Apr 24 '13 at 15:31

1 Answers1

1

The ability to invoke arbitrary non-property-related methods in EL is introduced in EL version 2.2 which goes hand in hand with Servlet 3.0. This feature didn't exist in older versions like Servlet 2.5 / EL 2.1.

So, if you deploy your webapp to a Servlet 3.0 compatible container with a Servlet 3.0 compatible web.xml root declaration, then it will work fine. However, if you deploy your webapp to a container of an older version, or with a web.xml which dictates an older version, or have dropped arbitrary container-specific JAR files of an older version inside webapp's /WEB-INF/lib or even server's own /lib, then this feature won't work.

Provided that you're absolutely positive that the test server is running Tomcat 7 and thus not Tomcat 6 or so, then that can only mean that the web.xml was been changed to dictate an older version, or that your webapp or server's /lib is littered with arbitrary container-specific JAR files such as jsp-api.jar, el-api.jar, etc which would only conflict with container's own libraries (this is often done by ignorant starters in order to workaround compilation errors they face in their IDE; which should have been solved differently).

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555