0 Replies Latest reply on Sep 18, 2003 3:52 AM by Guillermo Guisado

    Can't get Datasource out of Jboss

    Guillermo Guisado Newbie

      Hi:
      I have this code:
      Hashtable hashtable = new Hashtable();
      hashtable.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
      hashtable.put("java.naming.provider.url","jnp://localhost:1099" );
      InitialContext ic = new InitialContext(hashtable);
      Object ref= ic.lookup("java:mySource");
      DataSource dataSource = (DataSource) javax.rmi.PortableRemoteObject.narrow(ref, DataSource.class);
      myConnection = dataSource.getConnection();

      so this code works inside an ear in Jboss but when I use it on a separate java application instead of getting a org.jboss.pool.jdbc.xa.XAPoolDataSource I get a org.jnp.interfaces.NamingContext
      I get the famous:
      java.lang.ClassCastException
      at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:293)

      why?
      I am using jboss2.4.4 tomcat 4.0.1