UcanAccess イントロの質問を読みましたが、ドライバーを OSGi / RCP アプリケーションで動作させることができません。クラスローダーの問題だと思いますが、解決方法がわかりません。
関連するコード スニペット。2 行目で失敗します。MDB が存在し、UcanAccess を使用する OSGi 以外の Java アプリで MDB を正常に開くことができます。
Class.forName("net.ucanaccess.jdbc.UcanaccessDriver");
con = DriverManager.getConnection("jdbc:ucanaccess://" + FILENAME);
次の例外が発生します。
**4302 INFO org.eclipse.ecf.osgi.services.remoteserviceadmin - [S:{org.osgi.framework.hooks.service.EventListenerHook}={service.id=274, service.bundleid=86, service.scope=singleton}] ServiceEvent REGISTERED
net.ucanaccess.jdbc.UcanaccessSQLException: user lacks privilege or object not found java.lang.ClassNotFoundException: net.ucanaccess.converters.Functions cannot be found by org.hsqldb.hsqldb_2.3.1 net.ucanaccess.converters.Functions in statement [CREATE FUNCTION SLN(par0 DOUBLE,par1 DOUBLE,par2 DOUBLE) RETURNS DOUBLE LANGUAGE JAVA DETERMINISTIC NO SQL EXTERNAL NAME 'CLASSPATH:net.ucanaccess.converters.Functions.sln']
at net.ucanaccess.jdbc.UcanaccessDriver.connect(UcanaccessDriver.java:247)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:270)
at com.easa.motordb.load.HornerLoad.execute(HornerLoad.java:26)
at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:294)
at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:90)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:55)
at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:247)
at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:229)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:132)
at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:149)
at org.eclipse.core.commands.Command.executeWithChecks(Command.java:499)
at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:210)
at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.executeItem(HandledContributionItem.java:825)
at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.handleWidgetSelection(HandledContributionItem.java:701)
at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.access$6(HandledContributionItem.java:685)
at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem$4.handleEvent(HandledContributionItem.java:613)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4353)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1061)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4172)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3761)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1151)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1032)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:148)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:636)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:579)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
at com.easa.acmotor.base.Application.start(Application.java:24)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
at org.eclipse.equinox.launcher.Main.main(Main.java:1438)
Caused by: java.sql.SQLSyntaxErrorException: user lacks privilege or object not found java.lang.ClassNotFoundException: net.ucanaccess.converters.Functions cannot be found by org.hsqldb.hsqldb_2.3.1 net.ucanaccess.converters.Functions in statement [CREATE FUNCTION SLN(par0 DOUBLE,par1 DOUBLE,par2 DOUBLE) RETURNS DOUBLE LANGUAGE JAVA DETERMINISTIC NO SQL EXTERNAL NAME 'CLASSPATH:net.ucanaccess.converters.Functions.sln']
at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source)
at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source)
at org.hsqldb.jdbc.JDBCStatement.fetchResult(Unknown Source)
at org.hsqldb.jdbc.JDBCStatement.executeUpdate(Unknown Source)
at net.ucanaccess.converters.LoadJet.exec(LoadJet.java:1258)
at net.ucanaccess.converters.LoadJet.access$0(LoadJet.java:1253)
at net.ucanaccess.converters.LoadJet$FunctionsLoader.createFunctions(LoadJet.java:156)
at net.ucanaccess.converters.LoadJet$FunctionsLoader.addFunctions(LoadJet.java:151)
at net.ucanaccess.converters.LoadJet$FunctionsLoader.loadMappedFunctions(LoadJet.java:178)
at net.ucanaccess.converters.LoadJet$FunctionsLoader.access$2(LoadJet.java:177)
at net.ucanaccess.converters.LoadJet.loadDB(LoadJet.java:1310)
at net.ucanaccess.jdbc.UcanaccessDriver.connect(UcanaccessDriver.java:236)
... 48 more
Caused by: org.hsqldb.HsqlException: user lacks privilege or object not found java.lang.ClassNotFoundException: net.ucanaccess.converters.Functions cannot be found by org.hsqldb.hsqldb_2.3.1 net.ucanaccess.converters.Functions
at org.hsqldb.error.Error.error(Unknown Source)
at org.hsqldb.Routine.getMethods(Unknown Source)
at org.hsqldb.Routine.getMethod(Unknown Source)
at org.hsqldb.Routine.resolveReferences(Unknown Source)
at org.hsqldb.Routine.resolve(Unknown Source)
at org.hsqldb.StatementSchema.getResult(Unknown Source)
at org.hsqldb.StatementSchema.execute(Unknown Source)
at org.hsqldb.Session.executeCompiledStatement(Unknown Source)
at org.hsqldb.Session.executeDirectStatement(Unknown Source)
at org.hsqldb.Session.execute(Unknown Source)
... 58 more
Caused by: java.lang.ClassNotFoundException: net.ucanaccess.converters.Functions cannot be found by org.hsqldb.hsqldb_2.3.1
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:432)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:345)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:337)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:160)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
... 67 more
私が取ったステップ:
- ucanaccess からプラグイン/バンドルを作成する
- Require-Bundle: マニフェストの org.hsqldb.hsqldb;bundle-version="2.3.1"
- 登録済みのバディにする (Eclipse-BuddyPolicy: registered)
- 私のバンドルにそれを知らせる (Eclipse-RegisterBuddy: ucanaccess)
- すべてのバンドルが自動開始されていることを確認します (ucanaccess、hsql、および my bundle)