Problema: Flash + Java + Blazeds + eclipse

Bom dia galera do guj!

Meu problema éo seguinte: instalei em minha maquina o eclipse juntamente com um plugin do adobe flash builder. Para realizar a “conexao” entre java e flash estou usando o blazeds. Busquei varios tutoriais na internet que ensinavam como configurar os arquivos para proporcionar a comuçao entre flash e java. Porem, mesmo seguindo passo a passo, nao obtive sucesso. O programa é so um exemplo mesmo, onde o que o cara digitasse no campo “Usuario” seria repedito no campo “Senha”.

Abaixo seguem as modificações indicadas nos arquivos e o erro relatado:

services-config.xml


<?xml version="1.0" encoding="UTF-8"?>
<service id="remoting-service" 
    class="flex.messaging.services.RemotingService">

    <adapters>
        <adapter-definition id="java-object" class="flex.messaging.services.remoting.adapters.JavaAdapter" default="true"/>
    </adapters>

    <default-channels>
        <channel ref="my-amf"/>
    </default-channels>
        
    <destination id="conecta">
    	<properties>
    		<source>ControleUsuario</source>
    	</properties>
    </destination>

</service>

ClasseJava :

public class ControleUsuario {
	
	public String Usuarios(String usuario){
		return "Usuario : " + usuario;
	}

}

Arquivo mxml :

<?xml version="1.0" encoding="utf-8"?>
<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">
	<fx:Declarations>
		<mx:RemoteObject id="remot" destination="conecta" />
		<!-- Place non-visual elements (e.g., services, value objects) here -->
	</fx:Declarations>
	
	<fx:Script>
		
		<![CDATA[
			import mx.controls.Alert;
			public function Clicou():void{
				Alert.show("Clicou !");
			}
		]]>
	</fx:Script>
	
	<s:Panel width="250" height="200" backgroundColor="#FAFAF5" contentBackgroundColor="#F9F6F6" horizontalCenter="-3" top="218">
		<s:Label text="Autenticação do Sistema" fontFamily="Courier New" fontWeight="bold" fontSize="15" textAlign="center" width="228" x="10" height="17" y="-22"/>
		<s:Label x="10" y="45" text="Usuário:" fontSize="15"/>
		<s:Label x="9" y="74.35" text="Senha:" fontSize="15"/>
		<s:Button x="168" y="136" label="Sair"  id="Sair" enabled="true" click="Clicou();"/>
		<s:Button x="89" y="136" label="Entrar" id="Entrar" click="Clicou();"/>
		<s:TextInput x="68" y="40" width="158" maxChars="30" borderVisible="true" id="Usuario" change="remot.Usuarios(Usuario.text);" />
		<s:TextInput x="68" y="70" width="158" displayAsPassword="true" maxChars="30" borderVisible="true" id="Senha" text="{remot.Usuarios.lastResult}" />

	</s:Panel>
	
	
	
</s:Application>

[red]Erro : [/red]

[RPC Fault faultString="Send failed" faultCode="Client.Error.MessageSend" faultDetail="Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Status 404: url: 'http://localhost:8080/WebContent/messagebroker/amf'"]
	at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::faultHandler()[E:\dev\4.x\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:345]
	at mx.rpc::Responder/fault()[E:\dev\4.x\frameworks\projects\rpc\src\mx\rpc\Responder.as:68]
	at mx.rpc::AsyncRequest/fault()[E:\dev\4.x\frameworks\projects\rpc\src\mx\rpc\AsyncRequest.as:113]
	at mx.messaging::ChannelSet/faultPendingSends()[E:\dev\4.x\frameworks\projects\rpc\src\mx\messaging\ChannelSet.as:1614]
	at mx.messaging::ChannelSet/channelFaultHandler()[E:\dev\4.x\frameworks\projects\rpc\src\mx\messaging\ChannelSet.as:1206]
	at flash.events::EventDispatcher/dispatchEventFunction()
	at flash.events::EventDispatcher/dispatchEvent()
	at mx.messaging::Channel/connectFailed()[E:\dev\4.x\frameworks\projects\rpc\src\mx\messaging\Channel.as:1128]
	at mx.messaging.channels::PollingChannel/connectFailed()[E:\dev\4.x\frameworks\projects\rpc\src\mx\messaging\channels\PollingChannel.as:406]
	at mx.messaging.channels::AMFChannel/statusHandler()[E:\dev\4.x\frameworks\projects\rpc\src\mx\messaging\channels\AMFChannel.as:453]

Obrigado pela atenção!

falta o caminho no services-config.xml

&lt;channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel"&gt;
            &lt;endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/&gt;
&lt;/channel-definition&gt;

depois tenta acessar direto do brownser para testar a conexão
ex:

http://localhost:8080/contexto_de_sua_aplicacao/messagebroker/amf 

posta seu remoting-config, web.xml etc…

Boa tarde daniel.info. Obrigado pela resposta!

Não sei se era esse o caminho que tinha q ter colocado… Mas acho que não é não pq o erro continua…

Como solicitado, segue os arquivos:

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
	<display-name>Teste</display-name>

	<context-param>
		<param-name>flex.class.path</param-name>
		<param-value>/WEB-INF/flex/hotfixes,/WEB-INF/flex/jars</param-value>
	</context-param>

	<!-- Http Flex Session attribute and binding listener support -->
	<listener>
		<listener-class>flex.messaging.HttpFlexSession</listener-class>
	</listener>

	<!-- MessageBroker Servlet -->
	<servlet>
		<servlet-name>MessageBrokerServlet</servlet-name>
		<servlet-class>flex.messaging.MessageBrokerServlet</servlet-class>
		<init-param>
			<param-name>services.configuration.file</param-name>
			<param-value>/WEB-INF/flex/services-config.xml</param-value>
		</init-param>
		<init-param>
			<param-name>flex.write.path</param-name>
			<param-value>/WEB-INF/flex</param-value>
		</init-param>
		<load-on-startup>1</load-on-startup>
	</servlet>

	<servlet-mapping>
		<servlet-name>MessageBrokerServlet</servlet-name>
		<url-pattern>/messagebroker/*</url-pattern>
	</servlet-mapping>
	<welcome-file-list>
		<welcome-file>Teste.html</welcome-file>
		<welcome-file>Teste.htm</welcome-file>
	</welcome-file-list>

	<!-- for WebSphere deployment, please uncomment -->
	<!--
		<resource-ref>
		<description>Flex Messaging WorkManager</description>
		<res-ref-name>wm/MessagingWorkManager</res-ref-name>
		<res-type>com.ibm.websphere.asynchbeans.WorkManager</res-type>
		<res-auth>Container</res-auth>
		<res-sharing-scope>Shareable</res-sharing-scope>
	</resource-ref>
	-->
</web-app>

services-config

<?xml version="1.0" encoding="UTF-8"?>
<services-config>

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

    <security>
        <login-command class="flex.messaging.security.TomcatLoginCommand" server="Tomcat"/>
        <!-- Uncomment the correct app server
        <login-command class="flex.messaging.security.TomcatLoginCommand" server="JBoss">
		<login-command class="flex.messaging.security.JRunLoginCommand" server="JRun"/>        
        <login-command class="flex.messaging.security.WeblogicLoginCommand" server="Weblogic"/>
        <login-command class="flex.messaging.security.WebSphereLoginCommand" server="WebSphere"/>
        -->

        <!-- 
        <security-constraint id="basic-read-access">
            <auth-method>Basic</auth-method>
            <roles>
                <role>guests</role>
                <role>accountants</role>
                <role>employees</role>
                <role>managers</role>
            </roles>
        </security-constraint>
         -->
    </security>

    <channels>

        <channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel">
            <endpoint url="http://localhost:8080/Teste/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/>
        </channel-definition>

        <channel-definition id="my-secure-amf" class="mx.messaging.channels.SecureAMFChannel">
            <endpoint url="https://{server.name}:{server.port}/{context.root}/messagebroker/amfsecure" class="flex.messaging.endpoints.SecureAMFEndpoint"/>
            <properties>
                <add-no-cache-headers>false</add-no-cache-headers>
            </properties>
        </channel-definition>

        <channel-definition id="my-polling-amf" class="mx.messaging.channels.AMFChannel">
            <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amfpolling" class="flex.messaging.endpoints.AMFEndpoint"/>
            <properties>
                <polling-enabled>true</polling-enabled>
                <polling-interval-seconds>4</polling-interval-seconds>
            </properties>
        </channel-definition>

        <!--
        <channel-definition id="my-http" class="mx.messaging.channels.HTTPChannel">
            <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/http" class="flex.messaging.endpoints.HTTPEndpoint"/>
        </channel-definition>

        <channel-definition id="my-secure-http" class="mx.messaging.channels.SecureHTTPChannel">
            <endpoint url="https://{server.name}:{server.port}/{context.root}/messagebroker/httpsecure" class="flex.messaging.endpoints.SecureHTTPEndpoint"/>
            <properties>
                <add-no-cache-headers>false</add-no-cache-headers>
            </properties>
        </channel-definition>
        -->
    </channels>

    <logging>
        <target class="flex.messaging.log.ConsoleTarget" level="Error">
            <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>

    <system>
        <redeploy>
            <enabled>false</enabled>
            <!-- 
            <watch-interval>20</watch-interval>
            <watch-file>{context.root}/WEB-INF/flex/services-config.xml</watch-file>
            <watch-file>{context.root}/WEB-INF/flex/proxy-config.xml</watch-file>
            <watch-file>{context.root}/WEB-INF/flex/remoting-config.xml</watch-file>
            <watch-file>{context.root}/WEB-INF/flex/messaging-config.xml</watch-file>
            <watch-file>{context.root}/WEB-INF/flex/data-management-config.xml</watch-file>
            <touch-file>{context.root}/WEB-INF/web.xml</touch-file>
             -->
        </redeploy>
    </system>

</services-config>

remoting-config

<?xml version="1.0" encoding="UTF-8"?>
<service id="remoting-service" 
    class="flex.messaging.services.RemotingService">

    <adapters>
        <adapter-definition id="java-object" class="flex.messaging.services.remoting.adapters.JavaAdapter" default="true"/>
    </adapters>

    <default-channels>
        <channel ref="my-amf"/>
    </default-channels>
    
    <destination id="Controle">
    	<properties>
    		<source>ControleUsuario</source>
    	</properties>
    </destination>

</service>

Obrigado!

Me esqueci de mencionar…

Digitando http://localhost:8080/Teste/messagebroker/amf no browser, carrega normalmente uma pagina em branco… sem erros…

alguem???

=/