Results 1 to 6 of 6

Thread: schema name conflict in collection???

  1. #1
    Join Date
    Oct 2008
    Posts
    107

    Default schema name conflict in collection???

    Hiyas,

    Can anyone offer some guidance as to what this error means:

    Code:
    org.springframework.xml.xsd.commons.CommonsXsdSchemaException: Schema [ServletContext resource [/WEB-INF/xsd/schema1.xsd]] could not be loaded; nested exception is org.apache.ws.commons.schema.XmlSchemaException: Schema name conflict in collection. Namespace: urn:com.company.domain.values
            at org.springframework.xml.xsd.commons.CommonsXsdSchemaCollection.afterPropertiesSet(CommonsXsdSchemaCollection.java:157)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
            Truncated. see log file for complete stacktrace
    org.apache.ws.commons.schema.XmlSchemaException: Schema name conflict in collection. Namespace: urn:com.comcast.domain.values
            at org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement(SchemaBuilder.java:142)
            at org.apache.ws.commons.schema.SchemaBuilder.build(SchemaBuilder.java:121)
            at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:509)
            at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:382)
            at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:422)
            Truncated. see log file for complete stacktrace
    I used JAXB (jdk 1.6) to generate the schema for my java classes (schemagen). Here is the Spring WS configuration:

    Code:
    	<bean id="profilerEndpoint" class="com.company.aggregate.profile.device.ProfilerImpl" />
    	
    	<bean class="org.springframework.ws.server.endpoint.adapter.GenericMarshallingMethodEndpointAdapter">
    		<constructor-arg ref="marshaller" />
    	</bean>
    	
    	<bean id="marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
    		<property name="classesToBeBound">
    			<list>
    				<value>com.company.aggregate.profile.device.Profile</value>
    				<value>com.company.aggregate.profile.device.Duplication</value>
    				<value>com.company.aggregate.profile.device.Association</value>
    				<value>com.company.aggregate.profile.device.DeviceEntry</value>
    			</list>
    		</property>
    		<property name="schema" value="/WEB-INF/xsd/schema.xsd" />
    	</bean>
    		
    	<bean id="profileDevice" class="org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition">
    		<property name="schema" ref="schema" />
    		<property name="portTypeName" value="ProfileDevice" />
    		<property name="locationUri" value="/services/" />
    		<property name="targetNamespace" value="http://www.company.com/information/services" />
    	</bean>
    	
    	<bean id="schema" class="org.springframework.xml.xsd.commons.CommonsXsdSchemaCollection">
    		<property name="xsds">
    			<list>
    				<value>/WEB-INF/xsd/schema.xsd</value>
    				<value>/WEB-INF/xsd/schema1.xsd</value>
    				<value>/WEB-INF/xsd/schema2.xsd</value>
    				<value>/WEB-INF/xsd/schema3.xsd</value>
    				<value>/WEB-INF/xsd/schema4.xsd</value>
    				<value>/WEB-INF/xsd/schema5.xsd</value>
    			</list>
    		</property>
    		<property name="inline" value="true" />
    	</bean>
    Thanks.

    Keith

  2. #2
    Join Date
    Oct 2008
    Posts
    107

    Default Resolved

    For anyone else having trouble with this error... make sure the XSDs are listed in order of increasing dependencies...

    for example, if schema2.xsd imports schema1.xsd, schema1.xsd must be appear 1st in the list. This applies all the way up the chain...

    A little note however, if you just list the highest level schema - the one that imports all the rest, you do not technically need to declare all the others, though it may be clearer to anyone reading the code.

    Keith

  3. #3
    Join Date
    Aug 2008
    Posts
    17

    Thumbs up Ordering XSDS for CommonsXsdSchemaCollection to prevent CommonsXsdSchemaException

    Thanks for this helpful post, it solved my problem. It would be great if this information was added to the javadoc for CommonsXsdSchemaCollection!

  4. #4
    Join Date
    Dec 2010
    Posts
    3

    Default

    thanks a lot. you saved my arss!!!

    god bless you!

    cheers

  5. #5
    Join Date
    Mar 2011
    Posts
    1

    Smile

    Thank you

    Merci beaucoup

    Best regards

  6. #6
    Join Date
    Jun 2012
    Posts
    1

    Default

    Hi,
    In my case org.springframework.xml.xsd.commons.CommonsXsdSche maCollection throwing the following exception. What are all the specific jars I have to include to use CommonsXsdSchemaCollection?

    org.springframework.web.servlet.FrameworkServlet initServletBean Context initialization failed
    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'schema' defined in ServletContext resource [/WEB-INF/spring/campaigntransactions-ws-config.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org/apache/ws/commons/schema/XmlSchemaCollection.read(Lorg/xml/sax/InputSourceLorg/apache/ws/commons/schema/XmlSchema;
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.initializeBean(Abstract AutowireCapableBeanFactory.java:1455)


    Thanks in advance

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •