Announcement Announcement Module
Collapse
No announcement yet.
Exception upgrading SI 2.1.0 to 2.1.2 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Exception upgrading SI 2.1.0 to 2.1.2

    Hi,

    I have a working project when using SI 2.1.0-RELEASE and Spring 3.0.7-RELEASE. When I changed it to compile with SI 2.1.2-RELEASE and Spring 3.1.0-RELEASE, I have an error loading the spring context, which is not intuitive to track down.

    I need assistance to track down what is causing this error.

    The error occurs even with the @Test method and the auto wired field removed, leaving just the @ContextConfiguration and @RunWith there.

    This is a sample class:
    Code:
    @RunWith(SpringJUnit4ClassRunner.class)
    @ContextConfiguration(locations = {"/sif/ws/routing-context.xml"})
    public class SaajServiceNameRouterTest {
    
    //    @Autowired
    //    private SaajServiceNameRouter saajServiceNameRouter;
    
        @Test
        public void testDetermineServiceName() throws Exception {
    }
    This is the context file:
    Code:
    <beans:beans
            xmlns:beans="http://www.springframework.org/schema/beans"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xmlns:int="http://www.springframework.org/schema/integration"
            xmlns:p="http://www.springframework.org/schema/p"
            xsi:schemaLocation="http://www.springframework.org/schema/beans
            http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
            http://www.springframework.org/schema/integration
            http://www.springframework.org/schema/integration/spring-integration-2.1.xsd">
    
        <int:channel id="ws-errorMessageChannel"/>
        <int:channel id="ws-unknownServiceChannel"/>
        <int:channel id="ws-incommingPingPongChannel"/>
        <int:channel id="ws-sifAdminMessageChannel"/>
    
    
        <!-- ======================================= SIF Routing ======================================= -->
        <int:router id="ws-route-SaajSoapMessage-ByServiceName"
                    input-channel="ws-inboundChannel"
                    default-output-channel="ws-unknownServiceChannel"
                    method="determineServiceName"
                    ref="saajServiceNameRouter"
                >
            <int:mapping value="service1" channel="service1Channel"/>
            <int:mapping value="service2" channel="service2Channel"/>
            <int:mapping value="service3" channel="service3Channel"/>
            <int:mapping value="service4" channel="service4Channel"/>
        </int:router>
    
        <beans:bean id="saajServiceNameRouter"
                    class="com.wfb.csts.sif.ws.message.SaajServiceNameRouter">
            <beans:property name="serviceNameRouter" ref="serviceNameRouterPrefixResolver"/>
        </beans:bean>
    
        <beans:bean id="serviceNameRouterPrefixResolver"
                    class="com.wfb.csts.sif.ws.message.ServiceNameRouterPrefixResolver">
        </beans:bean>
    </beans:beans>
    Last edited by Wrangler; Jun 28th, 2012, 01:16 PM. Reason: edited to trivial example

  • #2
    Hi Wrangler,


    It will be very helpful to paste your spring context loading error stack trace even if it is not intuitive to track down.

    Thank your

    Comment


    • #3
      Sorry, it did not fit due to forum content post rules. I had to shrink it down to post it by removing junit4 traces.

      Here is the stack trace:
      Code:
      [2012-06-28 09:20:06,170 ERROR main](org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:324)) - Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@95da38] to prepare test instance [com.wfb.csts.sif.ws.message.SaajServiceNameRouterTest@50988]
      java.lang.IllegalStateException: Failed to load ApplicationContext
      	at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:157)
      	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunnCaused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'channelInitializer': Invocation of init method failed; nested exception is java.lang.NoSuchFieldError: NULL
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
      	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
      	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
      	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
      	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
      	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
      	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
      	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
      	at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:103)
      	at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:1)
      	at org.springframework.test.context.support.DelegatingSmartContextLoader.loadContext(DelegatingSmartContextLoader.java:228)
      	at org.springframework.test.context.TestContext.loadApplicationContext(TestContext.java:124)
      	at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:148)
      	... 27 more
      Caused by: java.lang.NoSuchFieldError: NULL
      	at org.springframework.expression.TypedValue.<clinit>(TypedValue.java:32)
      	at org.springframework.expression.spel.support.StandardEvaluationContext.setRootObject(StandardEvaluationContext.java:88)
      	at org.springframework.expression.spel.support.StandardEvaluationContext.<init>(StandardEvaluationContext.java:74)
      	at org.springframework.context.expression.StandardBeanExpressionResolver.evaluate(StandardBeanExpressionResolver.java:124)
      	at org.springframework.beans.factory.support.AbstractBeanFactory.evaluateBeanDefinitionString(AbstractBeanFactory.java:1299)
      	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.evaluate(BeanDefinitionValueResolver.java:224)
      	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:200)
      	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedSet(BeanDefinitionValueResolver.java:365)
      	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:157)
      	at org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:616)
      	at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:148)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1035)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:939)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
      	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
      	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
      	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
      java.lang.IllegalStateException: Failed to load ApplicationContext
      	at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:157)
      	at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109)
      	at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)
      	at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:321)
      	at 	... 27 more
      Caused by: java.lang.NoSuchFieldError: NULL
      	at org.springframework.expression.TypedValue.<clinit>(TypedValue.java:32)
      	at org.springframework.expression.spel.support.StandardEvaluationContext.setRootObject(StandardEvaluationContext.java:88)
      	at org.springframework.expression.spel.support.StandardEvaluationContext.<init>(StandardEvaluationContext.java:74)
      	at org.springframework.context.expression.StandardBeanExpressionResolver.evaluate(StandardBeanExpressionResolver.java:124)
      	at org.springframework.beans.factory.support.AbstractBeanFactory.evaluateBeanDefinitionString(AbstractBeanFactory.java:1299)
      	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.evaluate(BeanDefinitionValueResolver.java:224)
      	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:200)
      	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedSet(BeanDefinitionValueResolver.java:365)
      	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:157)
      	at org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:616)
      	at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:148)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1035)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:939)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
      	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
      	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
      	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
      	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
      	at org.springframework.integration.config.xml.ChannelInitializer.afterPropertiesSet(ChannelInitializer.java:71)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)
      	... 41 more
      
      [2012-06-28 09:20:06,217 DEBUG main](org.springframework.test.annotation.ProfileValueUtils.retrieveProfileValueSource(ProfileValueUtils.java:68)) - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.wfb.csts.sif.ws.message.SaajServiceNameRouterTest]
      [2012-06-28 09:20:06,233 DEBUG

      Comment


      • #4
        Looks like a classpath problem; my best guess is you have spring-core 3.1.1 but spring-expression 3.0.7. TypeDescriptor.NULL no longer exists in 3.1 but spring-expression 3.0 references it.

        Comment


        • #5
          Originally posted by Gary Russell View Post
          Looks like a classpath problem; my best guess is you have spring-core 3.1.1 but spring-expression 3.0.7. TypeDescriptor.NULL no longer exists in 3.1 but spring-expression 3.0 references it.
          Gary,

          By the way, you gave a nice SI webinar last month, I found the content useful.

          Your answer was on target. I took a look at the output of "mvn dependency:tree" and noticed several SI or Spring dependencies are including the 3.0.7 version, such as spring-expression 3.0.7. I added maven excludes for these, and added in new dependencies to satisfy compiles for 3.1.0.RELEASE.

          The project builds correctly now.

          In looking at your answer, it looks like there is a 3.1.1.RELEASE available now, perhaps I should change my maven property to that version.

          Comment

          Working...
          X