I have done it with Resin. I think it is the same with Tomcat.
You need to initialise your DataObjects in the init method of your servlet :
JDO jdo = new JDO();
jdo.setConfiguration(...);
jdo.setDatabaseName(...),
The you then can put it correctly in your JNDI NameSpace :
InitialContext ic = new InitialContex();
Context jdoCtx = ic.createSubContext("java:comp/env/jdo");
jdoCtx.bind("myDb", jdo);
After that, you just have to lookup on "java:/comp/env/jdo/myDb" to get your
DataObjects ready to use.
Additionnal informations :
your database.xml and mapping.xml files must be in your classpath (under
WEB-INF/classes) so that you can get them by getClass().getResource() as
explained in the servlet example,
I think it is better to run a test query just after initialising the JDO
configuration so as to check it and to throw a ServletException in the init
method in case of pb.
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev