1 Reply Latest reply on May 7, 2006 2:36 AM by kbhdk1976

    ClassCastException if calling EJB from external servlet cont

      Hello Folks,

      I've got a simple EJB deployed to JBoss3.0.0 running in combination with Tomcat 4.0.3. Calling this EJB from a command line client works very fine using code like this:

      final String factoryClassName="org.jnp.interfaces.NamingContextFactory";
      final String providerURL = "jnp://195.30.48.4:1100/";
      final String packages = "org.jboss.naming:org.jnp.interfaces";

      Hashtable env=new Hashtable();
      env.put(Context.INITIAL_CONTEXT_FACTORY, factoryClassName);
      env.put(Context.PROVIDER_URL, providerURL);
      env.put(Context.URL_PKG_PREFIXES, packages);

      // create initial context
      Context ctx = new InitialContext(env);
      Object obj = ctx.lookup("ejb/TestCMPBean");
      EntityControllerHome home = (EntityControllerHome) obj;
      EntityController controller = home.create();

      ... and so on.

      Using exactly the same code within a (SIP) servlet container running on another system cause the following error message:

      Caught an exception: java.lang.ClassCastException: $Proxy0
      java.lang.ClassCastException: $Proxy0
      at vpe.agora.sip.communication.CommunicationTest.doRegister(CommunicationTest.java:53)
      at javax.servlet.sip.SipServlet.doRequest(SipServlet.java:109)
      at javax.servlet.sip.SipServlet.service(SipServlet.java:74)
      at com.dynamicsoft.ae.servlet.Dispatcher.forward(Dispatcher.java:94)
      at com.dynamicsoft.ae.servlet.sip.ServerTransaction.invokeServlet(ServerTransaction.java:390)
      at com.dynamicsoft.ae.servlet.sip.ServerTransaction.processRequest(ServerTransaction.java:469)
      at com.dynamicsoft.ae.servlet.sip.ServerTransaction.(ServerTransaction.java:141)
      at com.dynamicsoft.ae.servlet.ApplicationContext.process(ApplicationContext.java:628)
      at com.dynamicsoft.ae.services.em.EventManager.dispatchRequest(EventManager.java:316)
      at com.dynamicsoft.ae.services.pa.sip.PeToEmDispatcher.request(PeToEmDispatcher.java:239)
      at com.dynamicsoft.DsLibs.DsSipLlApi.DsSipRequestQueueHelper$QueueHelperUOW.process(Unknown Source)
      at com.dynamicsoft.DsLibs.DsUtil.DsQProcessor.run(Unknown Source)

      I'm not sure about this "$Proxy0" error. I've heard something about dynamic proxy generation. Could the problem be somewhere in this context ?

      Would appreciate any help or any hints,
      Michael.