I have deployed a spring batch through a war file in tomcat. I am running the batch using ContextListener at server start.
Batch launches fine but during database initialization db script is not running. The script is inside a jar file in WEB-INF/lib folder. Here is code part from config xml -
<jdbc:initialize-database data-source="dataSource">
<jdbc:script location="jar:file:org/springframework/batch/core/schema-drop-mysql.sql" />
<jdbc:script location="org/springframework/batch/core/schema-mysql.sql" />
</jdbc:initialize-database>
it gives me below exception -
java.io.FileNotFoundException: Could not open ServletContext resource [/org/springframework/batch/core/schema-drop-mysql.sql] at org.springframework.web.context.support.ServletContextResource.getInputStream(ServletContextResource.java:141) at org.springframework.core.io.support.EncodedResource.getReader(EncodedResource.java:132) at org.springframework.jdbc.datasource.init.ScriptUtils.readScript(ScriptUtils.java:278) at org.springframework.jdbc.datasource.init.ScriptUtils.executeSqlScript(ScriptUtils.java:438) ... 32 more