XML xsd validation issue with infinispan on JDK7
sudmong Jun 7, 2013 2:45 AMWe are using Infinispan 4.2.1 and facing some issue in parsing of infinispan config file with java 7.
Here is xml element of our config which is causing issues.
{code}
<!-- A query cache that replicates queries. Replication is asynchronous. -->
<namedCache name="replicated-query">
<clustering mode="replication">
<async/>
</clustering>
<locking isolationLevel="READ_COMMITTED" concurrencyLevel="1000"
lockAcquisitionTimeout="15000" useLockStriping="false"/>
<!--Eviction configuration. WakeupInterval defines how often the eviction thread runs, in milliseconds. 0 means
the eviction thread will never run. A separate executor is used for eviction in each cache. -->
<eviction wakeUpInterval="5000" maxEntries="10000" strategy="LRU"/>
<expiration maxIdle="100000"/>
<!-- State transfer forces all replication calls to be synchronous,
so for calls to remain async, use a cluster cache loader instead -->
<loaders passivation="false" shared="false" preload="false">
<loader class="org.infinispan.loaders.cluster.ClusterCacheLoader" fetchPersistentState="false"
ignoreModifications="false" purgeOnStartup="false">
<properties>
<property name="remoteCallTimeout" value="20000"/>
</properties>
</loader>
</loaders>
</namedCache>
{code}
This configuration is working fine with java 6. Recently we moved to java 7 and it started complaining for {code} <properties> <property name="remoteCallTimeout" value="20000"/> </properties> {code}
with the following error message
{code}
[junit] Caused by: javax.xml.bind.UnmarshalException: unexpected element (uri:"urn:infinispan:config:4.2", local:"properties"). Expected elements are <{urn:infinispan:config:4.2}typedProperties>,<{urn:infinispan:config:4.2}singletonStore>,<{urn:infinispan:config:4.2}async>
[junit] at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:647)
[junit] at com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:243)
[junit] at com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:238)
[junit] at com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportUnexpectedChildElement(Loader.java:105)
[junit] at com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.childElement(Loader.java:90)
[junit] at com.sun.xml.internal.bind.v2.runtime.unmarshaller.StructureLoader.childElement(StructureLoader.java:236)
[junit] at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:483)
[junit] at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:465)
[junit] at com.sun.xml.internal.bind.v2.runtime.unmarshaller.ValidatingUnmarshaller.startElement(ValidatingUnmarshaller.java:87)
[junit] at com.sun.xml.internal.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.java:135)
[junit] at org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:551)
[junit] at org.infinispan.config.parsing.NamespaceFilter.startElement(NamespaceFilter.java:29)
[junit] at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
[junit] at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
[junit] at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
[junit] at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
[junit] at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
[junit] at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
[junit] at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
[junit] at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
[junit] at org.xml.sax.helpers.XMLFilterImpl.parse(XMLFilterImpl.java:357)
[junit] at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:203)
[junit] at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:175)
[junit] at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:140)
[junit] at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:123)
[junit] at org.infinispan.config.InfinispanConfiguration.newInfinispanConfiguration(InfinispanConfiguration.java:256)
{code}
Which says {code} properties is not valid {code} and expecting {code} typedProperties , singletonStore or async {code}
Important point to note here is that {code}typedProperties{code} is not part of [xsd |http://docs.jboss.org/infinispan/schemas/infinispan-config-4.2.xsd]
What I have tried so far
1. if I remove the {code}<properties>{code} element from the config, it loads the config.
2. if i try renaming {code}properties to typedProperties {code} as it is complaining in the error message, I get the following error saying {code}typedProperties is invalid and properties is expected.{code}
{code}
[junit] Caused by: javax.xml.bind.UnmarshalException
[junit] - with linked exception:
[junit] [org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 5478; cvc-complex-type.2.4.a: Invalid content was found starting with element 'typedProperties'. One of '{"urn:infinispan:config:4.2":async, "urn:infinispan:config:4.2":singletonStore, "urn:infinispan:config:4.2":properties}' is expected.]
{code}
I could see following in source of infinispan in {code} AbstractCacheStoreConfig.java {code} this may be causing this.
{code}
@XmlElement(name="properties")
public TypedProperties getTypedProperties(){
return properties;}
{code}
Any guesses.