我正在开发需要使用 JDBC 驱动程序的插件(mysql-connector-java-5.1.19-bin.jar)。当我在插件清单中定义此 jar 文件的路径时,如下所示:
Bundle-ClassPath: lib/mysql-connector-java-5.1.19-bin.jar
插件停止识别我的视图,我得到这个异常:
java.lang.ClassNotFoundException: diplomaproject.views.SampleView
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:494)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:398)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:105)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:326)
at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:231)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1193)
...
当我删除行时:
Bundle-ClassPath: lib/mysql-connector-java-5.1.19-bin.jar
从清单来看,视图正在运行,但 JDBC 连接器不起作用。
我的整个清单文件:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: DiplomaProject
Bundle-SymbolicName: diplomaProject; singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: diplomaproject.Activator
Bundle-Vendor: MYDIPLOMA
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: lib/mysql-connector-java-5.1.19-bin.jar