Support du VFS 2 de JBoss 5 dans Spring 4

logo-spring-framework

Ce billet solutionne un problème rencontré lors de la montée de version du famework Spring  de la version 3.2 à la version 4.0. En effet, le déploiement d’une application sous JBoss 5.1 EAP échouait dès l’initialisation du contexte Spring. Plus précisément, une exception était levée lorsque Spring scanne le classpath à la recherche de beans Spring annotés par les annotations  @Repository, @Service, @Controller …
Comme le montre la pile d’appel complète ci-dessous, l’exception java.lang.ClassNotFoundException: org.jboss.vfs.VFS est encapsulée dans l’exception java.lang.IllegalStateException: Could not detect JBoss VFS infrastructure

Ce problème ne m’était initialement pas apparu lors des développements sous Eclipse avec le plugin JBoss Tools pour WTP : Spring n’a aucun mai à trouver les beans d’un WAR ou d’un EAR explosé. Cette erreur s’est manifestée  lors du déploiement manuel de l’EAR dans le répertoire deploy de JBoss puis du démarrage du serveur par la commande run.bat.

14:01:54,811 INFO  [STDOUT] 14:01:54.811 | ERROR | Context initialization failed
	| org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:336)
java.lang.ExceptionInInitializerError: null
        at org.springframework.core.io.support.PathMatchingResourcePatternResolver$VfsResourceMatchingDelegate.findMatchingResources(PathMatchingResourcePatternResolver.java:652) ~[spring-core-4.0.2.RELEASE.jar:4.0.2.RELEASE]
        at org.springframework.core.io.support.PathMatchingResourcePatternResolver.findPathMatchingResources(PathMatchingResourcePatternResolver.java:347) ~[spring-core-4.0.2.RELEASE.jar:4.0.2.RELEASE]
        at org.springframework.core.io.support.PathMatchingResourcePatternResolver.getResources(PathMatchingResourcePatternResolver.java:269) ~[spring-core-4.0.2.RELEASE.jar:4.0.2.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.getResources(AbstractApplicationContext.java:1170) ~[spring-context-4.0.2.RELEASE.jar:4.0.2.RELEASE]
        at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:268) ~[spring-context-4.0.2.RELEASE.jar:4.0.2.RELEASE]
        at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:242) ~[spring-context-4.0.2.RELEASE.jar:4.0.2.RELEASE]
        at org.springframework.context.annotation.ComponentScanAnnotationParser.parse(ComponentScanAnnotationParser.java:134) ~[spring-context-4.0.2.RELEASE.jar:4.0.2.RELEASE]
        at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:236) ~[spring-context-4.0.2.RELEASE.jar:4.0.2.RELEASE]
        at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:205) ~[spring-context-4.0.2.RELEASE.jar:4.0.2.RELEASE]
        at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:426) ~[spring-context-4.0.2.RELEASE.jar:4.0.2.RELEASE]
        at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:248) ~[spring-context-4.0.2.RELEASE.jar:4.0.2.RELEASE]
        at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:205) ~[spring-context-4.0.2.RELEASE.jar:4.0.2.RELEASE]
        at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:182) ~[spring-context-4.0.2.RELEASE.jar:4.0.2.RELEASE]
        at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:152) ~[spring-context-4.0.2.RELEASE.jar:4.0.2.RELEASE]
        at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:299) ~[spring-context-4.0.2.RELEASE.jar:4.0.2.RELEASE]
        at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:243) ~[spring-context-4.0.2.RELEASE.jar:4.0.2.RELEASE]
        at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:254) ~[spring-context-4.0.2.RELEASE.jar:4.0.2.RELEASE]
        at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:94) ~[spring-context-4.0.2.RELEASE.jar:4.0.2.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:609) ~[spring-context-4.0.2.RELEASE.jar:4.0.2.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464) ~[spring-context-4.0.2.RELEASE.jar:4.0.2.RELEASE]
        at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403) ~[spring-web-4.0.2.RELEASE.jar:4.0.2.RELEASE]
        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306) ~[spring-web-4.0.2.RELEASE.jar:4.0.2.RELEASE]
        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106) [spring-web-4.0.2.RELEASE.jar:4.0.2.RELEASE]
				... X common frames omitted
        at java.lang.Thread.run(Thread.java:662) [na:1.6.0_26]
Caused by: java.lang.IllegalStateException: Could not detect JBoss VFS infrastructure
        at org.springframework.core.io.VfsUtils.<clinit>(VfsUtils.java:92) ~[spring-core-4.0.2.RELEASE.jar:4.0.2.RELEASE]
        ... 93 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.jboss.vfs.VFS from BaseClassLoader@1269ac3{vfszip:/C:/dev/servers/jboss-eap-5.1/server/default/deploy/myapp-ear-1.0.0-SNAPSHOT.ear/}
        at org.jboss.classloader.spi.base.BaseClassLoader.loadClass(BaseClassLoader.java:477) ~[jboss-classloader.jar:2.0.9.GA]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:247) ~[na:1.6.0_26]
        at org.springframework.core.io.VfsUtils.<clinit>(VfsUtils.java:69) ~[spring-core-4.0.2.RELEASE.jar:4.0.2.RELEASE]
        ... 93 common frames omitted
14:01:55,014 ERROR [StandardContext] Error listenerStart

 Diagnostic

Les versions communautaires JBoss AS 5 et commerciales JBoss 5 EAP s’appuient toutes les deux sur la version 2 du Virtual File System.  Or, comme l’atteste le commit de Juergen Hoeller dans GitHub, le support de VFS 2 a été volontairement retiré de Spring 4.

Comme je m’y attendais, je ne suis pas le seul développeur à  regretter cet abandon. Le forum de Spring en donne une idée. Qui plus est, la documentation de Spring n’est pas tout à fait à jour à ce sujet. J’ai soumis la pull request concernant la JavaDoc de la classe VfsResource.

Réactivation de VFS2

Rétablir le support de VFS 2 dans Spring 4 n’a pas été très compliqué. J’ai tout simplement dupliqué le code de la classe VfsUtils de Spring 3.2 dans la classe Vfs2Utils. Il a ensuite été nécessaire d’implémenter l’interface ResourcePatternResolver et de câbler cette implémentation dans les classes responsables du chargement du contexte applicatif Spring (qui héritent de la classe AbstractApplicationContext).

Pour celles et ceux que cela intéresserait, j’ai publié ces quelques classes dans le projet spring4-vfs2-support sous GitHub. Les 2 classes JBoss5XmlWebApplicationContext et JBoss5AnnotationConfigWebApplicationContext en sont les points d’entrée.

Utilisation

Pour utiliser Spring 4 avec JBoss 5, vous pouvez copier/coller le code du repo spring4-vfs2-support ou bien tirer la dépendance maven suivante :

<dependency>
  <groupId>com.javaetmoi.core</groupId>
  <artifactId>javaetmoi-spring4-vfs2-support</artifactId>
  <version>1.1.0</version>
</dependency>

L’artefact javaetmoi-spring4-vfs2-support est publié sur un repository maven hébergé par CloudBees. Ce repo doit être référencé dans votre proxy Maven d’Entreprise (ex : Nexus) ou bien déclaré dans votre pom.xml au niveau de la balise <repositories> :

<repository>
  <id>javaetmoi-maven-release</id>
  <releases>
    <enabled>true</enabled>
  </releases>
  <name>Java et Moi Maven RELEASE Repository</name>
  <url>http://repository-javaetmoi.forge.cloudbees.com/release/</url>
</repository>

Une fois la configuration Maven terminée, il reste à indiquer à Spring quelle classe il doit utiliser pour charger sa configuration. Exemple de configuration du listener ContextLoaderListener dans le web.xml :

<context-param>
  <param-name>contextClass</param-name>
  <param-value> com.javaetmoi.core.spring.JBoss5XmlWebApplicationContext</param-value>
</context-param>
<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

Conclusion

A l’exception de celles basées sur la spécification Servlet 3.0, vous pouvez souhaiter la bienvenues à toutes les nouveautés de Spring 4.

9 thoughts on “Support du VFS 2 de JBoss 5 dans Spring 4

  1. Hi, i’m trying to use your vfs2 patch for spring 4 but i have a constant exception:

     

    Caused by: java.lang.ExceptionInInitializerError
    at org.springframework.core.io.support.PathMatchingResourcePatternResolver$VfsResourceMatchingDelegate.findMatchingResources(PathMatchingResourcePatternResolver.java:721)
    at org.springframework.core.io.support.PathMatchingResourcePatternResolver.findPathMatchingResources(PathMatchingResourcePatternResolver.java:413)
    at org.springframework.core.io.support.PathMatchingResourcePatternResolver.getResources(PathMatchingResourcePatternResolver.java:273)
    at org.springframework.context.support.AbstractApplicationContext.getResources(AbstractApplicationContext.java:1159)
    at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:270)
    at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:248)
    at org.springframework.context.annotation.ComponentScanBeanDefinitionParser.parse(ComponentScanBeanDefinitionParser.java:87)
    at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:74)
    at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1427)
    at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1417)
    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:174)
    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:144)
    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:100)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:510)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:392)
    … 89 more
    Caused by: java.lang.IllegalStateException: Could not detect JBoss VFS infrastructure
    at org.springframework.core.io.VfsUtils.<clinit>(VfsUtils.java:94)
    … 104 more
    Caused by: java.lang.ClassNotFoundException: org.jboss.vfs.VFS from BaseClassLoader@11528488{VFSClassLoaderPolicy@407b059a{name=vfsfile:/home/sol/JBOSS5/sol/HEAD/deploy/sebina.ear/sebinaopac.war/ domain=ClassLoaderDomain@584caa92{name=vfsfile:/home/sol/JBOSS5/sol/HEAD/deploy/sebina.ear/sebinaopac.war/ parentPolicy=AFTER_BUT_JAVA_BEFORE parent=BaseClassLoader@66c2de47{vfsfile:/home/sol/JBOSS5/sol/HEAD/deploy/sebina.ear/}} roots=[DelegatingHandler@1286398600[path=sebina.ear/sebinaopac.war/WEB-INF/lib/ki-jzkit-hss.jar context=file:/home/sol/JBOSS5/sol/HEAD/deploy/ real=file:/home/sol/JBOSS5/sol/HEAD/deploy/sebina.ear/sebinaopac.war/WEB-INF/lib/ki-jzkit-hss.jar], DelegatingHandler@1783395851[path=sebina.ear/sebinaopac.war/WEB-INF/lib/spring-aop-4.1.6.RELEASE.jar context=file:/home/sol/JBOSS5/sol/HEAD/deploy/ real=file:/home/sol/JBOSS5/sol/HEAD/deploy/sebina.ear/sebinaopac.war/WEB-INF/lib/spring-aop-4.1.6.RELEASE.jar], DelegatingHandler@1104806578[path=sebina.ear/sebinaopac.war/WEB-INF/lib/velocity-1.6.4.jar context=file:/home/sol/JBOSS5/sol/HEAD/deploy/ real=file:/home/sol/JBOSS5/sol/HEAD/deploy/sebina.ear/sebinaopac.war/WEB-INF/lib/velocity-1.6.4.jar], DelegatingHandler@1340544484[path=sebina.ear/sebinaopac.war/WEB-INF/lib/velocity-tools-2.0.jar context=file:/home/sol/JBOSS5/sol/HEAD/deploy/ real=file:/home/sol/JBOSS5/sol/HEAD/deploy/sebina.ear/sebinaopac.war/WEB-INF/lib/velocity-tools-2.0.jar], DelegatingHandler@1280201911[path=sebina.ear/sebinaopac.war/WEB-INF/lib/ki-util.jar context=file:/home/sol/JBOSS5/sol/HEAD/deploy/ real=file:/home/sol/JBOSS5/sol/HEAD/deploy/sebina.ear/sebinaopac.war/WEB-INF/lib/ki-util.jar], DelegatingHandler@714858884[path=sebina.ear/sebinaopac.war/WEB-INF/lib/oclc-srw-DM.jar context=file:/home/sol/JBOSS5/sol/HEAD/deploy/ real=file:/home/sol/JBOSS5/sol/HEAD/deploy/sebina.ear/sebinaopac.war/WEB-INF/lib/oclc-srw-DM.jar], DelegatingHandler@1609742070[path=sebina.ear/sebinaopac.war/WEB-INF/lib/spring-context-4.1.6.RELEASE.jar context=file:/home/sol/JBOSS5/sol/HEAD/deploy/ real=file:/home/sol/JBOSS5/sol/HEAD/deploy/sebina.ear/sebinaopac.war/WEB-INF/lib/spring-context-4.1.6.RELEASE.jar], DelegatingHandler@935985584[path=sebina.ear/sebinaopac.war/WEB-INF/lib/spring-webmvc-4.1.6.RELEASE.jar context=file:/home/sol/JBOSS5/sol/HEAD/deploy/ real=file:/home/sol/JBOSS5/sol/HEAD/deploy/sebina.ear/sebinaopac.war/WEB-INF/lib/spring-webmvc-4.1.6.RELEASE.jar], DelegatingHandler@791996013[path=sebina.ear/sebinaopac.war/WEB-INF/lib/ki-jzkit-z3950-DM.jar context=file:/home/sol/JBOSS5/sol/HEAD/deploy/ real=file:/home/sol/JBOSS5/sol/HEAD/deploy/sebina.ear/sebinaopac.war/WEB-INF/lib/ki-jzkit-z3950-DM.jar], DelegatingHandler@973346385[path=sebina.ear/sebinaopac.war/WEB-INF/lib/SN_Opac.jar context=file:/home/sol/JBOSS5/sol/HEAD/deploy/ real=file:/home/sol/JBOSS5/sol/HEAD/deploy/sebina.ear/sebinaopac.war/WEB-INF/lib/SN_Opac.jar], DelegatingHandler@1649753496[path=sebina.ear/sebinaopac.war/WEB-INF/lib/h2-1.3.173.jar context=file:/home/sol/JBOSS5/sol/HEAD/deploy/ real=file:/home/sol/JBOSS5/sol/HEAD/deploy/sebina.ear/sebinaopac.war/WEB-INF/lib/h2-1.3.173.jar], DelegatingHandler@1245640855[path=sebina.ear/sebinaopac.war/WEB-INF/lib/taglibs-string.jar context=file:/home/sol/JBOSS5/sol/HEAD/deploy/ real=file:/home/sol/JBOSS5/sol/HEAD/deploy/sebina.ear/sebinaopac.war/WEB-INF/lib/taglibs-string.jar], DelegatingHandler@1815259029[path=sebina.ear/sebinaopac.war/WEB-INF/lib/javaetmoi-spring4-vfs2-support-1.4.0.jar context=file:/home/sol/JBOSS5/sol/HEAD/deploy/ real=file:/home/sol/JBOSS5/sol/HEAD/deploy/sebina.ear/sebinaopac.war/WEB-INF/lib/javaetmoi-spring4-vfs2-support-1.4.0.jar], DelegatingHandler@1905811121[path=sebina.ear/sebinaopac.war/WEB-INF/lib/spring-beans-4.1.6.RELEASE.jar context=file:/home/sol/JBOSS5/sol/HEAD/deploy/ real=file:/home/sol/JBOSS5/sol/HEAD/deploy/sebina.ear/sebinaopac.war/WEB-INF/lib/spring-beans-4.1.6.RELEASE.jar], DelegatingHandler@1248915642[path=sebina.ear/sebinaopac.war/WEB-INF/lib/spring-expression-4.1.6.RELEASE.jar context=file:/home/sol/JBOSS5/sol/HEAD/deploy/ real=file:/home/sol/JBOSS5/sol/HEAD/deploy/sebina.ear/sebinaopac.war/WEB-INF/lib/spring-expression-4.1.6.RELEASE.jar], DelegatingHandler@1020029316[path=sebina.ear/sebinaopac.war/WEB-INF/lib/spring-web-4.1.6.RELEASE.jar context=file:/home/sol/JBOSS5/sol/HEAD/deploy/ real=file:/home/sol/JBOSS5/sol/HEAD/deploy/sebina.ear/sebinaopac.war/WEB-INF/lib/spring-web-4.1.6.RELEASE.jar], DelegatingHandler@270760011[path=sebina.ear/sebinaopac.war/WEB-INF/lib/dwr.jar context=file:/home/sol/JBOSS5/sol/HEAD/deploy/ real=file:/home/sol/JBOSS5/sol/HEAD/deploy/sebina.ear/sebinaopac.war/WEB-INF/lib/dwr.jar], DelegatingHandler@145656884[path=sebina.ear/sebinaopac.war/WEB-INF/lib/oaicat.jar context=file:/home/sol/JBOSS5/sol/HEAD/deploy/ real=file:/home/sol/JBOSS5/sol/HEAD/deploy/sebina.ear/sebinaopac.war/WEB-INF/lib/oaicat.jar], DelegatingHandler@2071375455[path=sebina.ear/sebinaopac.war/WEB-INF/lib/ini4j-0.5.4.jar context=file:/home/sol/JBOSS5/sol/HEAD/deploy/ real=file:/home/sol/JBOSS5/sol/HEAD/deploy/sebina.ear/sebinaopac.war/WEB-INF/lib/ini4j-0.5.4.jar], DelegatingHandler@749870668[path=sebina.ear/sebinaopac.war/WEB-INF/lib/ki-jzkit-iface.jar context=file:/home/sol/JBOSS5/sol/HEAD/deploy/ real=file:/home/sol/JBOSS5/sol/HEAD/deploy/sebina.ear/sebinaopac.war/WEB-INF/lib/ki-jzkit-iface.jar], DelegatingHandler@1642276480[path=sebina.ear/sebinaopac.war/WEB-INF/lib/cql-java.jar context=file:/home/sol/JBOSS5/sol/HEAD/deploy/ real=file:/home/sol/JBOSS5/sol/HEAD/deploy/sebina.ear/sebinaopac.war/WEB-INF/lib/cql-java.jar], DelegatingHandler@133484469[path=sebina.ear/sebinaopac.war/WEB-INF/lib/harvester2.jar context=file:/home/sol/JBOSS5/sol/HEAD/deploy/ real=file:/home/sol/JBOSS5/sol/HEAD/deploy/sebina.ear/sebinaopac.war/WEB-INF/lib/harvester2.jar], DelegatingHandler@1500543015[path=sebina.ear/sebinaopac.war/WEB-INF/lib/spring-core-4.1.6.RELEASE.jar context=file:/home/sol/JBOSS5/sol/HEAD/deploy/ real=file:/home/sol/JBOSS5/sol/HEAD/deploy/sebina.ear/sebinaopac.war/WEB-INF/lib/spring-core-4.1.6.RELEASE.jar], DelegatingHandler@1725986384[path=sebina.ear/sebinaopac.war/WEB-INF/lib/sn_opac_ws_mlol.jar context=file:/home/sol/JBOSS5/sol/HEAD/deploy/ real=file:/home/sol/JBOSS5/sol/HEAD/deploy/sebina.ear/sebinaopac.war/WEB-INF/lib/sn_opac_ws_mlol.jar], DelegatingHandler@444052212[path=sebina.ear/sebinaopac.war/WEB-INF/lib/spring-context-support-4.1.6.RELEASE.jar context=file:/home/sol/JBOSS5/sol/HEAD/deploy/ real=file:/home/sol/JBOSS5/sol/HEAD/deploy/sebina.ear/sebinaopac.war/WEB-INF/lib/spring-context-support-4.1.6.RELEASE.jar]]  delegates=null exported=[org.springframework.asm, com.k_int.util.Configuration, , it.sebina.w.dwr, org.directwebremoting.util, de.fuberlin.wiwiss.pubby.negotiation, org.springframework.web.servlet.tags, org.apache.taglibs.string.util, com.akros.sebina.opac.lucene, com.akros.sebina.opac.cache, org.h2.util.data.zip.org.h2.res, com.k_int.gen.ESFormat_ItemOrder, org.springframework.beans.factory.access, org.springframework.objenesis.instantiator.jrockit, org.springframework.objenesis.instantiator.perc, ORG.oclc.oai.server.verb.extension, org.apache.velocity.io, org.springframework.validation.annotation, org.directwebremoting.contrib, org.springframework.web.servlet.view, org.springframework.instrument.classloading.tomcat, org.springframework.jmx.export.assembler, ORG.oclc.os.SRW.Normalization, com.k_int.util.PrefixLang, org.apache.velocity.tools.view.context, org.springframework.core.annotation, org.springframework.web.bind.annotation.support, com.akros.sebina.opac.model.stampe, org.springframework.context.config, org.h2.fulltext, org.springframework.mail.javamail, org.h2.api, com.k_int.gen.ResourceReport_Format_Resource_2, it.sebina.w.search.mlol, org.springframework.http.client.support, com.k_int.gen.ResourceReport_Format_Resource_1, gov.loc.www.zing.srw.service, org.springframework.beans.factory.annotation, gov.loc.www.zing.srw, it.sebina.w.bo.sebstore, org.springframework.objenesis.instantiator.gcj, org.springframework.util.concurrent, it.sebina.w.search.facet, org.springframework.cglib.reflect, ORG.oclc.os.SRW.Lucene, it.sebina.w.frbr, org.springframework.lang, org.apache.velocity.runtime, org.springframework.expression, org.springframework.http.server, com.k_int.util.ThreadPool, org.h2.mvstore.type, org.springframework.web.filter, it.sebina.w.dwr.bean.listmania, org.springframework.scheduling.annotation, org.springframework.ejb.config, org.springframework.web.servlet.mvc, org.springframework.core.type.filter, META-INF.services, com.akros.sebina.opac.model.z3950, org.springframework.web.context.request.async, com.k_int.gen.RecordSyntax_explain, org.apache.velocity.runtime.resource, org.springframework.ui.freemarker, org.springframework.core.env, ORG.oclc.oai.harvester2.verb, org.springframework.cglib.proxy, org.springframework.aop, org.springframework.cglib.transform.impl, org.springframework.validation.support, org.springframework.jmx, org.springframework.jmx.access, com.akros.sebina.opac.control, it.sebina.w.core, com.acme.oai, org.springframework.core, com.k_int.IR.Syntaxes, org.directwebremoting.impl, org.apache.velocity.texen.defaults, it.sebina.w.search.voc, org.springframework.cache.jcache.interceptor, org.springframework.util.comparator, org.springframework.ejb.access, org.apache.velocity.runtime.parser, org.springframework.aop.scope, org.springframework.aop.aspectj, org.springframework.aop.support.annotation, org.h2.engine, org.springframework.expression.spel.support, org.directwebremoting.convert, com.k_int.gen.ESFormat_Update0, org.springframework.web.servlet.theme, it.sebina.w.bo.upgrade, it.sebina.w.inout, org.apache.velocity.tools.view.tools, com.akros.sebina.opac.model.db, it.sebina.w.dwr.bean.wroot, it.medialibrary.www.services, org.directwebremoting.webwork, org.springframework.scheduling.concurrent, org.h2.upgrade, org.springframework.instrument.classloading, org.springframework.objenesis.instantiator.basic, org.h2.tools, org.springframework.jndi.support, org.springframework.core.type, org.springframework.http.converter.xml, org.springframework.aop.framework.adapter, org.springframework.context.weaving, it.sebina.w.search, com.akros.sebina.opac.model.OAI.harvester, org.directwebremoting.beehive, it.sebina.w.bo.tools, META-INF, org.h2.mvstore.db, org.springframework.cache.annotation, org.springframework.http.converter.json, org.apache.velocity.tools.struts, org.springframework.context.expression, org.springframework.http.client, it.sebina.w.bo.ws.profile, it.sebina.w.search.facet.thread, org.springframework.scheduling.commonj, it.sebina.w.batch.PMV, org.h2.mvstore.cache, com.k_int.util.SearchFactory, org.apache.velocity.servlet, org.springframework.aop.target.dynamic, com.k_int.gen, org.springframework.web.servlet.config, org.springframework.web.servlet.handler, it.sebina.w.search.spell.lucene.util, com.k_int.gen.RecordSyntax_opac, org.springframework.beans.factory, org.springframework.util, org.apache.velocity.exception, org.h2.security, it.sebina.w.bo.news, it.sebina.w.search.opensearch, it.sebina.w.dwr.bean.suggread, org.ini4j, com.k_int.z3950.util, it.sebina.w.embed, org.springframework.web.servlet.view.xml, org.springframework.aop.config, org.springframework.jmx.export.naming, org.springframework.aop.framework, org.directwebremoting.proxy.scriptaculous, org.directwebremoting.fluent, org.h2.jmx, org.springframework.aop.aspectj.autoproxy, org.springframework.objenesis.strategy, org.springframework.web.jsf, org.apache.velocity.runtime.parser.node, org.springframework.objenesis.instantiator, com.k_int.gen.Z39_50_APDU_1995, it.sebina.w.bo.listmania, com.k_int.gen.RecordSyntax_summary, org.springframework.cglib.beans, it.sebina.w.dipendenze, org.apache.velocity.runtime.defaults, org.springframework.beans.annotation, org.springframework.context.i18n, it.sebina.w.search.parser, org.springframework.instrument.classloading.websphere, it.sebina.w.bo.scroll, ORG.oclc.oai.server.catalog.helpers, org.springframework.beans.factory.xml, com.akros.sebina.opac.model.re, it.sebina.w.bo.novita, org.directwebremoting.create, org.springframework.web.servlet.mvc.annotation, com.akros.sebina.opac.model.OAI, org.apache.velocity.util, org.h2.server.pg, org.directwebremoting.faces, org.h2.util.data.zip.org.h2.server.pg, org.h2.command.dml, org.h2.message, org.springframework.aop.support, org.apache.velocity.util.introspection, org.apache.velocity.context, org.springframework.context.support, gov.loc.www.zing.srw.interfaces, com.akros.sebina.opac.model.documento, gov.loc.www.zing.cql.xcql, org.springframework.scheduling.support, it.sebina.w.bo, com.k_int.gen.ESFormat_Update, it.sebina.w.locale, com.k_int.gen.AccessControlFormat_krb_1, org.apache.velocity.tools, ORG.oclc.oai.server.catalog, org.directwebremoting.annotations, com.akros.sebina.opac.model.sru, it.sebina.w.inout.xls, ORG.oclc.oai.server.verb, org.springframework.format, org.springframework.web.method.annotation, org.springframework.util.backoff, org.springframework.web.method, org.springframework.ui, com.k_int.gen.DiagnosticFormatDiag1, com.k_int.z3950.server, org.springframework.web.bind, org.apache.velocity, org.springframework.scripting, org.h2.store.fs, org.springframework.objenesis, org.springframework.aop.interceptor, org.springframework.context.access, org.springframework.web.servlet.i18n, org.h2.schema, it.sebina.w.bo.tom, org.directwebremoting.spring, com.akros.sebina.opac.xml2idx.blend, it.sebina.w.search.shelf, org.springframework.web.multipart.support, ORG.oclc.os.SRW, org.springframework.web.client.support, com.k_int.gen.ESFormat_ExportInvocation, org.springframework.remoting.soap, org.apache.velocity.runtime.directive, org.springframework.web, com.k_int.util.Repository, org.springframework.ui.jasperreports, com.k_int.IR.QueryModels, org.h2.bnf, org.springframework.web.multipart.commons, it.sebina.w.cache, org.springframework.core.io.support, it.sebina.w.formbean, org.apache.velocity.runtime.log, org.springframework.remoting, org.springframework.web.method.support, org.apache.velocity.tools.generic.log, org.springframework.core.serializer, org.apache.velocity.runtime.resource.loader, org.springframework.core.convert.converter, org.springframework.aop.target, org.springframework.web.servlet.view.jasperreports, org.springframework.web.servlet, org.springframework.aop.framework.autoproxy.target, org.springframework.beans.factory.support, ORG.oclc.oai.harvester2.app, org.h2.command, org.springframework.expression.spel.standard, org.springframework.cache.transaction, org.springframework.web.servlet.mvc.support, org.springframework.jmx.export.notification, it.sebina.w.dwr.bean, org.springframework.ui.context, org.apache.velocity.convert, org.directwebremoting.guice.spring, it.sebina.w.bo.decalog, org.h2.constraint, com.akros.sebina.opac.model.ricerca, org.springframework.format.datetime.standard, gov.loc.www.zing.srw.diagnostic, it.sebina.w.hibernate, org.springframework.core.task, org.springframework.web.servlet.tags.form, it.sebina.w.search.spell, com.k_int.gen.RecordSyntax_generic, org.directwebremoting.servlet, org.h2, org.springframework.beans.factory.config, org.springframework.util.xml, org.springframework.context.annotation, org.springframework.format.annotation, org.springframework.remoting.support, org.springframework.web.servlet.resource, com.akros.sebina.opac.locale, org.springframework.web.servlet.mvc.method.annotation, org.springframework.web.servlet.mvc.method, it.sebina.w.bo.initcontext, org.springframework.web.servlet.view.velocity, org.h2.store, org.directwebremoting.hibernate, com.k_int.IR, org.directwebremoting.struts, com.k_int.util.RPNQueryRep, com.javaetmoi.core.spring, it.sebina.w.bo.stat.search, it.sebina.w.dwr.a.dashboard, org.springframework.context.event, org.h2.constant, it.sebina.w.dwr.a, org.springframework.jmx.support, it.sebina.w.dwr.d, it.sebina.w.core.less, org.springframework.mail, org.springframework.stereotype, org.springframework.remoting.caucho, org.apache.velocity.tools.view.servlet, org.springframework.cache.support, org.h2.index, org.springframework.web.servlet.support, org.springframework.instrument.classloading.glassfish, com.k_int.z3950.IRClient, org.h2.value, ORG.oclc.oai.server.crosswalk, com.akros.sebina.opac.util, it.sebina.w.search.suggest, org.springframework.scheduling.quartz, org.springframework.web.multipart, it.sebina.w.search.voc.test, com.k_int.gen.ESFormat_PeriodicQuerySchedule, org.springframework.beans.support, org.springframework.web.servlet.view.tiles3, org.springframework.web.servlet.view.tiles2, org.z3950.zing.cql, org.h2.table, com.k_int.gen.AccessControlFormat_prompt_1, org.springframework.scripting.groovy, it.sebina.w.search.dym, org.springframework.ui.velocity, com.k_int.gen.RecordSyntax_SUTRS, com.k_int.gen.NegotiationRecordDefinition_charSetandLanguageNegotiation_3, org.apache.velocity.texen, it.sebina.w.bo.gamification, it.sebina.w.bo.twitter, org.springframework.scripting.bsh, org.springframework.http.converter.protobuf, org.springframework.cache.concurrent, org.springframework.core.task.support, org.springframework.objenesis.instantiator.android, org.springframework.aop.framework.autoproxy, it.sebina.w.bo.ws, org.springframework.web.util, org.apache.velocity.tools.generic, com.akros.sebina.opac.conf.w, org.springframework.remoting.rmi, org.springframework.http.converter.support, org.springframework.format.number, it.sebina.w.bo.task, com.javaetmoi.core.spring.vfs, META-INF.maven.org.ini4j.ini4j, com.k_int.gen.ESFormat_PersistentQuery, org.springframework.cache.jcache.config, it.sebina.w.bo.cover, it.sebina.w.bo.cover.amazon, it.sebina.w.bo.analytics, org.springframework.beans.factory.wiring, org.springframework.ui.context.support, META-INF.maven.com.javaetmoi.core.javaetmoi-spring4-vfs2-support, org.springframework.aop.aspectj.annotation, org.springframework.cache.guava, org.springframework.scheduling.config, org.apache.velocity.app.tools, org.springframework.http.converter, org.springframework.web.jsf.el, org.springframework.cache.interceptor, com.akros.sebina.opac.taglib, org.springframework.jmx.export, org.springframework.beans.propertyeditors, org.springframework.core.serializer.support, org.springframework.beans.factory.access.el, org.springframework.web.servlet.view.document, org.springframework.web.accept, org.springframework.scripting.jruby, org.apache.velocity.texen.util, org.springframework.cache.jcache, com.k_int.util.SortSpecLang, com.akros.sebina.opac.model.OAI.harvester.utility, ORG.oclc.oai.server, org.directwebremoting.dwrp, org.springframework.scripting.support, org.springframework.jmx.export.metadata, org.springframework.core.io, org.springframework.context, org.h2.mvstore, com.k_int.gen.ESFormat_PersistentResultSet, org.springframework.web.context, org.directwebremoting.extend, com.k_int.gen.RecordSyntax_ESTaskPackage, org.springframework.beans.factory.groovy, org.springframework.scheduling, com.k_int.gen.AccessControlFormat_des_1, org.springframework.web.servlet.view.xslt, uk.ltd.getahead.dwr.compat, it.sebina.w.search.where, org.directwebremoting.guice, org.apache.velocity.app.event, com.k_int.util, org.springframework.instrument.classloading.jboss, com.k_int.IR.QueryModels.InternalQueryRep, it.sebina.w.dwr.bean.wchisiamo, org.springframework.beans, org.h2.util.data.zip.org.h2.server.web.res, org.h2.jdbcx, uk.ltd.getahead.dwr, org.springframework.jndi, gov.loc.www.zing.srw.srw_sample_service, org.h2.result, org.springframework.web.servlet.view.freemarker, gov.loc.www.zing.srw.srw_bindings, org.apache.velocity.tools.view.i18n, it.sebina.w.hibernate.q, org.springframework.expression.spel, com.akros.sebina.opac.xml2idx.xsl, it.sebina.w.dwr.bean.wavanzata, org.springframework.cglib.transform, org.springframework.expression.common, org.springframework.core.style, org.springframework.validation, org.springframework.cglib, com.k_int.gen.ElementSpecificationFormat_eSpec_1, org.h2.command.ddl, org.h2.expression, it.sebina.w.control.api, org.springframework.expression.spel.ast, org.springframework.validation.beanvalidation, org.apache.velocity.tools.config, com.akros.sebina.opac.lucene.mixin, org.apache.velocity.texen.ant, com.akros.sebina.opac.view, org.springframework.beans.factory.parsing, ORG.oclc.oai.util, org.apache.velocity.tools.view, it.sebina.w.bo.mlol, org.springframework.web.context.request, org.springframework.format.datetime.joda, org.springframework.remoting.jaxws, com.akros.sebina.opac.xml2idx, com.k_int.hss, org.springframework.core.convert, org.springframework.web.servlet.config.annotation, org.springframework.format.datetime, org.springframework.remoting.httpinvoker, org.springframework.beans.factory.serviceloader, it.sebina.w.dwr.w, org.apache.velocity.runtime.resource.util, org.apache.velocity.anakia, org.springframework.cglib.util, com.akros.sebina.opac.xml2idx.test, org.springframework.core.convert.support, com.k_int.util.CCL, com.k_int.gen.UserInfoFormat_searchResult_1, org.directwebremoting.proxy.dwr, org.springframework.cache, org.springframework.format.support, org.springframework.cache.ehcache, org.apache.velocity.app, org.directwebremoting.proxy, META-INF.eliminati.zip.eliminati.com.k_int.z3950.client, it.sebina.w.search.spell.lucene, org.springframework.http.converter.feed, org.springframework.http, org.springframework.web.servlet.view.groovy, org.springframework.jmx.export.annotation, org.directwebremoting.filter, it.sebina.w.bo.impactfactor, org.springframework.scripting.config, it.sebina.w.batch.cmstypo3, org.apache.velocity.tools.view.jsp, org.springframework.web.servlet.mvc.condition, com.k_int.IR.Syntaxes.Conversion, org.springframework.web.context.support, org.directwebremoting, org.springframework.instrument.classloading.weblogic, org.springframework.web.bind.support, com.akros.sebina.opac.conf, it.sebina.w.dwr.bean.pagesearch, org.apache.taglibs.string, org.h2.server, org.ini4j.spi, com.k_int.z3950.server.demo, it.sebina.w.batch, com.k_int.util.LoggingFacade, org.springframework.web.bind.annotation, org.springframework.web.servlet.mvc.multiaction, org.springframework.cache.config, org.h2.jdbc, org.springframework.web.client, com.akros.sebina.opac.model.dispo, it.sebina.w.bo.newsletter, com.k_int.gen.ESFormat_ExportSpecification, com.akros.sebina.opac.model.OAI.harvester.xharvestinglog, org.h2.server.web, org.apache.velocity.app.event.implement, com.akros.sebina.opac.xml2idx.opera, it.sebina.w.search.clump, org.springframework.web.servlet.view.feed, org.springframework.cglib.core, org.springframework.web.servlet.view.json, org.apache.velocity.runtime.visitor, it.sebina.w.control, org.h2.compress, it.sebina.w.test, org.h2.util, it.sebina.w.bo.ebook, org.h2.mvstore.rtree, org.springframework.core.type.classreading, it.sebina.w.search.searcherquery, org.springframework.ejb.interceptor, org.springframework.objenesis.instantiator.sun] <IMPORT-ALL>NON_EMPTY}}
    at org.jboss.classloader.spi.base.BaseClassLoader.loadClass(BaseClassLoader.java:448)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    at org.springframework.core.io.VfsUtils.<clinit>(VfsUtils.java:71)
    … 104 more

     

    Can you give us support on this?

    It seems that it’s always trying to use vfs3 instead of 2, searching for org.jboss.vfs.VFS class.

    Thanks, Phaedra.

    • Hi Phaedra,

      The PathMatchingResourcePatternResolver is used instead of the VfsPathMatchingResourcePatternResolver. It’s demonstrate the VFS2 patch is not taken into account.
      Are you sure to configure the JBoss5AnnotationConfigWebApplicationContext or JBoss5XmlWebApplicationContext in your web.xml or in your Java configuration?
      As documentation, you may refer to the README.md of the https://github.com/arey/spring4-vfs2-support/ repo. Please, create an issue on GitHub. It’s more appropriate to discuss about your probleme

      Regards,

      Antoine

  2. Bonjour

    Je suis en train d’utiliser ta dependency dans mon projet mais nous devons faire face à cette problème:

    Actual exception
    Caught Exception while registering Interceptor class a.b.c.d.f.QuelquechoseInterceptor - interceptor - vfszip:/repertoire/jboss-5.0.1.GA/server/notre_app/deploy/notre_app.war/WEB-INF/classes/struts.xml:XX:YY

    Dans le fichier struts.xml, ligne XX, on trouve simplement la declaration de l’interceptor:


    Quel peut être le problème?

    Merci d’avance

    • Bonjour,

      Cela fait un petit moment que je n’ai pas travaillé sur le projet spring4-vfs2-support.
      Tout d’abord, avez-vous utilisé la dernière version 1.4.1 du projet ?
      Si oui, il faudrait essayer de debugger l’intercepteur (vu le nom, on dirait du code maison) pour voir quelle classe il utilise pour charger le fichier struts.xml. Comme son chargement échoue, il doit passer par la classe VfsUtils. Il faudra modifier le code de chargement pour utiliser l’une des classes Vfs2xxx du projet (ex: Vfs2Utils).
      Je vous laisse essayer.

      Cordialement,

      Antoine

  3. Bonjour Antoine, merci pour votre gentillesse.

    Je ne suis pas sûr de avoir un problème avec VFS. En fait, toutes les interceptors (de Struts, de Spring) sont bien chargés, a l’exception de celui-ci que nous avons programmé pour une nouvelle annotation:

    package a.b.c.d.e.f.annotation;

    import java.lang.annotation.ElementType;
    import java.lang.annotation.Retention;
    import java.lang.annotation.RetentionPolicy;
    import java.lang.annotation.Target;

    @Retention(RetentionPolicy.RUNTIME)
    @Target({ElementType.FIELD})
    public @interface QuelqueChose {}

    Et c’est tout pour la annotation. Pour la classe QuelqueChoseInterceptor, j’ai ça:

    package a.b.c.d.e.f.interceptor;

    import java.lang.reflect.Field;

    import org.slf4j.Logger;
    import org.slf4j.LoggerFactory;
    import org.springframework.beans.factory.annotation.Autowired;

    import com.opensymphony.xwork2.ActionInvocation;
    import com.opensymphony.xwork2.interceptor.AbstractInterceptor;

    import a.b.c.d.x.y.QuelqueChoseManager;
    import a.b.c.d.e.f.annotation.QuelqueChose;

    public class QuelqueChoseInterceptor extends AbstractInterceptor {

    private static final long serialVersionUID = …;

    @Autowired
    private QuelqueChoseManager quelqueChoseManager;

    @Override
    public String intercept(ActionInvocation actionInvocation) throws Exception {

    }

    Vous croyez que c’est necessaire de la faire passer par VFS2?

    Je suis un peu perdu, comme vous pouvez voir…

    Bien cordialement,

    Juanma

    • Voici l’instant précis ou le problème se produit:

      dans com.opensymphony.xwork2.factory.DefaultInterceptorFactory (Struts 2)

      public class DefaultInterceptorFactory implements InterceptorFactory {

      ....

      public Interceptor buildInterceptor(InterceptorConfig interceptorConfig, Map interceptorRefParams) throws ConfigurationException {

      ...

      try {

      Interceptor interceptor = (Interceptor) objectFactory.buildBean(interceptorClassName, null);

      ...

      Merci encore pour votre aide.

      • Je n’ai jamais travaillé avec Sruts 2. Mais à ce que je comprends, la classe QuelqueChoseInterceptor est un intercepteur Stuts 2 dans lequel est injecté des beans Spring (@Autowired).
        Je crois comprendre que l’exception est levée lors de l’appel à la méthode objectFactory.buildBean(). Cet objectFactory doit faire appel au contexte Spring. Il faudrait identifier précisément quel bout de code.
        Vous serait-il possible de m’envoyer la stacktrace complète ? D’ailleurs, je vous invite à continuer cet échange en ouvrant une issue dans le projet github. Ce sera plus facile qu’avec WordPress.

  4. Hi, i’m trying to use your vfs2 patch for spring 4 but i have a constant exception:

    [[dispatcher]] Servlet.service() for servlet dispatcher threw exception
    java.lang.ClassNotFoundException: org.jboss.vfs.VFS from BaseClassLoader…

    In the link: https://github.com/arey/spring4-vfs2-support/ suggest to create a webconfig class.
    Spring MVC webjar support
    With Spring MVC, static resources could be served from a webjar. The Vfs2ResourceHandlerRegistry class prevents you for having the error java.lang.ClassNotFoundException: org.jboss.vfs.VFS from BaseClassLoader.

    How to use it:

    @Configuration
    @EnableWebMvc
    public class WebConfig extends WebMvcConfigurerAdapter {

    @Autowired
    private ApplicationContext applicationContext;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
    new Vfs2ResourceHandlerRegistry(registry, applicationContext)
    .addResourceHandler(« /resources/webjars/** »)
    .addResourceLocations(« classpath:/META-INF/resources/webjars/ »);
    }
    }

    I am not sure if this class should be created in my project on in spring4-vfs2-support project and compile again because the Vfs2ResourceHandlerRegistry constructor is private.
    So, I try change the constructor to public and recompile the spring4-vfs2-support project and add depencie to my project and I create this config class in my project.
    Now a have this exception:

    [DispatcherServlet] Context initialization failed
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘resourceHandlerMapping’ defined in class path resource [org/springframework/web/servlet/config/annotation/DelegatingWebMvcConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.HandlerMapping]: Factory method ‘resourceHandlerMapping’ threw exception; nested exception is java.lang.NoSuchMethodError: org.springframework.web.servlet.config.annotation.ResourceHandlerRegistration.(Lorg/springframework/core/io/ResourceLoader;[Ljava/lang/String;)V

    ….

    Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.HandlerMapping]: Factory method ‘resourceHandlerMapping’ threw exception; nested exception is java.lang.NoSuchMethodError: org.springframework.web.servlet.config.annotation.ResourceHandlerRegistration.(Lorg/springframework/core/io/ResourceLoader;[Ljava/lang/String;)V
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
    … 90 more
    Caused by: java.lang.NoSuchMethodError: org.springframework.web.servlet.config.annotation.ResourceHandlerRegistration.(Lorg/springframework/core/io/ResourceLoader;[Ljava/lang/String;)V

    ….

    15:27:30,674 ERROR [[/agorarest]] StandardWrapper.Throwable
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘resourceHandlerMapping’ defined in class path resource [org/springframework/web/servlet/config/annotation/DelegatingWebMvcConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.HandlerMapping]: Factory method ‘resourceHandlerMapping’ threw exception; nested exception is java.lang.NoSuchMethodError: org.springframework.web.servlet.config.annotation.ResourceHandlerRegistration.(Lorg/springframework/core/io/ResourceLoader;[Ljava/lang/String;)V

    Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.HandlerMapping]: Factory method ‘resourceHandlerMapping’ threw exception; nested exception is java.lang.NoSuchMethodError: org.springframework.web.servlet.config.annotation.ResourceHandlerRegistration.(Lorg/springframework/core/io/ResourceLoader;[Ljava/lang/String;)V
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
    … 90 more
    Caused by: java.lang.NoSuchMethodError: org.springframework.web.servlet.config.annotation.ResourceHandlerRegistration.(Lorg/springframework/core/io/ResourceLoader;[Ljava/lang/String;)V

    15:27:30,690 ERROR [[/agorarest]] Servlet /agorarest threw load() exception
    java.lang.NoSuchMethodError: org.springframework.web.servlet.config.annotation.ResourceHandlerRegistration.(Lorg/springframework/core/io/ResourceLoader;[Ljava/lang/String;)V
    at com.javaetmoi.core.spring.vfs.Vfs2ResourceHandlerRegistration.(Vfs2ResourceHandlerRegistration.java:41)
    at com.javaetmoi.core.spring.vfs.Vfs2ResourceHandlerRegistry.addResourceHandler(Vfs2ResourceHandlerRegistry.java:63)

    Could you help me,

    Thanks

  5. Hi, i’m trying to use your vfs2 patch for spring 4 but i have a constant exception:

    [[dispatcher]] Servlet.service() for servlet dispatcher threw exception
    java.lang.ClassNotFoundException: org.jboss.vfs.VFS from BaseClassLoader…

    In the link: https://github.com/arey/spring4-vfs2-support/ suggest to create a webconfig class.
    Spring MVC webjar support
    With Spring MVC, static resources could be served from a webjar. The Vfs2ResourceHandlerRegistry class prevents you for having the error java.lang.ClassNotFoundException: org.jboss.vfs.VFS from BaseClassLoader.

    How to use it:

    @Configuration
    @EnableWebMvc
    public class WebConfig extends WebMvcConfigurerAdapter {

    @Autowired
    private ApplicationContext applicationContext;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
    new Vfs2ResourceHandlerRegistry(registry, applicationContext)
    .addResourceHandler(« /resources/webjars/** »)
    .addResourceLocations(« classpath:/META-INF/resources/webjars/ »);
    }
    }

    I am not sure if this class should be created in my project on in spring4-vfs2-support project and compile again because the Vfs2ResourceHandlerRegistry constructor is private.
    So, I try change the constructor to public and recompile the spring4-vfs2-support project and add depencie to my project and I create this config class in my project.
    Now a have this exception:

    [DispatcherServlet] Context initialization failed
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘resourceHandlerMapping’ defined in class path resource [org/springframework/web/servlet/config/annotation/DelegatingWebMvcConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.HandlerMapping]: Factory method ‘resourceHandlerMapping’ threw exception; nested exception is java.lang.NoSuchMethodError: org.springframework.web.servlet.config.annotation.ResourceHandlerRegistration.(Lorg/springframework/core/io/ResourceLoader;[Ljava/lang/String;)V

    ….

    Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.HandlerMapping]: Factory method ‘resourceHandlerMapping’ threw exception; nested exception is java.lang.NoSuchMethodError: org.springframework.web.servlet.config.annotation.ResourceHandlerRegistration.(Lorg/springframework/core/io/ResourceLoader;[Ljava/lang/String;)V
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
    … 90 more
    Caused by: java.lang.NoSuchMethodError: org.springframework.web.servlet.config.annotation.ResourceHandlerRegistration.(Lorg/springframework/core/io/ResourceLoader;[Ljava/lang/String;)V

    ….

    15:27:30,674 ERROR [[/agorarest]] StandardWrapper.Throwable
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘resourceHandlerMapping’ defined in class path resource [org/springframework/web/servlet/config/annotation/DelegatingWebMvcConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.HandlerMapping]: Factory method ‘resourceHandlerMapping’ threw exception; nested exception is java.lang.NoSuchMethodError: org.springframework.web.servlet.config.annotation.ResourceHandlerRegistration.(Lorg/springframework/core/io/ResourceLoader;[Ljava/lang/String;)V

    Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.HandlerMapping]: Factory method ‘resourceHandlerMapping’ threw exception; nested exception is java.lang.NoSuchMethodError: org.springframework.web.servlet.config.annotation.ResourceHandlerRegistration.(Lorg/springframework/core/io/ResourceLoader;[Ljava/lang/String;)V
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
    … 90 more
    Caused by: java.lang.NoSuchMethodError: org.springframework.web.servlet.config.annotation.ResourceHandlerRegistration.(Lorg/springframework/core/io/ResourceLoader;[Ljava/lang/String;)V

    15:27:30,690 ERROR [[/agorarest]] Servlet /agorarest threw load() exception
    java.lang.NoSuchMethodError: org.springframework.web.servlet.config.annotation.ResourceHandlerRegistration.(Lorg/springframework/core/io/ResourceLoader;[Ljava/lang/String;)V
    at com.javaetmoi.core.spring.vfs.Vfs2ResourceHandlerRegistration.(Vfs2ResourceHandlerRegistration.java:41)
    at com.javaetmoi.core.spring.vfs.Vfs2ResourceHandlerRegistry.addResourceHandler(Vfs2ResourceHandlerRegistry.java:63)

    Could you help me ?

    Thanks

Répondre à Phaedra Annuler la réponse

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Ce site utilise Akismet pour réduire les indésirables. En savoir plus sur comment les données de vos commentaires sont utilisées.