Announcement Announcement Module
Collapse
No announcement yet.
Problems with message-broker services-config-path Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problems with message-broker services-config-path

    Hello

    I have a web app with multiple applicationContect files so in my web.xml I have:
    Code:
       <servlet>
            <servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
            <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
            <init-param>
                <param-name>contextConfigLocation</param-name>
                <param-value>classpath*:applicationContext*.xml</param-value>
            </init-param>
            <load-on-startup>20</load-on-startup>
        </servlet>
    I've configured my message-broker a file named applicationContext-flex.xml in the following way:
    Code:
    <flex:message-broker services-config-path="classpath*:services-config.xml"/>
    When my web app deploys I get the following message when the applicationContext files load:
    Code:
    DEBUG 2009-08-06 12:18:21,188 DEBUG [org.springframework.core.io.support.PathMatchingResourcePatternResolver] - Resolved location pattern [classpath*:applicationContext*.xml] to resources [file [/home/tpurcell/data/projects/busInTheClouds/enterprise-flex-war/enterprise-war/target/classes/applicationContext-file.xml], file [/home/tpurcell/data/projects/busInTheClouds/enterprise-flex-war/enterprise-war/target/classes/applicationContext-flex.xml], file [/home/tpurcell/data/projects/busInTheClouds/enterprise-flex-war/enterprise-war/target/classes/applicationContext-integration.xml]]
    Spring starts to create the beans until it gets to the messageBroker. Then I get:
    Code:
    DEBUG 2009-08-06 11:38:41,893 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Invoking afterPropertiesSet() on bean with name '_messageBroker'                       
     INFO 2009-08-06 11:38:41,934 INFO [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@5e3a78ad: defining beans [org.springframework.integration.internalDefaultConfiguringBeanFactoryPostProcessor,org.springframework.integration.file.config.FileWritingMessageHandlerFactoryBean#0,file-writer-channel-adapter,_messageBrokerHandlerAdapter,_messageBrokerDefaultHandlerMapping,_jsonConfigMapEditorConfigurer,_messageBrokerMessagingProcessor,_flexRemotingAnnotationPostProcessor,_messageBrokerRemotingProcessor,org.springframework.flex.core.ExceptionTranslationAdvice#0,org.springframework.flex.core.EndpointServiceMessagePointcutAdvisor#0,org.springframework.flex.core.MessageInterceptionAdvice#0,org.springframework.flex.core.EndpointServiceMessagePointcutAdvisor#1,_messageBrokerEndpointProcessor,_messageBroker,org.springframework.flex.messaging.integration.IntegrationAdapter#0,payload-flex-destination,connectionFactory,requestQueue,org.springframework.integration.scheduling.IntervalTrigger#0,poller,org.springframework.integration.channel.interceptor.WireTap#0,jmsin-channel,org.springframework.integration.jms.JmsDestinationPollingSource#0,jmsin-channel-adapter,logging-channel-adapter,org.springframework.integration.handler.LoggingHandler#0,logging-channel-adapter.adapter,org.springframework.integration.handler.BridgeHandler#0,org.springframework.integration.config.ConsumerEndpointFactoryBean#0,payload-channel,nullChannel,errorChannel,org.springframework.integration.handler.LoggingHandler#1,org.springframework.integration.endpoint.EventDrivenConsumer#0,org.springframework.integration.channel.MessagePublishingErrorHandler#0,taskScheduler]; root of factory hierarchy                                                                                                                                                                        
    DEBUG 2009-08-06 11:38:41,935 DEBUG [org.springframework.beans.factory.support.DisposableBeanAdapter] - Invoking destroy() on bean with name 'taskScheduler'                                        
     INFO 2009-08-06 11:38:41,935 INFO [org.springframework.integration.scheduling.SimpleTaskScheduler] - shutting down TaskExecutor                                                                    
     INFO 2009-08-06 11:38:41,935 INFO [org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor] - Shutting down ThreadPoolExecutor                                                            
    ERROR 2009-08-06 11:38:41,936 ERROR [org.springframework.web.servlet.DispatcherServlet] - Context initialization failed                                                                             
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name '_messageBrokerDefaultHandlerMapping': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '_messageBroker': Invocation of init method failed; nested exception is java.lang.IllegalStateException: Flex configuration file does not exist at path: classpath*:services-config.xml                                                                                                                                             
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:480)                                                   
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)                                                          
            at java.security.AccessController.doPrivileged(Native Method)                                                                                                                               
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)                                                     
            at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)                                                                                  
            at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)                                                               
            at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)                                                                                    
            at 
    ...
    I'm running:
    Apache Maven: 2.2.0 (r788681; 2009-06-26 09:04:01-0400)
    Java version: 1.6.0_11
    org.springframework: 2.5.5
    org.springframework.integration: 1.0.3.RELEASE
    org.springframework.flex: 1.0.0.RELEASE

    I'm running using mvn jetty:run (jetty 6.1.14) but I packaged the app as a war and deployed to tomcat (6.0.16) and got the same result. Yes the file does exist:
    Code:
    tpurcell@linux-glk3:~/data/projects/busInTheClouds/enterprise-flex-war/enterprise-war/target/classes> ls -la
    total 32
    drwxr-xr-x 2 tpurcell users 4096 2009-08-06 12:18 .
    drwxr-xr-x 4 tpurcell users 4096 2009-08-06 12:18 ..
    -rw-r--r-- 1 tpurcell users 1015 2009-08-06 12:18 applicationContext-file.xml
    -rw-r--r-- 1 tpurcell users 1488 2009-08-06 12:18 applicationContext-flex.xml
    -rw-r--r-- 1 tpurcell users 3366 2009-08-06 12:18 applicationContext-integration.xml
    -rw-r--r-- 1 tpurcell users  331 2009-08-06 12:18 commons-logging.properties
    -rw-r--r-- 1 tpurcell users  867 2009-08-06 12:18 log4j.properties
    -rw-r--r-- 1 tpurcell users 1249 2009-08-06 12:18 services-config.xml
    I'm stuck. Any suggestions?

    Thanks
    Tom

  • #2
    I don't see any clear reason why it wouldn't be working. The same ResourceLoader that is able to find your app context files successfully should be the one getting used to load your services-config.xml. If you create a Jira and attach a similar example then we can try and reproduce.

    Comment


    • #3
      Okay

      The reason why I was doing this was because I needed to do resource filtering on the services-config.xml. Since Maven by default puts resources on the classpath (target/classes) I wanted to configure the Flex to look there for its config. Since that does not seem to work I came up with this work around.

      First in my pom I have the following filters/resources definitions that filter the services-config.xml file and copy it to the default location(WEB-INF/flex):
      Code:
          <filters>
            <filter>src/main/filters/spring.filter.properties</filter>
          </filters>
          <resources>
            <resource>
              <directory>src/main/resources</directory>
              <includes>
                <include>**/*</include>
              </includes>
              <excludes>
                <exclude>services-config.xml</exclude>
              </excludes>
              <filtering>true</filtering>
            </resource>
            <resource>
              <directory>src/main/resources</directory>
              <targetPath>${basedir}/src/main/webapp/WEB-INF/flex</targetPath>
              <includes>
                <include>services-config.xml</include>
              </includes>
              <filtering>true</filtering>
            </resource>
          </resources>
      Then in the applicationContext.xml I just use the default message-broker definition:
      Code:
      <flex:message-broker/>
      So I'm okay for now but I have created a jira issue (http://jira.springframework.org/browse/FLEX-70). I'll be posting a sample app to that issue shortly.

      Thanks
      Tom

      Comment


      • #4
        Tom,

        Thanks for opening the Jira and supplying the example to make it easy to reproduce. As it turns out, there was a bug in that we were only ever using the ResourceLoader interface instead of ResourcePatternResolver (if available). As such, a path like "classpath:services-config.xml" would work, but "classpath*:services.config.xml" would not. This has now been resolved, and the fix will be a part of the 1.0.1 release which we should get out within the next couple of weeks. The fix is also available in the latest CI build (http://s3.amazonaws.com/dist.springf...0.1.CI-245.zip or later) if you'd like to try it out prior to the actual 1.0.1 release.

        Comment

        Working...
        X