0

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.

Jay
  • 1,257
  • 2
  • 11
  • 16

2 Answers2

1

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.

Tom Watson
  • 56
  • 2
  • Hi Tom, Thanks for workaround but I'm not able to find attribute osname="Windows NT (unknown)". you have any idea whether it's a constant property or it is getting created at runtime? However I found some code in NativeCodeDescriptionImpl.java file which is present under org.eclipse.osgi.compatibility.state.jar. I suspect this attribute is created using this file. But not sure. Any suggestions? – Jay May 05 '16 at 08:29
  • I removed the entry os.name="Windows NT" and it worked for me. Thanks. – Jay May 17 '16 at 08:27
  • Follow up. I have tracked down the cause and a fix has been released. The bug was in the org.eclipse.osgi.compatibility.state fragment. The work around is to remove the "Windows NT (unknown)" values from the Bundle-NativeCode header or to stop using the org.eclipse.osgi.compatibility.state fragment. – Tom Watson Aug 30 '16 at 15:44
0

Does the bundle have a Bundle-NativeCode header? I suspect it is being mapped to a osgi.native requirement and the value Windows NT (unknown) is not being properly escaped to Windows NT \(unknown\). So the parens in the string are resulting in a bad expression.

BJ Hargrave
  • 9,324
  • 1
  • 19
  • 27
  • This is probably a bug in Equinox so you should open a bug report. – BJ Hargrave May 03 '16 at 12:56
  • Thanks. Also you have any idea about the second error: java.lang.IllegalStateException: Unable to acquire application service. Ensure that the org.eclipse.core.runtime bundle is resolved and started (see config.ini). I tried the solutions given in this post "http://stackoverflow.com/questions/2493415/unable-to-acquire-application-service-error-while-launching-eclipse" but they didn't work for me. You have any suggestions for this? – Jay May 04 '16 at 05:43
  • I am assuming the second issue is a side effect of the first problem. Since the first problem caused some bundle to fail to resolve, it is likely other bundles also did not resolve which resulted in the application service not being registered. – BJ Hargrave May 04 '16 at 16:25