Results 1 to 4 of 4

Thread: Only the "beans" namespace works in ANT task - would like to use others

  1. #1

    Default Only the "beans" namespace works in ANT task - would like to use others

    I have an ANT task that I've written that loads a bean config XML file, starts an application context with it, and fetches only the beans needed for the jBPM process that is currently being deployed. Using the "beans" namespace works fine and doesn't throw any exceptions.

    However, I would like to be able to use the spring component annotations to minimize the amount of maintenance that would need to be done in the bean config file, and possibly use AOP and some of the other namespaces provided by spring. I run into problems when I use namespaces other than "beans" -- I get the following exception:

    Code:
    org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/context]
    I've tested with the aop and util namespaces, and exceptions for those namespaces are nearly identical.

    I've done some searching on Google, and the closest I've come is finding that there are issues with the SpringIDE that are similar in nature, but don't help with my circumstance.

    Is there something else I need to be doing inside the ANT task with the application context?

    Thanks,
    Jim

  2. #2
    Join Date
    May 2007
    Location
    Saint Petersburg, Russian Federation
    Posts
    1,189

    Default

    Make sure that the following entry is available via ClassLoader.getResources(): META-INF/spring.handlers. It contains definitions of all builtin spring namespaces.

    Feel free to check more specific details at the corresponding spring class - org.springframework.beans.factory.xml.DefaultNames paceHandlerResolver

  3. #3

    Default

    Hi Denis,
    Thanks! That did the trick. Now I just need to figure out how to have the component scanner scan the classes from within the ANT task. :-) Two steps forward, one step back...

  4. #4
    Join Date
    May 2007
    Location
    Saint Petersburg, Russian Federation
    Posts
    1,189

    Default

    Jim,

    Welcome

    About the classpath scanning - I'd suggest to play around ant classpath settings and make sure that your classes are visible to the ant. You can try to use -lib switch for that.

    Another way is to fork a new java process via <java> task, set correct classpath there and perform the necessary activity from it.

Tags for this Thread

Posting Permissions

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