Announcement Announcement Module
Collapse
No announcement yet.
spring-flex-1.0: Unable to locate Spring NamespaceHandler Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • spring-flex-1.0: Unable to locate Spring NamespaceHandler

    Hi, all

    I always meet 'Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/flex]' as follows when I try the org.springframework.flex-1.0.0.RELEASE and 1.0.0.RC2 in Spring OSGI ENV:

    4682 [Timer-2] ERROR org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/simpleweb] - Servlet /simpleweb threw load() exception
    org.springframework.beans.factory.parsing.BeanDefi nitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/flex]
    Offending resource: ServletContext resource [/WEB-INF/osgiwebmvc-servlet.xml]

    at org.springframework.beans.factory.parsing.FailFast ProblemReporter.error(FailFastProblemReporter.java :68)
    at org.springframework.beans.factory.parsing.ReaderCo ntext.error(ReaderContext.java:85)
    at org.springframework.beans.factory.parsing.ReaderCo ntext.error(ReaderContext.java:80)
    at org.springframework.beans.factory.xml.BeanDefiniti onParserDelegate.error(BeanDefinitionParserDelegat e.java:281)
    at org.springframework.beans.factory.xml.BeanDefiniti onParserDelegate.parseCustomElement(BeanDefinition ParserDelegate.java:1294)
    at org.springframework.beans.factory.xml.BeanDefiniti onParserDelegate.parseCustomElement(BeanDefinition ParserDelegate.java:1287)
    at org.springframework.beans.factory.xml.DefaultBeanD efinitionDocumentReader.parseBeanDefinitions(Defau ltBeanDefinitionDocumentReader.java:135)
    at org.springframework.beans.factory.xml.DefaultBeanD efinitionDocumentReader.registerBeanDefinitions(De faultBeanDefinitionDocumentReader.java:92)
    at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.registerBeanDefinitions(XmlBeanDefinit ionReader.java:507)
    at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.doLoadBeanDefinitions(XmlBeanDefinitio nReader.java:398)
    at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.loadBeanDefinitions(XmlBeanDefinitionR eader.java:342)
    at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.loadBeanDefinitions(XmlBeanDefinitionR eader.java:310)
    at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:143)
    at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:178)
    at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:149)
    at org.springframework.web.context.support.XmlWebAppl icationContext.loadBeanDefinitions(XmlWebApplicati onContext.java:124)
    at org.springframework.web.context.support.XmlWebAppl icationContext.loadBeanDefinitions(XmlWebApplicati onContext.java:92)
    at org.springframework.context.support.AbstractRefres hableApplicationContext.refreshBeanFactory(Abstrac tRefreshableApplicationContext.java:123)
    at org.springframework.context.support.AbstractApplic ationContext.obtainFreshBeanFactory(AbstractApplic ationContext.java:422)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:352)
    at org.springframework.web.servlet.FrameworkServlet.c reateWebApplicationContext(FrameworkServlet.java:4 02)
    at org.springframework.web.servlet.FrameworkServlet.i nitWebApplicationContext(FrameworkServlet.java:316 )
    at org.springframework.web.servlet.FrameworkServlet.i nitServletBean(FrameworkServlet.java:282)
    at org.springframework.web.servlet.HttpServletBean.in it(HttpServletBean.java:126)
    at javax.servlet.GenericServlet.init(GenericServlet.j ava:241)
    at org.apache.catalina.core.StandardWrapper.loadServl et(StandardWrapper.java:1139)
    at org.apache.catalina.core.StandardWrapper.load(Stan dardWrapper.java:966)
    at org.apache.catalina.core.StandardContext.loadOnSta rtup(StandardContext.java:3956)
    at org.apache.catalina.core.StandardContext.start(Sta ndardContext.java:4230)
    at org.apache.catalina.core.ContainerBase.addChildInt ernal(ContainerBase.java:760)
    at org.apache.catalina.core.ContainerBase.addChild(Co ntainerBase.java:740)
    at org.apache.catalina.core.StandardHost.addChild(Sta ndardHost.java:544)
    at org.springframework.osgi.web.deployer.tomcat.Tomca tWarDeployer.startCatalinaContext(TomcatWarDeploye r.java:144)
    at org.springframework.osgi.web.deployer.tomcat.Tomca tWarDeployer.startDeployment(TomcatWarDeployer.jav a:133)
    at org.springframework.osgi.web.deployer.support.Abst ractWarDeployer.deploy(AbstractWarDeployer.java:93 )
    at org.springframework.osgi.web.extender.internal.act ivator.WarLoaderListener$DeploymentManager$DeployT ask.doRun(WarLoaderListener.java:244)
    at org.springframework.osgi.web.extender.internal.act ivator.WarLoaderListener$DeploymentManager$BaseTas k.run(WarLoaderListener.java:216)
    at org.springframework.scheduling.timer.DelegatingTim erTask.run(DelegatingTimerTask.java:66)
    at java.util.TimerThread.mainLoop(Timer.java:512)
    at java.util.TimerThread.run(Timer.java:462)

    What's the root cause? Why other spring can locate other name space?
    Please help me, thanks in advance.
    Last edited by edward_he2008; Aug 16th, 2009, 07:00 AM.

  • #2
    web.xml and osgiwebmvc-servlet.xml

    web.xml:
    ...
    <context-param>
    <param-name>contextClass</param-name>
    <param-value>
    org.springframework.osgi.web.context.support.OsgiB undleXmlWebApplicationContext
    </param-value>
    </context-param>
    <listener>
    <listener-class>
    org.springframework.web.context.ContextLoaderListe ner
    </listener-class>
    </listener>

    <servlet>
    <servlet-name>osgiwebmvc</servlet-name>
    <servlet-class>
    org.springframework.web.servlet.DispatcherServlet
    </servlet-class>
    <load-on-startup>2</load-on-startup>
    </servlet>

    <servlet-mapping>
    <servlet-name>osgiwebmvc</servlet-name>
    <url-pattern>/messagebroker/*</url-pattern>
    </servlet-mapping>
    ...

    osgiwebmvc-servlet.xml:

    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:flex="http://www.springframework.org/schema/flex"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="
    http://www.springframework.org/schema/flex
    http://www.springframework.org/schem...g-flex-1.0.xsd
    http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">

    <flex:message-broker/>
    ....
    </beans>

    Comment


    • #3
      solved

      Hi, all

      I figured it out! The root cause is that spring runtime can not find the required jar file, so can not find the namespace handler defined in it.

      It is very easy to slove it, you can add the org.springframework.flex-1.0.0.RELEASE.jar to classpath via Bundle-ClassPath.

      Now my sample can work with Spring OSGI bundle ENV rather than Spring bean.

      However, I still doubt it is a bug of Spring intergration:
      why spring runtime can not load it automatically since it is really a bundle.

      Comment

      Working...
      X