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.
John

Reply via email to