Results 1 to 8 of 8

Thread: SAXParseException

  1. #1
    Join Date
    Sep 2008
    Location
    Mannheim,Germany
    Posts
    125

    Unhappy SAXParseException-Help!

    Hi,
    I just created Spring WS and I would like to try using Spring Integration to send messages to this Spring WS. I have tried out the WebServiceDemo Example and Im using this example sort of a model for my application.However I got an error message
    GidWS.java
    Code:
    ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("gid.xml", GidWS.class);
    		// Compose the XML message according to the server's schema
    		String requestXml =
    				"<hr:CompanyRequest xmlns:hr=\"http://mycompany.com/hr/schemas\">" +
    				"<hr:Company>"+
    		        "<hr:CompanyName>BIS</hr:CompanyName>"+
    	            "</hr:Company>"+
                    "</hr:CompanyRequest>";
    Message<String> message = MessageBuilder.fromPayload(requestXml)
    				.setHeader(AbstractWebServiceHandler.SOAP_ACTION_PROPERTY_KEY, "http://mycompany.com/hr/schemas")
    				.build();
    ((MessageChannel)context.getBean("sendChannel")).send(message);
    	}}
    --------------------------------------------------------------------------
    gid.xml
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans:beans xmlns="http://www.springframework.org/schema/integration"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xmlns:beans="http://www.springframework.org/schema/beans"
    	xsi:schemaLocation="http://www.springframework.org/schema/beans
    			http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
    			http://www.springframework.org/schema/integration
    			http://www.springframework.org/schema/integration/spring-integration-core-1.0.xsd
    			http://www.springframework.org/schema/integration/spring-integration-ws-1.0.xsd
    			http://www.springframework.org/schema/tool
    			http://www.springframework.org/schema/tool/spring-tool-2.5.xsd">
    
    	<message-bus/>
            <channel id="sendChannel"/>
    <service-activator input-channel="sendChannel" ref="msgConverter"
    	                   output-channel="replyChannel"/>
    <ws-handler id="msgConverter" 
    				uri="http://localhost:8080/Trial1/companyservice/"/>
    <channel-adapter id="replyChannel" target="console"/>
    <console-target id="console"/>
    </beans:beans>
    Error stackjust the 1st part of it)
    Code:
    INFO: Loading XML bean definitions from class path resource [gid.xml]
    Oct 17, 2008 1:56:32 PM org.springframework.util.xml.SimpleSaxErrorHandler warning
    WARNING: Ignored XML validation warning
    org.xml.sax.SAXParseException: SchemaLocation: schemaLocation value = 'http://www.springframework.org/schema/beans    http://www.springframework.org/schem...-beans-2.5.xsd    http://www.springframework.org/schema/integration    http://www.springframework.org/schem...n-core-1.0.xsd    http://www.springframework.org/schem...ion-ws-1.0.xsd    http://www.springframework.org/schema/tool    http://www.springframework.org/schem...g-tool-2.5.xsd' must have even number of URI's.
    	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:236)
    	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.warning(ErrorHandlerWrapper.java:137)
    	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:378)
    	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:316)
    	at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:429)
    	at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.storeLocations(XMLSchemaValidator.java:2381)
    	at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1795)
    	at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:705)
    	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:330)
    	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(XMLNSDocumentScannerImpl.java:779)
    	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1794)
    	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
    	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
    	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
    	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
    	at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:250)
    	at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:292)
    	at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:396)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
    	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
    	at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:109)
    	at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:80)
    	at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123)
    	at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:423)
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:353)
    	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:197)
    	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:172)
    	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:158)
    	at org.springframework.integration.gidb.ws.GidWS.main(GidWS.java:21)
    Exception in thread "main" org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 25 in XML document from class path resource [gid.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'ws-handler'.
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:404)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
    	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
    	at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:109)
    	at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:80)
    	at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123)
    	at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:423)
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:353)
    	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:197)
    	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:172)
    	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:158)
    	at org.springframework.integration.gidb.ws.GidWS.main(GidWS.java:21)
    Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'ws-handler'.
    	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:236)
    	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:172)
    	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:382)
    	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:316)
    	at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:429)
    	at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3185)
    	at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1955)
    	at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.emptyElement(XMLSchemaValidator.java:725)
    	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:322)
    	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1693)
    Last edited by ashleyvijay; Oct 17th, 2008 at 07:35 AM.

  2. #2
    Join Date
    Oct 2008
    Location
    Auxerre, France
    Posts
    16

    Default

    In your xsi:schemaLocation
    add an URL ended by "/schema/integration" between the urls of spring-integration-core-1.0.xsd and spring-integration-ws-1.0.xsd

    like

    Code:
    ...springframework.org/schema/integration/spring-integration-1.0.xsd
    ...springframework.org/schema/integration/
    ...springframework.org/schema/integration/spring-integration-ws-1.0.xsd
    ('...' because I'm Not yet allowed to post URLS)

  3. #3
    Join Date
    Sep 2008
    Location
    Mannheim,Germany
    Posts
    125

    Unhappy

    Hey thanks for the reply but unfortunately it doesnt work. Im wondering whether it has to do something with uri of ws-handler in xml configuration

  4. #4
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,840

    Default

    Please check your error message. If you scroll all the way to the right, you will see this: "must have even number of URI's"

    That means your schemaLocation declaration is not legal. You must have a one-to-one mapping between each key and xsd location.

  5. #5
    Join Date
    Sep 2008
    Location
    Mannheim,Germany
    Posts
    125

    Unhappy

    Well ur absolutely right! But I didnt really understand what does this mean: That means your schemaLocation declaration is not legal. You must have a one-to-one mapping between each key and xsd location

    Can u explain a bit more. Should it be something similar to this??(this again shows error)Im totally confused.Would appreciate help.Thanks

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/integration"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xmlns:beans="http://www.springframework.org/schema/beans"
    	xmlns:ws="http://www.springframework.org/schema/integration/ws"
            xmlns:core="http://www.springframework.org/schema/integration/core"
            xmlns:tool="http://www.springframework.org/schema/tool"
            xmlns:integration="http://www.springframework.org/schema/integration"
    	
    	xsi:schemaLocation="http://www.springframework.org/schema/beans
    			http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
    			
    			http://www.springframework.org/schema/integration
    			http://www.springframework.org/schema/integration/spring-integration-1.0.xsd
    			
    			http://www.springframework.org/schema/integration/ws
    	                http://www.springframework.org/schema/integration/ws/spring-integration-ws-1.0.xsd
    	
    	                http://www.springframework.org/schema/integration/core
    	                http://www.springframework.org/schema/integration/core/spring-integration-core-1.0.xsd
    	
    	               http://www.springframework.org/schema/tool
    	               http://www.springframework.org/schema/tool/spring-tool-2.5.xsd">
        
        <integration:message-bus/>
        <integration:channel id="sendChannel"/>
    
    	<!-- The service activator receives from the 'sendChannel',
    	     invokes the handler, and sends the reply Message to the 'replyChannel'. -->
    	<integration:service-activator input-channel="sendChannel"
    	                   ref="msgConverter"
    	                   output-channel="replyChannel"/>
    
    	<!-- The handler invokes the WebService for the given URI and returns a reply Message. -->
    	<ws:ws-handler id="msgConverter" uri="http://localhost:8080/Trial1/companyservice"/>
    
    	<!-- The response from the service is logged to the console. -->
    	<integration:channel-adapter id="replyChannel" target="console"/>
    
    	<integration:console-target id="console"/>
    
    </beans>
    Last edited by ashleyvijay; Oct 20th, 2008 at 04:25 AM.

  6. #6
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,840

    Default

    This might help: http://www.w3.org/TR/xmlschema-0/#schemaLocation

    It looks like you did modify it to provide mappings with an even number, so your error message must be different (can you post it?).

    The one thing I notice is that you should remove the references to "core" - both the xmlns:core line and the pair within the schemaLocation values.

  7. #7
    Join Date
    Sep 2008
    Location
    Mannheim,Germany
    Posts
    125

    Unhappy

    Thanks for the reply.This is the modified version. I hve removed the "core".Would appreciate help

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/integration"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xmlns:beans="http://www.springframework.org/schema/beans"
    	xmlns:ws="http://www.springframework.org/schema/integration/ws"
            xmlns:tool="http://www.springframework.org/schema/tool"
            xmlns:integration="http://www.springframework.org/schema/integration"
    	xsi:schemaLocation="http://www.springframework.org/schema/beans
    			http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
    			
    			http://www.springframework.org/schema/integration
    			http://www.springframework.org/schema/integration/spring-integration-1.0.xsd
    			
    			http://www.springframework.org/schema/integration/ws
    	              http://www.springframework.org/schema/integration/ws/spring-integration-ws-1.0.xsd
    	
    	               http://www.springframework.org/schema/tool
    	               http://www.springframework.org/schema/tool/spring-tool-2.5.xsd">
        
        <integration:message-bus/>
        <integration:channel id="sendChannel"/>
    
    	<!-- The service activator receives from the 'sendChannel',
    	     invokes the handler, and sends the reply Message to the 'replyChannel'. -->
    	<integration:service-activator input-channel="sendChannel"
    	                   ref="msgConverter"
    	                   output-channel="replyChannel"/>
    
    	<!-- The handler invokes the WebService for the given URI and returns a reply Message. -->
    	<ws:ws-handler id="msgConverter" uri="http://localhost:8080/Trial1/companyservice"/>
    
    	<!-- The response from the service is logged to the console. -->
    	<integration:channel-adapter id="replyChannel" target="console"/>
    
    	<integration:console-target id="console"/>
    
    </beans>
    and this is the error msg:
    File http://www.springframework.org/schem...n-core-1.0.xsd is not valid
    Unable to load schema with target namespace "http://www.springframework.org/schema/tool" from".
    Error location:xsd:schema/xsd:import


    and even if remove the "tool" I still get the same error msg.Kindly help

  8. #8
    Join Date
    Sep 2008
    Location
    Mannheim,Germany
    Posts
    125

    Thumbs up

    Thank u for all the replies. I figured out the validation problem and it works perfectly now.Actually the correct version is like this:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans:beans xmlns="http://www.springframework.org/schema/integration"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xmlns:beans="http://www.springframework.org/schema/beans"
    	xmlns:tool="http://www.springframework.org/schema/tool"
       xmlns:integration="http://www.springframework.org/schema/integration"
     xsi:schemaLocation="http://www.springframework.org/schema/beans
    			http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
    			http://www.springframework.org/schema/tool
    			http://www.springframework.org/schema/tool/spring-tool-2.5.xsd
    			http://www.springframework.org/schema/integration
    	http://www.springframework.org/schema/integration/spring-integration-ws-1.0.xsd
    			">
    <message-bus/>
        <channel id="sendChannel"/>
    
    	<!-- The service activator receives from the 'sendChannel',
    	     invokes the handler, and sends the reply Message to the 'replyChannel'. -->
    	<service-activator input-channel="sendChannel"
    	                   ref="msgConverter"
    	                   output-channel="replyChannel"/>
    
    	<!-- The handler invokes the WebService for the given URI and returns a reply Message. -->
    	<ws-handler id="msgConverter" uri="http://localhost:8080/Trial1/companyservice"/>
    
    	<!-- The response from the service is logged to the console. -->
    	<channel-adapter id="replyChannel" target="console"/>
    
    	<console-target id="console"/>
    
    </beans:beans>
    Hope this helps for people who r facing the same problem
    Last edited by ashleyvijay; Oct 21st, 2008 at 07:51 AM.

Posting Permissions

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