当前位置:数据库 > SQLite >>

急:在线请教OSGI高手,如何在OSGI框架中加载sqlite数据库连接?补充内容代码和异常如下,小弟先谢谢了!

连接代码如下: private static String url = "org.sqlite.JDBC"; private static String dri = "jdbc:sqlite:D:/new.db"; public static Connection getConnection() { try { Class.forName(url); Connection conn = DriverManager.getConnection(dri); return conn; } catch (Exception e) { e.printStackTrace(); return null; } } 启动OSGI后抛出的异常如下: osgi> java.lang.ClassNotFoundException: org.sqlite.JDBC at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:513) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417) at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at com.huawei.nastar.server.siggsm.tools.SqliteConnectionFactory.getConnection(SqliteConnectionFactory.java:15) at com.huawei.nastar.server.siggsm.tools.SqliteInit.createTable(SqliteInit.java:54) at com.huawei.nastar.server.siggsm.tools.SqliteInit.initDB(SqliteInit.java:38) at com.huawei.nastar.server.siggsm.ui.ConfigDlg.<init>(ConfigDlg.java:56) at org.osgichina.dicquery.DictionaryQueryActivator.start(DictionaryQueryActivator.java:56) at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:711) at java.security.AccessController.doPrivileged(Native Method) at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:702) at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:683) at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:381) at org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:389) at org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1130) at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:559) at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:544) at org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:457) at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:243) at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:438) at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:1) at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,