You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Ed Rouse <er...@milner.com> on 2014/11/07 22:44:29 UTC

tomcat 8 context.xml problems

Migrating to 8.0 and am having trouble with a custom Resource loader. Below is my context.xml file:

<Context>
                <Resources className="com.comsquared.idw.catalina.ext.MyCustomStandardRoot" />
                <Loader loaderClass="com.comsquared.idw.catalina.ext.MyClassLoader" delegate="true"
                                useSystemClassLoaderAsParent="false" />
                <Resource name="jdbc/ImageDirectorWorkflowDS" type="javax.sql.DataSource" factory="com.comsquared.idwm.DataSourceFactory" />
</Context>

I am not concerned about the datasource right now. But when I try to get the context

org.apache.catalina.Context ctx = this.getContext();

ctx is null. Do I need to add something to the context.xml file? The docs only mention this:

"The standard implementation of Resources is org.apache.catalina.webresources.StandardRoot, and is configured by its parent Context element."

But no mention about how a custom implementation of Resources gets its Context. I would assume from its parent as well. But how do I get the parent context?

Thanks, Ed.