org.osgi.framework.BundleException: Invalid manifest header Import-Package: "java.lang.Boolean" : Cannot specify java.* packages in Import/Export headers "java.lang.Boolean"

Liferay Issues | Neil Griffin | 9 months ago
  1. 0

    h3. Steps to Reproduce: 1. Start Liferay Portal 7.0.0 B8 2. Clone the [blade|https://github.com/rotty3000/blade] Git repository. 3. Navigate to the blade.portlet.jsp Maven project: {code}cd blade/maven/blade.portlet.jsp{code} 4. Create the following package: {code}mkdir src/main/java/blade/portlet/jsp/stuff{code} 5. Create the following Java classes in the package; {code:java} package blade.portlet.jsp.stuff; public class Foo { } {code} {code:java} package blade.portlet.jsp.stuff; public class Bar { } {code} 6. Replace src/main/resources/META-INF/resources/view.jsp with the following contents: {code:html} <%@ include file="/init.jsp" %> <%@ page import="blade.portlet.jsp.stuff.*, java.lang.Boolean, java.util.ArrayList" %> <% Foo foo = new Foo(); ArrayList<String> myList = new ArrayList<String>(); %> <p>boolean=<%= Boolean.TRUE.toString() %></p> <p>myList=<%= myList.toString() %></p> {code} 7. Build the OSGi bundle: {code}mvn clean package{code} 8. Deploy the OSGi bundle: {code}cp target/blade.portlet.jsp-1.0.0.jar $LIFERAY_HOME/osgi/modules{code} If the bug is fixed, then the OSGi bundle will deploy properly. Otherwise, if the bug still exists, then the following stacktrace will appear in the server log: {noformat} 22:50:22,018 WARN [fileinstall-/Users/ngriffin/Portals/liferay.com/liferay-portal-7.0.0-SNAPSHOT-jsf-2.2/osgi/modules][org_apache_felix_fileinstall:102] Failed to update artifact /Users/ngriffin/Portals/liferay.com/liferay-portal-7.0.0-SNAPSHOT-jsf-2.2/osgi/modules/blade.portlet.jsp-1.0.0.jar org.osgi.framework.BundleException: Invalid manifest header Import-Package: "java.lang.Boolean" : Cannot specify java.* packages in Import/Export headers "java.lang.Boolean" at org.eclipse.osgi.container.builders.OSGiManifestBuilderFactory.checkImportExportSyntax(OSGiManifestBuilderFactory.java:147) at org.eclipse.osgi.container.builders.OSGiManifestBuilderFactory.validateHeaders(OSGiManifestBuilderFactory.java:118) at org.eclipse.osgi.container.builders.OSGiManifestBuilderFactory.createBuilder(OSGiManifestBuilderFactory.java:78) at org.eclipse.osgi.container.builders.OSGiManifestBuilderFactory.createBuilder(OSGiManifestBuilderFactory.java:56) at org.eclipse.osgi.storage.Storage.getBuilder(Storage.java:589) at org.eclipse.osgi.storage.Storage.update(Storage.java:714) at org.eclipse.osgi.internal.framework.EquinoxBundle.update(EquinoxBundle.java:448) at org.apache.felix.fileinstall.internal.DirectoryWatcher.update(DirectoryWatcher.java:1133) at org.apache.felix.fileinstall.internal.DirectoryWatcher.update(DirectoryWatcher.java:905) at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:484) at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:361) at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:313) {noformat} h3. Workaround: - Do not use comma-delimited lists of imports - Instead, use one {{<%@ page import="..." %>}} per line - Do not use wildcards, but instead specify each class individually h3. Observations: 1. In the JSP from step#6, the {{blade.portlet.jsp.stuff.*}} import is not actually necessary, since Bar.java is not used anywhere in the JSP. However, placing it in its own page directive makes the error go away: {code:html} <%@ page import="blade.portlet.jsp.stuff.*" %> <%@ page import="java.lang.Boolean, java.util.ArrayList" %> {code} 2. In the JSP from step#6, if the {{blade.portlet.jsp.stuff.\*}} import is replaced by {{java.net.\*}} then it works. Why does the first unused wildcard cause a problem, and the second does not? 3. The following JSP *should* work fine because Foo.java is used in the JSP, but it fails: {code:html} <%@ page import="blade.portlet.jsp.stuff.Foo, java.util.*, java.lang.Boolean" %> <% Foo foo = new Foo(); ArrayList<String> myList = new ArrayList<String>(); %> <p>boolean=<%= Boolean.TRUE.toString() %></p> <p>myList=<%= myList.toString() %></p> {code} ... error message is: {noformat} Invalid manifest header Import-Package: "java.util.*" : Cannot specify java.* packages in Import/Export headers "java.util.*" {noformat}

    Liferay Issues | 9 months ago | Neil Griffin
    org.osgi.framework.BundleException: Invalid manifest header Import-Package: "java.lang.Boolean" : Cannot specify java.* packages in Import/Export headers "java.lang.Boolean"
  2. 0

    OpenHab 2 startup Could not resolved module ui.paper

    GitHub | 4 months ago | bsutton
    org.osgi.framework.BundleException: Could not resolve module: org.eclipse.smarthome.ui.paper [180] Another singleton bundle selected: osgi.identity; osgi.identity="org.eclipse.smarthome.ui.paper"; type="osgi.bundle"; version:Version="0.9.0.201608031951"; singleton:="true" ```
  3. 0

    BundleException is thrown for empty Import-Package entry

    Eclipse Bugzilla | 7 years ago | zina
    org.osgi.framework.BundleException: Invalid manifest header Import-Package: ""
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Eclipse Community Forums: e(fx)clipse ยป tycho build failing due to missing efxclipse dependencies

    eclipse.org | 4 months ago
    org.osgi.framework.BundleException: Could not resolve module: test.app.plugin.test [25] Unresolved requirement: Import-Package: test.app.plugin.test2 -> Export-Package: test.app.plugin.test2; bundle-symbolic-name="test.app.plugin.test2"; bundle-version="1.0.0.201601141456"; version="0.0.0" test.app.plugin.test2 [10] Unresolved requirement: Import-Package: test.app.model.property -> Export-Package: test.app.model.property; bundle-symbolic-name="test.app.model"; bundle-version="1.0.0.201601141456"; version="0.0.0" test.app.model [19] Unresolved requirement: Import-Package: org.eclipse.fx.core.adapter; version="2.2.0"
  6. 0

    Framework extension will not be resolved on framework start from storage

    GitHub | 1 month ago | JochenHiller
    org.osgi.framework.BundleException: Resolution failed [BundleRequirement{Import-Package org.osgi.service.condpermadmin}, BundleRequirement{Import-Package org.osgi.service.permissionadmin}]

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.osgi.framework.BundleException

      Invalid manifest header Import-Package: "java.lang.Boolean" : Cannot specify java.* packages in Import/Export headers "java.lang.Boolean"

      at org.eclipse.osgi.container.builders.OSGiManifestBuilderFactory.checkImportExportSyntax()
    2. Eclipse OSGi
      EquinoxBundle.update
      1. org.eclipse.osgi.container.builders.OSGiManifestBuilderFactory.checkImportExportSyntax(OSGiManifestBuilderFactory.java:147)
      2. org.eclipse.osgi.container.builders.OSGiManifestBuilderFactory.validateHeaders(OSGiManifestBuilderFactory.java:118)
      3. org.eclipse.osgi.container.builders.OSGiManifestBuilderFactory.createBuilder(OSGiManifestBuilderFactory.java:78)
      4. org.eclipse.osgi.container.builders.OSGiManifestBuilderFactory.createBuilder(OSGiManifestBuilderFactory.java:56)
      5. org.eclipse.osgi.storage.Storage.getBuilder(Storage.java:589)
      6. org.eclipse.osgi.storage.Storage.update(Storage.java:714)
      7. org.eclipse.osgi.internal.framework.EquinoxBundle.update(EquinoxBundle.java:448)
      7 frames
    3. Apache Felix File Install
      DirectoryWatcher.run
      1. org.apache.felix.fileinstall.internal.DirectoryWatcher.update(DirectoryWatcher.java:1133)
      2. org.apache.felix.fileinstall.internal.DirectoryWatcher.update(DirectoryWatcher.java:905)
      3. org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:484)
      4. org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:361)
      5. org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:313)
      5 frames