jeudi 2 juillet 2015

Tomcat 8 cannot access protected member via reflection

I have a very strange situation. Reflection in my application works on Tomcat 7 but not on Tomcat 8. I am using reflection to inspect common field from generated objects by name.

What happens is that when application is ran on Tomcat 8 i get illegal access exception.

Field field = response.getClass().getDeclaredField(RESPONSE_FIELD);

        field.setAccessible(true);

        // get response status
        String status = (String) field.get(response);



java.lang.IllegalAccessException: Class com.siemens.ccf.services.DistributedCustomerCareService can not access a member of class com.siemens.ccf.generated.CcfGetProfileRes with modifiers "protected".

I have no clue how is this error possible, does anyboe have an idea?

Note: Java 7 is used on both PCs.





Aucun commentaire:

Enregistrer un commentaire