I am new to Maven and Spring. I am using Netbeans 7 as my IDE and setting up a Spring 3 project using Maven.
Everything seemed to be set up smoothly, and I started working with the Spring user guide. However, when I try to load my context.xml file, I get an exception not found by the file.
I have an App class located in com.myproject and the context.xml file is in com.myproject.conf
I use the following line of code in App.java to try to load the context.xml file:
ApplicationContext context = new ClassPathXmlApplicationContext("context.xml");
But when I launch the application, this leads to:
Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [context.xml]; nested exception is java.io.FileNotFoundException: class path resource [context.xml] cannot be opened because it does not exist
Looking at NetBeans output, it also looks like it doesnβt collect the log4j.properties file, which is also located in com.myproject.conf
I looked at the jar that the build process created and the entire com.myproject.conf package is missing, which also means that .xml and .properties are also missing. I tried to move these configuration files to the com.myproject package, and also just put them in the root of the project, which do not bring any other results.
So, I proceed from the assumption that my maven project is not configured completely correctly, or maybe NetBeans may have a wrong configuration.
source share