jaxb-ri icon indicating copy to clipboard operation
jaxb-ri copied to clipboard

Schema validation fails breaks for infinispan 2.4 default schema

Open Tomas-Kraus opened this issue 11 years ago • 8 comments

In version 2.2.4 and below the validation worked, in 2.2.5 it stopped working. I see that there was a change to how is handled see #869, maybe this the reason it broke as it is the abstractCacheStoreConfig complex type which is failing validation.

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>
	at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:662)
	at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:258)
	at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:253)
	at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportUnexpectedChildElement(Loader.java:120)
	at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.childElement(Loader.java:105)
	at com.sun.xml.bind.v2.runtime.unmarshaller.StructureLoader.childElement(StructureLoader.java:262)
	at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:498)
	at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:480)
	at com.sun.xml.bind.v2.runtime.unmarshaller.ValidatingUnmarshaller.startElement(ValidatingUnmarshaller.java:102)
	at com.sun.xml.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.java:150)
	at org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:551)
	at org.infinispan.config.parsing.NamespaceFilter.startElement(NamespaceFilter.java:29)
	at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
	at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
	at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
	at org.xml.sax.helpers.XMLFilterImpl.parse(XMLFilterImpl.java:357)
	at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:218)
	at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:190)
	at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:140)
	at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:123)

This config xml file is from the hibernate-infinispan v3.6.10.Final

**infinispan-config-4.2.xml**<?xml version="1.0" encoding="UTF-8"?>
<infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:infinispan:config:4.2">
   <global>
      <transport transportClass = "org.infinispan.remoting.transport.jgroups.JGroupsTransport" 
            clusterName="infinispan-hibernate-cluster" distributedSyncTimeout="50000">
         <!-- Note that the JGroups transport uses sensible defaults if no configuration property is defined. -->
         <properties>
            <!-- TODO: Change to udp.xml once streaming transfer requirement has been removed.  -->
            <property name="configurationFile" value="flush-udp.xml"/>
         </properties>
         <!-- See the JGroupsTransport javadocs for more flags -->
      </transport>
   </global>

   <default>
      <!-- Used to register JMX statistics in any available MBean server -->
      <jmxStatistics enabled="false"/>
   </default>

   <!-- Default configuration is appropriate for entity/collection caching. -->
   <namedCache name="entity">
      <clustering mode="invalidation">
         <stateRetrieval fetchInMemoryState="false" timeout="20000"/>
         <sync replTimeout="20000"/>
      </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"/>
      <lazyDeserialization enabled="true"/>
   </namedCache>

   <!-- Default configuration is appropriate for entity/collection caching. -->
   <namedCache name="entity-repeatable">
      <clustering mode="invalidation">
         <stateRetrieval fetchInMemoryState="false" timeout="20000"/>
         <sync replTimeout="20000"/>
      </clustering>
      <!-- Note: REPEATABLE_READ is only useful if the application evicts/clears entities 
        from the Hibernate Session and then expects to repeatably re-read them in 
        the same transaction. Otherwise, the Session's internal cache provides a 
        repeatable-read semantic. Before choosing this config, carefully read the docs
        and make sure you really need REPEATABLE_READ.
       -->
      <locking isolationLevel="REPEATABLE_READ" 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"/>
      <lazyDeserialization enabled="true"/>
   </namedCache>

   <!-- An alternative configuration for entity/collection caching that uses replication instead of invalidation -->
   <namedCache name="replicated-entity">
      <clustering mode="replication">
         <stateRetrieval fetchInMemoryState="false" timeout="20000"/>
         <sync replTimeout="20000"/>
      </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"/>
      <lazyDeserialization enabled="true"/>
   </namedCache>

   <!-- A config appropriate for query caching. Does not replicate queries. -->
   <namedCache name="local-query">
      <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"/>
   </namedCache>

   <!-- 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>

   <!-- Optimized for timestamp caching. A clustered timestamp cache
        is required if query caching is used, even if the query cache
        itself is configured with CacheMode=LOCAL. -->
   <namedCache name="timestamps">
      <clustering mode="replication">
         <async/>
      </clustering>
      <locking isolationLevel="READ_COMMITTED" concurrencyLevel="1000"
               lockAcquisitionTimeout="15000" useLockStriping="false"/>
      <lazyDeserialization enabled="true"/>
      <!--  Don't ever evict modification timestamps -->
      <eviction wakeUpInterval="0" strategy="NONE"/>
      <!-- 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>

</infinispan>

The schema to validate against

**infinispan-schema-4.2.xsd**<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" version="1.0" targetNamespace="urn:infinispan:config:4.2" xmlns:tns="urn:infinispan:config:4.2" xmlns:xs="http://www.w3.org/2001/XMLSchema"> 
  <xs:element name="infinispan" type="tns:infinispanConfiguration"/>

  <xs:complexType name="infinispanConfiguration">
    <xs:sequence>
      <xs:element name="global" type="tns:globalConfiguration" minOccurs="0"/>
      <xs:element name="default" type="tns:configuration" minOccurs="0"/>
      <xs:element name="namedCache" type="tns:configuration" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="globalConfiguration">
    <xs:complexContent>
      <xs:extension base="tns:abstractConfigurationBean">
        <xs:all>
          <xs:element name="asyncListenerExecutor" type="tns:executorFactoryType" minOccurs="0"/>
          <xs:element name="asyncTransportExecutor" type="tns:executorFactoryType" minOccurs="0"/>
          <xs:element name="evictionScheduledExecutor" type="tns:scheduledExecutorFactoryType" minOccurs="0"/>
          <xs:element name="replicationQueueScheduledExecutor" type="tns:scheduledExecutorFactoryType" minOccurs="0"/>
          <xs:element name="globalJmxStatistics" type="tns:globalJmxStatisticsType" minOccurs="0"/>
          <xs:element name="transport" type="tns:transportType" minOccurs="0"/>
          <xs:element name="serialization" type="tns:serializationType" minOccurs="0"/>
          <xs:element name="shutdown" type="tns:shutdownType" minOccurs="0"/>
        </xs:all>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="abstractConfigurationBean" abstract="true">
    <xs:sequence/>
  </xs:complexType>

  <xs:complexType name="executorFactoryType">
    <xs:complexContent>
      <xs:extension base="tns:factoryClassWithPropertiesType">
        <xs:sequence/>
        <xs:attribute name="factory" type="xs:string"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="factoryClassWithPropertiesType" abstract="true">
    <xs:complexContent>
      <xs:extension base="tns:abstractConfigurationBeanWithGCR">
        <xs:sequence>
          <xs:element name="properties" type="tns:propertiesType" minOccurs="0"/>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="abstractConfigurationBeanWithGCR" abstract="true">
    <xs:complexContent>
      <xs:extension base="tns:abstractConfigurationBean">
        <xs:sequence/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="propertiesType">
    <xs:sequence>
      <xs:element name="property" type="tns:property" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="property">
    <xs:sequence/>
    <xs:attribute name="name" type="xs:string"/>
    <xs:attribute name="value" type="xs:string"/>
  </xs:complexType>

  <xs:complexType name="scheduledExecutorFactoryType">
    <xs:complexContent>
      <xs:extension base="tns:factoryClassWithPropertiesType">
        <xs:sequence/>
        <xs:attribute name="factory" type="xs:string"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="globalJmxStatisticsType">
    <xs:complexContent>
      <xs:extension base="tns:abstractConfigurationBeanWithGCR">
        <xs:sequence>
          <xs:element name="properties" type="tns:propertiesType" minOccurs="0"/>
        </xs:sequence>
        <xs:attribute name="allowDuplicateDomains" type="xs:boolean"/>
        <xs:attribute name="cacheManagerName" type="xs:string"/>
        <xs:attribute name="enabled" type="xs:boolean"/>
        <xs:attribute name="jmxDomain" type="xs:string"/>
        <xs:attribute name="mBeanServerLookup" type="xs:string"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="transportType">
    <xs:complexContent>
      <xs:extension base="tns:abstractConfigurationBeanWithGCR">
        <xs:sequence>
          <xs:element name="properties" type="tns:propertiesType" minOccurs="0"/>
        </xs:sequence>
        <xs:attribute name="clusterName" type="xs:string"/>
        <xs:attribute name="distributedSyncTimeout" type="xs:long"/>
        <xs:attribute name="machineId" type="xs:string"/>
        <xs:attribute name="nodeName" type="xs:string"/>
        <xs:attribute name="rackId" type="xs:string"/>
        <xs:attribute name="siteId" type="xs:string"/>
        <xs:attribute name="strictPeerToPeer" type="xs:boolean"/>
        <xs:attribute name="transportClass" type="xs:string"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="serializationType">
    <xs:complexContent>
      <xs:extension base="tns:abstractConfigurationBeanWithGCR">
        <xs:sequence/>
        <xs:attribute name="marshallerClass" type="xs:string"/>
        <xs:attribute name="version" type="xs:string"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="shutdownType">
    <xs:complexContent>
      <xs:extension base="tns:abstractConfigurationBeanWithGCR">
        <xs:sequence/>
        <xs:attribute name="hookBehavior" type="tns:shutdownHookBehavior"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="configuration">
    <xs:complexContent>
      <xs:extension base="tns:abstractNamedCacheConfigurationBean">
        <xs:all>
          <xs:element name="locking" type="tns:lockingType" minOccurs="0"/>
          <xs:element name="loaders" type="tns:cacheLoaderManagerConfig" minOccurs="0"/>
          <xs:element name="transaction" type="tns:transactionType" minOccurs="0"/>
          <xs:element name="customInterceptors" type="tns:customInterceptorsType" minOccurs="0"/>
          <xs:element name="eviction" type="tns:evictionType" minOccurs="0"/>
          <xs:element name="expiration" type="tns:expirationType" minOccurs="0"/>
          <xs:element name="unsafe" type="tns:unsafeType" minOccurs="0"/>
          <xs:element name="clustering" type="tns:clusteringType" minOccurs="0"/>
          <xs:element name="jmxStatistics" type="tns:jmxStatistics" minOccurs="0"/>
          <xs:element name="lazyDeserialization" type="tns:lazyDeserialization" minOccurs="0"/>
          <xs:element name="invocationBatching" type="tns:invocationBatching" minOccurs="0"/>
          <xs:element name="deadlockDetection" type="tns:deadlockDetectionType" minOccurs="0"/>
          <xs:element name="indexing" type="tns:queryConfigurationBean" minOccurs="0"/>
        </xs:all>
        <xs:attribute name="name" type="xs:string"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="abstractNamedCacheConfigurationBean" abstract="true">
    <xs:complexContent>
      <xs:extension base="tns:abstractConfigurationBean">
        <xs:sequence/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="lockingType">
    <xs:complexContent>
      <xs:extension base="tns:abstractNamedCacheConfigurationBean">
        <xs:sequence/>
        <xs:attribute name="concurrencyLevel" type="xs:int"/>
        <xs:attribute name="isolationLevel" type="tns:isolationLevel"/>
        <xs:attribute name="lockAcquisitionTimeout" type="xs:long"/>
        <xs:attribute name="useLockStriping" type="xs:boolean"/>
        <xs:attribute name="writeSkewCheck" type="xs:boolean"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="cacheLoaderManagerConfig">
    <xs:complexContent>
      <xs:extension base="tns:abstractNamedCacheConfigurationBean">
        <xs:sequence>
          <xs:element name="loader" type="tns:abstractCacheStoreConfig" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
        <xs:attribute name="passivation" type="xs:boolean"/>
        <xs:attribute name="preload" type="xs:boolean"/>
        <xs:attribute name="shared" type="xs:boolean"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="abstractCacheStoreConfig">
    <xs:complexContent>
      <xs:extension base="tns:abstractCacheLoaderConfig">
        <xs:all>
          <xs:element name="async" type="tns:asyncStoreConfig" minOccurs="0"/>
          <xs:element name="singletonStore" type="tns:singletonStoreConfig" minOccurs="0"/>
          <xs:element name="properties" type="tns:propertiesType" minOccurs="0"/>
        </xs:all>
        <xs:attribute name="fetchPersistentState" type="xs:boolean"/>
        <xs:attribute name="ignoreModifications" type="xs:boolean"/>
        <xs:attribute name="purgeOnStartup" type="xs:boolean"/>
        <xs:attribute name="purgeSynchronously" type="xs:boolean"/>
        <xs:attribute name="purgerThreads" type="xs:int"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="abstractCacheLoaderConfig">
    <xs:complexContent>
      <xs:extension base="tns:abstractNamedCacheConfigurationBean">
        <xs:sequence/>
        <xs:attribute name="class" type="xs:string"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="asyncStoreConfig">
    <xs:complexContent>
      <xs:extension base="tns:abstractNamedCacheConfigurationBean">
        <xs:sequence/>
        <xs:attribute name="enabled" type="xs:boolean"/>
        <xs:attribute name="flushLockTimeout" type="xs:long"/>
        <xs:attribute name="shutdownTimeout" type="xs:long"/>
        <xs:attribute name="threadPoolSize" type="xs:int"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="singletonStoreConfig">
    <xs:complexContent>
      <xs:extension base="tns:abstractNamedCacheConfigurationBean">
        <xs:sequence/>
        <xs:attribute name="pushStateTimeout" type="xs:long"/>
        <xs:attribute name="pushStateWhenCoordinator" type="xs:boolean"/>
        <xs:attribute name="enabled" type="xs:boolean"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="transactionType">
    <xs:complexContent>
      <xs:extension base="tns:abstractNamedCacheConfigurationBean">
        <xs:sequence/>
        <xs:attribute name="cacheStopTimeout" type="xs:int"/>
        <xs:attribute name="eagerLockSingleNode" type="xs:boolean"/>
        <xs:attribute name="syncCommitPhase" type="xs:boolean"/>
        <xs:attribute name="syncRollbackPhase" type="xs:boolean"/>
        <xs:attribute name="transactionManagerLookupClass" type="xs:string"/>
        <xs:attribute name="useEagerLocking" type="xs:boolean"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="customInterceptorsType">
    <xs:complexContent>
      <xs:extension base="tns:abstractNamedCacheConfigurationBean">
        <xs:sequence>
          <xs:element name="interceptor" type="tns:interceptor" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="interceptor">
    <xs:complexContent>
      <xs:extension base="tns:abstractNamedCacheConfigurationBean">
        <xs:sequence>
          <xs:element name="properties" type="tns:propertiesType" minOccurs="0"/>
        </xs:sequence>
        <xs:attribute name="index" type="xs:int"/>
        <xs:attribute name="after" type="xs:string"/>
        <xs:attribute name="before" type="xs:string"/>
        <xs:attribute name="position" type="tns:position"/>
        <xs:attribute name="class" type="xs:string"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="evictionType">
    <xs:complexContent>
      <xs:extension base="tns:abstractNamedCacheConfigurationBean">
        <xs:sequence/>
        <xs:attribute name="maxEntries" type="xs:int"/>
        <xs:attribute name="strategy" type="tns:evictionStrategy"/>
        <xs:attribute name="threadPolicy" type="tns:evictionThreadPolicy"/>
        <xs:attribute name="wakeUpInterval" type="xs:long"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="expirationType">
    <xs:complexContent>
      <xs:extension base="tns:abstractNamedCacheConfigurationBean">
        <xs:sequence/>
        <xs:attribute name="lifespan" type="xs:long"/>
        <xs:attribute name="maxIdle" type="xs:long"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="unsafeType">
    <xs:complexContent>
      <xs:extension base="tns:abstractNamedCacheConfigurationBean">
        <xs:sequence/>
        <xs:attribute name="unreliableReturnValues" type="xs:boolean"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="clusteringType">
    <xs:complexContent>
      <xs:extension base="tns:abstractNamedCacheConfigurationBean">
        <xs:all>
          <xs:element name="sync" type="tns:syncType" minOccurs="0"/>
          <xs:element name="stateRetrieval" type="tns:stateRetrievalType" minOccurs="0"/>
          <xs:element name="l1" type="tns:l1Type" minOccurs="0"/>
          <xs:element name="async" type="tns:asyncType" minOccurs="0"/>
          <xs:element name="hash" type="tns:hashType" minOccurs="0"/>
        </xs:all>
        <xs:attribute name="mode" type="xs:string"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="syncType">
    <xs:complexContent>
      <xs:extension base="tns:abstractNamedCacheConfigurationBean">
        <xs:sequence/>
        <xs:attribute name="replTimeout" type="xs:long"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="stateRetrievalType">
    <xs:complexContent>
      <xs:extension base="tns:abstractNamedCacheConfigurationBean">
        <xs:sequence/>
        <xs:attribute name="alwaysProvideInMemoryState" type="xs:boolean"/>
        <xs:attribute name="fetchInMemoryState" type="xs:boolean"/>
        <xs:attribute name="initialRetryWaitTime" type="xs:long"/>
        <xs:attribute name="logFlushTimeout" type="xs:long"/>
        <xs:attribute name="maxNonProgressingLogWrites" type="xs:int"/>
        <xs:attribute name="numRetries" type="xs:int"/>
        <xs:attribute name="retryWaitTimeIncreaseFactor" type="xs:int"/>
        <xs:attribute name="timeout" type="xs:long"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="l1Type">
    <xs:complexContent>
      <xs:extension base="tns:abstractNamedCacheConfigurationBean">
        <xs:sequence/>
        <xs:attribute name="enabled" type="xs:boolean"/>
        <xs:attribute name="lifespan" type="xs:long"/>
        <xs:attribute name="onRehash" type="xs:boolean"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="asyncType">
    <xs:complexContent>
      <xs:extension base="tns:abstractNamedCacheConfigurationBean">
        <xs:sequence/>
        <xs:attribute name="asyncMarshalling" type="xs:boolean"/>
        <xs:attribute name="replQueueClass" type="xs:string"/>
        <xs:attribute name="replQueueInterval" type="xs:long"/>
        <xs:attribute name="replQueueMaxElements" type="xs:int"/>
        <xs:attribute name="useReplQueue" type="xs:boolean"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="hashType">
    <xs:complexContent>
      <xs:extension base="tns:abstractNamedCacheConfigurationBean">
        <xs:sequence/>
        <xs:attribute name="class" type="xs:string"/>
        <xs:attribute name="hashFunctionClass" type="xs:string"/>
        <xs:attribute name="numOwners" type="xs:int"/>
        <xs:attribute name="rehashEnabled" type="xs:boolean"/>
        <xs:attribute name="rehashRpcTimeout" type="xs:long"/>
        <xs:attribute name="rehashWait" type="xs:long"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="jmxStatistics">
    <xs:complexContent>
      <xs:extension base="tns:booleanAttributeType">
        <xs:sequence/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="booleanAttributeType">
    <xs:complexContent>
      <xs:extension base="tns:abstractNamedCacheConfigurationBean">
        <xs:sequence/>
        <xs:attribute name="enabled" type="xs:boolean"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="lazyDeserialization">
    <xs:complexContent>
      <xs:extension base="tns:booleanAttributeType">
        <xs:sequence/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="invocationBatching">
    <xs:complexContent>
      <xs:extension base="tns:booleanAttributeType">
        <xs:sequence/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="deadlockDetectionType">
    <xs:complexContent>
      <xs:extension base="tns:abstractNamedCacheConfigurationBean">
        <xs:sequence/>
        <xs:attribute name="enabled" type="xs:boolean"/>
        <xs:attribute name="spinDuration" type="xs:long"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="queryConfigurationBean">
    <xs:complexContent>
      <xs:extension base="tns:abstractConfigurationBean">
        <xs:sequence/>
        <xs:attribute name="enabled" type="xs:boolean"/>
        <xs:attribute name="indexLocalOnly" type="xs:boolean"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:simpleType name="shutdownHookBehavior">
    <xs:restriction base="xs:string">
      <xs:enumeration value="DEFAULT"/>
      <xs:enumeration value="REGISTER"/>
      <xs:enumeration value="DONT_REGISTER"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="isolationLevel">
    <xs:restriction base="xs:string">
      <xs:enumeration value="NONE"/>
      <xs:enumeration value="SERIALIZABLE"/>
      <xs:enumeration value="REPEATABLE_READ"/>
      <xs:enumeration value="READ_COMMITTED"/>
      <xs:enumeration value="READ_UNCOMMITTED"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="position">
    <xs:restriction base="xs:string">
      <xs:enumeration value="FIRST"/>
      <xs:enumeration value="LAST"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="evictionStrategy">
    <xs:restriction base="xs:string">
      <xs:enumeration value="NONE"/>
      <xs:enumeration value="UNORDERED"/>
      <xs:enumeration value="FIFO"/>
      <xs:enumeration value="LRU"/>
      <xs:enumeration value="LIRS"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="evictionThreadPolicy">
    <xs:restriction base="xs:string">
      <xs:enumeration value="PIGGYBACK"/>
      <xs:enumeration value="DEFAULT"/>
    </xs:restriction>
  </xs:simpleType>
</xs:schema>

Here is a simplified JUnit version of the code to test

**InfinispanConfigurationTest.java**package test.infinispan;

import java.io.InputStream;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import javax.xml.bind.ValidationEvent;
import javax.xml.bind.ValidationEventHandler;
import javax.xml.transform.sax.SAXSource;
import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.SchemaFactory;

import org.infinispan.config.InfinispanConfiguration;
import org.infinispan.config.JAXBUnmarshallable;
import org.infinispan.config.parsing.NamespaceFilter;
import org.infinispan.util.FileLookup;
import org.junit.Ignore;
import org.junit.Test;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLReaderFactory;

public class InfinispanConfigurationTest {

	@Test
	public void testFull42() throws SAXException, JAXBException {
		testFull("infinispan-config-4.2.xml", "infinispan-config-4.2.xsd");
	}

	@Ignore
	private void testFull(String xml, String xsd) throws SAXException, JAXBException {
		FileLookup fileLookup = new FileLookup();
		InputStream config = fileLookup.lookupFile(xml);
		InputStream schema = InfinispanConfiguration.findSchemaInputStream(xsd);
		JAXBContext jc = JAXBContext.newInstance(InfinispanConfiguration.class);
		Unmarshaller u = jc.createUnmarshaller();
		NamespaceFilter nf = new NamespaceFilter();
		XMLReader reader = XMLReaderFactory.createXMLReader();
		nf.setParent(reader);

		SchemaFactory factory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema"); 		u.setSchema(factory.newSchema(new StreamSource(schema)));
		u.setEventHandler(new ValidationEventHandler() {
			@Override
			public boolean handleEvent(ValidationEvent event) {
				int severity = event.getSeverity();
				return (severity != ValidationEvent.FATAL_ERROR && severity != ValidationEvent.ERROR);
			}
		});

		SAXSource source = new SAXSource(nf, new InputSource(config));
		u.setListener(new Unmarshaller.Listener() {
			@Override
			public void beforeUnmarshal(Object target, Object parent) {
				if (target instanceof JAXBUnmarshallable) {
					// notify the bean that it is about to be unmarshalled 					((JAXBUnmarshallable) target).willUnmarshall(parent);
				}
			}
		});

		InfinispanConfiguration ic = (InfinispanConfiguration) u.unmarshal(source);
		ic.accept(null);
	}

}

And maven dependencies of the versions I tested with.

**maven dependencies**<dependency>
	<groupId>javax.xml.bind</groupId>
	<artifactId>jaxb-api</artifactId>
	<version>2.2</version>
</dependency>
<dependency>
	<groupId>com.sun.xml.bind</groupId>
	<artifactId>jaxb-impl</artifactId>
	<version>2.2.5</version>
<!--
	<version>2.2.4</version>
-->
</dependency>
<dependency>
	<groupId>xerces</groupId>
	<artifactId>xercesImpl</artifactId>
	<version>2.11.0</version>
</dependency>
<dependency>
	<groupId>org.hibernate</groupId>
	<artifactId>hibernate-infinispan</artifactId>
	<version>3.6.10.Final</version>
	<exclusions>
		<exclusion>
			<groupId>org.infinispan</groupId>
			<artifactId>infinispan-parent</artifactId>
		</exclusion>
	</exclusions>
</dependency>
<dependency>
	<groupId>org.infinispan</groupId>
	<artifactId>infinispan-core</artifactId>
	<version>4.2.1.FINAL</version>
	<exclusions>
		<exclusion>
			<groupId>org.jboss.javaee</groupId>
			<artifactId>jboss-transaction-api</artifactId>
		</exclusion>
	</exclusions>
</dependency>

Environment

JDK 7, OSX

Affected Versions

[2.2.5]

Tomas-Kraus avatar Jul 20 '13 04:07 Tomas-Kraus

  • Issue Imported From: https://github.com/javaee/jaxb-v2/issues/968
  • Original Issue Raised By:@glassfishrobot
  • Original Issue Assigned To: @glassfishrobot

Tomas-Kraus avatar Sep 21 '18 16:09 Tomas-Kraus

@glassfishrobot Commented Reported by jamesmcintosh

Tomas-Kraus avatar Jul 20 '13 04:07 Tomas-Kraus

@glassfishrobot Commented yaroska said: Hi,

Thank you for reporting. Is this problem reproducible with the latest 2.2.7 release or 2.2.8-bxx?

– Iaroslav

Tomas-Kraus avatar Jul 22 '13 07:07 Tomas-Kraus

@glassfishrobot Commented jamesmcintosh said: Yes, it fails on 2.2.7 and 2.2.8-b1

Tomas-Kraus avatar Jul 27 '13 11:07 Tomas-Kraus

@glassfishrobot Commented jamesmcintosh said: I also have a maven project with a unit test but I can't see how to attach a file to this ticket.

Tomas-Kraus avatar Jul 27 '13 11:07 Tomas-Kraus

@glassfishrobot Commented File: infinispan-test.tgz Attached By: yaroska

Tomas-Kraus avatar Aug 04 '13 20:08 Tomas-Kraus

@glassfishrobot Commented Was assigned to yaroska

Tomas-Kraus avatar Jul 20 '13 04:07 Tomas-Kraus

@glassfishrobot Commented This issue was imported from java.net JIRA JAXB-968

Tomas-Kraus avatar Apr 24 '17 12:04 Tomas-Kraus