felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stuart McCulloch" <stuart.mccull...@jayway.net>
Subject Re: problems with felix 308 patch and log4j
Date Wed, 08 Aug 2007 14:36:37 GMT
On 08/08/07, Arash Amiri <arash.amiri@researchstudio.at> wrote:
>
> Hi,
> Sorry for posting again and again about the same issue, but I just have
> problems getting it done.
>
> I fixed a couple of things in my pom file now using the patch of the
> bundle plugin (felix 308).
> I did set up a very simple maven project (basically a simple artifact),
> imported log4j as dependency, set the packaging to "bundle" and set the
> dependencies the following way:
> I use <Embed-Dependency>*<Embed-Dependency> and
> <Embed-Transitive>true</Embed-Transitive>
>
> still, the bundle cant be started, because of the following missing
> dependencies:
>
>   Missing imported package com.sun.jdmk.comm_0.0.0.
>   Missing imported package javax.jms_0.0.0.
>   Missing imported package javax.mail_0.0.0.
>   Missing imported package javax.mail.internet_0.0.0.


welcome to the world of OSGi :)

these are dependencies that aren't declared in maven because they're
normally found in the Java runtime... however, because their packages
don't start with java.* the OSGi framework does not export them from
the bootclasspath (this is so alternative versions can be provided).

there are a couple of ways to solve this:

  a)  mark them as optional imports, for example Spring-OSGi uses:

       <Import-Package>
           com.sun*;resolution:=optional,
           javax.*;resolution:=optional,
           org.w3c.dom;resolution:=optional,
           org.xml.sax;resolution:=optional,
           org.xml.sax.helpers;resolution:=optional,
           *
       </Import-Package>

  b)  use the org.osgi.framework.bootdelegation OSGi property to get
        the OSGi framework to surface the required additional runtime
        packages (ie. set it to sun.*,com.sun.*,javax.*)

  c)  add bundles that provide these packages

most people choose a) because it's simpler, more portable (ie no extra
setup / bundles) and those packages are _not_ required for general use
of Log4J.

FYI, you might want to look at the Pax-Logging bundle:

    http://wiki.ops4j.org/confluence/x/F

which provides a range of logging APIs that use a single Log4J backend.

HTH  (ps. I've copied this to the felix mailing list)

my (very simple) POM file can be found below:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <project xmlns="http://maven.apache.org/POM/4.0.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/maven-v4_0_0.xsd">
>   <modelVersion>4.0.0</modelVersion>
>   <groupId>TestLog4j</groupId>
>   <artifactId>TestLog4j</artifactId>
>   <packaging>bundle</packaging>
>   <name>TestLog4j</name>
>   <version>1.0-SNAPSHOT</version>
>   <url>http://maven.apache.org</url>
>   <build>
>     <plugins>
>       <plugin>
>         <groupId>org.apache.felix</groupId>
>         <artifactId>maven-bundle-plugin</artifactId>
>         <version>3.1.0-SNAPSHOT</version>
>         <extensions>true</extensions>
>         <configuration>
>           <instructions>
>             <Private-Package>*</Private-Package>


not sure this is what you want - here you're saying that all packages
on the compilation classpath should be marked as 'private' and not
exported... perhaps try <Export-Package>*<Export-Package> ?

            <Embed-Transitive>true</Embed-Transitive>
>             <Embed-Dependency>
>             *
>             </Embed-Dependency>
>           </instructions>
>         </configuration>
>       </plugin>
>     </plugins>
>   </build>
>   <dependencies>
>     <dependency>
>       <groupId>junit</groupId>
>       <artifactId>junit</artifactId>
>       <version>3.8.1</version>
>       <scope>test</scope>
>     </dependency>
>     <dependency>
>       <groupId>log4j</groupId>
>       <artifactId>log4j</artifactId>
>       <version>1.2.14</version>
>     </dependency>
>   </dependencies>
> </project>
>
> is there any problem in the pom?
>
> greetings, arash
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
Cheers, Stuart

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message