On 6/12/10 1:57, Curt Arnold wrote:
On Jun 10, 2010, at 7:59 AM, Richard S. Hall wrote:
On 6/9/10 17:53, petergent wrote:
Hi,
When I try to start just one bundle, the 'log4j-1.2.16.jar' bundle, I get this
error:
Auto-deploy install: org.osgi.framework.BundleException: Duplicate import -
com.sun.jdmk.comm
Google doesn't help me here.
Could you help me?
The maven directory: http://repo1.maven.org/maven2/log4j/log4j/1.2.16/
Looking at its manifest, I see:
Import-Package: com.ibm.uvm.tools;resolution:=optional,com.sun.jdmk.co
mm;resolution:=optional,com.sun.jdmk.comm;resolution:=optional,javax.
The package is imported twice, not sure why, but that is an error. Try a
different version.
I inadvertently specified that class twice in the Import-Package element in the
log4j's POM. I just noticed the typo when writing that last sentence. I was
ready to report it as a bug in maven-bundle-plugin since I thought that it had
duplicated the entry. However, it would have been nice for the bundle plugin
to warn about it.
Agreed. I'm surprised that it doesn't.
Before seeing the typo, I had committed a modified pom.xml and have checked
that it successfully starts in Equinox.
In http://issues.apache.org/bugzilla/show_bug.cgi?id=43282#c4, Craig Muchinsky
raises an issue that the exported packages do not contain an explicit version
number. I do not have sufficient experience with OSGi to know if that is a
valid complaint. Basically was depending on the bundle plugin to do the right
thing and it would seem to have enough info to do that if it should be done.
There is no default for package versions, so if you don't specify one
then it doesn't get one. In your case, it might be simplest just to
specify the bundle version (i.e., JAR version) as the package version
for all exported packages otherwise.
I could appreciate any suggestions. Hopefully, we can release a log4j 1.2.17
to fix it shortly.
The current pom.xml is
http://svn.apache.org/repos/asf/logging/log4j/trunk/pom.xml. Some discussion
of the changes appear in bug 43282. The resulting MANIFEST.MF looks like:
Unfortunately, older versions of the BND tool make a simplifying
decision to import all exports, which you most likely don't want to do,
since you are creating a library bundle. I am hoping that we can update
maven-bundle-plugin to use the newer versions of BND that have a few
more heuristics for generating imports for exported package.
I generated a log4j bundle using a newer version of BND and ended up
with the attached manifest file, where you can see it no longer imports
the exports. You can achieve this in the current plugin with an export
like this:
<Export-Package>!org.apache.log4j.lf5.*,!org.apache.log4j.chainsaw.*,org.apache.log4j.*;-noimport:=true</Export-Package>
Once we get a new plugin release, it will hopefully make better default
choices for this issue.
-> richard
Manifest-Version: 1.0
Export-Package: org.apache.log4j.net;uses:="org.apache.log4j,org.apach
e.log4j.spi,javax.naming,org.apache.log4j.helpers,javax.jms,org.apach
e.log4j.xml,javax.mail,javax.mail.internet,org.w3c.dom,javax.jmdns",o
rg.apache.log4j.jmx;uses:="org.apache.log4j,javax.management,org.apac
he.log4j.helpers,org.apache.log4j.spi",org.apache.log4j.jdbc;uses:="o
rg.apache.log4j,org.apache.log4j.spi",org.apache.log4j.config;uses:="
org.apache.log4j.helpers,org.apache.log4j,org.apache.log4j.spi",org.a
pache.log4j.helpers;uses:="org.apache.log4j,org.apache.log4j.spi,org.
apache.log4j.pattern",org.apache.log4j;uses:="org.apache.log4j.spi,or
g.apache.log4j.helpers,org.apache.log4j.pattern,org.apache.log4j.or,o
rg.apache.log4j.config",org.apache.log4j.or.jms;uses:="org.apache.log
4j.helpers,javax.jms,org.apache.log4j.or",org.apache.log4j.spi;uses:=
"org.apache.log4j,org.apache.log4j.helpers,org.apache.log4j.or",org.a
pache.log4j.pattern;uses:="org.apache.log4j.helpers,org.apache.log4j.
spi,org.apache.log4j,org.apache.log4j.or",org.apache.log4j.or.sax;use
s:="org.apache.log4j.or,org.xml.sax",org.apache.log4j.nt;uses:="org.a
pache.log4j.helpers,org.apache.log4j,org.apache.log4j.spi",org.apache
.log4j.or;uses:="org.apache.log4j.helpers,org.apache.log4j.spi,org.ap
ache.log4j",org.apache.log4j.xml;uses:="javax.xml.parsers,org.w3c.dom
,org.xml.sax,org.apache.log4j.config,org.apache.log4j.helpers,org.apa
che.log4j,org.apache.log4j.spi,org.apache.log4j.or",org.apache.log4j.
varia;uses:="org.apache.log4j.spi,org.apache.log4j,org.apache.log4j.h
elpers"
Ignore-Package: com.sun.jdmk.comm,com.ibm.uvm.tools
Built-By: rickhall
Tool: Bnd-1.0.0
Bundle-Name: Apache Log4j
Created-By: Apache Maven Bundle Plugin
Bundle-Vendor: The Apache Software Foundation
Build-Jdk: 1.6.0_20
Bundle-Version: 1.2.17
Bnd-LastModified: 1276353397052
Bundle-ManifestVersion: 2
Bundle-Description: Apache felix is an OSGi implementation.
Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
Bundle-DocURL: http://logging.apache.org/log4j/1.2
Bundle-SymbolicName: log4j.mod
Import-Package: javax.jmdns;resolution:=optional,javax.jms;resolution:
=optional,javax.mail;resolution:=optional,javax.mail.internet;resolut
ion:=optional,javax.management,javax.naming,javax.xml.parsers,org.w3c
.dom,org.xml.sax
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]