This error blows my brain. All the junit tests is fine but when my application loads as plugin for another application I have an errors. The beans.xml is 100% at root of jar file but for some reason the main application, that loads my plugin can't find the file. Why?
In my application's boot method I call
new ClassPathXmlApplicationContext("beans.xml"); throws
org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [beans.xml]; nested exception is java.io.FileNotFoundException: class path resource [beans.xml] cannot be opened because it does not exist
or
new FileSystemXmlApplicationContext(getClass().getClassLoader().getResource("beans.xml").getPath()); throws
org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from URL [file:/C:/path/to/my.jar!/beans.xml]; nested exception is java.io.FileNotFoundException: C:\path\to\my.jar!\beans.xml (The system cannot find the path specified)
UPD: The problem was the application uses custom classloader that does not load resource files in root, META-INF and etc. but only classes