2 Replies Latest reply on Dec 8, 2011 11:55 AM by kh40s z3r0

    Connection problem flex 4, blaze ds and java with spring annotations

    kh40s z3r0

      Hi, i wrote a very simple application with java that i need to connect with a flex application, to this connection i use blazeds and spring annotations

       

      and when i try to make the connection with flex, i get this error and i have been looking for and answer in internet, i have been doing tutorial but rigth now i don´t know  what´s the problem yet.

       

      the error is:

       

      [MessagingError message='Destination 'IndicadorCitaMedicaService' either does not exist or the destination has no channels defined (and the application does not define any default channels.)']

      Couldn't establish a connection to 'IndicadorCitaMedicaService'

       

      My web.xml  is:

       

      <!-- servlet para cargar el contexto de spring -->

      <servlet>

      <servlet-name>dispatcherServlet</servlet-name>

      <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>

      <load-on-startup>1</load-on-startup>

      </servlet>

       

      <!-- begin rds -->

      <servlet>

      <servlet-name>RDSDispatchServlet</servlet-name>

      <servlet-class>flex.rds.server.servlet.FrontEndServlet</servlet-class>

      <init-param>

      <param-name>messageBrokerId</param-name>

      <param-value>_messageBroker</param-value>

      </init-param>

      <init-param>

      <param-name>useAppserverSecurity</param-name>

      <param-value>false</param-value>

      </init-param>

      <load-on-startup>10</load-on-startup>

      </servlet>

       

      <servlet-mapping id="RDS_DISPATCH_MAPPING">

      <servlet-name>RDSDispatchServlet</servlet-name>

      <url-pattern>/CFIDE/main/ide.cfm</url-pattern>

      </servlet-mapping>

       

      <servlet-mapping>

      <servlet-name>dispatcherServlet</servlet-name>

      <url-pattern>/messagebroker/*</url-pattern>

      </servlet-mapping>

        • 1. Re: Connection problem flex 4, blaze ds and java with spring annotations
          kh40s z3r0 Level 1

          my dispatcherServlet-servlet.xml is:

           

          <flex:message-broker>

          <flex:remoting-service default-channels="my-amf" />

          </flex:message-broker>

           

          <context:annotation-config />

          <context:component-scan base-package="mx.....indicadores" />

           

          my services-config.xml is:

           

          <services>

          <service-include file-path="remoting-config.xml" />

          </services>

           

          <security />

           

          <channels>

          <channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel">

          <endpoint

          url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf"

          class="flex.messaging.endpoints.AMFEndpoint" />

          </channel-definition>

          </channels>

           

          <logging>

          <target class="flex.messaging.log.ConsoleTarget" level="Info">

          <properties>

          <prefix>[BlazeDS] </prefix>

          <includeDate>false</includeDate>

          <includeTime>false</includeTime>

          <includeLevel>false</includeLevel>

          <includeCategory>false</includeCategory>

          </properties>

          <filters>

          <pattern>Endpoint.*</pattern>

          <pattern>Service.*</pattern>

          <pattern>Configuration</pattern>

          </filters>

          </target>

          </logging>

          • 2. Re: Connection problem flex 4, blaze ds and java with spring annotations
            kh40s z3r0 Level 1

            my remoting-config.xml is:

             

            <adapters>

                    <adapter-definition id="java-object"

                                             class="flex.messaging.services.remoting.adapters.JavaAdapter"

                                             default="true"/>

                </adapters>

             

                <default-channels>

                    <channel ref="my-amf"/>

                </default-channels>

             

            my java class is this:

             

            @Service("IndicadorCitaMedicaService")

            @RemotingDestination(channels = {"my-amf"})

            public class BSIndicadores implements IBSIndicadores {

            @RemotingInclude

            public String sayHello(){

            return "Hello world from Flex";

            }

            }

             

            and the mxml is:

             

            <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

            xmlns:s="library://ns.adobe.com/flex/spark"

            xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:services="services.*">

            <fx:Script>

            <![CDATA[

            import mx.controls.Alert;

            import mx.events.FlexEvent;

             

            protected function form_creationCompleteHandler(event:FlexEvent):void

            {

            sayHelloResult.token = indicadorCitaMedicaService.sayHello();

            }

             

            ]]>

            </fx:Script>

             

            <fx:Declarations>

            <services:IndicadorCitaMedicaService id="indicadorCitaMedicaService" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/>

            <s:CallResponder id="sayHelloResult"/>

            </fx:Declarations>

            <mx:Form id="form" creationComplete="form_creationCompleteHandler(event)">

            <mx:FormItem label="SayHello">

            <s:TextInput id="sayHelloTextInput" text="{sayHelloResult.lastResult as String}"/>

            </mx:FormItem>

            </mx:Form>

             

            </s:Application>