You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Volodymyr Siedlecki (Jira)" <de...@myfaces.apache.org> on 2023/03/17 14:53:00 UTC

[jira] [Comment Edited] (MYFACES-4469) "java.lang.IllegalArgumentException: object is not an instance of declaring class" occurs in FacesConfigurator.purgeConfiguration

    [ https://issues.apache.org/jira/browse/MYFACES-4469?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17701824#comment-17701824 ] 

Volodymyr Siedlecki edited comment on MYFACES-4469 at 3/17/23 2:52 PM:
-----------------------------------------------------------------------

Reopening – I have a successful fix for the user who experienced this issue.

They create  war in one time zone (difference of 1 hour), but deploy in another.  Once an hour passes, the exception occurs. 



Somehow this triggers the code to call the purgeConfiguration code here: [https://github.com/apache/myfaces/blob/4a996076a298b3767dab5e16fd312d5221e6b14a/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java#L383-L394]

Fix is fairly simply as all we need to do is unwrap the objects to ensure we invoke the methods on the right classes.

I'll update the existing PR in a bit.


was (Author: volosied):
Reopening – I have a successful fix for the user who experienced this issue.

They create  war in one time zone, but deploy in another. 

Somehow this triggers the code to call the purgeConfiguration code here: [https://github.com/apache/myfaces/blob/4a996076a298b3767dab5e16fd312d5221e6b14a/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java#L383-L394]

Fix is fairly simply as all we need to do is unwrap the objects to ensure we invoke the methods on the right classes. 

I'll update the existing PR in a bit.

> "java.lang.IllegalArgumentException: object is not an instance of declaring class" occurs in FacesConfigurator.purgeConfiguration 
> ----------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: MYFACES-4469
>                 URL: https://issues.apache.org/jira/browse/MYFACES-4469
>             Project: MyFaces Core
>          Issue Type: Bug
>    Affects Versions: 4.0.0-RC1, 2.3.10, 2.3-next-M7, 3.0.2
>            Reporter: Volodymyr Siedlecki
>            Assignee: Volodymyr Siedlecki
>            Priority: Minor
>
> If an application uses a custom factory via META-INF/services (such as javax.faces.application.ApplicationFactory), then a purge failure can occur when in *development mode* when an *update occurs to the faces-config.xml.* Additionally, the server must not restart the application (which can occur).
> {code:java}
> java.lang.IllegalArgumentException: object is not an instance of declaring class
> …
> at java.lang.reflect.Method.invoke(Method.java:508)
> org.apache.myfaces.config.FacesConfigurator.purgeConfiguration(FacesConfigurator.java:555)
> at org.apache.myfaces.config.FacesConfigurator.update(FacesConfigurator.java:485)
> at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:136){code}
> Code where the exception can occur: [https://github.com/apache/myfaces/blob/e9fe59f96410f31a7f5c0fbd6838c1a22683a691/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java#L452-L456]
> getPurgeMethod unwraps the factory to get the method, but it then calls the private method on the wrong class ( which doesn't have that purge method)



--
This message was sent by Atlassian Jira
(v8.20.10#820010)