You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, where are you using the war deployment? tomcat?
I think you should open an issue on JoinFaces project and provide stacktrace, steps to reproduce and a sample project so they will be able to help you.
Yes Tomcat.
The AdminFilter will be initialized by the servlet container due to the @webfilter annotation and uses inject to wire some beans. But these beans cannot be wired because the AdminFilter is not instantiated by Spring i think.
Sure, we can do that if it's causing problems in SpringBoot integration. Can you create a separated issue?
Anyway, it will not solve the problem. Tomcat will try to create AdminFilter and LogoutServlet when Tomcat is not embedded.
If you run Tomcat inside full java ee server, it will work because java ee server has DI capability. If you run embedded with spring boot, it work because spring has DI capability too. Single Tomcat does not have DI capability.
It works ok because Weld is full CDI implementation, but Spring Boot is not full CDI implementation.
Running Admin Template with Spring Boot and embedded Tomcat works ok too because JoinFaces autoconfiguration.
However, usecase described in this issue is about running Admin Template with Spring Boot inside Tomcat. Here, Tomcat tries to create AdminFilter because @webfilter annotation and Spring Boot can not help. Spring Boot can create another instance of AdminFilter, but it will be the second one.
If we remove @webfilter annotation to avoid this situation, JoinFaces/Spring Boot can handle it, but it will break Weld usecase probably.
HI, I am facing the same issue. Getting NPE on AdminFilter when running on Tomcat server. Could anyone help?
java.lang.NullPointerException: null
at com.github.adminfaces.template.session.AdminFilter.init(AdminFilter.java:53) ~[admin-template-1.0.0-RC20.jar:na]
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:270) ~[catalina.jar:9.0.13]
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:251) ~[catalina.jar:9.0.13]
at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:102) ~[catalina.jar:9.0.13]
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4491) [catalina.jar:9.0.13]
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5135) [catalina.jar:9.0.13]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [catalina.jar:9.0.13]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1432) [catalina.jar:9.0.13]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1422) [catalina.jar:9.0.13]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_191]
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) [tomcat-util.jar:9.0.13]
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134) [na:1.8.0_191]
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:944) [catalina.jar:9.0.13]
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:831) [catalina.jar:9.0.13]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [catalina.jar:9.0.13]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1432) [catalina.jar:9.0.13]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1422) [catalina.jar:9.0.13]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_191]
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) [tomcat-util.jar:9.0.13]
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134) [na:1.8.0_191]
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:944) [catalina.jar:9.0.13]
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:261) [catalina.jar:9.0.13]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [catalina.jar:9.0.13]
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422) [catalina.jar:9.0.13]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [catalina.jar:9.0.13]
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:801) [catalina.jar:9.0.13]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [catalina.jar:9.0.13]
at org.apache.catalina.startup.Catalina.start(Catalina.java:695) [catalina.jar:9.0.13]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_191]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_191]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_191]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_191]
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:350) [bootstrap.jar:9.0.13]
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:492) [bootstrap.jar:9.0.13]
Added the three things u told me, but giving the following error:
Caused by: java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered?
at org.springframework.web.jsf.FacesContextUtils.getRequiredWebApplicationContext(FacesContextUtils.java:83)
at org.springframework.web.jsf.el.SpringBeanFacesELResolver.getWebApplicationContext(SpringBeanFacesELResolver.java:151)
at org.springframework.web.jsf.el.SpringBeanFacesELResolver.getValue(SpringBeanFacesELResolver.java:78)
at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:180)
at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:208)
at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:94)
at org.apache.el.parser.AstValue.getValue(AstValue.java:137)
at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:190)
at org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:50)
at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:115)
at com.sun.faces.facelets.tag.TagAttributeImpl.getObject(TagAttributeImpl.java:358)
at com.sun.faces.facelets.tag.TagAttributeImpl.getValue(TagAttributeImpl.java:324)
at com.sun.faces.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:167)
at com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:94)
at com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:88)
at com.sun.faces.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:162)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.buildView(FaceletViewHandlingStrategy.java:381)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:102)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:223)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:671)
... 26 more
Activity
rmpestano commentedon Nov 28, 2018
Hi, where are you using the war deployment? tomcat?
I think you should open an issue on JoinFaces project and provide stacktrace, steps to reproduce and a sample project so they will be able to help you.
Tosken1337 commentedon Nov 28, 2018
Yes Tomcat.
The AdminFilter will be initialized by the servlet container due to the @webfilter annotation and uses inject to wire some beans. But these beans cannot be wired because the AdminFilter is not instantiated by Spring i think.
rmpestano commentedon Nov 28, 2018
So, it is JoinFaces that does this integration with Spring, CDI and JSF. Not something we can fix in this project, I think.
Tosken1337 commentedon Nov 29, 2018
I created an issue
joinfaces/joinfaces#588
persapiens commentedon Nov 29, 2018
Is it possible to configure
AdminFilterandLogoutServletatweb-fragment.xmlinstead of using @webfilter and @WebServlet annotations?rmpestano commentedon Nov 29, 2018
Sure, we can do that if it's causing problems in SpringBoot integration. Can you create a separated issue?
persapiens commentedon Nov 29, 2018
Anyway, it will not solve the problem. Tomcat will try to create
AdminFilterandLogoutServletwhen Tomcat is not embedded.If you run Tomcat inside full java ee server, it will work because java ee server has DI capability. If you run embedded with spring boot, it work because spring has DI capability too. Single Tomcat does not have DI capability.
rmpestano commentedon Nov 29, 2018
But in admin-starter-tomcat we add DI capability by adding CDI implementation and configuring BeanManager in META-INF/context.xml and weld in web.xml, that doesn't help in this case also?
persapiens commentedon Nov 29, 2018
It works ok because Weld is full CDI implementation, but Spring Boot is not full CDI implementation.
Running Admin Template with Spring Boot and
embeddedTomcat works ok too because JoinFaces autoconfiguration.However, usecase described in this issue is about running Admin Template with Spring Boot
insideTomcat. Here, Tomcat tries to createAdminFilterbecause @webfilter annotation and Spring Boot can not help. Spring Boot can create another instance ofAdminFilter, but it will be the second one.If we remove @webfilter annotation to avoid this situation, JoinFaces/Spring Boot can handle it, but it will break Weld usecase probably.
rmpestano commentedon Nov 29, 2018
I see, It is more a springboot limitation than an AdminFaces issue. Can I close this issue or we can try something else?
persapiens commentedon Nov 29, 2018
Admin Template uses CDI injection in Servlet and Filter. Spring handle this only if it creates them. Unfortunately, this issue is not the case.
DhannyaP commentedon Jan 9, 2019
HI, I am facing the same issue. Getting NPE on AdminFilter when running on Tomcat server. Could anyone help?
java.lang.NullPointerException: null
at com.github.adminfaces.template.session.AdminFilter.init(AdminFilter.java:53) ~[admin-template-1.0.0-RC20.jar:na]
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:270) ~[catalina.jar:9.0.13]
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:251) ~[catalina.jar:9.0.13]
at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:102) ~[catalina.jar:9.0.13]
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4491) [catalina.jar:9.0.13]
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5135) [catalina.jar:9.0.13]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [catalina.jar:9.0.13]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1432) [catalina.jar:9.0.13]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1422) [catalina.jar:9.0.13]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_191]
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) [tomcat-util.jar:9.0.13]
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134) [na:1.8.0_191]
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:944) [catalina.jar:9.0.13]
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:831) [catalina.jar:9.0.13]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [catalina.jar:9.0.13]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1432) [catalina.jar:9.0.13]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1422) [catalina.jar:9.0.13]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_191]
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) [tomcat-util.jar:9.0.13]
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134) [na:1.8.0_191]
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:944) [catalina.jar:9.0.13]
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:261) [catalina.jar:9.0.13]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [catalina.jar:9.0.13]
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422) [catalina.jar:9.0.13]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [catalina.jar:9.0.13]
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:801) [catalina.jar:9.0.13]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [catalina.jar:9.0.13]
at org.apache.catalina.startup.Catalina.start(Catalina.java:695) [catalina.jar:9.0.13]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_191]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_191]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_191]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_191]
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:350) [bootstrap.jar:9.0.13]
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:492) [bootstrap.jar:9.0.13]
rmpestano commentedon Jan 9, 2019
Hi, have you tried with admin-starter-tomcat?
DhannyaP commentedon Jan 9, 2019
admin-starter-tomcat works, but it is not using spring boot.
My application is spring boot application with joinfaces and adminfaces.
DhannyaP commentedon Jan 9, 2019
thanks it works fine when i give the bean manager in context.xml
rmpestano commentedon Jan 9, 2019
That's is quite interesting! have you noticed any other side effect?
@persapiens anything else we should take into account? perhaps we should include context.xml in admin-starter-springboot as well, WDYT?
danjimgar commentedon Feb 26, 2019
Hello,
Can you explain how did you do?
Thanks.
rmpestano commentedon Feb 26, 2019
I think @DhannyaP did something like this: #141 (comment)
danjimgar commentedon Feb 26, 2019
Added the three things u told me, but giving the following error:
Caused by: java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered?
at org.springframework.web.jsf.FacesContextUtils.getRequiredWebApplicationContext(FacesContextUtils.java:83)
at org.springframework.web.jsf.el.SpringBeanFacesELResolver.getWebApplicationContext(SpringBeanFacesELResolver.java:151)
at org.springframework.web.jsf.el.SpringBeanFacesELResolver.getValue(SpringBeanFacesELResolver.java:78)
at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:180)
at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:208)
at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:94)
at org.apache.el.parser.AstValue.getValue(AstValue.java:137)
at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:190)
at org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:50)
at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:115)
at com.sun.faces.facelets.tag.TagAttributeImpl.getObject(TagAttributeImpl.java:358)
at com.sun.faces.facelets.tag.TagAttributeImpl.getValue(TagAttributeImpl.java:324)
at com.sun.faces.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:167)
at com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:94)
at com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:88)
at com.sun.faces.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:162)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.buildView(FaceletViewHandlingStrategy.java:381)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:102)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:223)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:671)
... 26 more
rmpestano commentedon Feb 26, 2019
Can you share your project?
danjimgar commentedon Feb 27, 2019
You can check it here.
Thanks.
danjimgar commentedon Mar 5, 2019
Hi @rmpestano did you check it?
Thanks.