Results 1 to 7 of 7

Thread: Exception when running example demo main methods in eclipse

  1. #1
    Join Date
    Jan 2007
    Posts
    107

    Question Exception when running example demo main methods in eclipse

    Hi,

    I've checked out SI from SVN and have imported samples/ into eclipse as a maven project. When I run the demo main methods I get the following exception for most of the examples.

    Code:
    25-Jan-2009 14:36:29 org.springframework.context.support.AbstractApplicationContext prepareRefresh
    INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@137c60d: display name [org.springframework.context.support.ClassPathXmlApplicationContext@137c60d]; startup date [Sun Jan 25 14:36:29 GMT 2009]; root of context hierarchy
    25-Jan-2009 14:36:29 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
    INFO: Loading XML bean definitions from class path resource [errorHandlingDemo.xml]
    Exception in thread "main" org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/integration/stream]
    Offending resource: class path resource [errorHandlingDemo.xml]
    
    	at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
    	at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
    	at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:80)
    	at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.error(BeanDefinitionParserDelegate.java:281)
    	at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1294)
    	at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1287)
    	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:135)
    	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:92)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:507)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398)
    	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:422)
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
    	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.samples.errorhandling.PartyDemo.main(PartyDemo.java:28)
    The xml file that the exception is referring to above is presented below.

    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:context="http://www.springframework.org/schema/context"
    	xmlns:stream="http://www.springframework.org/schema/integration/stream"
    	xsi:schemaLocation="http://www.springframework.org/schema/beans
    			http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
    			http://www.springframework.org/schema/context
    			http://www.springframework.org/schema/context/spring-context-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/stream
    			http://www.springframework.org/schema/integration/stream/spring-integration-stream-1.0.xsd">
    
    	<context:component-scan base-package="org.springframework.integration.samples.errorhandling" />
    
    	<poller default="true" max-messages-per-poll="1">
    		<interval-trigger interval="1000" />
    	</poller>
    
    	<inbound-channel-adapter ref="partyHost" method="nextInvitation" channel="invitations" />
    
    	<channel id="invitations">
    		<queue capacity="100" />
    	</channel>
    
    	<chain input-channel="invitations">
    		<header-enricher error-channel="failed-invitations" />
    		<service-activator ref="partyGuest" method="onInvitation" />
    	</chain>
    
    	<channel id="failed-invitations" />
    
    	<chain input-channel="failed-invitations">
    		<transformer ref="errorUnwrapper" />
    		<service-activator ref="partyHost" method="onInvitationFailed" />
    	</chain>
    
    	<stream:stderr-channel-adapter channel="errorChannel" append-newline="true" />
    
    </beans:beans>
    Any idea how I can resolve this? The xsd url for the stream namespace seems to resolve to the xsd.

    Many thanks.
    Last edited by Narada; Jan 25th, 2009 at 12:54 PM.

  2. #2
    Join Date
    Jan 2007
    Posts
    107

    Default

    I've also noticed that this only happens with those examples where the xml file contains the use of the stream namespace. It doesn't happen with other namespaces.

  3. #3
    Join Date
    Jan 2009
    Posts
    20

    Default Spring Plugin for Eclipse

    Are you including the org.springframework.integration.stream-1.x.x-RELEASE.jar file in you build? Also, I'm not sure if it's related, but when I began using the Spring Plugin for Eclipse, my problem went away.

  4. #4
    Join Date
    May 2007
    Location
    Netherlands
    Posts
    614

    Default

    This is a familiar problem. I don't have the issue number at hand, but if you search the forums a bit you will find a bug relating to this I think. Post back here if you can't find it and I'll have a look.

  5. #5
    Join Date
    May 2007
    Location
    Netherlands
    Posts
    614

    Default

    I haven't reproduced it, but I think if you set the XML catalog it should go away. Installing SpringSource Toolsuite or Spring IDE will do the same.

  6. #6

    Default include spring stream dependency

    Quote Originally Posted by Narada View Post
    Hi,

    I've checked out SI from SVN and have imported samples/ into eclipse as a maven project. When I run the demo main methods I get the following exception for most of the examples.

    Code:
    25-Jan-2009 14:36:29 org.springframework.context.support.AbstractApplicationContext prepareRefresh
    INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@137c60d: display name [org.springframework.context.support.ClassPathXmlApplicationContext@137c60d]; startup date [Sun Jan 25 14:36:29 GMT 2009]; root of context hierarchy
    25-Jan-2009 14:36:29 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
    INFO: Loading XML bean definitions from class path resource [errorHandlingDemo.xml]
    Exception in thread "main" org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/integration/stream]
    Offending resource: class path resource [errorHandlingDemo.xml]
    
    	at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
    	at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
    	at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:80)
    	at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.error(BeanDefinitionParserDelegate.java:281)
    	at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1294)
    	at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1287)
    	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:135)
    	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:92)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:507)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398)
    	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:422)
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
    	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.samples.errorhandling.PartyDemo.main(PartyDemo.java:28)
    The xml file that the exception is referring to above is presented below.

    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:context="http://www.springframework.org/schema/context"
    	xmlns:stream="http://www.springframework.org/schema/integration/stream"
    	xsi:schemaLocation="http://www.springframework.org/schema/beans
    			http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
    			http://www.springframework.org/schema/context
    			http://www.springframework.org/schema/context/spring-context-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/stream
    			http://www.springframework.org/schema/integration/stream/spring-integration-stream-1.0.xsd">
    
    	<context:component-scan base-package="org.springframework.integration.samples.errorhandling" />
    
    	<poller default="true" max-messages-per-poll="1">
    		<interval-trigger interval="1000" />
    	</poller>
    
    	<inbound-channel-adapter ref="partyHost" method="nextInvitation" channel="invitations" />
    
    	<channel id="invitations">
    		<queue capacity="100" />
    	</channel>
    
    	<chain input-channel="invitations">
    		<header-enricher error-channel="failed-invitations" />
    		<service-activator ref="partyGuest" method="onInvitation" />
    	</chain>
    
    	<channel id="failed-invitations" />
    
    	<chain input-channel="failed-invitations">
    		<transformer ref="errorUnwrapper" />
    		<service-activator ref="partyHost" method="onInvitationFailed" />
    	</chain>
    
    	<stream:stderr-channel-adapter channel="errorChannel" append-newline="true" />
    
    </beans:beans>
    Any idea how I can resolve this? The xsd url for the stream namespace seems to resolve to the xsd.

    Many thanks.


    in the maven pom.xml if we have the following dependency

    <dependency>
    <groupId>org.springframework.integration</groupId>
    <artifactId>spring-integration-core</artifactId>
    <version>2.1.0.RELEASE</version>
    </dependency>


    replace it with the below


    <dependency>
    <groupId>org.springframework.integration</groupId>
    <artifactId>spring-integration-stream</artifactId>
    <version>2.1.0.RELEASE</version>
    </dependency>

    then for your project steam along with core will be available, and it will fine

  7. #7
    Join Date
    Jan 2008
    Location
    Mohnton, PA USA (that's near Philadelphia)
    Posts
    2,148

    Default

    Also, 2.1.3 is the latest release

Tags for this Thread

Posting Permissions

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