I am creating a new Spring application which has Jetty integrated and includes MyBatis through the usual MyBatis-Spring project.
So the application is a standalone java application (meaning no WebContent or WEB-INF folders), and I am starting it through getting the Jetty bean from the Spring context, then calling start on it; Jetty links to Spring's DispatcherServlet and thus takes care of running Spring.
However, running the application from Eclipse (first run), I am unable to startup since the SQL Session Factory is unable to find the MyBatis XML configuration file; I have tried several formats with no luck, the file is found in the config folder which is a resource in Maven meaning the file should be in the classpath:
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="configLocation" value="classpath*:pbsGlobalMapConfig.xml" />
</bean>
Appreciate the help ! The exception I'm guetting is:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in file [C:\Users\Dood\Desktop\Code\PBS\trunk\global\source\target\classes\spring-servlet.xml]:
Invocation of init method failed; nested exception is java.io.FileNotFoundException: class path resource [classpath*:pbsGlobalMapConfig.xml] cannot be opened because it does not exist
This solved through replacing 'classpath*:pbsGlobalMapConfig.xml' with 'classpath:pbsGlobalMapConfig.xml'.