lundi 25 avril 2016

Launch Scheduled executions in database when Jee app start

I'm a little bit confused about this point 'cause I'm not an expert on this domain :

I want to lauch a specific data insert method when spring app is initialized. I'm trying to explain what is the issue :

When I want to execute a classical Java connexion to SQLite JDBC in this following method (is this method who spring calls when he's initialized):

@Override
public void contextInitialized(ServletContextEvent event) {
    System.out.println("Started");

    //method who call a jdbc connection

I have an error like this :

java.lang.ClassNotFoundException: org.sqlite.JDBC
java.lang.ClassNotFoundException: org.sqlite.JDBC
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1305)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1157)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at com.hw.serv.app.config.HerowarsJdbc.getConnect(HerowarsJdbc.java:13)
at com.hw.serv.app.config.testTimer.contextInitialized(testTimer.java:37)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4729)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5167)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1399)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
avr. 25, 2016 10:35:17 PM org.apache.catalina.core.ApplicationContext log
etc...

Maybe I'm totally wrong but I want understand what's happened here =/

(PS : Sorry for my bad english grammar :p )

Aucun commentaire:

Enregistrer un commentaire