Flex Cairngorm Spring Blazeds - 远程处理错误 - 请帮助我

发布于 2024-08-09 22:26:52 字数 2333 浏览 6 评论 0原文

当我尝试从 Flex/Cairngorm 应用程序访问远程 Java 类(在 Spring/BlazeDS 上)时,我似乎收到以下错误。我现在快要疯了,试图找出问题所在 - 任何帮助将不胜感激 - 谢谢迈克。

**Error: C0007E: RemoteObject not found for mycomponentsService
    at RemoteObjects/getService()
    at com.adobe.cairngorm.business::ServiceLocator/getRemoteObject()
    at com.nomura.dashboard.client.business::DashBoardDelegate()**

我的所有配置文件如下:

Cairngorm - BusinessDelegate.as

this.service = ServiceLocator.getInstance().getRemoteObject("**mycomponentsService**");

Cairngorm - Services.mxml

mx:RemoteObject id="mycomponentsService" 
                destination="remotecomponentService" 
                showBusyCursor="true">

Spring/BlazeDS - application-config.xml

flex:remote-service ref="remotecomponentService" 

bean id="remotecomponentService" 
     class="com.mycompany.dashboard.server.dao.ComponentsDAO"

Spring/BlazeDS - services-config.xml

channel-definition id="myamf" class="mx.messaging.channels.AMFChannel"
endpoint url="http://localhost:8080/dashboard-server/spring/messagebroker/amf" 
class="flex.messaging.endpoints.AMFEndpoint"

web.xml 还包含 Spring 引用 - 见下文

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4">

<!-- The front controller of this Spring Web application, responsible for handling all application requests -->
<display-name>dashboard-server</display-name>

<servlet>
    <servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>

    <init-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/spring/*-config.xml</param-value>
    </init-param>

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

<!-- Map /spring/* requests to the DispatcherServlet -->
<servlet-mapping>
    <servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
    <url-pattern>/spring/*</url-pattern>
    </servlet-mapping>
</web-app>

I seem to be getting the following error when I try to access a Remote Java class (on Spring/BlazeDS) from the Flex/Cairngorm application. I am going crazy at the moment trying to see what is wrong - any help would be greatly appreciated - thanks Mike.

**Error: C0007E: RemoteObject not found for mycomponentsService
    at RemoteObjects/getService()
    at com.adobe.cairngorm.business::ServiceLocator/getRemoteObject()
    at com.nomura.dashboard.client.business::DashBoardDelegate()**

All my config files are below:

Cairngorm - BusinessDelegate.as

this.service = ServiceLocator.getInstance().getRemoteObject("**mycomponentsService**");

Cairngorm - Services.mxml

mx:RemoteObject id="mycomponentsService" 
                destination="remotecomponentService" 
                showBusyCursor="true">

Spring/BlazeDS - application-config.xml

flex:remote-service ref="remotecomponentService" 

bean id="remotecomponentService" 
     class="com.mycompany.dashboard.server.dao.ComponentsDAO"

Spring/BlazeDS - services-config.xml

channel-definition id="myamf" class="mx.messaging.channels.AMFChannel"
endpoint url="http://localhost:8080/dashboard-server/spring/messagebroker/amf" 
class="flex.messaging.endpoints.AMFEndpoint"

The web.xml also contains Spring references - see below

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4">

<!-- The front controller of this Spring Web application, responsible for handling all application requests -->
<display-name>dashboard-server</display-name>

<servlet>
    <servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>

    <init-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/spring/*-config.xml</param-value>
    </init-param>

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

<!-- Map /spring/* requests to the DispatcherServlet -->
<servlet-mapping>
    <servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
    <url-pattern>/spring/*</url-pattern>
    </servlet-mapping>
</web-app>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

转角预定愛 2024-08-16 22:26:52

我们也可以看看您的 web.xml 吗?我很惊讶地在端点 URL 中看到“spring”一词。我的端点看起来总是像

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

这样:我认为你的 services-config.xml 应该看起来更像这样。

    <channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel">
         <endpoint url="http://{server.name}/dashboard-server/messagebroker/amf"
                   class="flex.messaging.endpoints.AMFEndpoint"/> 
    </channel-definition>

我还建议不要对端点 URL 进行过多的硬编码。只需选择

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

Update:

OK,这样您的 web.xml 看起来就可以了,URL 中包含 spring 也是如此。我在 Spring 配置文件 (application-config.xml) 中看到的是 Spring URL 映射。例如,在我的 Spring 配置文件中,除了 bean 定义之外,还有一个映射。例如:

<bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
    <property name="mappings">
        <value>
            /histogram/**=bean.HistogramController
            /counter/**=bean.CounterController
        </value>
    </property>
</bean>

<bean id="bean.HistogramController" class="ch.comp.app.HistogramXportController"  />
<bean id="bean.CounterController"   class="ch.comp.app.CounterXportController"    />

(我有一个基于 Spring 的应用程序,另一个使用 BlazeDS,但不是两者都有...所以我可能会遗漏一些东西。也就是说,我所要求的仍然应该是有效的。理论上但请持保留态度。)

也许需要进行一些超级基本的调试。您能否检查对服务器的调用是否在这些问题端点上返回 HTTP 404 ?有几种方法可以做到这一点:

  • 检查 GET /dashboard-server/spring/messagebroker/amf 的访问日志。这些请求的 HTTP 状态代码是什么? (免费、简单、无需新工具。)
  • 如果您使用 FireFox 作为浏览器,请添加 Tamper Data 插件。您不必篡改数据,但它会向您显示正在调用什么、返回什么,以及所有 HTTP 标头。
  • 使用完整的面向 Flash/Flex 的协议嗅探工具,例如 Charles Web 调试代理

了解这些请求是否在通信堆栈上失败,这对于缩小问题范围非常有帮助。

Can we see your web.xml also please? I am surprised to see the word "spring" in the endpoint URL. My endpoints have always looked like

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

E.g.: I think your services-config.xml should look more like this.

    <channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel">
         <endpoint url="http://{server.name}/dashboard-server/messagebroker/amf"
                   class="flex.messaging.endpoints.AMFEndpoint"/> 
    </channel-definition>

I would also suggest not hardcoding the end-point URL so much. Just go with

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

Update:

OK, so your web.xml looks OK, as does having the spring in your URL. What I don's see in your Spring configuration file (application-config.xml) is the Spring URL mapping. For example, in my Spring config files, in addition to the the bean definitions, there is a mapping. E.g.:

<bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
    <property name="mappings">
        <value>
            /histogram/**=bean.HistogramController
            /counter/**=bean.CounterController
        </value>
    </property>
</bean>

<bean id="bean.HistogramController" class="ch.comp.app.HistogramXportController"  />
<bean id="bean.CounterController"   class="ch.comp.app.CounterXportController"    />

(I have one app that is Spring-based, and another that uses BlazeDS, but not both...so I might be missing something. That said, what I'm asking still should be valid. In theory. But take it with a grain of salt.)

Maybe some some super basic debugging is in order. Can you check to see if the calls to your server are returning HTTP 404 or not on theses problem endpoints? A couple ways to do this:

  • Check the access logs for GET /dashboard-server/spring/messagebroker/amf. What is the HTTP status code for these requests? (Free, easy, no new tools.)
  • If you are using FireFox as a browser, add the Tamper Data plug in. You don't have to tamper with the data, but it shows you what is being called, what is returned, and all the HTTP headers.
  • Use a full on Flash/Flex oriented protocol sniffer tool, like Charles Web Debugging Proxy.

It will very helpful to narrow down the problem to know if where these requests are failing on the communications stack.

半﹌身腐败 2024-08-16 22:26:52

我在下面附上了 web.xml。就“Spring”一词而言 - 我正在使用标准 BlazrDS/Spring 集成 WAR 文件,该文件需要“spring”存在。 bean id="remotecomponentService" 实际上是一个 Spring bean。

您是说即使使用 BlazeDS/Spring WAR 我也可以使用您上面的解决方案吗?

web.xml 还包含 Spring 引用 - 见下文

<web-app version="2.4">
<display-name>dashboard-server</display-name>
<servlet>
    <servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/spring/*-config.xml</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
</servlet>
<!-- Map /spring/* requests to the DispatcherServlet -->
<servlet-mapping>
    <servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
    <url-pattern>/spring/*</url-pattern>
    </servlet-mapping>
</web-app>

I have attached web.xml below. In terms of the word "Spring" - I am using the standard BlazrDS/Spring integration WAR file which requires "spring" to be there. The bean id="remotecomponentService" is acutally a Spring bean.

Are you saying even with the BlazeDS/Spring WAR I can use your solution above?

The web.xml also contains Spring references - see below

<web-app version="2.4">
<display-name>dashboard-server</display-name>
<servlet>
    <servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/spring/*-config.xml</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
</servlet>
<!-- Map /spring/* requests to the DispatcherServlet -->
<servlet-mapping>
    <servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
    <url-pattern>/spring/*</url-pattern>
    </servlet-mapping>
</web-app>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文