Results 1 to 2 of 2

Thread: Problems running the spring-comet integration

  1. #1
    Join Date
    May 2007
    Location
    Sofia, Bulgaria
    Posts
    16

    Default Problems running the spring-comet integration

    Hi guys,

    I'm trying to integrate comet with spring in my application, but Im exeriencing some difficulties. So here's what I did:
    1) I pulled the spring-integration-comet from the spring integration sandbox and built it.
    2) Declared it as a dependency in my pom.xml:

    Code:
            
           <dependency>
                <groupId>org.springframework.integration</groupId>
                <artifactId>spring-integration-comet</artifactId>
                <version>2.1.BUILD-SNAPSHOT</version>
            </dependency>
    3) Declared the MeteorServlet in my web.xml as the following:
    Code:
        <!-- Handles Comet requests -->
        <servlet>
            <servlet-name>cometServlet</servlet-name>
            <servlet-class>org.atmosphere.cpr.MeteorServlet</servlet-class>
            <init-param>
                <param-name>org.atmosphere.servlet</param-name>
                <param-value>org.springframework.web.servlet.DispatcherServlet</param-value>
            </init-param>
            <init-param>
                <param-name>org.atmosphere.cpr.broadcasterClass</param-name>
                <param-value>org.springframework.integration.comet.HttpMessageBroadcaster</param-value>
            </init-param>
            <init-param>
                <param-name>org.atmosphere.useStream</param-name>
                <param-value>true</param-value>
            </init-param>
            <init-param>
                <param-name>org.atmosphere.cpr.broadcasterCacheClass</param-name>
                <param-value>org.atmosphere.cache.HeaderBroadcasterCache</param-value>
            </init-param>
            <init-param>
                <param-name>contextConfigLocation</param-name>
                <param-value>/WEB-INF/my-comet.xml</param-value>
            </init-param>
            <load-on-startup>1</load-on-startup>
        </servlet>
    
        <servlet-mapping>
            <servlet-name>cometServlet</servlet-name>
            <url-pattern>/flows/test/*</url-pattern>
        </servlet-mapping>
    4) Declared my-comet.xml as the following:

    Code:
        <bean name="/recent/notifications" class="org.springframework.integration.comet.AsyncHttpRequestHandlingMessageAdapter">
            <property name="messageChannel" ref="recentActivity" />
            <property name="messageThreshold" value="2" />
        </bean>
    
        <bean class="org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter"/>
    5) And finally I have a page with the atmosphere jquery plugin and the following Javascript:
    Code:
        /* transport can be : long-polling, streaming or websocket */
        $.atmosphere.subscribe(basePath, activityNotificationHandler,
            $.atmosphere.request = {
                transport : "websocket",
                maxRequest : 2,
                timeout: 10000,
                headers : { "Accept" : "application/json" }
            }
        );
    Now the problem.. Going to that page throws the following warning:
    Code:
    WARN  PageNotFound - No mapping found for HTTP request with URI [/flows/test/recent/notifications] in DispatcherServlet with name 'cometServlet'
    Does anybody know what is the problem here?
    Thanks.

  2. #2
    Join Date
    Jan 2009
    Posts
    10

    Default Yep

    I sure do, just went through this exact problem myself. You don't have anything mapping your URL to that HandlerAdapter. Keith seems to have it configured in the Greenhouse example to map the bean name of the adapter as the URL (notice your bean's name is defined as /recent/notifications), but I sure don't see where he did it. But add this to your application context somewhere and see if that doesn't fix your problem.

    Code:
    	<bean class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping" >
    		<property name="order" value="3" />
    	</bean>
    That should get you past that issue, but I still have problems after that with atmosphere and have yet to actually get this implementation working outside of greenhouse. Let me know if you have any better luck or if this helps at all.

Posting Permissions

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