Resolving Bundle-SymbolicName Syntax Issues

Liferay’s OSGi Runtime framework sometimes throws an IllegalContextNameException. Often, this is because an OSGi bundle’s Bundle-SymbolicName manifest header has a space in it.

The Bundle-SymbolicName uniquely identifies the bundle—along with the Bundle-Version manifest header—and cannot contain spaces. To follow naming best practices, use a reverse-domain name in your Bundle-SymbolicName. For example, a module with the domain troubleshooting.liferay.com would be reversed to com.liferay.troubleshooting..

There are three ways to specify a bundle’s Bundle-SymbolicName:

  1. Bundle-SymbolicName header in a bundle’s bnd.bnd file.

  2. Bundle-SymbolicName header in a plugin WAR’s liferay-plugin-package.properties file.

  3. Plugin WAR file name, if the WAR’s liferay-plugin-package.properties has no Bundle-SymbolicName header.

For plugin WARs, specifying the Bundle-SymbolicName in the liferay-plugin-package.properties file is preferred.

For example, if you deploy a plugin WAR that has no Bundle-SymbolicName header in its liferay-plugin-package.properties, the WAB Generator uses the WAR’s name as the WAB’s Bundle-SymbolicName. If the WAR’s name has a space in it (e.g., space-program-theme v1.war) an IllegalContextNameException occurs on deployment.

org.apache.catalina.core.ApplicationContext.log The context name 'space-program-theme v1' does not follow Bundle-SymbolicName syntax.
org.eclipse.equinox.http.servlet.internal.error.IllegalContextNameException: The context name 'space-program-theme v1' does not follow Bundle-SymbolicName syntax.

However you set your a Bundle-SymbolicName, refrain from using spaces.

Using the WAB Generator

« Identifying Liferay Artifact Versions for DependenciesCalling Non-OSGi Code that Uses OSGi Services »
Was this article helpful?
0 out of 0 found this helpful