2 Replies Latest reply on Oct 16, 2002 10:31 AM by ragnarokkrr

    Narrowing problems with JBoss on Win2k

      Greetings,

      I´m using jboss-3.0.3_tomcat-4.1.12 bundle on a Win2k Advanced Server with no SP and Cygwin+Postgresql.

      I deployed a simple Session Stateless Server with XDoclet. And it seems working fine. The jboss logger follows:

      11:24:33,493 INFO [MainDeployer] Starting deployment of package: file:/D:/jboss
      -3.0.3_tomcat-4.1.12/server/default/deploy/agenda.jar
      11:24:33,693 INFO [EjbModule] Creating
      11:24:33,733 INFO [EjbModule] Deploying AgendaBusiness/UsuarioSessionFacadeEJBe
      an
      11:24:33,783 INFO [EjbModule] Created
      11:24:33,783 INFO [EjbModule] Starting
      11:24:33,823 INFO [EjbModule] Started
      11:24:33,823 INFO [MainDeployer] Deployed package: file:/D:/jboss-3.0.3_tomcat-
      4.1.12/server/default/deploy/agenda.jar


      I´m included all {JBOSS_HOME}\client jar files in Forte for Java IDE (I´ve mounted the Jar's), start debugging the code (after running it) and located the exception

      java.lang.ClassCastException
      at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:293)
      at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:134)
      at testes.TesteUsuario2.main(TesteUsuario2.java:42)

      throwed by the method :
      UsuarioSessionFacadeHome usuarioHome = (UsuarioSessionFacadeHome)
      PortableRemoteObject.narrow (ref, UsuarioSessionFacadeHome.class);

      I´ve already tried to run this code using both jdk 1.3.1_05 and jdk 1.4.0 (seting the JAVA_HOME and the External Compiler FFJ option) and the symptom remains the same.

      I started the tests using jboss-3.0.0_tomcat-4.0.3 bundle.


      If anyone has any idea about how could I solve the question, please answer me.


      Thanks in advance.

      P.S. the test code:

      public static void main(String[] args) {
      try{
      InitialContext context=null;

      Hashtable env = new Hashtable();
      env.put(Context.INITIAL_CONTEXT_FACTORY
      ,"org.jnp.interfaces.NamingContextFactory");
      env.put(Context.PROVIDER_URL, "mmagos:1099");
      env.put("java.naming.factory.url.pkgs"
      ,"org.jboss.naming:org.jnp.interfaces");
      context = new InitialContext(env);

      Object ref = context.lookup("ejb/AgendaBusiness/UsuarioSessionFacadeEJBean");

      UsuarioSessionFacadeHome usuarioHome = (UsuarioSessionFacadeHome)
      PortableRemoteObject.narrow (ref, UsuarioSessionFacadeHome.class);

      UsuarioSessionFacade usuario = usuarioHome.create();

      UsuarioVO[] usuarios = usuario.findAll();

      for (int i = 0; i < usuarios.length; ++i){
      System.out.println(usuarios);
      }
      }catch (Exception e){
      e.printStackTrace();
      }

        • 1. Re: Narrowing problems with JBoss on Win2k
          prabhakar

          Try this instead:

          UsuarioSessionFacadeHome usuarioHome = context.lookup("ejb/AgendaBusiness/UsuarioSessionFacadeEJBean");

          UsuarioSessionFacade usuario = usuarioHome.create();

          UsuarioVO[] usuarios = usuario.findAll();

          HTH
          -prabhakar

          • 2. Re: Narrowing problems with JBoss on Win2k

            Thanks for attention, prabhakar.

            I've done the code update you send me. Again tested it against current and last versions of JBoss/Tomcat and JDK, but this time I got the exception:

            java.lang.ClassCastException: $Proxy0
            at testes.TesteUsuario2.main(TesteUsuario2.java:45)

            throwed in line

            UsuarioSessionFacade usuario = (UsuarioSessionFacade) usuarioHome.create();

            Should I Use JBoss 2.x with jdk 1.3?