Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

classpath*: is no longer finding resources with <import resource=""/> [SPR-6351] #11017

Closed
spring-projects-issues opened this issue Nov 13, 2009 · 2 comments
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: bug A general bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Nov 13, 2009

Scott Andrews opened SPR-6351 and commented

Between RC1 and RC2, classpath*: file paths stopped working. In a web app context, I am importing a set of spring contexts that form a plugin system. None of the files that match this pattern are detected
<import resource="classpath*:META-INF/insight/insight-plugin-*.xml" />

Removing the wild card and hard coding the path also does not pickup the files.
<import resource="classpath*:META-INF/insight/insight-plugin-springmvc.xml" />

Replacing the classpath*: with classpath: it is able to find the file.
<import resource="classpath:META-INF/insight/insight-plugin-springmvc.xml" />

Using classpath: with a wild card only imports a single resource. (appears to be the first match alphabetically)
<import resource="classpath:META-INF/insight/insight-plugin-*.xml" />


Affects: 3.0 RC2

Issue Links:

1 votes, 0 watchers

@spring-projects-issues
Copy link
Collaborator Author

Klaus Lehner commented

Not only that this feature isn't working any more, the error message that comes up now is quite confusing:

We have something like:

<import resource="classpath*:WEB-INF/dao-context-*.xml"/>

respectively just:

<import resource="classpath*:/WEB-INF/dao-context.xml"/>

The error message that comes up when starting the server is astonishing:

java.io.FileNotFoundException: URL [jndi:/localhost/WEB-INF/] cannot be resolved to absolute file path because it does not reside in the file system: jndi:/localhost/WEB-INF/
at org.springframework.util.ResourceUtils.getFile(ResourceUtils.java:204) [org.springframework.core.jar:3.0.0.RC2]
at org.springframework.core.io.AbstractFileResolvingResource.getFile(AbstractFileResolvingResource.java:51) [org.springframework.core.jar:3.0.0.RC2]
at org.springframework.core.io.UrlResource.getFile(UrlResource.java:168) [org.springframework.core.jar:3.0.0.RC2]
at org.springframework.core.io.support.PathMatchingResourcePatternResolver.doFindPathMatchingFileResources(PathMatchingResourcePatternResolver.java:529) [org.springframework.core.jar:3.0.0.RC2]
at org.springframework.web.context.support.ServletContextResourcePatternResolver.doFindPathMatchingFileResources(ServletContextResourcePatternResolver.java:82) [org.springframework.web.jar:3.0.0.RC2]
at org.springframework.core.io.support.PathMatchingResourcePatternResolver.findPathMatchingResources(PathMatchingResourcePatternResolver.java:350) [org.springframework.core.jar:3.0.0.RC2]
at org.springframework.core.io.support.PathMatchingResourcePatternResolver.getResources(PathMatchingResourcePatternResolver.java:282) [org.springframework.core.jar:3.0.0.RC2]
at org.springframework.context.support.AbstractApplicationContext.getResources(AbstractApplicationContext.java:1169) [org.springframework.context.jar:3.0.0.RC2]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:177) [org.springframework.beans.jar:3.0.0.RC2]
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:197) [org.springframework.beans.jar:3.0.0.RC2]
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseDefaultElement(DefaultBeanDefinitionDocumentReader.java:145) [org.springframework.beans.jar:3.0.0.RC2]
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:130) [org.springframework.beans.jar:3.0.0.RC2]
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:90) [org.springframework.beans.jar:3.0.0.RC2]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493) [org.springframework.beans.jar:3.0.0.RC2]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390) [org.springframework.beans.jar:3.0.0.RC2]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334) [org.springframework.beans.jar:3.0.0.RC2]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302) [org.springframework.beans.jar:3.0.0.RC2]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143) [org.springframework.beans.jar:3.0.0.RC2]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178) [org.springframework.beans.jar:3.0.0.RC2]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149) [org.springframework.beans.jar:3.0.0.RC2]
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124) [org.springframework.web.jar:3.0.0.RC2]
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:93) [org.springframework.web.jar:3.0.0.RC2]
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130) [org.springframework.context.jar:3.0.0.RC2]
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:464) [org.springframework.context.jar:3.0.0.RC2]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:388) [org.springframework.context.jar:3.0.0.RC2]
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:261) [org.springframework.web.jar:3.0.0.RC2]
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:192) [org.springframework.web.jar:3.0.0.RC2]
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47) [org.springframework.web.jar:3.0.0.RC2]

And that although there is no use of jndi anywhere in our server code.

@spring-projects-issues
Copy link
Collaborator Author

Sam Brannen commented

FYI: the inclusion of the jndi resource lookup is likely the result of running your web application in Tomcat.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: bug A general bug
Projects
None yet
Development

No branches or pull requests

1 participant