Friday, September 3, 2010

J2ee: Spring Schema not getting loaded ?

I am sharing a weired issue I faced in my Java workspace... when I used Spring framework.


I was trying to load Spring Beans to Application context in my new enterprise application; used RSA as my IDE.

   'Application Context. new ClassPathXmlApplicationContext(BUSINESS_BEANS_FILE);'



This gave me runtime exception that "Unable to load schema mappings from location [META-INF/spring.schemas]" due to a FileNotFoundException''. 


===== Detailed Exception ====== neverminf my application name :) ==

Caused by: org.springframework.beans.FatalBeanException: Unable to load schema mappings from location [META-INF/spring.schemas]; nested exception is java.io.FileNotFoundException: C:\vdi\vdi-users\s0madat\My Documents\ELO\ELOrder\Jars\spring-2.5.6.jar (The system cannot find the path specified.) 
=============================================================

The made sure that this Jar is there in "Build Path" and to avoid Runtime Exception I verified whether I added it to 'J2EE Run Time Dependencies' as well.But still the exception was persisting :(
                    With this much, did you get what actually caused the problem?
Finally it was revealed... please take a look at the path to the Jar. The culprit was "My Documents".
The Space in the path was making the trouble. 

So make sure that you never create your Java/J2EE workspace with name or path having "Space"... ; like I created in 'My Documents' :P