Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Maven Dependencies for Spring DM IntegrationTests

  1. #1
    Join Date
    Dec 2008
    Posts
    11

    Default 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. #2

    Default

    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

  3. #3
    Join Date
    Jul 2008
    Posts
    9

    Default 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.

  4. #4

    Default

    integration test samples are provided with Spring OSGi distribution

  5. #5
    Join Date
    Dec 2008
    Posts
    11

    Default

    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

    Quote 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

  6. #6
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    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,
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

  7. #7
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    David, I've raised an issue myself (http://jira.springframework.org/browse/OSGI-691).
    Cheers,
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

  8. #8
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    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.
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

  9. #9
    Join Date
    Dec 2008
    Posts
    11

    Default

    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

  10. #10
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    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,
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •