Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XML schema spring-gemfire.xsd missing, application cannot start without Internet connection [DATAGEODE-131] #179

Closed
spring-projects-issues opened this issue Jul 20, 2018 · 6 comments
Assignees
Labels
in: configuration status: declined type: bug

Comments

@spring-projects-issues
Copy link

spring-projects-issues commented Jul 20, 2018

Vlad Ermolaev opened DATAGEODE-131 and commented

I have an SDG application which uses a configuration file like the following:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:gfe="http://www.springframework.org/schema/gemfire"
       xmlns:gfe-data="http://www.springframework.org/schema/data/gemfire"
       xsi:schemaLocation="http://www.springframework.org/schema/gemfire http://www.springframework.org/schema/gemfire/spring-gemfire.xsd
       http://www.springframework.org/schema/data/gemfire http://www.springframework.org/schema/data/gemfire/spring-data-gemfire.xsd
	   http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

    <gfe:annotation-driven/>

    <gfe:transaction-manager/>

    <gfe:cache
            properties-ref="gemfireProperties"
            copy-on-read="true"
            use-bean-factory-locator="false"
    />
...

The application cannot start without Internet connection.

Error messages:

Failed to read schema document 'http://www.springframework.org/schema/gemfire/spring-gemfire.xsd'

java.net.UnknownHostException: www.springframework.org
 

The full stacktrace:

2018-07-20 21:46:53.767 WARN  [main] o.s.b.f.x.XmlBeanDefinitionReader:48 warning - Ignored XML validation warning2018-07-20 21:46:53.767 WARN  [main] o.s.b.f.x.XmlBeanDefinitionReader:48 warning - Ignored XML validation warningorg.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/gemfire/spring-gemfire.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>. at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203) ~[?:1.8.0_172] at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.warning(ErrorHandlerWrapper.java:99) [?:1.8.0_172] at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:392) [?:1.8.0_172] at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:306) [?:1.8.0_172] at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaErr(XSDHandler.java:4158) [?:1.8.0_172] at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaWarning(XSDHandler.java:4149) [?:1.8.0_172] at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.getSchemaDocument1(XSDHandler.java:2491) [?:1.8.0_172] at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.getSchemaDocument(XSDHandler.java:2193) [?:1.8.0_172] at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.parseSchema(XSDHandler.java:578) [?:1.8.0_172] at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:610) [?:1.8.0_172] at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.findSchemaGrammar(XMLSchemaValidator.java:2447) [?:1.8.0_172] at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1768) [?:1.8.0_172] at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.emptyElement(XMLSchemaValidator.java:761) [?:1.8.0_172] at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:351) [?:1.8.0_172] at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2784) [?:1.8.0_172] at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602) [?:1.8.0_172] at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112) [?:1.8.0_172] at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505) [?:1.8.0_172] at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:842) [?:1.8.0_172] at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:771) [?:1.8.0_172] at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141) [?:1.8.0_172] at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:243) [?:1.8.0_172] at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339) [?:1.8.0_172] at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:77) [spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadDocument(XmlBeanDefinitionReader.java:428) [spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390) [spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:335) [spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:303) [spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:187) [spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:223) [spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:233) [spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseDefaultElement(DefaultBeanDefinitionDocumentReader.java:190) [spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:175) [spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:148) [spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:98) [spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:507) [spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:391) [spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:335) [spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:303) [spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:187) [spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:223) [spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:194) [spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:258) [spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:128) [spring-context-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:94) [spring-context-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:133) [spring-context-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:621) [spring-context-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:522) [spring-context-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:144) [spring-context-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:85) [spring-context-5.0.7.RELEASE.jar:5.0.7.RELEASE] }}

...

{{[classes/:?]Caused by: java.net.UnknownHostException: www.springframework.org at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184) ~[?:1.8.0_172] at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) ~[?:1.8.0_172] at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[?:1.8.0_172] at java.net.Socket.connect(Socket.java:589) ~[?:1.8.0_172] at java.net.Socket.connect(Socket.java:538) ~[?:1.8.0_172] at sun.net.NetworkClient.doConnect(NetworkClient.java:180) ~[?:1.8.0_172] at sun.net.www.http.HttpClient.openServer(HttpClient.java:463) ~[?:1.8.0_172] at sun.net.www.http.HttpClient.openServer(HttpClient.java:558) ~[?:1.8.0_172] at sun.net.www.http.HttpClient.<init>(HttpClient.java:242) ~[?:1.8.0_172] at sun.net.www.http.HttpClient.New(HttpClient.java:339) ~[?:1.8.0_172] at sun.net.www.http.HttpClient.New(HttpClient.java:357) ~[?:1.8.0_172] at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1220) ~[?:1.8.0_172] at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1156) ~[?:1.8.0_172] at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1050) ~[?:1.8.0_172] at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:984) ~[?:1.8.0_172] at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1564) ~[?:1.8.0_172] at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492) ~[?:1.8.0_172] at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:647) ~[?:1.8.0_172] at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:148) ~[?:1.8.0_172] at com.sun.org.apache.xerces.internal.impl.xs.opti.SchemaParsingConfig.parse(SchemaParsingConfig.java:583) ~[?:1.8.0_172] at com.sun.org.apache.xerces.internal.impl.xs.opti.SchemaParsingConfig.parse(SchemaParsingConfig.java:686) ~[?:1.8.0_172] at com.sun.org.apache.xerces.internal.impl.xs.opti.SchemaDOMParser.parse(SchemaDOMParser.java:530) ~[?:1.8.0_172] at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.getSchemaDocument(XSDHandler.java:2181) ~[?:1.8.0_172] 
... 44 more
 

Affects: 2.0.8 (Kay SR8)

@spring-projects-issues
Copy link
Author

spring-projects-issues commented Jul 20, 2018

John Blum commented

Hi Vlad Ermolaev - What version of Spring Data for Apache Geode (SDG) were you using prior to SD Kay-SR8 (SDG 2.0.8.RELEASE)?

The reason I ask is, I wondered whether I accidentally removed the "GemFire-based" schemas from the SDG JAR file after the GA release (i.e. SD Kay-GA/SDG 2.0.0.RELEASE) but before the next SD Release Train version (i.e. SD Lovelace/SDG 2.1.0).

However, I see that I removed the "GemFire-based" schemas long before the SD Kay-GA/SDG 2.0.0.RELEASE. See here (this was already the SD Kay-RC1/SDG 2.0.0.RC1 release, which is technically allowed).

Anyway, you can fix this by changing your schema declaration in your SDG XML configuration file to...

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
             xmlns:gfe="http://www.springframework.org/schema/geode"
             xmlns:gfe-data="http://www.springframework.org/schema/data/geode"
             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.xsd
    http://www.springframework.org/schema/geode http://www.springframework.org/schema/geode/spring-geode.xsd
    http://www.springframework.org/schema/data/geode http://www.springframework.org/schema/data/geode/spring-data-geode.xsd
">

    <gfe:annotation-driven/>

    <gfe:transaction-manager/>

    <gfe:cache
            properties-ref="gemfireProperties"
            copy-on-read="true"
            use-bean-factory-locator="false"
    />

...

The http://www.springframework.org/schema/geode/**spring-geode.xsd** and the http://www.springframework.org/schema/data/geode/**spring- data-geode.xsd** XML schema (XSD) files are contained in the SDG JAR file...

$ jar -tvf ~/.m2/repository/org/springframework/data/spring-data-geode/2.0.8.RELEASE/spring-data-geode-2.0.8.RELEASE.jar | grep ".*\.xsd"
139292 Wed Jun 13 21:07:04 PDT 2018 org/springframework/data/gemfire/config/spring-geode-1.1.xsd
 10305 Wed Jun 13 21:07:04 PDT 2018 org/springframework/data/gemfire/config/spring-data-geode-1.1.xsd
144014 Wed Jun 13 21:07:04 PDT 2018 org/springframework/data/gemfire/config/spring-geode-1.0.xsd
140517 Wed Jun 13 21:07:04 PDT 2018 org/springframework/data/gemfire/config/spring-geode-2.0.xsd
 10305 Wed Jun 13 21:07:04 PDT 2018 org/springframework/data/gemfire/config/spring-data-geode-2.0.xsd
 10260 Wed Jun 13 21:07:04 PDT 2018 org/springframework/data/gemfire/config/spring-data-geode-1.0.xsd

Note, the default XML schema (XSD) if a version is not explicitly declared by your XML document (not recommended) is... spring-[data-]geode-2.0.xsd; see here and here.

By referencing the right XML schemas (i.e. spring-geode.xsd and/or spring-data-geode.xsd) in your XML document (i.e. Spring XML configuration file, as shown above), Spring will locate the XSD files in the SDG JAR file and thus you will not need a Internet connection to resolve the XSD files.

Hope this helps.

Regards
John Blum

@spring-projects-issues
Copy link
Author

spring-projects-issues commented Jul 20, 2018

Vlad Ermolaev commented

Hi John,

sorry, I cannot help you to find the proper version because older versions were running always online. Today I had network outage for the first time and got the issue

@spring-projects-issues
Copy link
Author

spring-projects-issues commented Jul 20, 2018

John Blum commented

Hi Vlad-

No worries; was just curious. My recommended changes should resolve the issue. If you continue to have problems, please follow up with this ticket and I will dig deeper.

Cheers,
John

@spring-projects-issues
Copy link
Author

spring-projects-issues commented Jul 20, 2018

John Blum commented

1 more thing, as additional reassurance, there are many test classes in the SDG test suite that do test with a SDG XML-based configuration file, for instance, so I am quite confident using the right schema should work.

However, I would say that, in general, I am moving away from XML-based configuration, as is all of Spring, in favor of annotation-based configuration using Java config, i.e. this.

This also sets you up quite nicely for Spring Boot for Apache Geode, which simplifies configuration and development even further by employing Spring Boot's "convention over configuration" approach using auto-configuration, FYI. See here for more details.

Regards,
John

@spring-projects-issues
Copy link
Author

spring-projects-issues commented Jul 20, 2018

Vlad Ermolaev commented

Thanks a lot for the information. I would recommend to search-and-replace the SDG Reference doc, it still contains a lot of "gemfire.xsd" entries in examples

@spring-projects-issues
Copy link
Author

spring-projects-issues commented Jul 20, 2018

John Blum commented

Good point! I am in the process of reviewing/editing the docs now, actually. See this, which stemmed from PR #95. This will be ported to SD for Apache Geode will all gemfire references converted to geode.

Sorry for any confusion that caused.

-John

@spring-projects-issues spring-projects-issues added type: bug status: declined in: configuration labels Dec 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: configuration status: declined type: bug
Projects
None yet
Development

No branches or pull requests

2 participants