Mark,

On Wed, Dec 14, 2016 at 3:10 AM Mark Thomas <ma...@apache.org> wrote:

> On 14/12/2016 03:13, John D. Ament wrote:
> > Hi,
> >
> > I'm using Tomcat embedded to start a container.  I need to set some
> > initParameters in that embedded runtime.  However, when I try to set the
> > parameters I get the follow:
> >
> > java.lang.IllegalStateException: Initialization parameters cannot be set
> > after the context has been initialized
> >
> > at
> >
> org.apache.catalina.core.ApplicationContext.setInitParameter(ApplicationContext.java:1003)
> > at
> >
> org.apache.catalina.core.ApplicationContextFacade.setInitParameter(ApplicationContextFacade.java:624)
> >
> > I'm using the following to set the init parameter:
> >
> > Context ctx = tomcat.addContext("",base.getAbsolutePath());
> > ServletContext servletContext = ctx.getServletContext();
> > servletContext.setInitParameter("key","value");
> >
> > When i look, the tomcat instance is in the new state.  So it hasn't been
> > initialized yet.  I was wondering if this was an error?  I'm using Tomcat
> > 8.5.9.
>
> The error message might need a tweak for the embedded case but it is
> telling you the ServletContext is in the wrong state for editing the
> parameters.
>
> You want to add addParameter() on the Context object.
>

That worked.  Thanks.


>
> Mark
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>

Reply via email to