Results 1 to 3 of 3

Thread: contextLoader and import tag

  1. #1

    Default contextLoader and import tag

    Hi

    I have broken up my spring config into separate XML files. The applicationContext-scheduledjobs.xml file has a dependency on the beans defined inside applicationContext-hibernate.xml.....

    <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/applicationContext-resources.xml,/WEB-INF/applicationContext-hibernate.xml,/WEB-INF/applicationContext-scheduledjobs.xml</param-value>
    </context-param>

    (I am using Tomcat 5 BTW)

    So I tried listing the xml files in order, hoping that the files would be parsed in that order... and great... they do!

    But I keep getting this error message saying Spring cannot find the dependant bean (even though I know it is parsed and initialised it):

    An element with the identifier "mailMessage" must appear in the document.

    So, I next try using the import tag, and try importing applicationContext-hibernate.xml from the applicationContext-schedulejobs.xml file, (I tried leaving the applicationContext-hibernate.xml file defined in the contextLoaderParam and not defined in the contextLoaderParam, but neither worked) and I get the same error....

    The reason I need them to be separate, is that I am using Quartz scheduler, and I have two servers. I only want one server to have the Cron Trigger bean definition (else they both do the work!)... The only other solution I can think of at the momment, is putting all definitions in the one file, and maintaining two different versions of the file, one with the quartz definition, and the other one without it... but this is not ideal...

    I am using Spring 1.2.4.... (but I did not see anything in the 1.2.5 changelog relating to this area)

    Any ideas as to what else I can try?

  2. #2
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    are you using by any change ref local instead of ref? ref local requires the bean definition to be in the same file.
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

  3. #3

    Smile

    I changed ref local="mailMessage" to ref bean="mailMessage" and everything now works fine....

    Thank you!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •