can not run Togglz with the guide: http://www.togglz.org/quickstart.html

420 views
Skip to first unread message

姚梦龙

unread,
May 4, 2016, 4:12:43 AM5/4/16
to togglz-users
i am new to Togglz so i try to use it with the "Quickstart" of Togglz , but it is wrong.Who can tell my why ? thank you !
i  fellow every steps of "Quickstart"(http://www.togglz.org/quickstart.html),and my errors are here:


class DemoConfiguration has two errors:   
1,ApplicationScoped cannot be resolved to a type
2,The constructor ServletUserProvider() is undefined

and this is my directory


Christian Kaltepoth

unread,
May 4, 2016, 11:48:07 AM5/4/16
to togglz...@googlegroups.com
Could you describe the environment you are working in? Are you using CDI?

You are correct regarding the constructor. You have to supply the name of the role to detect whether a user is feature admin there. I'll fix the documentation.


姚梦龙

unread,
May 4, 2016, 9:30:17 PM5/4/16
to togglz-users
1 , environment are jdk 1.7 、STS、maven.   and what environment should i add?
i am using CDI or spring.  but i add filter an context-param in web.xml as the guide. 

2 , yesterday i deleted the annotation @ApplicationScoped, and add a string to match ServletUserProvider(String), then two error disappeared.
then i ran it , project got the error:                             

3,If you can supple "Quickstart" with all classes which are need while run , i will be so happy : )  Are there example project in github ? or can you give me the example project zip? thank you for help~



java.util.ServiceConfigurationError: org.togglz.core.spi.BeanFinder: Provider org.togglz.cdi.spi.CDIBeanFinder could not be instantiated: java.lang.NoClassDefFoundError: javax/enterprise/context/spi/Contextual
at java.util.ServiceLoader.fail(ServiceLoader.java:224)
at java.util.ServiceLoader.access$100(ServiceLoader.java:181)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:377)
at java.util.ServiceLoader$1.next(ServiceLoader.java:445)
at org.togglz.core.context.BeanFinderFeatureManagerProvider.getFeatureManager(BeanFinderFeatureManagerProvider.java:37)
at org.togglz.core.context.FeatureContext.getFeatureManagerOrNull(FeatureContext.java:95)
at org.togglz.servlet.TogglzFilter.init(TogglzFilter.java:54)
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4908)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5602)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1572)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1562)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.NoClassDefFoundError: javax/enterprise/context/spi/Contextual
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2493)
at java.lang.Class.getConstructor0(Class.java:2803)
at java.lang.Class.newInstance(Class.java:345)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:373)
... 16 more
Caused by: java.lang.ClassNotFoundException: javax.enterprise.context.spi.Contextual
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1858)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1701)
... 21 more

姚梦龙

unread,
May 4, 2016, 9:32:17 PM5/4/16
to togglz-users
sorry , i wrote wrong words before.          In fact , I am not using CDI or spring ! 

Christian Kaltepoth

unread,
May 5, 2016, 1:35:06 AM5/5/16
to togglz...@googlegroups.com
You have to make sure that you just add the optional Togglz modules you really need. You don't have a CDI environment, so you should remove "togglz-cdi". According to your screenshot you also don't use the Spring framework, so you should also remove "togglz-spring-*".

Also have a look at the configuration chapter of the documentation:


If you don't use CDI and Spring, you should follow the steps described in the "Servlet environment" section.


Reply all
Reply to author
Forward
0 new messages