Announcement Announcement Module
Collapse

Spring Dynamic Modules forum decommissioned in favor of Eclipse Gemini Blueprint

With the official first release of Eclipse Gemini Blueprint shipped, the migration of the Spring Dynamic Modules code base to the Eclipse Foundation, as part of the Gemini project, has been completed.

As such, this forum has been decommissioned in favour of the Eclipse Gemini forums.
See more
See less
Maven Dependencies for Spring DM IntegrationTests Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Maven Dependencies for Spring DM IntegrationTests

    Hello,

    I've been trying to configure an integration test using maven 2.0.7 and Eclipse Ganymede (4.3.1): at this stage I am simply trying to verify the framework (Chapter 9 of the reference guide, 9.2.1).

    This works successfully with the following dependencies:

    Code:
    <dependency>  
         <groupId>org.springframework.osgi</groupId>
         <artifactId>spring-osgi-test</artifactId>
         <version>1.0</version>
         <scope>test</scope>
    </dependency>
    <dependency>
         <groupId>org.eclipse.osgi</groupId>
         <artifactId>org.eclipse.osgi</artifactId>
         <version>3.2.2</version>
         <type>jar</type>
         <scope>provided</scope>
    </dependency>
    <dependency>
         <groupId>org.easymock</groupId>
         <artifactId>easymock</artifactId>
         <version>2.3</version>
         <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>3.8.2</version>
    </dependency>
    but if I try to upgrade spring-osgi-test to 1.1.2 (or 1.1.0/1.1.1) I get the following error:
    Code:
    org.osgi.framework.BundleException: The bundle could not be resolved. 
    Reason: Missing Constraint: Import-Package: org.slf4j.impl; version="1.5.0"
    I asssume this means that I have a dependency missing but cannot find a definitive answer as to what this is (I have been down several blind alleys which lead to other problems)

    Any help or suggestions would be gratefully received

    David Bull

  • #2
    You need this dependency :

    Code:
    <dependency> 
    <groupId>org.slf4j</groupId>  <artifactId>com.springsource.slf4j.log4j</artifactId>
    <version>1.5.6</version>
    </dependency>
    +

    its required dependencies:

    Bundle Name Bundle Symbolic Name Version
    Apache Log4J com.springsource.org.apache.log4j 1.2.15
    SLF4J API com.springsource.slf4j.api 1.5.6
    SLF4J Jakarta Commons Logging Binding com.springsource.slf4j.jcl 1.5.6
    Apache Commons Logging com.springsource.org.apache.commons.logging 1.1.1

    Comment


    • #3
      Tests failed because of missing JUnitTestActivator

      I am also beginner in Spring DM server integration tests. I have run tests in same manner as described in chapter 9 and I get weird error:
      Code:
      16:16:16,125 DEBUG SimpleOsgiTest:208 - Looking for Spring/OSGi powered bundles to wait for...
      16:16:16,140 DEBUG SimpleOsgiTest:377 - Caught exception starting up
      java.lang.IllegalArgumentException: no OSGi service reference found at org.springframework.osgi.test.JUnitTestActivator
      	at org.springframework.util.Assert.notNull(Assert.java:112)
      	at org.springframework.osgi.test.AbstractOsgiTests.initializeServiceRunnerInvocationMethods(AbstractOsgiTests.java:423)
      	at org.springframework.osgi.test.AbstractOsgiTests.startup(AbstractOsgiTests.java:264)
      	at org.springframework.osgi.test.AbstractOsgiTests.prepareTestExecution(AbstractOsgiTests.java:374)
      	at org.springframework.osgi.test.AbstractOsgiTests.runBare(AbstractOsgiTests.java:203)
      	at org.springframework.osgi.test.AbstractOsgiTests$1.protect(AbstractOsgiTests.java:184)
      	at junit.framework.TestResult.runProtected(TestResult.java:128)
      	at org.springframework.osgi.test.AbstractOsgiTests.run(AbstractOsgiTests.java:181)
      	at junit.framework.TestSuite.runTest(TestSuite.java:232)
      	at junit.framework.TestSuite.run(TestSuite.java:227)
      	at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:81)
      	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
      	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
      16:16:16,156  INFO SimpleOsgiTest:491 - Shutting down OSGi platform
      This means some problems with running Junit activator.
      I am using the following bundles:
      Code:
      "org.aopalliance, com.springsource.org.aopalliance, 1.0.0",
      "org.objectweb.asm, com.springsource.org.objectweb.asm, 2.2.3",
      "org.junit, com.springsource.junit, 3.8.2",
      "org.slf4j, com.springsource.slf4j.api, 1.5.0",
      "org.slf4j, com.springsource.slf4j.log4j, 1.5.0",
      "org.slf4j, com.springsource.slf4j.jcl, 1.5.6",
      "org.slf4j, com.springsource.slf4j.org.apache.commons.logging, 1.5.0",
      "org.springframework, org.springframework.aop, 2.5.5.A",
      "org.springframework, org.springframework.beans, 2.5.5.A",
      "org.springframework, org.springframework.context, 2.5.5.A",
      "org.springframework, org.springframework.core, 2.5.5.A",
      "org.springframework, org.springframework.test, 2.5.5.A",	
      "org.springframework.osgi,log4j.osgi,1.2.15-SNAPSHOT",
      "org.springframework.osgi,spring-osgi-annotation,1.0",
      "org.springframework.osgi, org.springframework.osgi.extender, 1.1.2.B",
      "org.springframework.osgi, org.springframework.osgi.core, 1.1.2.B",
      "org.springframework.osgi, org.springframework.osgi.io, 1.1.2.B",
      "org.springframework.osgi, org.springframework.osgi.test, 1.1.2.B",
      BWT, has somebody simple workable example for running these tests?

      I will be thankful for any good idea and suggestion.

      Comment


      • #4
        integration test samples are provided with Spring OSGi distribution

        Comment


        • #5
          Thank you for your suggestion: unfortunately, when I tried this I still get the same "org.osgi.framework.BundleException: Missing Constraint: Import-Package: org.slf4j.impl; version="1.5.0" error

          David

          Originally posted by frederic.conrotte View Post
          You need this dependency :

          Code:
          <dependency> 
          <groupId>org.slf4j</groupId>  <artifactId>com.springsource.slf4j.log4j</artifactId>
          <version>1.5.6</version>
          </dependency>
          +

          its required dependencies:

          Bundle Name Bundle Symbolic Name Version
          Apache Log4J com.springsource.org.apache.log4j 1.2.15
          SLF4J API com.springsource.slf4j.api 1.5.6
          SLF4J Jakarta Commons Logging Binding com.springsource.slf4j.jcl 1.5.6
          Apache Commons Logging com.springsource.org.apache.commons.logging 1.1.1

          Comment


          • #6
            David, can you please raise an issue to track this down? As frederic mentioned, the distribution already provides several samples which you can use.
            It might be that either our setup process automatically downloads an artifact that's missing from your repo. By the way, could you try Maven 2.0.9 and see whether that fixes your problem?
            Thanks,

            Comment


            • #7
              David, I've raised an issue myself (http://jira.springframework.org/browse/OSGI-691).
              Cheers,

              Comment


              • #8
                tushak, you seem to be using the 1.1.2.B versions - can you try the SourceForge (non-A,B) versions?
                I've raised an issue to track this down here: http://jira.springframework.org/browse/OSGI-692

                This being said, in the future, please start your own thread when reporting slightly different problems - linking is prefereable to 'thread hijacking'. Thanks.

                Comment


                • #9
                  Costin,

                  I apologise for not replying sooner: I am pretty sure that I tried 2.0.9 as well but will try again with a clean workspace and attach a comment to the JIRA ticket

                  David

                  Comment


                  • #10
                    David, I've looked at the issue closer and the problem is that you've added only the SFL4J API - you also need the commons-logging adapter and log4j bridge (or whatever other logging implementation you want to use).
                    I've updated section 5.3 from the docs to better reflect the needed logging jars.

                    The jars you need are the following:

                    Code:
                        <!-- commons-logging in slf4j wrapper -->
                        <dependency>
                          <groupId>org.slf4j</groupId>
                          <artifactId>com.springsource.slf4j.org.apache.commons.logging</artifactId>
                          <version>${slf4j.version}</version>
                          <scope>provided</scope>
                        </dependency>
                        <dependency>
                          <groupId>org.slf4j</groupId>
                          <artifactId>com.springsource.slf4j.api</artifactId>
                          <version>${slf4j.version}</version>
                          <scope>provided</scope>
                        </dependency>
                        <dependency>
                          <groupId>org.slf4j</groupId>
                          <artifactId>com.springsource.slf4j.log4j</artifactId>
                          <version>${slf4j.version}</version>
                          <scope>provided</scope>
                          <exclusions>
                            <exclusion>
                                <groupId>log4j</groupId>
                                <artifactId>log4j</artifactId>
                            </exclusion>
                            <exclusion>
                                <groupId>org.apache.log4j</groupId>
                                <artifactId>com.springsource.org.apache.log4j</artifactId>
                            </exclusion>
                          </exclusions>
                        </dependency>
                    Note that this is just the slf4j bit - you'll still have to add the log4j bit (or again, change that to a different implementation if you want).
                    Cheers,

                    Comment


                    • #11
                      tushak, I've been unable to reproduce your problem. Try using on of the samples inside the distribution or take a look at this slightly old screencast:
                      http://www.springsource.org/osgi/demos

                      If you still encounter problems, please start a separate thread.
                      Cheers,

                      Comment


                      • #12
                        Costin,

                        thank you for your responses. I am now able to run the initial integration tests.

                        For completeness, the dependencies I required were:

                        Code:
                        <dependencies>
                        		<!--  OSGi Implementation -->
                        		<dependency>
                        			<groupId>org.eclipse.osgi</groupId>
                        			<artifactId>org.eclipse.osgi</artifactId>
                        			<version>3.2.2</version>
                        			<type>jar</type>
                        			<scope>provided</scope>
                        		</dependency>
                        		<!--  Spring OSGI Test Framework -->
                        		<dependency>
                        			<groupId>org.springframework.osgi</groupId>
                        			<artifactId>spring-osgi-test</artifactId>
                        			<version>1.0</version>
                        			<scope>test</scope>
                        		</dependency>
                        		<!--  Test Framework -->
                        		<dependency>
                        			<groupId>org.easymock</groupId>
                        			<artifactId>easymock</artifactId>
                        			<version>2.3</version>
                        			<scope>test</scope>
                        		</dependency>
                        		<dependency>
                        			<groupId>junit</groupId>
                        			<artifactId>junit</artifactId>
                        			<version>3.8.2</version>
                        		</dependency>
                        		<!--  Logging -->
                        		<dependency>
                        			<groupId>log4j</groupId>
                        			<artifactId>log4j</artifactId>
                        			<version>1.2.14</version>
                        			<scope>provided</scope>
                        		</dependency>
                        		<dependency>
                        			<groupId>org.slf4j</groupId>
                        			<artifactId>com.springsource.slf4j.org.apache.commons.logging</artifactId>
                        			<version>1.5.6</version>
                        			<scope>provided</scope>
                        		</dependency>
                        		<!-- commons-logging in slf4j wrapper -->
                        		<dependency>
                        			<groupId>org.slf4j</groupId>
                        			<artifactId>slf4j-log4j12</artifactId>
                        			<version>1.4.3</version>
                        		</dependency>
                        		<dependency>
                        			<groupId>org.slf4j</groupId>
                        			<artifactId>jcl104-over-slf4j</artifactId>
                        			<version>1.4.3</version>
                        		</dependency>
                        		<dependency>
                        			<groupId>org.slf4j</groupId>
                        			<artifactId>com.springsource.slf4j.log4j</artifactId>
                        			<version>1.5.6</version>
                        			<scope>provided</scope>
                        			<exclusions>
                        				<exclusion>
                        					<groupId>log4j</groupId>
                        					<artifactId>log4j</artifactId>
                        				</exclusion>
                        				<exclusion>
                        					<groupId>org.apache.log4j</groupId>
                        					<artifactId>com.springsource.org.apache.log4j</artifactId>
                        				</exclusion>
                        			</exclusions>
                        		</dependency>
                        		<!--  Dependent bundles -->
                        		<dependency>
                        			<groupId>org.aopalliance</groupId>
                        			<artifactId>com.springsource.org.aopalliance</artifactId>
                        			<version>1.0.0</version>
                        			<scope>test</scope>
                        		</dependency>
                        		<dependency>
                        			<groupId>org.springframework.osgi</groupId>
                        			<artifactId>aopalliance.osgi</artifactId>
                        			<version>1.0-SNAPSHOT</version>
                        			<scope>test</scope>
                        		</dependency>
                        		<dependency>
                        			<groupId>org.springframework.osgi</groupId>
                        			<artifactId>spring-osgi-annotation</artifactId>
                        			<version>1.0</version>
                        			<scope>test</scope>
                        		</dependency>
                        		<dependency>
                        			<groupId>org.springframework.osgi</groupId>
                        			<artifactId>log4j.osgi</artifactId>
                        			<version>1.2.15-SNAPSHOT</version>
                        			<scope>test</scope>
                        		</dependency>
                        	</dependencies>
                        (I basically cleared my local maven repository and added in what was need to the pom.)

                        Also, for completeness I need to use the following repositories:
                        Code:
                        <repositories>
                        		<repository>
                        			<id>com.springsource.repository.bundles.external</id>
                        			<name>SpringSource Enterprise Bundle Repository - External Bundle Releases</name>
                        			<url>http://repository.springsource.com/maven/bundles/external</url>
                        		</repository>
                        		<repository>
                        			<id>spring-release</id>
                        			<name>Spring Portfolio Release Repository</name>
                        			<url>http://maven.springframework.org/release</url>
                        		</repository>
                        		<repository>
                        			<id>spring-external</id>
                        			<name>Spring Portfolio Release Repository</name>
                        			<url>http://maven.springframework.org/external</url>
                        		</repository>
                        		<repository>
                        			<id>spring-milestone</id>
                        			<name>Spring Portfolio Milestone Repository</name>
                        			<url>http://maven.springframework.org/milestone</url>
                        		</repository>
                        		<repository>
                        			<id>spring-ext</id>
                        			<name>Spring External Dependencies Repository</name>
                        			<url>http://springframework.svn.sourceforge.net/svnroot/springframework/repos/repo-ext/</url>
                        		</repository>
                        		<!-- used when building against Spring snapshots -->
                        		<repository>
                        			<id>spring-snapshot</id>
                        			<name>Spring Portfolio
                        			Milestone Repository</name>
                        			<url>http://maven.springframework.org/snapshot</url>
                        			<snapshots>
                        				<enabled>true</enabled>
                        			</snapshots>
                        		</repository>
                        		<repository>
                        			<id>i21-s3-osgi-repo</id>
                        			<name>i21 osgi artifacts repo</name>
                        			<snapshots>
                        				<enabled>true</enabled>
                        			</snapshots>
                        			<url>http://maven.springframework.org/osgi</url>
                        		</repository>
                        	</repositories>
                        I think the JIRA issue can now simply be a request for the maven dependencies to be added to the documentation and will add a comment accordingly.

                        Thank you once again, David

                        Comment

                        Working...
                        X