Results 1 to 5 of 5

Thread: Spring 2.0 XSD-style configuration and Tomcat 5.5

  1. #1
    Join Date
    Oct 2006
    Posts
    6

    Default Spring 2.0 XSD-style configuration and Tomcat 5.5

    I'm trying to use the new style configuration, but only get exceptions when deploying on tomcat 5.5.

    My applicationContext.xml:
    Code:
    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/spring-beans.xsd">
    
    </beans>
    When deploying this on a tomcat 5.5.17 running on JDK1.5.0_08 I get:
    Code:
         0 INFO  [pringframework.web.context.ContextLoader] Root WebApplicationContext: initialization started
       188 INFO  [eans.factory.xml.XmlBeanDefinitionReader] Loading XML bean definitions from class path resource [applicationContext.xml]
       219 ERROR [pringframework.web.context.ContextLoader] Context initialization failed
    org.springframework.beans.factory.BeanDefinitionStoreException: Line 17 in XML document from class path resource [applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException: Document root element "beans", must match DOCTYPE root "null".
    org.xml.sax.SAXParseException: Document root element "beans", must match DOCTYPE root "null".
    	at org.apache.xerces.parsers.DOMParser.parse(DOMParser.java:267)
    	at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:201)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:258)
    I guess it has something to do with the classloader not finding the .xds inside the spring-beans.jar, but have no clue as to how to fix this.

    Please help!!

    Magne

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,629

    Default

    We use the following (notice the 2.0 in the header!)

    Code:
    <beans xmlns="http://www.springframework.org/schema/beans"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xsi:schemaLocation="
                    http://www.springframework.org/schema/beans
                    http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3
    Join Date
    Oct 2006
    Posts
    6

    Default

    I use version 2.0-m2 of spring (latest version with semi-decent maven2 pom's on ibiblio), and in this version the schema hasn't changed to '-2.0.xsd' yet. But I've also tried with the '-2.0' with the same result.

    Magne

  4. #4
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,629

    Default

    I assume that people always use the latest (I know I know don't assume ). However it could be a parser problem, try upgrading the parser. Also check that tomcat and your jdk use the same parser (the jdk comes equiped with an older one if I'm not mistaken).
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  5. #5
    Join Date
    Dec 2004
    Location
    Duluth, MN
    Posts
    18

    Default

    Make sure that you do not have any older-version Spring jars anywhere on your classpath. I ran into this issue a couple weeks back and it drove me nuts. As it turned out, Maven was putting a copy of spring-1.2.6.jar (alongside various spring-*-2.0-rc4.jars) in my lib directory due to a transitive dependency issue.

    May or may not be your problem, but it is work a check.

Posting Permissions

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