开发者

Spring Import Can't See Resources

开发者 https://www.devze.com 2023-04-09 03:20 出处:网络
I\'m using Spring to handle my dependency injection and I am currently writing a jar that makes use of a homegrown logging-1.0.jar that I also made some time ago. I am writing this inside Eclipse, whi

I'm using Spring to handle my dependency injection and I am currently writing a jar that makes use of a homegrown logging-1.0.jar that I also made some time ago. I am writing this inside Eclipse, which may be important.

That logging-1.0.jar has a critical config file in it called logging-base.xml where all sorts of environmental properties get set so that my logger works correctly.

My new jar is compiling/building in Ant fine, but at runtime is throwing an exception stating:

Exception in thread "main"     
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: 
Configuration problem: Failed to import bean definitions from URL location 
[classpath:logging-base.xml] Offending resource: class path resource
[spring/client-config.xml]; nested exception is 
org.springframework.beans.factory.parsing.BeanDefinitionParsingException:
Configuration problem: Unable to locate Spring NamespaceHandler for XML schema
namespace [http://camel.apache.org/schema/spring]

Offending resource: class path resource [logging-base.xml]

So it seems that Spring cannot find my logging-base.xml file as its not "in the classpath". In my project I have a lib/ directory where all of my dependent jars are stored. When I copy a new jar into this directory, I just right-click it and go Build Path >> Add to Build Path and Eclipse makes a reference of that jar available to the runtime.

Of all the jars under my lib/ directory, logger-1.0.jar has a distinct icon next to its name in the package explorer. Its icon has a little tiny question-mark ("?")开发者_运维知识库 in it.

So I'm guessing that, somehow, my logging jar isn't configured correctly, and as a result, isn't adding its logging-base.xml file to the classpath. As such, at runtime, Spring can't find it.

But that's where my knowledge of Eclipse and Spring grinds to a halt.

Any ideas?


I think the issue might be with spring handlers, You might have defined this name space http://camel.apache.org/schema/spring in your client-config.xml, Spring usually has name space handlers defined for every name space that is defined in the application context. These handlers are defined in a file called spring.handlers and are included in the respective jars in this case (camel-spring-X.jar).


You might want to add xerces.jar and in jre6\lib\ext directory, Just try this out.. coz it helped me solve this problem !

0

精彩评论

暂无评论...
验证码 换一张
取 消