hi....I don't succeed to connect to "java://DefaultDS" from a swing
client.....this is the code:
try {
| Properties ps = new Properties();
| ps.load(new
FileInputStream("resources/jndi.properties"));
| InitialContext ic = new InitialContext(ps);
| Object ref = ic.lookup("java://DefaultDS");
|
| DataSource dcf = (DataSource) ref;
|
| java.sql.Connection dc = dcf.getConnection();
|
| dc.close();
| } catch (NamingException e) {
| e.printStackTrace();
| }
this is jndi.properties:
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
| java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
| java.naming.provider.url=vitro03:10999
I have this error when I execute DataSource dcf = (DataSource) ref;:
Exception in thread "main" java.lang.ClassCastException:
org.jnp.interfaces.NamingContext
| at client.Main.main(Main.java:231
why?
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3886760#3886760
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3886760
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user