我正在尝试在Openshift服务器上部署可运行的JAR文件,我的可运行JAR文件包含一个cron作业,它的功能是在某些时候从数据库中读取数据我将mysql-connector-jar放在我的JAR文件中并部署在我的openshift应用程序,在运行时我遇到异常。在我的cron工作中。
Exception in thread "main" java.lang.NoClassDefFoundError: com/mysql/jdbc/jdbc2/optional/MysqlDataSource
at com.fs.sstore.communicator.cronjob.db.DataSourceFactory.getMySQLDataSource(DataSourceFactory.java:46)
at com.fs.sstore.communicator.cronjob.db.DBManager.fetchScheduleRecharges(DBManager.java:29)
at com.fs.sstore.communicator.cronjob.RechargeScheduler.scheduleRecharge(RechargeScheduler.java:15)
at com.fs.sstore.communicator.cronjob.RechargeScheduler.<init>(RechargeScheduler.java:9)
at com.fs.sstore.communicator.cronjob.RechargeScheduler.main(RechargeScheduler.java:22)
Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.jdbc2.optional.MysqlDataSource
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 5 more