On 24/03/2010 18:39, David Calavera wrote:
Hi,
I'm working in an application that uses an embedded tomcat and I'd like to
add a feature to add a connection pool by source but when I run the server
I'm getting this error:
javax.naming.NoInitialContextException: Need to specify class name in
environment or system property, or as an applet parameter, or in an
application resource file: java.naming.factory.initial
That sounds like you haven't configued the InitialContext via a suitable
Factory. I don't think Tomcat embedded does that automatically*, so you
would need to provide it yourself.
p
* someone will correct me if I'm wrong.
I'm using the tomcat jars for the version 6.0.18, and this is how I'm trying
to do it:
tomcat = new org.apache.catalina.startup.Tomcat() //creates the new server
... // configures the server
StandardContext application = tomcat.addWebapp(); //creates the web
application
... // configures the web application
resource = org.apache.catalina.deploy.ContextResource() // creates the new
JNDI resource
... // configures the JNDI resource with the name, type and properties
application.getNamingResources().addResource(resource) // adds the resource
to the application context
tomcat.start() //start tomcat
This is more or less the code, seems I'm not configuring anything because
without the resource it works fine.
Can anyone help me?
Thank you
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org