Oops, I copied and pasted while I was testing stuff out, the PrivatePackage line should read
<Private-Package>com.company.container.*,org.json</Private-Package> But the results are the same, org.json is not in my private package list in the manifest and is also not listed in the bundle in the jar. On Oct 29, 2013, at 9:45 AM, Wade Girard <[email protected]> wrote: > I am still new to felix and osgi and I am trying to create a war that I can > deploy to felix. > > Here is my pom.xml > > <?xml version="1.0" encoding="UTF-8"?> > <project> > <modelVersion>4.0.0</modelVersion> > <groupId>com.company</groupId> > <artifactId>container</artifactId> > <version>1.0.0</version> > <packaging>war</packaging> > <name>Container</name> > <description>An OSGi bundle version of the Container</description> > <url>http://www.wso1.org</url> > > <build> > <plugins> > <plugin> > <groupId>org.apache.felix</groupId> > <artifactId>maven-bundle-plugin</artifactId> > <version>1.4.0</version> > <extensions>true</extensions> > <executions> > <execution> > <id>bundle-manifest</id> > <phase>process-classes</phase> > <goals> > <goal>manifest</goal> > </goals> > </execution> > </executions> > <configuration> > <supportedProjectTypes> > <supportedProjectType>jar</supportedProjectType> > <supportedProjectType>bundle</supportedProjectType> > <supportedProjectType>war</supportedProjectType> > </supportedProjectTypes> > <instructions> > > <Bundle-SymbolicName>${pom.groupId}.${pom.artifactId}</Bundle-SymbolicName> > <Bundle-Name>${pom.name}</Bundle-Name> > <Bundle-Version>${pom.version}</Bundle-Version> > > <Bundle-Activator>com.company.container.Activator</Bundle-Activator> > <Private-Package>com.company.container.*</Private-Package> > <Embed-Dependency>*;scope=compile|runtime</Embed-Dependency> > <Embed-Directory>WEB-INF/lib</Embed-Directory> > <Embed-Transitive>true</Embed-Transitive> > <Web-ContextPath>/container</Web-ContextPath> > <Webapp-Context>/container</Webapp-Context> > <_wab>src/main/webapp</_wab> > </instructions> > </configuration> > </plugin> > <plugin> > <groupId>org.apache.maven.plugins</groupId> > <artifactId>maven-war-plugin</artifactId> > <version>2.1.1</version> > <executions> > <execution> > <phase>compile</phase> > <goals> > <goal>exploded</goal> > </goals> > </execution> > </executions> > <configuration> > <webappDirectory>src/main/webapp/</webappDirectory> > <archive> > <!-- add the generated manifest to the war --> > > <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile> > </archive> > </configuration> > </plugin> > </plugins> > </build> > > <dependencies> > <dependency> > <groupId>org.apache.felix</groupId> > <artifactId>org.osgi.core</artifactId> > <version>1.0.0</version> > </dependency> > <dependency> > <groupId>org.apache.felix</groupId> > <artifactId>org.apache.felix.utils</artifactId> > <version>1.2.0</version> > </dependency> > <dependency> > <groupId>org.apache.felix</groupId> > <artifactId>org.apache.felix.http.bundle</artifactId> > <version>2.2.1</version> > </dependency> > <dependency> > <groupId>org.json</groupId> > <artifactId>json</artifactId> > <version>20080701</version> > </dependency> > </dependencies> > </project> > </xml> > > In my code for my bundle I am using org.json. Here is the manifest that is > produced > > Manifest-Version: 1.0 > Webapp-Context: /container > Embed-Directory: WEB-INF/lib > Private-Package: com.company.container;version="1.0.0",com.company.c > ontainer.object;version="1.0.0",com.company.container.services;versi > on="1.0.0",com.company.container.services.impl;version="1.0.0",com.c > ompany.container.servlet;version="1.0.0" > Tool: Bnd-0.0.238 > Bundle-Name: Container > Created-By: 1.6.0_65 (Apple Inc.) > Web-ContextPath: /container > Bundle-Version: 1.0.0 > Bnd-LastModified: 1383057583330 > Embed-Transitive: true > Bundle-ManifestVersion: 2 > Bundle-Activator: com.company.container.Activator > Bundle-Description: An OSGi bundle version of the Container > Import-Package: javax.servlet;version="2.5",javax.servlet.http;version > ="2.5",org.json,org.osgi.framework;version="1.4",org.osgi.service.htt > p;version="1.2",org.osgi.util.tracker;version="1.3" > Embed-Dependency: *;scope=compile|runtime > Bundle-SymbolicName: com.company.container > > As you can see, org.json is not in the Private-Package list. It is in the > Import-Package list. Unfortunately it is not being exported by any bundles > running on my felix server. > > I can see the json.jar file in the list of files in the wars WEB-INF/lib > directory. > > When I install and start this I get the following error > org.osgi.framework.BundleException: Unresolved constraint in bundle > com.company.container [98]: Unable to resolve 98.0: missing requirement > [98.0] osgi.wiring.package; (osgi.wiring.package=org.json) > > What is the correct way to handle this? Have the jar in the WEB-INF and > somehow import it from there? or have it be in the bundle? And how do I go > about making the correct solution work? > > Thanks

