Two nice gotchas that helped me waste time tonight…
EXCEPTION_ACCESS_VIOLATION
If you get the following, kill all of your JVMs and try again. Simple as. Grrrr… Big red hearing when you’ve just changed a load of code.
EXCEPTION_ACCESS_VIOLATION (0xc0000005) at
Thanks to http://www.java-forums.org/eclipse/312-exception_access_violation-0xc0000005.html for this.
OSGi Bundles and Native Code
Be warned, configuring native code within an OSGi bundle manifest isn’t obvious or intuitive.
This looks like it works, but it doesn’t … and it fails silently, even though if I added some nonsense entry, it would complain.
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: My Cool Plug-in
Bundle-SymbolicName: com.figmentweb.cool;singleton:=true
Bundle-Version: 1.0.0
Bundle-Activator: com.figmentweb.cool.Activator
Bundle-Vendor: DKIB
SpringContext: OSGI-INF/importexport.xml,
spring/cool/application-context.xml,
spring/client/cool/cool-beans.xml
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.ui;bundle-version="3.4.1"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-NativeCode: dll/a.dll,
dll/b.dll,
dll/c.dll,
dll/d.dll,
dll/e.dll,
dll/f.dll,
dll/g.dll,
dll/h.dll
Bundle-ClassPath: ...
This is what it should be:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: My Cool Plug-in
Bundle-SymbolicName: com.figmentweb.cool;singleton:=true
Bundle-Version: 1.0.0
Bundle-Activator: com.figmentweb.cool.Activator
Bundle-Vendor: DKIB
SpringContext: OSGI-INF/importexport.xml,
spring/cool/application-context.xml,
spring/client/cool/cool-beans.xml
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.ui;bundle-version="3.4.1"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-NativeCode: dll/a.dll;
dll/b.dll;
dll/c.dll;
dll/d.dll;
dll/e.dll;
dll/f.dll;
dll/g.dll;
dll/h.dll
Bundle-ClassPath: ...
That is, even though every other multi-entry/list of configurations is split across lines by ‘,’ – within the Bundle-NativeCode we should use ‘;’. Using ‘,’ won’t cause an error, it just means that only the first DLL is loaded.
The ability to bundle DLLs/SOs into a bundle jar is awesome though.
Thanks to: http://www.eclipse.org/newsportal/article.php?id=12052&group=eclipse.platform.rcp#12052