Announcement Announcement Module
Collapse
No announcement yet.
Cannot find Spring XSD on machine w/o internet access Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Cannot find Spring XSD on machine w/o internet access

    Hi,

    I'm testing a Spring application using Spring 2.0.4 on JDK1.4.2

    The application works fine on our own environment except on a clients test-machine where firewalling makes the internet unreachable, where I see the error:

    Code:
    org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'beans'.
    The Spring config looks fine to me; I cannot find what would be wrong when I compare it against various advice given on this forum:

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    
    <!--
        Document   : springContext.xml
        Created on : April 19, 2007, 10:43 PM
        Author     : Tim
        Description:
            Purpose of the document follows.
    -->
    
    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:fmt="http://www.secondfloor.nl/schema/fileformat"
           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
      http://www.secondfloor.nl/schema/fileformat http://www.secondfloor.nl/schema/fileformat/fileformat.xsd
    	"
            >
     <!-- Bean definitions removed -->
    
    </beans>

    I have no clue at the moment how to proceed, especially since I cannot reproduce the problem locally (not even when removing the network cable from my workstation)

    Help would be appreciated.

    Regards,

    --Tim

  • #2
    Most likely that is has absolutely nothing to do with an Internet access (I have used Spring in such circumtainces many times without any troubles).

    Much more likely that you have something wrong with classpath on those machine (e.g. another SAX-parser on classpath).

    Regards,
    Oleksandr

    Comment


    • #3
      It is related the internet connection, I'm afraid

      Hi Oleksandr,

      Thanks for your reply. I'm afraid that the problem is related both to classpath, and to lack of internet connection.

      Yesterday with the help of one of my collegues I managed to reproduce the problem locally, and we also identified a fix that works on our machines.

      However, the problem is still not fixed on the client's test-site so some further investigation is required into the differences between our setup, and theirs.

      The application is a standalone Java application running on an IBM 1.4.2 JVM. We are testing on WinXP workstation and on a Linux server with IBM 1.4.2 JVM; the client is running on AIX with IBM 1.4.2 JVM.

      We deliver the application as a JAR file. The Manifest in the JAR file contains the classpath for the application, including Spring. All the required JAR files are in a lib directory alongside the application JAR file.

      When we start the application from the commandline, we pass only our application's JAR file in the classpath to the JVM.

      Looking at the log what happens in this situation, is that Spring can not find it the file 'spring.schemas' which is in the spring-beans-2.0.4.jar and therefore it starts looking for them on the 'net. When there is no network connection, an error happens -- this is easy to test by taking the network cable out of my machine, or by routing 'www.springframework.org' via localhost on the Linux server.

      From the logfile:

      Code:
      2007-06-12 08:09:05,275 [main] DEBUG PluggableSchemaResolver:95 - Loading schema mappings from [META-INF/spring.schemas]
      2007-06-12 08:09:05,319 [main] DEBUG PluggableSchemaResolver:101 - Loaded schema mappings: {http://www.secondfloor.nl/schema/fileformat/fileformat.xsd=fileformat.xsd}
      2007-06-12 08:09:05,321 [main] INFO XmlBeanDefinitionReader:293 - Loading XML bean definitions from class path resource [springContext.xml]
      2007-06-12 08:09:05,345 [main] DEBUG DefaultDocumentLoader:73 - Using JAXP provider [org.apache.xerces.jaxp.DocumentBuilderFactoryImpl]
      2007-06-12 08:10:20,287 [main] ERROR Batch:325 - Error during batch processing; aborting
      org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 18 in XML document from class path resource [springContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'beans'.
      Caused by:
      org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'beans'.
              at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
              at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
      I cut off part of the stacktrace because I believe the most relevant bit here is the part where you can see that the PluggableSchemaResolver finds only the schema which we defined ourselves, and which is in the application's JAR file.

      We can make the problem go away by adding the spring-beans jarfile to the classpath, before the application's own jarfile.

      The problem seems therefore related with how the classpath is being constructed and searched by the JVM.

      However, when the client tried this on their own machine, they still get the same problem. So we still need to do some more research in the problem and the exact differences between the setup of theirs, and our own.

      Update: It works now on the clients test-machine as well. Apparently they made a mistake in changing their commandline when I asked them to put the spring-beans jarfile first thing in the classpath. So the problem is resolved.

      Regards,

      --Tim
      Last edited by tnleeuw; Jun 13th, 2007, 03:14 AM.

      Comment


      • #4
        Yes, this is a very reason why I never, ever use "advanced" manifest capabilities (if is not forced to) and always specify all classpathes directly on commandline (or, when it is problematic as on IBM iSeries, in the environment).

        With very simple shell scripting you may build classpath that contains all jars in the LIB directory without listing each jar manually.

        BTW, IBM JVM 1.4.2 (at least in the iSeries incarnation) is a big piece of shit from performance point of view. Some my test programs run on the almost top-notch server several times slower then on the "rank and file" Windows XP workstation (confirmed by IBM Performance center). I would strongly suggest to migrate to IBM J9 JVM if it is available on your platform.

        Regards,

        Oleksandr

        Comment


        • #5
          Hi Tim,

          What did you do to produce the problem locally?

          Thanks,
          SAch

          Comment

          Working...
          X