2 Replies Latest reply on Mar 23, 2007 1:49 AM by arijit

    casting exception in datasource lookup

    arijit Newbie

      Hi, I am new to jBoss AS.
      I am using jboss 4.0.4GA for developing an web-application. I have configured datasource(ds1) for MSSQL server as per demo xml file from "/docs/examples/" folder. It's in global namespace (i used <use-java-context>false</use-java-context>).

      Jboss is running in one machine on default installation. I am using a different machine in LAN. My web-application is running in my machine in tomcat(5.5.23) in 8080 port.

      here's the code snippet of lookup:
      -----------------------------------------------------------------------------
      Properties prop= new Properties();
      prop.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      prop.put(Context.PROVIDER_URL, "jnp://192.168.1.5:1099");
      prop.put("java.naming.factory.url.pkgs","org.jboss.namingrg.jnp.interfaces");
      Context ctx= new InitialContext(prop);

      DataSource ds= (DataSource)ctx.lookup("ds1");

      ----------------------------------------------------------------------------
      I am always getting this error:
      java.lang.ClassCastException: javax.naming.Reference cannot be cast to javax.sql.DataSource

      Can anybody shed a light, what is going wrong?
      please tell me if more information is needed?