spring-projects / spring-framework

Spring Framework
https://spring.io/projects/spring-framework
Apache License 2.0
56.68k stars 38.15k forks source link

VfsResource.getFile() broken on Wildfly 14.0.1 [SPR-17563] #22095

Closed spring-projects-issues closed 5 years ago

spring-projects-issues commented 5 years ago

Kristiaan Lenaerts opened SPR-17563 and commented

Deployment of the Apereo CAS application https://apereo.github.io/cas/5.3.x/ on wildfly 14.0.1 fails with following stacktrace: 14:58:14,539 ERROR [org.springframework.boot.SpringApplication] (ServerService Thread Pool -- 95) Application startup failed: java.lang.IllegalArgumentException: object is not an instance of declaring class at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.core.io.VfsUtils.invokeVfsMethod(VfsUtils.java:100) at org.springframework.core.io.VfsUtils.getFile(VfsUtils.java:172) at org.springframework.core.io.VfsResource.getFile(VfsResource.java:90) at org.apereo.cas.util.CasVersion.getDateTime(CasVersion.java:59) at org.apereo.cas.util.SystemUtils.getSystemInfo(SystemUtils.java:50)

This also affect Jboss EAP 7.1.5 and 6.4.21

This is caused by a change in the VFS layer: https://github.com/jbossas/jboss-vfs/pull/28 The proposed fix https://github.com/jbossas/jboss-vfs/pull/30 does not reintroduce the old behaviour, but adds a new accessor that can be used to get the undelying file.

The workaround from Drools can be found here: https://github.com/kiegroup/drools/commit/2a36f67 - this should work on either version of wildfly/jboss


Affects: 4.3.19

Reference URL: https://groups.google.com/forum/#!topic/jasig-cas-user/Vk9hcFRg9Bw

spring-projects-issues commented 5 years ago

Juergen Hoeller commented

As far as I can tell, the fix needs to go into https://github.com/apereo/cas/blob/master/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/CasVersion.java since the VfsResource instance is being created from a getContent() call there. At the Spring Framework level, we're just expecting VfsResource to be created with a VirtualFile instance, and for all internal code paths of ours, this is still reliably the case. And for an externally created VfsResource instance, it is the calling code's responsibility to pass in a matching resource handle.

rkrishna-gembrill commented 5 years ago

I'm facing the same issue. Is it resolved

rkrishna-gembrill commented 5 years ago

tried with cas 6x and wildfly 15. have the same issue

rkrishna-gembrill commented 5 years ago

I'm not sure is this is a sprig fix or cas or wildlfy