views:

460

answers:

1

Hi,

I'm following the examples from Modular Java but I'm having trouble with chapter 6 and adding the Spring DM modules to my project.

I run:

pax-import-bundle -g org.springframework.osgi -a spring-osgi-extender -v 1.2 -- -DwidenScope -DimportTransitive

When running pax-provision the Spring DM bundles are not resolved. I get complaints about missing imported packages from the spring.osgi.extender and the other two unresolved bundles. My list of provisioned bundles look like this:

0   ACTIVE      org.eclipse.osgi_3.5.0.v20090520
1   ACTIVE      org.eclipse.osgi.util_3.2.0.v20090520-1800
2   ACTIVE      org.eclipse.osgi.services_3.2.0.v20090520-1800
3   ACTIVE      org.ops4j.pax.logging.pax-logging-api_1.3.0
4   ACTIVE      org.ops4j.pax.logging.pax-logging-service_1.3.0
5   INSTALLED   org.springframework.osgi.extender_1.2.0
6   INSTALLED   org.springframework.osgi.core_1.2.0
7   INSTALLED   org.springframework.osgi.io_1.2.0
8   ACTIVE      com.springsource.slf4j.org.apache.commons.logging_1.5.0
9   ACTIVE      com.springsource.slf4j.api_1.5.0
                Fragments=10
10  RESOLVED    com.springsource.slf4j.log4j_1.5.0
                Master=9
11  ACTIVE      com.springsource.org.aopalliance_1.0.0
12  ACTIVE      com.springsource.edu.emory.mathcs.backport_3.1.0
13  ACTIVE      com.springsource.org.apache.log4j_1.2.15
14  ACTIVE      com.springsource.javax.jms_1.1.0
15  ACTIVE      com.springsource.javax.mail_1.4.0
16  ACTIVE      com.springsource.javax.transaction_1.1.0
17  ACTIVE      com.springsource.javax.activation_1.1.0
diag 5

gives the following output:

initial@reference:file:../bundles/org.springframework.osgi.extender_1.2.0.jar/ [5]
  Direct constraints which are unresolved:
    Missing imported package org.springframework.beans_[2.5.6,4.0.0).
    Missing imported package org.springframework.beans.factory_[2.5.6,4.0.0).
    Missing imported package org.springframework.beans.factory.config_[2.5.6,4.0.0).
    Missing imported package org.springframework.beans.factory.xml_[2.5.6,4.0.0).
    Missing imported package org.springframework.context_[2.5.6,4.0.0).
    Missing imported package org.springframework.context.event_[2.5.6,4.0.0).
    Missing imported package org.springframework.core_[2.5.6,4.0.0).
    Missing imported package org.springframework.core.enums_[2.5.6,4.0.0).
    Missing imported package org.springframework.core.io_[2.5.6,4.0.0).
    Missing imported package org.springframework.core.task_[2.5.6,4.0.0).
    Missing imported package org.springframework.osgi_[1.2.0,1.2.0].
    Missing imported package org.springframework.osgi.context_[1.2.0,1.2.0].
    Missing imported package org.springframework.osgi.context.event_[1.2.0,1.2.0].
    Missing imported package org.springframework.osgi.context.support_[1.2.0,1.2.0].
    Missing imported package org.springframework.osgi.extensions.annotation_[1.2.0,1.2.0].
    Missing imported package org.springframework.osgi.service.importer_[1.2.0,1.2.0].
    Missing imported package org.springframework.osgi.service.importer.event_[1.2.0,1.2.0].
    Missing imported package org.springframework.osgi.service.importer.support_[1.2.0,1.2.0].
    Missing imported package org.springframework.osgi.util_[1.2.0,1.2.0].
    Missing imported package org.springframework.scheduling.timer_[2.5.6,4.0.0).
    Missing imported package org.springframework.util_[2.5.6,4.0.0).
    ...

A: 

The problem was a combination of missing repositories and wrong version of the artifact (1.2.0 instead of 1.2).

pax-add-repository -i springsource-repository-release -u http://repository.springsource.com/maven/bundles/release
pax-add-repository -i springsource-repository-external -u 
http://repository.springsource.com/maven/bundles/external

pax-import-bundle -g org.springframework.osgi -a spring-osgi-extender -v 1.2 -- -DwidenScope -DimportTransitive

Fixed the problem.

Mattias Holmqvist
Version 1.2 and 1.2.0 are the same thing - the micro defaults to '0' if you don't specify it.
AlBlue