I have an osgi application which runs on equinox. This is how the bundles are started in the bootstrap class.
String[] equinoxArgs = new String[]{"-console"};
EclipseStarter.setInitialProperties(getInitialProperties());
BundleContext context = EclipseStarter.startup(equinoxArgs, null);
List<URL> urls = getListOfBundleUrls();
for(URL url: urls) {
Bundle bundle = context.installBundle(url.toString());
bundle.start();
}
There is a start method in my application in one of the bundles. This method should be called after all the bundles are started to run the application. When that method is called in the bootstrap class, it gives an error saying some classes are not found in the classpath. Here is the stack trace.
Initial SessionFactory creation failed.org.hibernate.service.classloading.spi.ClassLoadingException: Specified JDBC Driver com.mysql.jdbc.Driver class not found
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.cc.erp.platform.dbutils.services.BasicDBManager.buildSessionFactory(BasicDBManager.java:26)
at com.cc.erp.platform.dbutils.services.BasicDBManager.<clinit>(BasicDBManager.java:12)
at com.cc.erp.platform.dbutils.DBAgent.getNewCRUDService(DBAgent.java:19)
at com.cc.erp.reload.core.WebService.forQuery(WebService.java:51)
at com.cc.erp.reload.ui.CommandLineUserInterface.<init>(CommandLineUserInterface.java:27)
at com.cc.erp.helius.bootstrap.Bootstrap.launchHelius(Bootstrap.java:41)
at com.cc.erp.helius.bootstrap.Bootstrap.main(Bootstrap.java:22)
Caused by: org.hibernate.service.classloading.spi.ClassLoadingException: Specified JDBC Driver com.mysql.jdbc.Driver class not found
at org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl.configure(DriverManagerConnectionProviderImpl.java:107)
at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:75)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:159)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131)
at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.buildJdbcConnectionAccess(JdbcServicesImpl.java:223)
at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:89)
Package com.mysql.jdbc is exported in the osgi runtime. But its not not in the bootstrap classpath.I believe this method should be called from the framework itself. Please tell me the best way to do it.