Problema ao implantar Flex + Servlet + Blazeds no Tomcat 6 do Linux

7 respostas
EugenioMonteiro

Desenvolvi um sistema utilizando Flex + Blazeds + Tomcat. Eu gero o arquivo .war da aplicação e implanto no servidor Windows pelo admin do tomcat, porém quando eu faço o mesmo no servidor Linux, não consigo acessar os servlets. Quando acesso o caminho no navegado para /messagebroker/amf, no servidor Windows aparece uma página em branco (ou seja, funciona), já no Linux é mostrada uma mensagem de erro: Servlet MessageBrokerServlet is not available.

No flex é exibida a seguinte mensagem: Channel.Security.Error. Li que para resolver este problema é preciso colocar o arquivo crossdomain.xml no diretório ROOT do tomcat, mas não resolveu.

Preciso fazer uma alteração na aplicação para que ele funcione no Tomcat do Linux?

obs.: Os arquivos ficam em /var/lib/tomcat6/webapps.

7 Respostas

davidbuzatto

O crossdomain é usado apenas se seu swf estiver em um servidor diferente da parte de infraestrutura. Como está tudo no mesmo servidor, não há necessidade deste arquivo. O que pode estar acontecendo é que o .jar do Blaze e das dependências dele não estão sendo implantadas. Você verificou se no seu .war os arquivos do Blaze estão sendo enviados? Outra coisa. Para compilar os serviços, se não me engano, o flex utiliza o endereço completo da aplicação. Normalmente, em desenvolvimento, no NetBeans a porta do Tomcat é 8084 e em produção a porta padrão é a 8080. Se você estiver compilando os serviços na porta 8084 não vai funcionar mesmo. A solução é colocar o Tomcat de desenvolvimento para rodar também na porta 8080 e configurar no Flex (Flash) Builder a porta correta tbm, ai a compilação do swf via ficar correta, pq vc vai ter um ambiente consistente entre desenvolvimento e produção.

[]´s

EugenioMonteiro

Todos os arquivos vão corretamente para o servidor, mas ainda assim não acessar o messagebroker/amf. Preciso de alterar alguma configuração?

davidbuzatto

Poste os arquivos de configuração (blaze e web.xml) para a gente dar uma olhada.

[]´s

EugenioMonteiro

web.xml

<?xml version="1.0" encoding="UTF-8" ?> 
  <!DOCTYPE web-app (View Source for full doctype...)> 
- <web-app>
  <display-name>BlazeDS</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>
- <servlet-mapping>
  <servlet-name>MessageBrokerServlet</servlet-name> 
  <url-pattern>/messagebroker/*</url-pattern> 
  </servlet-mapping>
- <welcome-file-list>
- <!-- <welcome-file>index.jsp</welcome-file>
        <welcome-file>index.jsp</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

<?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://{server.name}:{server.port}/{context.root}/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

<?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="DAO.UsuarioDAO">
- <properties>
  <source>DAO.UsuarioDAO</source> 
  </properties>
  </destination>
- <destination id="DAO.ServicoDAO">
- <properties>
  <source>DAO.ServicoDAO</source> 
  </properties>
  </destination>
  </service>
F

Eugênio,
Tenta:
Em vez

isso

[]s
Fabio da Silva

EugenioMonteiro

Fabiophx, tentei isso que você sugeriu mas não funcionou.
Não faço ideia do que possa ser, no servidor Windows não apresenta erro nenhum. Eu implanto e não preciso alterar nenhum arquivo.

EugenioMonteiro

Mais alguém tem alguma ideia?

Criado 2 de junho de 2010
Ultima resposta 4 de jun. de 2010
Respostas 7
Participantes 3