OSGi - 在eclipse之外运行 [英] OSGi - running outside eclipse
问题描述
我一直在努力让我的OSGi应用程序在eclipse之外运行。它肯定不是那么容易,因为我以为会肯定不只是一个运行java -jar org.eclipse.osgi_3.7.1.jar和安装插件的情况。
I have been working on getting my OSGi application to run outside eclipse. It has certainly wasn't as easy as I thought out would be certainly not just a case of running java -jar org.eclipse.osgi_3.7.1.jar and installing the plugins.
我希望这是最后一个问题
I'm hoping this is the last problem
java.sql.SQLException:找不到适合jdbc的驱动程序:mysql:/ / localhost:3306 /
java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/
这在Eclipse中工作正常。我有一个持久性捆绑包和几个碎片捆绑,我根据我需要的数据库类型加载。然后我还有另一个捆绑数据库的JDBC驱动程序。在eclipse中,我可以运行它,在外面的Eclipse中,我一直在尝试所有的东西,包括使用类加载器加载驱动程序
This works fine in Eclipse. I have a persistence bundle and several fragmentation bundles that I load depending on the database type that I require. I then also have another bundle with the database JDBC drivers. In eclipse I can run it, out side eclipse I have been trying everything including using class loaders to load the Driver
Activator.context = bundleContext;
Class.forName("com.mysql.jdbc.Driver");
try {
context.getBundle().loadClass("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
任何想法要看什么?
推荐答案
您的软体包是否导入软件包 com.mysql.jdbc
?
Does your bundle import the package com.mysql.jdbc
?
阅读以下维基页面,了解为什么这可能在Eclipse内部工作,但不在适当的OSGi环境: http://wiki.osgi.org/wiki/Why_does_Eclipse_find_javax.swing_but_not_Felix% 3F
Read the following wiki page for some background on why this might work inside Eclipse but not in a proper OSGi environment: http://wiki.osgi.org/wiki/Why_does_Eclipse_find_javax.swing_but_not_Felix%3F
这篇关于OSGi - 在eclipse之外运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!