[jboss-user] [JCA/JBoss] - casting exception in datasource lookup

arijit_2404 do-not-reply at jboss.com
Thu Mar 22 08:40:56 EDT 2007


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?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4030616#4030616

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4030616



More information about the jboss-user mailing list