Announcement Announcement Module
Collapse
No announcement yet.
Spring 3.0 and Spring Batch 2.0.2 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring 3.0 and Spring Batch 2.0.2

    I read that Spring Batch 2.0.2 "should" work with Spring 3.0.x however if I start using those two I get an exception immediately when my application initializes -> java.lang.reflect.MalformedParameterizedTypeExcept ion

    Is this somehting known - Is there a way to get around this?

    Here are the versions I'm using. I thought

    <dependency>
    <groupId>org.springframework.batch</groupId>
    <artifactId>spring-batch-core</artifactId>
    <version>2.0.2.RELEASE</version>
    </dependency>
    <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>org.springframework.core</artifactId>
    <version>3.0.0.M3</version>
    <type>jar</type>
    <optional>false</optional>
    </dependency>
    <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>org.springframework.test</artifactId>
    <version>3.0.0.M3</version>
    <type>jar</type>
    <optional>false</optional>
    </dependency>
    <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>org.springframework.jdbc</artifactId>
    <version>3.0.0.M3</version>
    <type>jar</type>
    <optional>false</optional>
    </dependency>
    <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>org.springframework.orm</artifactId>
    <version>3.0.0.M3</version>
    <type>jar</type>
    <optional>false</optional>
    </dependency>
    <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>org.springframework.transaction</artifactId>
    <version>3.0.0.M3</version>
    <type>jar</type>
    <optional>false</optional>
    </dependency>
    <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>org.springframework.context</artifactId>
    <version>3.0.0.M3</version>
    <type>jar</type>
    <optional>false</optional>
    </dependency>
    <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>org.springframework.beans</artifactId>
    <version>3.0.0.M3</version>
    <type>jar</type>
    <optional>false</optional>
    </dependency>
    <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>org.springframework.aop</artifactId>
    <version>3.0.0.M3</version>
    <type>jar</type>
    <optional>false</optional>
    </dependency>

    Here the exception:

    21:51:11,556 ERROR TestContextManager:270 - Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.Dependenc yInjectionTestExecutionListener@366573] to prepare test instance [com.j4fe.batch.SimpleBatchTest@13e75a5]
    java.lang.IllegalStateException: Failed to load ApplicationContext
    at org.springframework.test.context.TestContext.getAp plicationContext(TestContext.java:255)
    at org.springframework.test.context.support.Dependenc yInjectionTestExecutionListener.injectDependencies (DependencyInjectionTestExecutionListener.java:109 )
    at org.springframework.test.context.support.Dependenc yInjectionTestExecutionListener.prepareTestInstanc e(DependencyInjectionTestExecutionListener.java:75 )
    at org.springframework.test.context.TestContextManage r.prepareTestInstance(TestContextManager.java:267)
    at org.springframework.test.context.junit4.SpringJUni t4ClassRunner.createTest(SpringJUnit4ClassRunner.j ava:155)
    at org.springframework.test.context.junit4.SpringJUni t4ClassRunner$1.runReflectiveCall(SpringJUnit4Clas sRunner.java:263)
    at org.junit.internal.runners.model.ReflectiveCallabl e.run(ReflectiveCallable.java:15)
    at org.springframework.test.context.junit4.SpringJUni t4ClassRunner.methodBlock(SpringJUnit4ClassRunner. java:265)
    at org.springframework.test.context.junit4.SpringJUni t4ClassRunner.runChild(SpringJUnit4ClassRunner.jav a:210)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild( BlockJUnit4ClassRunner.java:44)
    at org.junit.runners.ParentRunner.runChildren(ParentR unner.java:180)
    at org.junit.runners.ParentRunner.access$000(ParentRu nner.java:41)
    at org.junit.runners.ParentRunner$1.evaluate(ParentRu nner.java:173)
    at org.junit.internal.runners.statements.RunBefores.e valuate(RunBefores.java:28)
    at org.junit.internal.runners.statements.RunAfters.ev aluate(RunAfters.java:31)
    at org.junit.runners.ParentRunner.run(ParentRunner.ja va:220)
    at org.springframework.test.context.junit4.SpringJUni t4ClassRunner.run(SpringJUnit4ClassRunner.java:191 )
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestR eference.run(JUnit4TestReference.java:46)
    at org.eclipse.jdt.internal.junit.runner.TestExecutio n.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.main(RemoteTestRunner.java:197)
    Caused by: org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'entityManagerFactory' defined in class path resource [com/j4fe/batch/SimpleBatchTest-context.xml]: Initialization of bean failed; nested exception is java.lang.reflect.MalformedParameterizedTypeExcept ion
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:480)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory$1.run(AbstractAutowireC apableBeanFactory.java:409)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:380)
    at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 64)
    at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:222)
    at org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:261 )
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:185)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:164)
    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:423)
    at org.springframework.context.support.AbstractApplic ationContext.finishBeanFactoryInitialization(Abstr actApplicationContext.java:728)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:380)
    at org.springframework.test.context.support.AbstractG enericContextLoader.loadContext(AbstractGenericCon textLoader.java:84)
    at org.springframework.test.context.support.AbstractG enericContextLoader.loadContext(AbstractGenericCon textLoader.java:1)
    at org.springframework.test.context.TestContext.loadA pplicationContext(TestContext.java:226)
    at org.springframework.test.context.TestContext.getAp plicationContext(TestContext.java:251)
    ... 22 more
    Caused by: java.lang.reflect.MalformedParameterizedTypeExcept ion
    at sun.reflect.generics.reflectiveObjects.Parameteriz edTypeImpl.validateConstructorArguments(Parameteri zedTypeImpl.java:42)
    at sun.reflect.generics.reflectiveObjects.Parameteriz edTypeImpl.<init>(ParameterizedTypeImpl.java:35)
    at sun.reflect.generics.reflectiveObjects.Parameteriz edTypeImpl.make(ParameterizedTypeImpl.java:77)
    at sun.reflect.generics.factory.CoreReflectionFactory .makeParameterizedType(CoreReflectionFactory.java: 86)
    at sun.reflect.generics.visitor.Reifier.visitClassTyp eSignature(Reifier.java:122)
    at sun.reflect.generics.tree.ClassTypeSignature.accep t(ClassTypeSignature.java:31)
    at sun.reflect.generics.repository.ClassRepository.ge tSuperInterfaces(ClassRepository.java:82)
    at java.lang.Class.getGenericInterfaces(Class.java:79 4)
    at org.springframework.core.GenericTypeResolver.getTy peVariableMap(GenericTypeResolver.java:174)
    at org.springframework.core.GenericTypeResolver.resol veReturnType(GenericTypeResolver.java:99)
    at org.springframework.beans.GenericTypeAwareProperty Descriptor.getPropertyType(GenericTypeAwarePropert yDescriptor.java:88)
    at org.springframework.beans.TypeConverterDelegate.co nvertIfNecessary(TypeConverterDelegate.java:138)
    at org.springframework.beans.BeanWrapperImpl.convertF orProperty(BeanWrapperImpl.java:386)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.convertForProperty(Abst ractAutowireCapableBeanFactory.java:1289)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.applyPropertyValues(Abs tractAutowireCapableBeanFactory.java:1250)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.populateBean(AbstractAu towireCapableBeanFactory.java:1010)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:472)
    ... 37 more
    Edit/Delete Message

  • #2
    3.0.0.M3 is a very old version now. I'm not sure if it ever worked with Batch. Upgrade to the latest snapshots (or M4) should work.

    Comment


    • #3
      Spring 3.0 vs. Spring Batch 2.0 - does this work?

      I tried it with M4 but its also not working. However what I found out is that it is working when I run my project from the command line (maven test). Using eclipse it does not work. (even if i use the same classpath -> maven classpath container) and the same Java version (1.6).

      Also I tried to use JDK 1.5 however - same result. It works on command line but not in eclipse. If I remove the dependency on spring batch...

      <dependency>
      <groupId>org.springframework.batch</groupId>
      <artifactId>spring-batch-core</artifactId>
      <version>2.0.2.RELEASE</version>
      </dependency>

      ... it also works in eclipse. So I guess its somhow related to eclipse or the eclipse maven plugin

      Comment


      • #4
        Spring 3.0 vs. Spring Batch 2.0 - does this work?

        Is it possible I'm missing a dependency? I found a similar issue in the ActiveMQ project

        https://brutus.apache.org/activemq/browse/CAMEL-1348

        But as far as i can see the deps are ok

        <dependency>
        <groupId>javax.persistence</groupId>
        <artifactId>persistence-api</artifactId>
        <version>1.0</version>
        </dependency>
        <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.6</version>
        </dependency>
        <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>org.springframework.core</artifactId>
        <version>3.0.0.M4</version>
        <type>jar</type>
        <optional>false</optional>
        </dependency>
        <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>org.springframework.test</artifactId>
        <version>3.0.0.M4</version>
        <type>jar</type>
        <optional>false</optional>
        </dependency>
        <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>org.springframework.jdbc</artifactId>
        <version>3.0.0.M4</version>
        <type>jar</type>
        <optional>false</optional>
        </dependency>
        <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>org.springframework.orm</artifactId>
        <version>3.0.0.M4</version>
        <type>jar</type>
        <optional>false</optional>
        </dependency>
        <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>org.springframework.transaction</artifactId>
        <version>3.0.0.M4</version>
        <type>jar</type>
        <optional>false</optional>
        </dependency>
        <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>org.springframework.context</artifactId>
        <version>3.0.0.M4</version>
        <type>jar</type>
        <optional>false</optional>
        </dependency>
        <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>org.springframework.beans</artifactId>
        <version>3.0.0.M4</version>
        <type>jar</type>
        <optional>false</optional>
        </dependency>
        <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>org.springframework.aop</artifactId>
        <version>3.0.0.M4</version>
        <type>jar</type>
        <optional>false</optional>
        </dependency>

        <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>ejb3-persistence</artifactId>
        <version>1.0.2.GA</version>
        </dependency>

        <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-annotations</artifactId>
        <version>3.4.0.GA</version>
        </dependency>

        <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>3.3.2.GA</version>
        </dependency>

        <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-ehcache</artifactId>
        <version>3.3.2.GA</version>
        </dependency>

        <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-entitymanager</artifactId>
        <version>3.4.0.GA</version>
        </dependency>

        <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-validator</artifactId>
        <version>3.1.0.GA</version>
        </dependency>

        <dependency>
        <groupId>com.oracle</groupId>
        <artifactId>jdbc-jdk5</artifactId>
        <version>11.1.0.7</version>
        <type>jar</type>
        <optional>false</optional>
        </dependency>
        <dependency>
        <groupId>javax.transaction</groupId>
        <artifactId>jta</artifactId>
        <version>1.0.1B</version>
        <type>jar</type>
        <optional>false</optional>
        </dependency>
        <dependency>
        <groupId>javassist</groupId>
        <artifactId>javassist</artifactId>
        <version>3.11.0.GA</version>
        </dependency>

        <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>1.5.6</version>
        </dependency>
        <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>1.5.6</version>
        </dependency>
        <dependency>
        <groupId>org.springframework.batch</groupId>
        <artifactId>spring-batch-core</artifactId>
        <version>2.0.2.RELEASE</version>
        </dependency>
        <dependency>
        <groupId>org.springframework.batch</groupId>
        <artifactId>org.springframework.batch.infrastructu re</artifactId>
        <version>2.0.2.RELEASE</version>
        </dependency>

        Comment


        • #5
          You have a strange mixture there of S2EBR (org.springframework.*) and Maven Central (spring-*) dependencies. Stick to one or the other, and have a careful look at the transitive dependencies (in your IDE or with "mvn dependency:tree") to remove duplicates and wrong versions.

          And please use [code][/code] tags to post code and stacktraces.
          Last edited by Dave Syer; Aug 22nd, 2009, 10:03 AM. Reason: codetags

          Comment

          Working...
          X