users@glassfish.java.net

jndi jdbc examples?

From: <glassfish_at_javadesktop.org>
Date: Fri, 10 Jul 2009 06:35:32 PDT

Hi all,

I haven't done any serious Java work in a very long time so most of the J2EE jargon is lost on me.

I'm having problems with getting my application talking to my JDBC connection (SQL Server w/jTDS) exposed via JNDI in Glassfish V3 Prelude.

As far as I know, my JDBC connection pool and JDBC resource is working properly - I can successfuly see my JDBC resource using asadmin list-jdbc-resources and I can ping the JDBC connection pool with success via the web and asadmin.

My question is - how the heck am I supposed to get my InitialContext? I'm completely ignorant about J2EE, WAR files and the various XML files that I when I google for help. I'm deploying a Django application with the Jython container.

I *think* I'm supposed to just use the default empty constructor for javax.naming.InitialContext, but that doesn't seem to work. I get NullPointer exceptions when I try creating an instance.

Is there a context factory I'm supposed to define somewhere? How do I know which JAR files I'm supposed to use - and frankly where am I supposed to put them?

Right now, I've got things hobbling along by grepping the JAR contents in glassfish/modules and copying JAR files into glassfish/lib/endorsed or else I get ClassNotFound exceptions.
[Message sent by forum member 'victorng' (victorng)]

http://forums.java.net/jive/thread.jspa?messageID=355112