I am deploying my Spring application to JBoss AS 5. After a couple of days I managed to make it work with multiple contexts. The problem I encountered is that I can't auto detect my spring components. I traced it down to the new VFS used by deployers and JBoss AS 5. and the way the Spring util class is listing files. It only use 'File' protocol and then it finds 'vfsfile' protocol and then don't scan the directory as it considers it as non existent in the file system.

Where can I find the VFS spec?The fix would be to extend the Spring path matcher to understand the 'vfsfile' protocol and list files on the directory.

2008-06-27 09:41:32,514 DEBUG [org.springframework.core.io.support.PathMatchingResourcePatternResolver] Cannot search for matching files underneath URL [vfsfile:/D:/server/jboss-5.0.0.Beta4/server/wits/deploy/wits-deployment-ear.ear/wits-wims-batch.jar/za/ac/wits/batch/] because it does not correspond to a directory in the file systemjava.io.FileNotFoundException: URL [vfsfile:/D:/server/jboss-5.0.0.Beta4/server/wits/deploy/wits-deployment-ear.ear/wits-wims-batch.jar/za/ac/wits/batch/] cannot be resolved to absolute file path because it does not reside in the file system: vfsfile:/D:/server/jboss-5.0.0.Beta4/server/wits/deploy/wits-deployment-ear.ear/wits-wims-batch.jar/za/ac/wits/batch/ at org.springframework.util.ResourceUtils.getFile(ResourceUtils.java:198) at org.springframework.core.io.UrlResource.getFile(UrlResource.java:156) at org.springframework.core.io.support.PathMatchingResourcePatternResolver.doFindPathMatchingFileResources(PathMatchingResourcePatternResolver.java:495) at org.springframework.core.io.support.PathMatchingResourcePatternResolver.findPathMatchingResources(PathMatchingResourcePatternResolver.java:341) at org.springframework.core.io.support.PathMatchingResourcePatternResolver.getResources(PathMatchingResourcePatternResolver.java:262) at org.springframework.context.support.AbstractApplicationContext.getResources(AbstractApplicationContext.java:1019) at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:177) at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:200) at org.springframework.context.annotation.ComponentScanBeanDefinitionParser.parse(ComponentScanBeanDefinitionParser.java:84) at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:69) at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1253) at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1243) at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:135) at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:92) at org.jboss.spring.factory.NamedXmlBeanDefinitionReader.registerBeanDefinitions(NamedXmlBeanDefinitionReader.java:54) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310) at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:190) at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseDefaultElement(DefaultBeanDefinitionDocumentReader.java:147) at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:132) at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:92) at org.jboss.spring.factory.NamedXmlBeanDefinitionReader.registerBeanDefinitions(NamedXmlBeanDefinitionReader.java:54) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310) at org.jboss.spring.factory.NamedXmlApplicationContext.loadBeanDefinitions(NamedXmlApplicationContext.java:87) at org.jboss.spring.factory.NamedXmlApplicationContext.loadBeanDefinitions(NamedXmlApplicationContext.java:82) at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123) at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:423) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:353) at org.jboss.spring.factory.NamedXmlApplicationContext.(NamedXmlApplicationContext.java:61) at org.jboss.spring.factory.NamedXmlApplicationContext.(NamedXmlApplicationContext.java:50) at org.jboss.spring.deployers.ApplicationContextDeployer$1.doCreate(ApplicationContextDeployer.java:41) at org.jboss.spring.deployers.ApplicationContextDeployer$1.doCreate(ApplicationContextDeployer.java:44) at org.jboss.spring.deployers.AbstractSpringMetaDataDeployer$SpringDeploymentVisitor.deploy(AbstractSpringMetaDataDeployer.java:72) at org.jboss.spring.deployers.AbstractSpringMetaDataDeployer$SpringDeploymentVisitor.deploy(AbstractSpringMetaDataDeployer.java:58) at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployerWithInput.internalDeploy(AbstractRealDeployerWithInput.java:108) at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50) at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:169) at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:853) at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:906) at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:794) at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:327) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1309) at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:734) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:862) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:784) at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:622) at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:411) at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:498) at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:506) at org.jboss.system.server.profileservice.ProfileServiceBootstrap.loadProfile(ProfileServiceBootstrap.java:246) at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:131) at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:408) at org.jboss.Main.boot(Main.java:208) at org.jboss.Main$1.run(Main.java:534) at java.lang.Thread.run(Thread.java:619)

I guess we'll be seeing a lot of these in new JBoss5. :-(Since not a lot of frameworks out there knows how to handle anything else besides plain JDK url/uri stuff, which is a shame.I already provided a patch for Facelets, so that our Seam could work.

I suggest you go ahead, try how far you can go with fixing this with some vfs aware code. Or making that 'file' agnostic.If you got stuck, I'll help you.And then we can see what we should do with that:1) separate artifact bridging vfs&spring_component_lookup2) patch for spring :-)3) useful instructions for others

"alesj" wrote:OK, this is not really the topic of this forum (see sticky), but since it's an interesting topic, and I (re)wrote most of VFS, I'll help you. :-)

at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:353)
at org.jboss.spring.factory.NamedXmlApplicationContext.(NamedXmlApplicationContext.java:61)
at org.jboss.spring.factory.NamedXmlApplicationContext.(NamedXmlApplicationContext.java:50)
at org.jboss.spring.deployers.ApplicationContextDeployer$1.doCreate(ApplicationContextDeployer.java:41)
at org.jboss.spring.deployers.ApplicationContextDeployer$1.doCreate(ApplicationContextDeployer.java:44)
at org.jboss.spring.deployers.AbstractSpringMetaDataDeployer$SpringDeploymentVisitor.deploy(AbstractSpringMetaDataDeployer.java:72)
at org.jboss.spring.deployers.AbstractSpringMetaDataDeployer$SpringDeploymentVisitor.deploy(AbstractSpringMetaDataDeployer.java:58)

It should work, otherwise I wouldn't commit - specially so close to CR1 release. ;-)

It does work, but with prior versions of Spring. I am using 2.5.3 in JBoss AS CR1 and Spring has added a method called 'isReadable' in Resource. I have added the method in my local version and compiled and it is working. But I just returned true for all cases, as I don't have a full grasp of the VFS.

I am trying to deploy a jar with the spring beans and I get this error:

Caused by: java.lang.IllegalArgumentException: Cannot find entry: java.io.FileInputStream@37f44d, za/ac/wits/batch/aop at org.jboss.virtual.plugins.context.zip.ZipEntryContext.findEntry(ZipEntryContext.java:338) at org.jboss.virtual.plugins.context.zip.ZipEntryContext.createZipSource(ZipEntryContext.java:284) at org.jboss.virtual.plugins.context.zip.ZipEntryContext.init(ZipEntryContext.java:214) at org.jboss.virtual.plugins.context.zip.ZipEntryContext.(ZipEntryContext.java:145) at org.jboss.virtual.plugins.context.zip.ZipEntryContext.(ZipEntryContext.java:130) at org.jboss.virtual.plugins.context.zip.ZipEntryContextFactory.getVFS(ZipEntryContextFactory.java:71) at org.jboss.virtual.VFS.getVFS(VFS.java:135) at org.jboss.virtual.VFS.getRoot(VFS.java:149) at org.jboss.spring.io.VFSResourcePatternResolver.getVFSResources(VFSResourcePatternResolver.java:85) at org.jboss.spring.io.VFSResourcePatternResolver.findPathMatchingResources(VFSResourcePatternResolver.java:69) at org.springframework.core.io.support.PathMatchingResourcePatternResolver.getResources(PathMatchingResourcePatternResolver.java:262) at org.springframework.context.support.AbstractApplicationContext.getResources(AbstractApplicationContext.java:1019) at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:177) at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:200) at org.springframework.context.annotation.ComponentScanBeanDefinitionParser.parse(ComponentScanBeanDefinitionParser.java:84) at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:69) at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1253) at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1243) at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:135) at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:92) at org.jboss.spring.factory.NamedXmlBeanDefinitionReader.registerBeanDefinitions(NamedXmlBeanDefinitionReader.java:52) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398)