DataSource ds = (DataSource) ctx.lookup(JNDI);这样可以呀,你查出来报错了么?什么错呀?