Cannot determine the artifact identity of the file - osgi

I was getting import package exception, which i solved using menifist file. But now i am getting other excepotions which i have no idea, i am able to deploy simple bundle, but this particular bundle is not running on virgo server from pickup directory.
I have attached the server log and the error i come across.
looking forward to hear from you.
[2012-08-30 22:43:43.250] fs-watcher <DE0014I> Uninstalled bundle 'tasknodebundle' version '0.0.0'.
[2012-08-30 22:44:56.453] fs-watcher <HD0001I> Hot deployer processing 'CREATED' event for file 'tasknodebundle.jar'.
[2012-08-30 22:44:56.468] fs-watcher <DE0701E> Cannot determine the artifact identity of the file 'C:\VIRGO-~1.REL\pickup\tasknodebundle.jar'.
[2012-08-30 22:44:56.484] fs-watcher <HD0002E> Hot deploy failed for file 'tasknodebundle.jar'. org.eclipse.virgo.kernel.deployer.core.DeploymentException: Cannot determine the artifact identity of the file 'C:\VIRGO-~1.REL\pickup\tasknodebundle.jar': uri='file:/C:/VIRGO-~1.REL/pickup/tasknodebundle.jar': uri='file:/C:/VIRGO-~1.REL/pickup/tasknodebundle.jar'
at org.eclipse.virgo.kernel.deployer.core.internal.PipelinedApplicationDeployer.doInstall(PipelinedApplicationDeployer.java:167)
at org.eclipse.virgo.kernel.deployer.core.internal.PipelinedApplicationDeployer.install(PipelinedApplicationDeployer.java:139)
at org.eclipse.virgo.kernel.deployer.core.internal.PipelinedApplicationDeployer.deploy(PipelinedApplicationDeployer.java:252)
at org.eclipse.virgo.kernel.deployer.hot.HotDeploymentFileSystemListener.deploy(HotDeployerFileSystemListener.java:163)
at org.eclipse.virgo.kernel.deployer.hot.HotDeploymentFileSystemListener.onChange(HotDeployerFileSystemListener.java:67)
at org.eclipse.virgo.util.io.FileSystemChecker.notifyListeners(FileSystemChecker.java:245)
at org.eclipse.virgo.util.io.FileSystemChecker.check(FileSystemChecker.java:166)
at org.eclipse.virgo.kernel.deployer.hot.WatchTask.run(WatchTask.java:48)
at java.lang.Thread.run(Thread.java:662)
Caused by: org.eclipse.virgo.kernel.deployer.core.DeploymentException: Cannot determine the artifact identity of the file 'C:\VIRGO-~1.REL\pickup\tasknodebundle.jar': uri='file:/C:/VIRGO-~1.REL/pickup/tasknodebundle.jar'
at org.eclipse.virgo.kernel.deployer.core.internal.PipelinedApplicationDeployer.determineIdentity(PipelinedApplicationDeployer.java:209)
at org.eclipse.virgo.kernel.deployer.core.internal.PipelinedApplicationDeployer.doInstall(PipelinedApplicationDeployer.java:159)
... 8 common frames omitted
Caused by: org.eclipse.virgo.kernel.deployer.core.DeploymentException: Cannot determine the artifact identity of the file 'C:\VIRGO-~1.REL\pickup\tasknodebundle.jar'
at org.eclipse.virgo.kernel.deployer.core.internal.PipelinedApplicationDeployer.determineIdentity(PipelinedApplicationDeployer.java:348)
at org.eclipse.virgo.kernel.deployer.core.internal.PipelinedApplicationDeployer.determineIdentity(PipelinedApplicationDeployer.java:207)
... 9 common frames omitted
menifest file
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: task-node-bundle
Bundle-SymbolicName: task-node-bundle
Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Export-Package: com.ccl.aws.swf.nodes
Bundle-Vendor: Test user
Import-Package: com.ccl.aws.swf.nodes; version="0.0.0",
com.ccl.aws.swf.nodes.util; version="0.0.0",
com.amazonaws.services.ec2; version="1.3.14",
com.amazonaws.services.s3; version="1.3.14",
com.amazonaws.services.sns; version="1.3.14",
com.amazonaws.services.sqs; version="1.3.14",
com.amazonaws.auth; version="1.3.14"

Can you post the manifest file? I guess the problem is there. The file format of the manifest files can be tricky, really small things like a space, backslash or a line that's too long will mess it up.

Related

GMavenPlus: Groovy to JAR - Failed to find or load main class. Main class is present, manifest file appears valid

I've done a successfull mvn clean install on the project I built and the structure appears correct, all classes included and manifest is under META-INF including class-paths and main-class. Not sure what's not matching up here, but the class contents are valid when I checked contents using javap. Main method is present in the redacted_automatedSupport class and is also public.
Error:
host MINGW64 ~/Desktop/Projects/redacted_Automated_Support/target (master)
$ java -jar redacted_automatedSupport-1.0.jar
Error: Could not find or load main class support.redacted_automatedSupport
host MINGW64 ~/Desktop/Projects/redacted_Automated_Support/target (master)
$ java -cp redacted_automatedSupport-1.0.jar support.redacted_automatedSupport
Error: Could not find or load main class support.redacted_automatedSupport
host MINGW64 ~/Desktop/Projects/redacted_Automated_Support/target (master)
$
Manifest contents:
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Built-By: bennet.vella
Class-Path: aws-java-sdk-s3-1.11.696.jar aws-java-sdk-kms-1.11.696.jar
aws-java-sdk-core-1.11.696.jar commons-logging-1.1.3.jar httpclient-
4.5.9.jar httpcore-4.4.11.jar commons-codec-1.11.jar ion-java-1.0.2.j
ar jackson-databind-2.6.7.3.jar jackson-annotations-2.6.0.jar jackson
-core-2.6.7.jar jackson-dataformat-cbor-2.6.7.jar joda-time-2.8.1.jar
jmespath-java-1.11.696.jar groovy-3.0.1.jar groovy-json-3.0.1.jar gr
oovy-dateutil-3.0.1.jar
Created-By: Apache Maven 3.6.3
Build-Jdk: 1.8.0_231
Main-Class: support.redacted_automatedSupport
Jar Archive Contents (renamed to zip to browse):
Support Jar Contents (removed some unecessary data, all names match):
It is not a complete answer, since it doesn't target the Maven issue I was having, but I did solve the IntelliJ problem I had with the wrong manifest file - and that's because I was creating the manifest in src/main/java when it should have been src/main/resources. This should hopefully alleviate some users' problems.
I have not however resolved how to properly build and include all relevant dependent jars using Maven - intelliJ does this successfully.

BitBucket Server Maven error: The default package '.' is not permitted by the Import-Package syntax

I am developing a plugin for BitBucket Server. Today, the Maven instance started throwing the following error after I changed the scope of one dependency:
[ERROR] Manifest com.my-plugin:integrationPlugin:atlassian-plugin:0.1-DEV : The default package '.' is not permitted by the Import-Package syntax.
This can be caused by compile errors in Eclipse because Eclipse creates
valid class files regardless of compile errors.
The following package(s) import from the default package null
[ERROR] Error(s) found in manifest configuration
After I reverted the change, the error did not go away.
I have tried solutions described in other StackOverflow posts, but they did not help me, since:
I am not using Eclipse
I have all packages declared in all my class files
The Bundle tool has this error fixed already
The manifest I got from the Maven debugging output is:
[DEBUG] Final Manifest:
#-----------------------------------------------------------------------
Manifest-Version: 1.0
Atlassian-Build-Date: 2019-04-04T11:44:27+0000
Atlassian-Plugin-Key: com.my-plugin.integrationPlugin
Bnd-LastModified: 1554378274635
Build-Jdk: 1.8.0_191
Built-By: egta136
Bundle-ClassPath: .,META-INF/lib/commons-logging-1.2.jar,META-INF/lib/pd
fbox-2.0.14.jar,META-INF/lib/fontbox-2.0.14.jar,META-INF/lib/ij-1.52n.j
ar
Bundle-Description: This is the com.my-plugin:integrationPlugin plu
gin for Atlassian Bitbucket Server.
Bundle-DocURL: https://example.com
Bundle-ManifestVersion: 2
Bundle-Name: integrationPlugin
Bundle-SymbolicName: com.my-plugin.integrationPlugin
Bundle-Vendor: Example
Bundle-Version: 0.1.0.DEV
Created-By: Apache Maven Bundle Plugin
Export-Package: com.my-plugin.integrationPlugin.api;version="0.1.0"
Import-Package:
com.apple.eawt;version=0;resolution:=optional,
com.atlassian.bitbucket.auth;version=0;resolution:=optional,
com.atlassian.bitbucket.commit;version=0;resolution:=optional,
com.atlassian.bitbucket.project;version=0;resolution:=optional,
com.atlassian.bitbucket.user;version=0;resolution:=optional,
com.atlassian.plugin.spring.scanner.annotation.export;version=0;resolut
ion:=optional,
com.atlassian.plugin.spring.scanner.annotation.imports;version=0;resolu
tion:=optional,
com.atlassian.sal.api;version=0;resolution:=optional,
com.atlassian.sal.api.pluginsettings;version=0;resolution:=optional,
com.atlassian.soy.renderer;version=0;resolution:=optional,
com.dizainsync.ddm.integrationPlugin.api;version=0;resolution:=optional
,
com.fasterxml.jackson.databind;version=0;resolution:=optional,
com.google.common.collect;version=0;resolution:=optional,
javax.crypto;version=0;resolution:=optional,
javax.crypto.spec;version=0;resolution:=optional,
javax.imageio;version=0;resolution:=optional,
javax.imageio.metadata;version=0;resolution:=optional,
javax.imageio.plugins.jpeg;version=0;resolution:=optional,
javax.imageio.stream;version=0;resolution:=optional,
javax.inject;version=0;resolution:=optional,
javax.script;version=0;resolution:=optional,
javax.servlet;version=0;resolution:=optional,
javax.servlet.http;version=0;resolution:=optional,
javax.swing;version=0;resolution:=optional,
javax.swing.event;version=0;resolution:=optional,
javax.swing.table;version=0;resolution:=optional,
javax.swing.text;version=0;resolution:=optional,
javax.swing.text.html;version=0;resolution:=optional,
javax.swing.tree;version=0;resolution:=optional,
javax.tools;version=0;resolution:=optional,
javax.xml.namespace;version=0;resolution:=optional,
javax.xml.parsers;version=0;resolution:=optional,
javax.xml.xpath;version=0;resolution:=optional,
org.apache.avalon.framework.logger;version=0;resolution:=optional,
org.apache.commons.fileupload;version=0;resolution:=optional,
org.apache.commons.fileupload.disk;version=0;resolution:=optional,
org.apache.commons.fileupload.servlet;version=0;resolution:=optional,
org.apache.commons.io;version=0;resolution:=optional,
org.apache.commons.lang3;version=0;resolution:=optional,
org.apache.log;version=0;resolution:=optional,
org.apache.log4j;version=0;resolution:=optional,
org.bouncycastle.asn1;version=0;resolution:=optional,
org.bouncycastle.asn1.cms;version=0;resolution:=optional,
org.bouncycastle.asn1.pkcs;version=0;resolution:=optional,
org.bouncycastle.asn1.x500;version=0;resolution:=optional,
org.bouncycastle.asn1.x509;version=0;resolution:=optional,
org.bouncycastle.cert;version=0;resolution:=optional,
org.bouncycastle.cms;version=0;resolution:=optional,
org.bouncycastle.cms.jcajce;version=0;resolution:=optional,
org.slf4j;version=0;resolution:=optional,
org.w3c.dom;version=0;resolution:=optional,
org.xml.sax;version=0;resolution:=optional,
com.atlassian.plugin.osgi.bridge.external
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"
Spring-Context: *
Tool: Bnd-3.5.0.201709291849
#-----------------------------------------------------------------------
What could be causing this? It is especially weird since reverting the changes to pom.xml did not get rid of the error.
The error was caused by the ImageJ dependency that I had. Apparently some of their classes use the default package which does not play well with maven. Removing the dependency fixes the issue.
I had a similar issue. To find out which dependency may prevent OSGi packaging to work, review error message like Classes found in the wrong directory: {META-INF/versions/9/module-info.class=module-info}
Using jcfind to identify its origin, as an example:
./target/classes/META-INF/lib/classgraph-4.8.43.jar META-INF/versions/9/module-info.class
I am contacting parent POM provider to get this fixed.

Virgo server plugin resolver conflict

I have two bundles, A export two packages, and then B use these two packages(org.dom4j , org.dom4j.io) , and B still uses spring packages exported by other bundles. If I load bundle A then load bundle B in the osgi console, there is no resolver issue.
But, if I put these two packages into a par, if would fail in the synthetic.context bundle, saying "Uses violation:
A's manifest:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: device-openapi
Bundle-SymbolicName: device-openapi
Bundle-Version: 1.0.0
Export-Package: com.google.gson,
com.google.gson.annotations,
com.google.gson.internal,
com.google.gson.internal.bind,
com.google.gson.reflect,
com.google.gson.stream,
org.apache.commons.codec,
org.apache.commons.codec.binary,
org.apache.commons.codec.digest,
org.apache.commons.codec.language,
org.apache.commons.codec.language.bm,
org.apache.commons.codec.net,
org.apache.commons.io,
org.apache.commons.io.comparator,
org.apache.commons.io.filefilter,
org.apache.commons.io.input,
org.apache.commons.io.monitor,
org.apache.commons.io.output,
org.apache.commons.lang3,
org.apache.commons.lang3.builder,
org.apache.commons.lang3.concurrent,
org.apache.commons.lang3.event,
org.apache.commons.lang3.exception,
org.apache.commons.lang3.math,
org.apache.commons.lang3.mutable,
org.apache.commons.lang3.reflect,
org.apache.commons.lang3.text,
org.apache.commons.lang3.text.translate,
org.apache.commons.lang3.time,
org.apache.commons.lang3.tuple,
org.apache.commons.logging,
org.apache.commons.logging.impl,
org.apache.http,
org.apache.http.annotation,
org.apache.http.auth,
org.apache.http.auth.params,
org.apache.http.client,
org.apache.http.client.config,
org.apache.http.client.entity,
org.apache.http.client.methods,
org.apache.http.client.params,
org.apache.http.client.protocol,
org.apache.http.client.utils,
org.apache.http.concurrent,
org.apache.http.config,
org.apache.http.conn,
org.apache.http.conn.params,
org.apache.http.conn.routing,
org.apache.http.conn.scheme,
org.apache.http.conn.socket,
org.apache.http.conn.ssl,
org.apache.http.conn.util,
org.apache.http.cookie,
org.apache.http.cookie.params,
org.apache.http.entity,
org.apache.http.entity.mime,
org.apache.http.entity.mime.content,
org.apache.http.impl,
org.apache.http.impl.auth,
org.apache.http.impl.client,
org.apache.http.impl.conn,
org.apache.http.impl.conn.tsccm,
org.apache.http.impl.cookie,
org.apache.http.impl.entity,
org.apache.http.impl.execchain,
org.apache.http.impl.io,
org.apache.http.impl.pool,
org.apache.http.io,
org.apache.http.message,
org.apache.http.params,
org.apache.http.pool,
org.apache.http.protocol,
org.apache.http.util,
org.apache.log4j,
org.apache.log4j.chainsaw,
org.apache.log4j.config,
org.apache.log4j.helpers,
org.apache.log4j.jdbc,
org.apache.log4j.jmx,
org.apache.log4j.lf5,
org.apache.log4j.lf5.util,
org.apache.log4j.lf5.viewer,
org.apache.log4j.lf5.viewer.categoryexplorer,
org.apache.log4j.lf5.viewer.configure,
org.apache.log4j.net,
org.apache.log4j.nt,
org.apache.log4j.or,
org.apache.log4j.or.jms,
org.apache.log4j.or.sax,
org.apache.log4j.pattern,
org.apache.log4j.rewrite,
org.apache.log4j.spi,
org.apache.log4j.varia,
org.apache.log4j.xml,
org.dom4j,
org.dom4j.bean,
org.dom4j.datatype,
org.dom4j.dom,
org.dom4j.dtd,
org.dom4j.io,
org.dom4j.jaxb,
org.dom4j.rule,
org.dom4j.rule.pattern,
org.dom4j.swing,
org.dom4j.tree,
org.dom4j.util,
org.dom4j.xpath,
org.dom4j.xpp,
org.json,
org.wcc.crypt,
org.wcc.framework
Import-Package: javax.crypto,javax.crypto.spec,javax.naming,javax.nami
ng.directory,javax.naming.event,javax.naming.ldap,javax.naming.spi,ja
vax.net,javax.net.ssl,javax.security.auth.x500
B's manifest:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: NGCPlugin-service
Bundle-SymbolicName: com.myplugin.esdk.storage.service
Bundle-Version: 1.5.50
Bundle-Vendor: myplugin
Bundle-ClassPath: .
Tool: Bundlor 1.1.0.RELEASE
Export-Package: com.myplugin.esdk.storage.mvc,
com.myplugin.esdk.storage.service.datastore,
com.myplugin.esdk.storage.service.device,
com.myplugin.esdk.storage.service.host,
com.myplugin.esdk.storage.service.mount,
com.myplugin.esdk.storage.service.resource,
com.myplugin.esdk.storage.service.snapshot,
com.myplugin.esdk.storage.service.vm
Import-Package: org.apache.commons.logging,
org.dom4j,
org.dom4j.io,
org.json,org.w3c.dom,
org.xml.sax,
org.apache.commons.codec,
org.apache.commons.codec.binary,
org.apache.commons.codec.digest,
org.apache.commons.codec.language,
org.apache.commons.codec.language.bm,
org.apache.commons.codec.net,
org.apache.commons.io,
org.slf4j,
org.springframework.beans.factory.annotation
Error log:
Resolver report:
Uses violation: <Import-Package: org.springframework.beans.factory.annotation; version="0.0.0"> in bundle <com.myplugin.esdk.storage.ngc-2.1.7-com.myplugin.esdk.storage.service_1.5.50[1520387337960]>
Resolver reported uses conflict for import
An Import-Package could not be resolved. Resolver error data <Import-Package: com.myplugin.esdk.storage.service.snapshot; version="0.0.0">. Caused by missing constraint in bundle <com.myplugin.esdk.storage.ngc-2.1.7-synthetic.context_2.1.7>
constraint: <Import-Package: com.myplugin.esdk.storage.service.snapshot; version="0.0.0"> constrained to bundle <com.myplugin.esdk.storage.ngc-2.1.7-com.myplugin.esdk.storage.service> constrained bundle version range "[1.5.50,1.5.50]"
with attributes {module_scope=com.myplugin.esdk.storage.ngc-2.1.7}
Anyone knows how to fix this? I tried to make a dummy bundle which uses Import-Bundle to import the two bundle's all exported packages, after I manually loaed the A and B bundle, these is no resolver error......
I am not familiar with deployment of PAR files, when using Virgo I normally deploy PLAN files. This said, I suspect that the problem may be due to the fact that A exports a number of packages org.apache* which are probably already exported by other bundles included in Virgo and which are dependencies of Spring. So when your PAR is resolved, plan B finds itself in the situation in which the same package is being inherited from A and also from Spring via transitive dependencies.
I would try to remove from A manifest the export of all the packages that are already provided by Virgo.

Felix GoGo Shell throws MalformedURLException: unknown protocol: bundleresource in Equinox

I am writing an extension to a Java application called ZAP. The extension is a fat/uber jar that has the Equinox bundle (org.eclipse.osgi) inlined. Additional bundles are also included in this jar, within a sub-directory bundles. The OSGi framework is being launched as outlined in How To Embed OSGi.
I'm trying to get Felix GoGo shell to work, following the steps outlined via Eclipse's "Console Shell" documentation. It specifies the following required bundles:
org.apache.felix.gogo.command
org.apache.felix.gogo.runtime
org.apache.felix.gogo.shell
org.eclipse.equinox.console
In addition to Equinox / org.eclipse.osgi. Since Equinox is not on the class path, I set org.osgi.framework.system.packages.extra configuration to the Export-Package value specified by Equinox's bundle, visible here.
Once the framework is in the ACTIVE state, I see the following stack trace in Eclipse (or via the command line outside of Eclipse):
Starting OSGi framework...
OSGi framework state: 32
gogo: MalformedURLException: unknown protocol: bundleresource
java.net.MalformedURLException: unknown protocol: bundleresource
at java.net.URL.<init>(URL.java:593)
at java.net.URL.<init>(URL.java:483)
at java.net.URL.<init>(URL.java:432)
at java.net.URI.toURL(URI.java:1089)
at org.apache.felix.gogo.shell.Shell.readScript(Shell.java:209)
at org.apache.felix.gogo.shell.Shell.source(Shell.java:192)
at org.apache.felix.gogo.shell.Shell.gosh(Shell.java:109)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.felix.gogo.runtime.Reflective.invoke(Reflective.java:137)
at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:82)
at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:477)
at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:403)
at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)
at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183)
at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120)
at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:89)
at org.apache.felix.gogo.shell.Activator.run(Activator.java:75)
at java.lang.Thread.run(Thread.java:745)
It seems the Equinox URL handlers are not being used by GoGo. I noticed the following packages related to them were not in Equinox's Export-Package:
org.eclipse.osgi.storage.url
org.eclipse.osgi.storage.url.bundleresource
org.eclipse.osgi.storage.url.bundleentry
So I also included those in the org.osgi.framework.system.packages.extra package list. That didn't help.
The bundles are installed and started without any obvious errors otherwise.
How do I make GoGo utilize Equinox's custom URL handlers?
Update 1: Maybe Red Herring
In random troubleshoot I wanted to execute the final shaded jar as outlined here. I copied both the original org.eclipse.osgi bundle and the shaded jar in the same directory. There's a configuration/config.ini specifying the bundles to load.
Executing the stock bundle brings up the console:
$ java -cp ~/.p2/pool/plugins/org.eclipse.osgi_3.11.0.v20160121-2005.jar org.eclipse.core.runtime.adaptor.EclipseStarter -console
osgi> ss
"Framework is launched."
id State Bundle
0 ACTIVE org.eclipse.osgi_3.11.0.v20160121-2005
1 ACTIVE org.apache.felix.gogo.runtime_0.10.0.v201209301036
2 ACTIVE org.apache.felix.gogo.command_0.10.0.v201209301215
3 ACTIVE org.apache.felix.gogo.shell_0.10.0.v201212101605
4 ACTIVE org.eclipse.equinox.console_1.1.200.v20150929-1405
osgi> exit
Really want to stop Equinox? (y/n; default=y)
Executing the shaded jar, not so much:
java -cp semiotics-alpha-1.zap org.eclipse.core.runtime.adaptor.EclipseStarter -console
java.lang.NullPointerException: A null service reference is not allowed.
at org.eclipse.osgi.internal.framework.BundleContextImpl.getService(BundleContextImpl.java:617)
at org.eclipse.core.runtime.adaptor.EclipseStarter.startup(EclipseStarter.java:299)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:231)
at org.eclipse.core.runtime.adaptor.EclipseStarter.main(EclipseStarter.java:208)
This could be a total red herring... I'm very ignorant on OSGi, this being my first hands-on experience with it. However, I would expect the shaded jar to execute no differently than the stock Equinox jar. Since I don't understand why there's a difference I'm gonna dig there for lack of any better spots to dig...
Update 2: Equinox on Classpath Works Around Issue
I added the Equinox bundle to ZAP's classpath via its lib directory and removed it from being inlined into the extension jar. Doing this and adjusting the ServiceLoader.load call to not include a class loader (defaulting to system class loader) works:
Starting bundle: org.apache.felix.gogo.shell_0.10.0.v201212101605 [1]
Starting bundle: org.eclipse.equinox.console_1.1.100.v20141023-1406 [2]
Starting bundle: org.apache.felix.gogo.command_0.10.0.v201209301215 [3]
Starting bundle: org.eclipse.emf.ecore_2.11.2.v20160208-0816 [4]
Starting bundle: org.eclipse.emf.common_2.11.1.v20160208-0816 [5]
Starting bundle: org.apache.felix.gogo.runtime_0.10.0.v201209301036 [6]
osgi> ss
"Framework is launched."
id State Bundle
0 ACTIVE org.eclipse.osgi_3.11.0.v20160121-2005
1 ACTIVE org.apache.felix.gogo.shell_0.10.0.v201212101605
2 ACTIVE org.eclipse.equinox.console_1.1.100.v20141023-1406
3 ACTIVE org.apache.felix.gogo.command_0.10.0.v201209301215
4 ACTIVE org.eclipse.emf.ecore_2.11.2.v20160208-0816
5 ACTIVE org.eclipse.emf.common_2.11.1.v20160208-0816
6 ACTIVE org.apache.felix.gogo.runtime_0.10.0.v201209301036
osgi>
The underlying issue might be how the jar is being inlined, possibly related to the MANIFEST.MF file. Possibly related, I now don't need to supply a value for org.osgi.framework.system.packages.extra.
I'm going to leave this question unanswered since the original point was to include the OSGi library as a shaded artifact. Maybe bndtools can help?
OK, it seems the lack of a descriptive META-INF/MANIFEST.MF was the culprit:
Removed (jar uM...) then updated (jar um...) the shaded jar's MANIFEST.MF to be a copy of Equinox's manifest, modifying the Bundle-Version number to end in 1766 versus 1700.
Removed Equinox from ZAP's classpath
Then I loaded the extension as is. GoGo shell starts:
osgi> 13177 [AWT-EventQueue-0] INFO org.parosproxy.paros.control.Control - New Session
ss
"Framework is launched."
id State Bundle
0 ACTIVE org.eclipse.osgi_3.10.102.v20160118-1766
1 ACTIVE org.apache.felix.gogo.runtime_0.10.0.v201209301036
2 ACTIVE org.eclipse.emf.common_2.11.1.v20160208-0816
3 ACTIVE org.apache.felix.gogo.shell_0.10.0.v201212101605
4 ACTIVE org.eclipse.equinox.console_1.1.100.v20141023-1406
5 ACTIVE org.apache.felix.gogo.command_0.10.0.v201209301215
6 ACTIVE org.eclipse.emf.ecore_2.11.2.v20160208-0816
osgi>
I see the system bundle ends in the same modified version number, so it's honoring the added MANIFEST.MF. So the underlying issue was an incomplete system bundle manifest. Copying an existing one (Equinox's) works well enough. It also works for a straight commandline test:
$ java -cp semiotics-alpha-1.zap org.eclipse.core.runtime.adaptor.EclipseStarter -console
osgi> exit
Really want to stop Equinox? (y/n; default=y) y
Dunno if I'll use this approach or not. At least I know what I need to do if I want to use this approach.

Unable to wire proper bundle with my own bundle in wso2 app server

I am using wso2 Application Server 5.1.0.
I have deployed my own bundle having name demo-service which contains import-package definition in its manifest as below:
>Bundle-SymbolicName = demo-service
Import-Package = javax.sql,org.apache.commons.dbcp;version="[1.4,2)"
I tried to diagnose the most popular "uses conflict" in OSGi world for my case and I found that commons-dbcp_1.4.0.wso2v1.jar and commons-dbcp-1.4.jar both were converted to OSGi bundle by container and exported their packages with version "0.0.0" which can be observed from the output below:
>osgi> packages org.apache.commons.dbcp
org.apache.commons.dbcp; version="0.0.0"<commons-dbcp_1.4.0.wso2v1 [49]>
compass_2.0.1.wso2v2 [60] imports
org.wso2.carbon.core_4.1.0 [256] imports
org.wso2.carbon.registry.core_4.1.0 [377] imports
org.wso2.carbon.tenant.mgt_2.1.0 [434] imports
synapse-commons_2.1.1.wso2v3 [528] imports
synapse-core_2.1.1.wso2v3 [529] imports
org.apache.commons.dbcp; version="0.0.0"<commons_dbcp_1.4_1.0.0 [57]>
According to the requirement of my demo-service bundle it's not able to find
org.apache.commons.dbcp;version="[1.4,2)"
Is there any way to export the packages of commons-dbcp-1.4.jar after it gets converted from non-osgi bundle to osgi bundle because I need to make sure that my demo-service bundle should wire with commons-dbcp-1.4.jar..
In brief, any version of thirdparty jar I put in WSO2_HOME\repository\components\lib folder container exports it with version="0.0.0" .. which discourages the main concept for classloading of OSGi
please suggest if any workaround is possible in this case .. :)
Thanks ..
When a version is not specified while exporting packages OSGi defaults to version 0.0.0. In this case as it's automatically converting to osgi bundle it might not be having version explicitly specified. Sometimes this also helps to ensure that multiple versions of packages are not present.
In your case as you need to use the packages in the bundle put in repository\components\lib folder you could manually specify the version. The OSGi-fied bundles of the jars you put in repository\components\lib can be found in repository\components\dropins folder. Inside that bundle you will find the OSGi manifest file. In the manifest file manually specify the versions for the required packages under Export-Package category as follows.
org.apache.commons.dbcp;version=1.4.1
Then on startup, it would use these bundles and you should be able to export packages with specified version.

Resources