Closed spring-projects-issues closed 6 years ago
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
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
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
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
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
Vlad Ermolaev opened DATAGEODE-131 and commented
I have an SDG application which uses a configuration file like the following:
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:
Affects: 2.0.8 (Kay SR8)