HI
I am trying to get a DataSource object in a stand alone java program.
this is my program
| import java.util.*;
| import javax.naming.*;
| public class jndi {
| public static void main(String args[]){
| try{
|
| Properties prop = new Properties();
| prop.put("java.naming.factory.initial",
"org.jnp.interfaces.NamingContextFactory");
| prop.put("java.naming.provider.url","jnp://localhost:51099" );
|
prop.put("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
| Context context = new InitialContext(prop);
| Object dSource = context.lookup("java://qpmDS");
| System.out.println(dSource.toString());
| javax.sql.DataSource da =(javax.sql.DataSource) dSource;
|
| }catch(Exception ex){
| ex.printStackTrace();
| System.out.println("Error-1.0"+ex);
| }
|
| }
| }
|
|
Here
Object dSource = context.lookup("java://DSname");
|
dSource object is a org.jnp.interfaces.NamingContext's object
When i try to type cast it it throwing Type cast exception
pls let me is there any problem in my code.
Pranav
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3968084#3968084
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3968084
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user