Announcement Announcement Module
Collapse
No announcement yet.
Only the "beans" namespace works in ANT task - would like to use others Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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

    Comment


    • #3
      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...

      Comment


      • #4
        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.

        Comment

        Working...
        X