I keep on receiving a IllegalStateException: Could not find the FeatureManager when installing togglz in a web app on maven. I've followed the instuctions exactly. In my maven application, I have the following settings in my pom.xml file:
<dependency>
<groupId>org.togglz</groupId>
<artifactId>togglz-core</artifactId>
<version>2.1.0.Final</version>
</dependency>
<dependency>
<groupId>org.togglz</groupId>
<artifactId>togglz-console</artifactId>
<version>2.1.0.Final</version>
</dependency>
<dependency>
<groupId>org.togglz</groupId>
<artifactId>togglz-servlet</artifactId>
<version>2.1.0.Final</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
As well as the following in the web.xml file:
<context-param>
<param-name>org.togglz.core.manager.TogglzConfig</param-name>
<param-value>com.test.test.ana.FeatureFlagConfiguration</param-value>
</context-param>
<servlet>
<servlet-name>TogglzConsoleServlet</servlet-name>
<servlet-class>org.togglz.console.TogglzConsoleServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>TogglzConsoleServlet</servlet-name>
<url-pattern>/togglz/*</url-pattern>
</servlet-mapping>
This sample maven app runs fine, but when I try to go to the togglz virtual directory, it throws IllegalStateException: Could not find the FeatureManager error, it doesn't give much more detail than that. Any suggestions as to what that error really means? I'm just trying to get a sample project that uses togglz that works. I can't use spring or cdi, just servlets. (yes, i have servlet 3.0 configured)
Thanks in advance,
Edit: Here is the exact stack trace:
[ERROR ] SRVE0777E: Exception thrown by application class 'org.togglz.core.context.FeatureContext.getFeatureManager:49'
java.lang.IllegalStateException: Could not find the FeatureManager. For web applications please verify that the TogglzFilter starts up correctly. In other deployment scenarios you will typically have to implement a FeatureManagerProvider as described in the 'Advanced Configuration' chapter of the documentation.
at org.togglz.core.context.FeatureContext.getFeatureManager(FeatureContext.java:49)
at org.togglz.core.manager.LazyResolvingFeatureManager.getDelegate(LazyResolvingFeatureManager.java:24)
at org.togglz.core.manager.LazyResolvingFeatureManager.getCurrentFeatureUser(LazyResolvingFeatureManager.java:49)
at org.togglz.console.TogglzConsoleServlet.isFeatureAdmin(TogglzConsoleServlet.java:68)
at org.togglz.console.TogglzConsoleServlet.service(TogglzConsoleServlet.java:55)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1285)
at [internal classes]
If you are in a plain Servlet environment, you will have to do the following things after adding the Maven dependencies:
Implement your feature enum
This typically looks like this:
Configure Togglz by implementing TogglzConfig
A typical example looks like this:
Register your configuration class in web.xml
In a plain Servlet environment you will now have to register your TogglzConfig implementation by adding something like this to your web.xml:
You should also explicitly tell Togglz that you do not want it to lookup the FeatureManager from Spring or CDI but to create and manage an instance itself:
In Servlet 3.0 environments, the TogglzFilter is typically picked up automatically. However, you can also register it manually:
I hope this help. If this still doesn't work, please include the full stacktrace in your question.