small medium large xlarge

Back to: All Forums  Modular Java
Generic-user-small
03 Dec 2009, 22:46
Shalandra Sharma (4 posts)

Hi, I have been following the dwmj example of this book. I am at chapter 5 (paper book page 83). I have imported pax-logging-api and pax-logging-service bundles as shown in the book. I have also added the pax repository to my pom.xml file. After all this when I am running pax-provision (after building using mvn install), the pax-logging bundles are not starting because of the missing dependencies. Here are the errors which I am getting:

osgi> ss

Framework is launched.

id      State       Bundle
0       ACTIVE      org.eclipse.osgi_3.5.0.v20090520
1       INSTALLED   org.ops4j.pax.logging.pax-logging-api_1.3.0
2       INSTALLED   org.ops4j.pax.logging.pax-logging-service_1.3.0
3       ACTIVE      com.dwmj.domain_1.0.0.SNAPSHOTs
4       ACTIVE      org.compass-project.compass_2.2.0
5       RESOLVED    com.dwmj.index_1.0.0.SNAPSHOT

osgi> diag 1
initial@reference:file:../bundles/org.ops4j.pax.logging.pax-logging-api_1.3.0.jar/ [1]
  Direct constraints which are unresolved:
    Missing imported package org.apache.avalon.framework.logger_4.3.0.
    Missing imported package org.apache.commons.logging_1.1.1.
    Missing imported package org.apache.commons.logging.impl_1.1.1.
    Missing imported package org.apache.juli.logging_1.0.0.
    Missing imported package org.apache.log_0.0.0.
    Missing imported package org.apache.log4j_1.2.15.
    Missing imported package org.apache.log4j.spi_1.2.15.
    Missing imported package org.apache.log4j.xml_1.2.15.
    Missing imported package org.knopflerfish.service.log_1.1.0.
    Missing imported package org.ops4j.pax.logging_[0.9.5,2.0.0).
    Missing imported package org.ops4j.pax.logging.avalon_[0.9.5,2.0.0).
    Missing imported package org.osgi.service.event_[1.0.0,2.0.0).
    Missing imported package org.osgi.service.log_[1.3.0,2.0.0).
    Missing imported package org.slf4j_1.5.6.
    Missing imported package org.slf4j.helpers_1.5.6.
    Missing imported package org.slf4j.spi_1.5.6.

osgi> diag 2
initial@reference:file:../bundles/org.ops4j.pax.logging.pax-logging-service_1.3.0.jar/ [2]
  Direct constraints which are unresolved:
    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.
    Missing imported package org.knopflerfish.service.log_[1.1.0,2.0.0).
    Missing imported package org.ops4j.pax.logging_[0.9.5,2.0.0).
    Missing imported package org.ops4j.pax.logging.spi_1.3.0.
    Missing imported package org.osgi.service.cm_[1.0.0,2.0.0).
    Missing imported package org.osgi.service.event_[1.0.0,2.0.0).
    Missing imported package org.osgi.service.log_[1.3.0,2.0.0).
  Leaf constraints in the dependency chain which are unresolved:
    initial@reference:file:../bundles/org.ops4j.pax.logging.pax-logging-api_1.3.0.jar/ [1]
      Missing imported package org.apache.log_0.0.0.
    initial@reference:file:../bundles/org.ops4j.pax.logging.pax-logging-api_1.3.0.jar/ [1]
      Missing imported package org.osgi.service.event_[1.0.0,2.0.0).

Anyone else has faced the same issue? Any pointers?

Thanks Shalandra

Generic-user-small
03 Dec 2009, 23:36
Shalandra Sharma (4 posts)

I just realized that my equinox environment does not has org.eclipse.osgi.util and org.eclipse.osgi.services bundles installed. Going by the logging example, I am guessing that I would need to import these two bundles. Is that correct? The other option might be to change the highest level POM (dwmj/pom.xml) so that instead of minimal Equinox profile, it downloads the full profile which has these two bundles automatically.

If I have to import these two bundles, how can I get the Maven dependency information (groupId, artifactId and version) for these two bundles and are they in central maven repository? If not, what’s their repository?

Thanks Shalandra

Generic-user-small
03 Dec 2009, 23:50
Shalandra Sharma (4 posts)

My hunch was correct, I was not able to start the logging bundles because org.eclipse.osgi.util and org.eclipse.osgi.services bundles were not installed. For the time being, I manually installed and started these two bundles (start util first and then services). After that I started pax-logging bundles and they came up fine.

So, now I want to know how can I instruct pax:provision command to download and install these two bundles automatically rather than me installing them manually. Any ideas? I am thinking that answer is pax-import-bundle but for that I need Maven dependency information (groupId, artifactId and version) for these two bundles. Does any one have that information?

Generic-user-small
04 Dec 2009, 00:24
Shalandra Sharma (4 posts)

All right folks, after a lot of googling, I have found what I was looking for. I am providing the information here so that others can also benefit if they face the same issues.

To add the bundles org.eclipse.osgi.util and org.eclipse.osgi.services to my project, I did following:

  1. Add the repository “http://repository.jboss.org/maven2/” to main pom.xml using pax-add-repository command because these jar files are not available in central Maven repository.
D:\DEV_EN~1\ECLIPS~1\OSGI_P~1\dwmj>pax-add-repository -i jboss -u http://repository.jboss.org/maven2/
  1. Import the two bundles using pax-import-bundle command:
D:\DEV_EN~1\ECLIPS~1\OSGI_P~1\dwmj>pax-import-bundle -g org.eclipse.equinox -a org.eclipse.osgi.util -v 3.5.1

D:\DEV_EN~1\ECLIPS~1\OSGI_P~1\dwmj>pax-import-bundle -g org.eclipse.equinox -a org.eclipse.osgi.services -v 3.5.1
  1. After this I was able to start all the bundles except for “index” (as expected).
osgi> ss

Framework is launched.

id      State       Bundle
0       ACTIVE      org.eclipse.osgi_3.5.0.v20090520
1       ACTIVE      org.ops4j.pax.logging.pax-logging-api_1.3.0
2       ACTIVE      org.ops4j.pax.logging.pax-logging-service_1.3.0
3       ACTIVE      org.eclipse.osgi.util_3.2.0.v20090520-1800
4       ACTIVE      org.eclipse.osgi.services_3.2.0.v20090520-1800
5       ACTIVE      com.dwmj.domain_1.0.0.SNAPSHOTs
6       ACTIVE      org.compass-project.compass_2.2.0
7       RESOLVED    com.dwmj.index_1.0.0.SNAPSHOT
Bear_pragsmall
09 Dec 2009, 20:22
Alex Khvatov (1 post)

What I ended up doing was, given the fact that you have added http://repository.ops4j.org/maven2/ to your pom Issue these commands:

@pax-import-bundle -g org.eclipse.osgi -a services -v 3.2.0.v20090520-1800@

@pax-import-bundle -g org.eclipse.osgi -a util -v 3.2.0.v20090520-1800@

that would add the missing bundles. Hope this helps. Alex

Generic-user-small
21 Dec 2009, 20:43
Richard Seldon (1 post)

Just a quick word of thanks to Shalandra for taking the time to post his efforts here. Big time saver - I had exactly the same issues and the above fixed them. Thx.

Generic-user-small
27 Dec 2009, 17:18
Ross Duncan (1 post)

Ditto the thanks to Shalandra. This solved my problem also after a long afternoons frustration!

Generic-user-small
09 Jan 2010, 03:45
Matt Stine (1 post)

Thanks folks…this solved my issue as well! :-)

Matt

  You must be logged in to comment