0 Replies Latest reply on Dec 27, 2006 6:31 AM by lboin

    EJB call from FDS

    lboin
      Hi,

      I'm trying to call an EJB Method from a destination which is a service facade class as explained in the flex 2 dev guide (page 1163)

      Destination method called :

      public String connect(String lcd_clientID)
      {
      try
      {
      Properties props = new Properties();
      props.put(Context.INITIAL_CONTEXT_FACTORY, "jrun.naming.JRunContextFactory");
      props.put(Context.PROVIDER_URL,"myserver:2908");
      Context ctx = new InitialContext(props);

      Object o = ctx.lookup("Simple");
      SimpleHome home = (SimpleHome) PortableRemoteObject.narrow(o, SimpleHome.class);

      return "ok";
      }
      catch(java.lang.ClassCastException e)
      {
      return "ClassCastException";

      }
      catch(Exception e)
      {
      return "exception : " + e.getMessage();
      }
      }

      This method called from a standalone client returns "ok" as expected

      Deployed in FDS and called from an mxml, it returns a classcastexception :

      [Flex] Serializing AMF/HTTP response
      Version: 3
      (Message #0 targetURI=/2/onResult,
      (Typed Object #0 'flex.messaging.
      destination = null
      headers = (Object #1)
      correlationId = "DE53BD1A-5342-
      messageId = "7E1616E1-C509-474C
      timestamp = 1.167228393109E12
      clientId = "7E1616BA-B509-F9C6-
      timeToLive = 0.0
      body = "ClassCastException"

      EJB Classes are placed in this directory : "C:\JRun4\servers\default\flex\WEB-INF\classes\"
      Destination class (.jar) is placed in this directory : "C:\JRun4\servers\default\flex\WEB-INF\lib"

      Config : JRUN 4 installed + Update6. + JDK 1.5

      Could someone explain what is uncorrect ?

      Thanks !!

      Laurent