Announcement Announcement Module
Collapse
No announcement yet.
Trouble installing and running the Samples Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Trouble installing and running the Samples

    Hi,

    I have gone through quite a bit of trouble to try installing and running the sample jobs. Of all the things I've tried, the following is my most successful "thread" so far, but I'm still stuck and unable to run any of the sample unit tests. Any help would be greatly appreciated.

    What I have done (using Maven 2.0.4, and an empty local repository)

    1) Downloaded m3a and extracted
    2) "mvn install" ed the from the spring-batch-samples folder
    3) Install failed with below message

    Code:
    [INFO] ------------------------------------------------------------------------
    [ERROR] BUILD ERROR
    [INFO] ------------------------------------------------------------------------
    [INFO] Failed to resolve artifact.
    
    Unsupported Protocol: 's3': Cannot find wagon which supports the requested protocol: s3
      commons-logging:commons-logging:jar:1.1
    
    from the specified remote repositories:
      spring-snapshot (s3://maven.springframework.org/snapshot),
      spring-milestone (http://s3.amazonaws.com/maven.springframework.org/milestone),
      spring-release (s3://maven.springframework.org/release),
      apache-snapshot (http://people.apache.org/maven-snapshot-repository),
      spring-external (http://s3.amazonaws.com/maven.springframework.org/external),
      central (http://repo1.maven.org/maven2)
    Path to dependency:
            1) org.springframework.batch:spring-batch-samples:jar:1.0.0.m3
            2) org.springframework.aws:spring-aws-maven:jar:1.2
            3) commons-logging:commons-logging:jar:1.1
    4) Googled and found the following post: http://forum.springframework.org/arc...p/t-42855.html

    5) As suggested in that post, manually added the following repository in front of the first repository in the *parent* POM:

    Code:
    <repository>
    <id>central-maven2-repo</id>
    <name>Central maven 2 repo</name>
    <url>http://repo1.maven.org/maven2</url>
    </repository>
    6) Re-ran the mvn install
    7) Install failed with below message:

    Code:
    [INFO] ------------------------------------------------------------------------
    [ERROR] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Compilation failure
    
    C:\SpringBatchSecondTry\spring-batch-1.0.0.m3\samples\spring-batch-samples\src\main\java\org\springframework\batch\sampl
    e\tasklet\ExceptionRestartableTasklet.java:[32,7] cannot access org.springframework.beans.factory.InitializingBean
    class file for org.springframework.beans.factory.InitializingBean not found
    public class ExceptionRestartableTasklet extends RestartableItemProviderTasklet {
    8) Googled and found following post: http://forum.springframework.org/showthread.php?t=43264

    9) As suggested in that post, commented the <exclusion> tag for org.springframework - artifact:spring out, as below:

    Code:
    <!--exclusion>
    <groupId>org.springframework</groupId>
    <artifactId>spring</artifactId>
    </exclusion-->
    10) Rerun the mvn install
    11) Install successful this time
    12) Imported project into Eclipse
    13) When trying to execute any of the Unit tests in test/org.springframework.batch.sample, I get the following error:

    Code:
    java.lang.NoSuchMethodError: org.springframework.beans.factory.config.ConfigurableListableBeanFactory.registerResolvableDependency(Ljava/lang/Class;Ljava/lang/Object;)V
    	at org.springframework.context.support.AbstractApplicationContext.prepareBeanFactory(AbstractApplicationContext.java:446)
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:341)
    	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:122)
    	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:66)
    	at org.springframework.batch.sample.AbstractBatchLauncherTests.createApplicationContext(AbstractBatchLauncherTests.java:53)
    	at org.springframework.test.AbstractSingleSpringContextTests.loadContextLocations(AbstractSingleSpringContextTests.java:212)
    	at org.springframework.test.AbstractSingleSpringContextTests.loadContext(AbstractSingleSpringContextTests.java:187)
    	at org.springframework.test.AbstractSpringContextTests.getContext(AbstractSpringContextTests.java:140)
    	at org.springframework.test.AbstractSingleSpringContextTests.setUp(AbstractSingleSpringContextTests.java:100)
    	at junit.framework.TestCase.runBare(TestCase.java:125)
    	at org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:76)
    	at junit.framework.TestResult$1.protect(TestResult.java:106)
    	at junit.framework.TestResult.runProtected(TestResult.java:124)
    	at junit.framework.TestResult.run(TestResult.java:109)
    	at junit.framework.TestCase.run(TestCase.java:118)
    	at junit.framework.TestSuite.runTest(TestSuite.java:208)
    	at junit.framework.TestSuite.run(TestSuite.java:203)
    	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
    	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)
    Now I'm really stuck. Could this error have to do with the two "hacks" I felt obliged to use in order to successfully complete the Maven install? If so, do you have any suggestions for an alternative to using these hacks?

    I would really like to get these samples running asap - we are considering the Spring Batch framework for an application scheduled to go to production in a few months.

    Thanks a lot in advance !
    Charlie

  • #2
    I would say that the two hacks were unnecessary. You probably had an issue with maven 'caching', rather than needing to make any changes to the pom.

    Something like 'mvn -cpu -U' probably would have worked to solve the first issue. If you notice on the error message you sent, you were already pulling from the central repo, adding it explicitly probably didn't change much.

    I'm also not sure what excluding spring would have done either.

    The first thing I would do is upgrade to the latest version of maven. 2.0.4 is pretty old, and then try it from scratch.

    Comment

    Working...
    X