Announcement Announcement Module
No announcement yet.
Weird stacktrace Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Weird stacktrace


    I'm having a weird stacktrace while using a <service-activator> :

    <int:chain input-channel="channel1" output-channel="channel2">
    	<int:service-activator method="generateTrni">
    		<bean parent="AbstractTrnGeneratorServices">
    			<property name="prefix" value="ABC" />
    The bean AbstractTrnGeneratorServices is present in another file in the classpath loaded in the same context :

    <bean id="AbstractTrnGeneratorServices" class="com.TrnGeneratorServicesImpl" abstract="true" />
    At runtime, I get the stacktrace :

    04/08/10 15:26:14,944 - DEBUG istableBeanFactory - Ignoring unresolvable metadata in bean definition 'AbstractTrnGeneratorServices$child#0'
    org.springframework.beans.factory.BeanDefinitionSt oreException: Invalid bean definition with name 'AbstractTrnGeneratorServices$child#0' defined in class path resource [project.xml]: Could not resolve parent bean definition 'AbstractTrnGeneratorServices'; nested exception is org.springframework.beans.factory.NoSuchBeanDefini tionException: No bean named 'AbstractTrnGeneratorServices' is defined
    BUT still, it works and the method gets successfully invoked.

    Note: Later in the log, I can see the following :

    DEBUG istableBeanFactory - Creating instance of bean 'AbstractTrnGeneratorServices$child#0'
    This is not blocking, but still a bit confusing when reading the logs. Any idea where this comes from ?

    -- Pierre

    PS : Using Spring Integration 2.0 M6

  • #2
    How are you loading the multiple config files? Are you using imports or passing multiple config file paths? Is there a hierarchy?


    • #3
      A bit of everything

      There is a hierarchy between some context files of a similar structure:
      • core-context.xml
        -> services-context.xml
        -> local-services-context.xml
        (--> AbstractTrnGeneratorServices is defined in this file)
        -> remote-services-context.xml
      • project.xml (--> <service-activator> is defined in this file)

      (in other words: core-context.xml imports services-context.xml, and the latter imports local- and remote-services-context.xml)

      And the context is loaded the following way:

      new ClasspathXmlApplicationContext([project.xml, core-context.xml]);


      • #4
        Interesting. So, if you are only using imports, then there is no actual hierarchy... everything is at the same level (no parent-child relationships).

        Do you see the same problem if you switch the order of the 2 config paths in the constructor call?


        • #5
          No, the problem is gone when I change the order of the context files.

          The dependencies between the two files being only one way, this should do for me. Is this a bug?


          • #6
            Yes, I would say it is a bug. The only question is whether it's a Spring Integration or a general Spring bug. We can investigate that and open it in the appropriate JIRA.

            Can you do one more favor? I would be interested if it works ok when you pass 'project.xml' to the constructor only and have it import 'core-context.xml').



            • #7
              Yes, it works. No such exception.

              Would the whole stacktrace help you to investigate?


              • #8
                I tried to reproduce it with no luck, so its definitely something to do wit the order of imports.
                I have no imports and simply doing this:
                new ClassPathXmlApplicationContext(new String[]{"config.xml", "parent-config.xml"}, TestClass.class);
                and my configuration is simple:
                <bean id="another" class="forum.AnotherService" abstract="true"/>
                <int:channel id="output"/>
                	<int:chain input-channel="input" output-channel="output">
                			<bean parent="another">
                				<property name="prefix" value="anx"/>
                Could you please attach a small sample replicating the issue?


                • #9
                  Here's how to reproduce it:

                  <int-stream:stdin-channel-adapter channel="channel1">
                  		<int:interval-trigger interval="1000" />
                  <int:channel id="channel1" />
                  <int:service-activator input-channel="channel1" output-channel="channel2">
                  	<bean parent="myService" />
                  <int:channel id="channel2" />
                  <int-stream:stdout-channel-adapter channel="channel2" />
                  <bean id="myService" class="test.RandomService" abstract="true" />
                  public static void main(String[] args) throws Exception {
                  	new ClassPathXmlApplicationContext("firstImport.xml","secondImport.xml");

                  Note 1: if you replace "channel2" with "nullChannel", the exception doesn't appear.

                  Note 2: the exception only appears with a logger configured at the DEBUG level.

                  Note 3: in spite of the exception, the application works fine.


                  • #10
                    Thank you

                    I was able to reproduce the problem and we actually have an open JIRA that is related to this, so I've attached this forum to it as well as explanation and the fix, so I would suggest to add yourself as a watcher so you can track its progress.

                    Just so you understand, although I agree this error is nuisance, it is not affecting you, since everything is resolved correctly once the AC is created. However as I said, the issue is fixed and will be available with RC1 unless you want to try nightly build (after tonight)