Conexão BlazeDs não funciona

0 respostas
WillEndiabrado

Pessoal, estou tendo problemas com a conexão BlazeDs Java Flex, pelo que verifiquei ta tudo ok com a codificação e as configurações, mas o projeto abre normalmente e quando vai fazer comunicação com JAVA o erro é apresentado e a conexão não funciona a mensagem apresentada é a seguinte - Cannot create class of type, já executei vários testes inclusive em projetos de testes diferentes, segue um exemplo simples de um projeto que não executa a comunicação.

Classe JAVA:

public class operacao {
	public int soma(int a, int b){
		return a + b;
	}
}

Application Flex:

<?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>
		<!-- Place non-visual elements (e.g., services, value objects) here -->
		<s:RemoteObject id="operacao" destination="operacao">
			<s:method name="soma" result="ResultadoSoma(event)"/>
		</s:RemoteObject>
	</fx:Declarations>
	
	<fx:Script>
		<![CDATA[
			import mx.rpc.events.ResultEvent;
			
			public function chama_somar():void{
				operacao.soma(Number(ti_a.text),Number(ti_b.text));
			}
				
			public function ResultadoSoma(event:mx.rpc.events.ResultEvent):void{
				ti_r.text = event.result.toString();
			}
		]]>
	</fx:Script>
	
	<s:Button x="215" y="135" label="Somar" click="chama_somar"/>
	
	<s:TextInput id="ti_a" x="63" y="135" width="69"/>
	<s:TextInput id="ti_b" x="140" y="135" width="69"/>
	<s:TextInput id="ti_r" x="290" y="135" width="69"/>
	
</s:Application>

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>

    <display-name>teste</display-name>
    <description>BlazeDS Application</description>

    <!-- 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>
        <display-name>MessageBrokerServlet</display-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>
        <load-on-startup>1</load-on-startup>
    </servlet>
    
<!-- begin rds
    <servlet>
        <servlet-name>RDSDispatchServlet</servlet-name>
		<display-name>RDSDispatchServlet</display-name>
        <servlet-class>flex.rds.server.servlet.FrontEndServlet</servlet-class>
		<init-param>
			<param-name>useAppserverSecurity</param-name>
			<param-value>true</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>
end rds -->

    <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>

Remote 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="operacao">
    	<properties>
    		<source>operacao</source>
    	</properties>
    </destination>

</service>

Valeu pessoal, agradeço desde já, isto já ta me enlouquecendo … rsrs.

Criado 24 de junho de 2012
Respostas 0
Participantes 1