Search code examples
javaeclipsemavenosgiequinox

Issues in upgrading osgi jar from 3.8.1 to 3.10.1


I'm trying to upgrade the OSGI version in my project and while launching my application I'm facing below exceptions.

I'm facing the below exception in start() of Activator class:

Caused by: java.lang.IllegalArgumentException: Declaration is invalid: osgi.native; native.paths:List="Some_DLL's_are_specified_here"; filter:="(|(&(|(osgi.native.osname~=win32)(osgi.native.osname~=Windows 8)(osgi.native.osname~=Windows 8.1)(osgi.native.osname~=Windows Server 2012)(osgi.native.osname~=Windows Server 2012 R2)(osgi.native.osname~=Windows 10)(osgi.native.osname~=Windows NT (unknown)))(osgi.native.processor~=x86_64)))" .. ... .... Caused by: org.osgi.framework.BundleException: Invalid manifest header Require-Capability: osgi.native; native.paths:List="Some_DLL's_are_specified_here"; filter:="(|(&(|(osgi.native.osname~=win32)(osgi.native.osname~=Windows 8)(osgi.native.osname~=Windows 8.1)(osgi.native.osname~=Windows Server 2012)(osgi.native.osname~=Windows Server 2012 R2)(osgi.native.osname~=Windows 10)(osgi.native.osname~=Windows NT (unknown)))(osgi.native.processor~=x86_64)))" .. ... .... Caused by: org.osgi.framework.InvalidSyntaxException: Invalid value at "(unknown))) (osgi.native.processor~=x86_64)))": (|(&(|(osgi.native.osname~=win32)(osgi.native.osname~=Windows 8)(osgi.native.osname~=Windows 8.1)(osgi.native.osname~=Windows Server 2012)(osgi.native.osname~=Windows Server 2012 R2)(osgi.native.osname~=Windows 10)(osgi.native.osname~=Windows NT (unknown)))(osgi.native.processor~=x86_64))) .. ... .... Root exception: java.lang.IllegalArgumentException: Declaration is invalid: osgi.native; native.paths:List="<>"; filter:="(|(&(|(osgi.native.osname~=win32)(osgi.native.osname~=Windows 8)(osgi.native.osname~=Windows 8.1)(osgi.native.osname~=Windows Server 2012)(osgi.native.osname~=Windows Server 2012 R2)(osgi.native.osname~=Windows 10)(osgi.native.osname~=Windows NT (unknown)))(osgi.native.processor~=x86_64)))"

And at last I'm getting following exception on console:

java.lang.IllegalStateException: Unable to acquire application service. Ensure that the org.eclipse.core.runtime bundle is resolved and started (see config.ini).

Anyone familiar with this? or any suggestions?

Note: I've replaced org.eclipse.osgi_3.10.1 jar with org.eclipse.osgi_3.8.1 in my project.


Solution

  • You must have a bundle with a Bundle-NativeCode header that has an attribute of osname="Windows NT (unknown)". There is a bug in the Equinox framework that is not escaping such values when generating a filter for the osgi.native namespace. I opened bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=492890 to get that fixed.

    While waiting for a fix I suggest you remove the osname="Windows NT (unknown)" from your list of attributes. You look to be already using the win32 alias which should cover all Windows varieties.