Hi Spring Forum,
some things first: I used the search but didn't really get good answers to my problem. Second I'm kinda new to spring but I just want to try the blazeds integration since my company is using spring all the way
So here's my situation: I use Jetty 7.1 with spring and spring-flex integration. So I created my application context that looks like this:
and I have the services-config.xml:Code:<bean id="remotingBean" class="com.eyeplorer.flex.remoting.SimpleRemoteObject"/> <flex:message-broker services-config-path="classpath*:com/eyeplorer/flex/remoting/services-config.xml"> <flex:mapping pattern="/messagebroker/*"/> </flex:message-broker> <flex:remoting-destination ref="remotingBean" destination-id="simpleRemoteService" channels="my-amf-channel" include-methods="echo"/>
and I created a simple Java Class called SimpleRemoteObject:Code:<services> <default-channels> <channel ref="my-amf-channel" /> </default-channels> </services> <channels> <channel-definition id="my-amf-channel" class="mx.messaging.channels.AMFChannel"> <!-- TODO: change that later? http://{server.name}:{server.port}/{context.root} --> <endpoint url="http://localhost:8080/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint" /> <properties> <polling-enabled>false</polling-enabled> </properties> </channel-definition> </channels> <logging> <target class="flex.messaging.log.ConsoleTarget" level="Debug"> <properties> <prefix>[BlazeDS]</prefix> <includeDate>false</includeDate> <includeTime>false</includeTime> <includeLevel>true</includeLevel> <includeCategory>true</includeCategory> </properties> <filters> <pattern>Endpoint.*</pattern> <pattern>Service.*</pattern> <pattern>Message.*</pattern> <pattern>DataService.*</pattern> <pattern>Configuration</pattern> </filters> </target> </logging>
and here's my web.xml:Code:public class SimpleRemoteObject { public SimpleRemoteObject() { System.err.println("[SimpleRemoteObject]"); } public String echo(String someText) { System.err.println("Remotely called"); return someText + "-" + someText; } }
When I start jetty this is the log i get:Code:<listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:com/eyeplorer/applicationContext.xml</param-value> </context-param>In Flex I build a simple function that trys to connect to my locally running jetty based blazedsspring-magic (localhost:8080).Code:>>> STARTING EMBEDDED JETTY SERVER, PRESS ANY KEY TO STOP INFO - log - jetty-7.1.0.v20100505 INFO - log - NO JSP Support for /, did not find org.apache.jasper.servlet.JspServlet WARN - log - java.lang.ClassNotFoundException: org.eclipse.jetty.jsp.JettyLog INFO - / - Initializing Spring root WebApplicationContext INFO - ContextLoader - Root WebApplicationContext: initialization started INFO - XmlWebApplicationContext - Refreshing Root WebApplicationContext: startup date [Thu May 20 13:20:33 CEST 2010]; root of context hierarchy INFO - XmlBeanDefinitionReader - Loading XML bean definitions from class path resource [com/eyeplorer/applicationContext.xml] INFO - DefaultListableBeanFactory - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@178aab40: defining beans [remotingBean,_messageBrokerHandlerAdapter,_messageBrokerDefaultHandlerMapping,_jsonConfigMapEditorConfigurer,_messageBrokerMessagingProcessor,_flexRemotingAnnotationPostProcessor,_messageBrokerRemotingProcessor,org.springframework.flex.core.ExceptionTranslationAdvice#0,org.springframework.flex.core.EndpointServiceMessagePointcutAdvisor#0,org.springframework.flex.core.MessageInterceptionAdvice#0,org.springframework.flex.core.EndpointServiceMessagePointcutAdvisor#1,_messageBrokerEndpointProcessor,_messageBroker,org.springframework.flex.remoting.RemotingDestinationExporter#0]; root of factory hierarchy [SimpleRemoteObject] INFO - FlexConfigurationManager - Loading Flex services configuration from: URL [file:/Users/jeckyll/Documents/eyeplorer/playground/blazedsjettytest/target/classes/com/eyeplorer/flex/remoting/services-config.xml] INFO - MessageBrokerFactoryBean - BlazeDS - Community Edition: 3.2.0.3978 [BlazeDS][WARN] [Configuration] No login command was found for 'jetty/7.1.0.v20100505'. Please ensure that the login-command tag has the correct server attribute value, or use 'all' to use the login command regardless of the server. [BlazeDS][INFO] [Configuration] Endpoint my-amf-channel created with security: None at URL: http://localhost:8080/messagebroker/amf INFO - MessageBrokerFactoryBean - MessageBroker with id '_messageBroker' is starting. [BlazeDS][DEBUG] [Configuration] MessageBroker id: _messageBroker classLoader is: the context class loader (classLoader hashCode: 1000613778 (parent system) INFO - MessageBrokerFactoryBean - MessageBroker with id '_messageBroker' is ready (startup time: '183' ms) INFO - SimpleUrlHandlerMapping - Mapped URL path [/messagebroker/*] onto handler [flex.messaging.MessageBroker@49f10a67] INFO - emotingDestinationExporter - Created remoting destination with id 'simpleRemoteService' INFO - emotingDestinationExporter - Remoting destination 'simpleRemoteService' has been started started successfully. INFO - ContextLoader - Root WebApplicationContext: initialization completed in 1087 ms INFO - log - Started SocketConnector@0.0.0.0:8080
I do it like this:But when I debug my flex app all I get is the usualCode:protected function applicationCompleteHandler(event:FlexEvent):void { var remoteObject:RemoteObject = new RemoteObject("simpleRemoteService"); remoteObject.addEventListener(ResultEvent.RESULT, resultHandler); remoteObject.addEventListener(FaultEvent.FAULT, faultHandler); var anObject:AsyncToken = remoteObject.echo("foo"); } private function resultHandler(event:ResultEvent):void { trace(event.result); } private function faultHandler(event:FaultEvent):void { trace(event.fault.message); }
I used the -services compiler option in FlashBuilder to make the mxml compiler aware of the services.Code:Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Failed: url: 'http://localhost:8080/messagebroker/amf
I don't see why it's not working. In the jetty log I see that BlazeDS is starting and also the bean that should react to the remote calls is created and thelike. I specifically hardcoded the path in the channels-definition to "http://localhost:8080/messagebroker/amf" since I just wanna try it and use no context.
Am I overseeing something or did I not read the documentations carefully enough? (Although I have to say that all are a little bit confusing)
Any Help of you experts would be very much appreciated!
Cheers,
norman



Reply With Quote
