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


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

Reply via email to