Tuesday 15 February 2011

java - Mojarra JSF 2.1 fails to call correct method after upgrade to JDK7 -


We look at changing our Sun.JDK6 + JT6 to our large webpop (using primfaces, mojorra 2.1, jetty) Oracle JDK 7+ Jetty 9. It was mostly painless, but it seems that the methods of using method 7 are different.

P>

  public object getValue (string _name) {...}   and  
  # {myBean.getValue (index) }   

using the correct method ( int parameter) and return true value under Java 6. In Java 7, however, it will fail silently and do not return / print anything. When I change the name of the method and use the proper name in the JSF file, the accessibility function is as expected.

Why am I seeing this only on Java 7 and there is a way of restoring the old behavior (which, basically, works like this in Java code - using the correct method is the class of parameters ( SE))?

This is not specific to JSF / Moserra, but for example, while using MyFaces You had only one problem.

You were facing a bug in the EL implementation used by Jetty, it does not clearly take the method when looking for a method parameter type (how the EL function works properly) . Buggy EL implementation will loop only on class # getDeclaredMethods () and select the first matching the name and ignore the parameter types as you can read,

... The elements of the given array have not been solved and are not in any particular order ...

The order is unspecified. Basically, under cover, it becomes JVM Dependent on / version This at least tells the difference when switching to JVM.

I recommend that you use the EL method to upgrade or change the name of your method.

No comments:

Post a Comment