[JBoss JIRA] (SOLDER-311) HttpServletRequest cannot be @Inject-ed
by Daniel Farcas de Almeida Queiroz (JIRA)
[ https://issues.jboss.org/browse/SOLDER-311?page=com.atlassian.jira.plugin... ]
Daniel Farcas de Almeida Queiroz commented on SOLDER-311:
---------------------------------------------------------
One detail I forgot, my project is modular EAR -> CDI / EJB -> WAR - managed by Maven 3 and deployed in JBoss 7.1.Final
> HttpServletRequest cannot be @Inject-ed
> ---------------------------------------
>
> Key: SOLDER-311
> URL: https://issues.jboss.org/browse/SOLDER-311
> Project: Solder
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: Servlet
> Affects Versions: 3.1.0.Final
> Environment: JBossAS 7.1beta1b
> Reporter: Juergen Zimmermann
> Attachments: testcase.ear.zip, testcase.src.zip
>
>
> "@Inject HttpServletRequest request;" results in the stacktrace below, when I invoke "request(myusername, mypassword);" using JBossAS 7.1beta1b. I'll attach a testcase as an EAR. Just invoke http://localhost:8080/testcase and you'll see a form where you click the OK button. Then you'll see the stacktrace in the JBoss console.
> Stacktrace:
> 09:11:00,535 Warnung [javax.enterprise.resource.webcontainer.jsf.lifecycle] (http--127.0.0.1-8080-1) #{cust.findCustomer}: org.jboss.weld.exceptions.IllegalProductException: WELD-000052 Cannot return null from a non-dependent producer method: [method] @Produces @Typed @RequestScoped protected org.jboss.solder.servlet.http.ImplicitHttpServletObjectsProducer.getHttpServletRequest(): javax.faces.FacesException: #{cust.findCustomer}: org.jboss.weld.exceptions.IllegalProductException: WELD-000052 Cannot return null from a non-dependent producer method: [method] @Produces @Typed @RequestScoped protected org.jboss.solder.servlet.http.ImplicitHttpServletObjectsProducer.getHttpServletRequest()
> at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118) [jsf-impl-2.1.3-b02-jbossorg-2.jar:]
> at javax.faces.component.UICommand.broadcast(UICommand.java:315) [jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:]
> at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794) [jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:]
> at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259) [jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:]
> at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81) [jsf-impl-2.1.3-b02-jbossorg-2.jar:]
> at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [jsf-impl-2.1.3-b02-jbossorg-2.jar:]
> at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) [jsf-impl-2.1.3-b02-jbossorg-2.jar:]
> at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593) [jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:]
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.3.Final.jar:]
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.3.Final.jar:]
> at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62) [weld-core-1.1.4.Final.jar:]
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.3.Final.jar:]
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.3.Final.jar:]
> at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:126) [prettyfaces-jsf2-3.3.2.jar:]
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.3.Final.jar:]
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.3.Final.jar:]
> at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.3.Final.jar:]
> at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.3.Final.jar:]
> at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:397) [jbossweb-7.0.3.Final.jar:]
> at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.1.0.Beta1b.jar:]
> at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:151) [jboss-as-web-7.1.0.Beta1b.jar:]
> at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.3.Final.jar:]
> at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.3.Final.jar:]
> at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.3.Final.jar:]
> at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [jbossweb-7.0.3.Final.jar:]
> at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.3.Final.jar:]
> at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.3.Final.jar:]
> at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.3.Final.jar:]
> at java.lang.Thread.run(Thread.java:722) [:1.7.0_02]
> Caused by: javax.faces.el.EvaluationException: org.jboss.weld.exceptions.IllegalProductException: WELD-000052 Cannot return null from a non-dependent producer method: [method] @Produces @Typed @RequestScoped protected org.jboss.solder.servlet.http.ImplicitHttpServletObjectsProducer.getHttpServletRequest()
> at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:102) [jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:]
> at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102) [jsf-impl-2.1.3-b02-jbossorg-2.jar:]
> ... 28 more
> Caused by: org.jboss.weld.exceptions.IllegalProductException: WELD-000052 Cannot return null from a non-dependent producer method: [method] @Produces @Typed @RequestScoped protected org.jboss.solder.servlet.http.ImplicitHttpServletObjectsProducer.getHttpServletRequest()
> at org.jboss.weld.bean.AbstractProducerBean.checkReturnValue(AbstractProducerBean.java:217) [weld-core-1.1.4.Final.jar:]
> at org.jboss.weld.bean.AbstractProducerBean.create(AbstractProducerBean.java:300) [weld-core-1.1.4.Final.jar:]
> at org.jboss.weld.context.AbstractContext.get(AbstractContext.java:107) [weld-core-1.1.4.Final.jar:]
> at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:90) [weld-core-1.1.4.Final.jar:]
> at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:104) [weld-core-1.1.4.Final.jar:]
> at org.jboss.weld.proxies.HttpServletRequest$83012492$Proxy$_$$_WeldClientProxy.login(HttpServletRequest$83012492$Proxy$_$$_WeldClientProxy.java)
> at testcase.CustomerController.findCustomer(CustomerController.java:43) [classes:]
> at testcase.CustomerController$Proxy$_$$_WeldClientProxy.findCustomer(CustomerController$Proxy$_$$_WeldClientProxy.java) [classes:]
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.7.0_02]
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [:1.7.0_02]
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [:1.7.0_02]
> at java.lang.reflect.Method.invoke(Method.java:601) [:1.7.0_02]
> at org.apache.el.parser.AstValue.invoke(AstValue.java:196) [jbossweb-7.0.3.Final.jar:]
> at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276) [jbossweb-7.0.3.Final.jar:]
> at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:39) [weld-core-1.1.4.Final.jar:]
> at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50) [weld-core-1.1.4.Final.jar:]
> at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105) [jsf-impl-2.1.3-b02-jbossorg-2.jar:]
> at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88) [jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:]
> ... 29 more
--
This message was sent by Atlassian JIRA
(v6.2.6#6264)
10 years, 5 months
[JBoss JIRA] (SOLDER-311) HttpServletRequest cannot be @Inject-ed
by Daniel Farcas de Almeida Queiroz (JIRA)
[ https://issues.jboss.org/browse/SOLDER-311?page=com.atlassian.jira.plugin... ]
Daniel Farcas de Almeida Queiroz commented on SOLDER-311:
---------------------------------------------------------
I solved this error downloading solder-impl.3.2.1.Final and change the file org.jboss.solder.servlet.event.ServletEventBridgeFilter.java line 62 method doFilter() i add a Event Fire for InternalServletRequestEvent before fire InternalServletResponseEvent :
partial code:
import org.jboss.solder.servlet.event.ImplicitServletObjectsHolder.InternalServletRequestEvent;
method doFilter()
fireEvent(new InternalServletRequestEvent(request), InitializedLiteral.INSTANCE);
fireEvent(new InternalServletResponseEvent(response), InitializedLiteral.INSTANCE);
HttpServletRequest Now is not null.
I had to recompile the solder-impl.jar and add to project.
I do not know upon what can inpactar but the error disappeared.
Thanks.
> HttpServletRequest cannot be @Inject-ed
> ---------------------------------------
>
> Key: SOLDER-311
> URL: https://issues.jboss.org/browse/SOLDER-311
> Project: Solder
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: Servlet
> Affects Versions: 3.1.0.Final
> Environment: JBossAS 7.1beta1b
> Reporter: Juergen Zimmermann
> Attachments: testcase.ear.zip, testcase.src.zip
>
>
> "@Inject HttpServletRequest request;" results in the stacktrace below, when I invoke "request(myusername, mypassword);" using JBossAS 7.1beta1b. I'll attach a testcase as an EAR. Just invoke http://localhost:8080/testcase and you'll see a form where you click the OK button. Then you'll see the stacktrace in the JBoss console.
> Stacktrace:
> 09:11:00,535 Warnung [javax.enterprise.resource.webcontainer.jsf.lifecycle] (http--127.0.0.1-8080-1) #{cust.findCustomer}: org.jboss.weld.exceptions.IllegalProductException: WELD-000052 Cannot return null from a non-dependent producer method: [method] @Produces @Typed @RequestScoped protected org.jboss.solder.servlet.http.ImplicitHttpServletObjectsProducer.getHttpServletRequest(): javax.faces.FacesException: #{cust.findCustomer}: org.jboss.weld.exceptions.IllegalProductException: WELD-000052 Cannot return null from a non-dependent producer method: [method] @Produces @Typed @RequestScoped protected org.jboss.solder.servlet.http.ImplicitHttpServletObjectsProducer.getHttpServletRequest()
> at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118) [jsf-impl-2.1.3-b02-jbossorg-2.jar:]
> at javax.faces.component.UICommand.broadcast(UICommand.java:315) [jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:]
> at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794) [jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:]
> at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259) [jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:]
> at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81) [jsf-impl-2.1.3-b02-jbossorg-2.jar:]
> at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [jsf-impl-2.1.3-b02-jbossorg-2.jar:]
> at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) [jsf-impl-2.1.3-b02-jbossorg-2.jar:]
> at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593) [jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:]
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.3.Final.jar:]
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.3.Final.jar:]
> at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62) [weld-core-1.1.4.Final.jar:]
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.3.Final.jar:]
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.3.Final.jar:]
> at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:126) [prettyfaces-jsf2-3.3.2.jar:]
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.3.Final.jar:]
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.3.Final.jar:]
> at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.3.Final.jar:]
> at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.3.Final.jar:]
> at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:397) [jbossweb-7.0.3.Final.jar:]
> at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.1.0.Beta1b.jar:]
> at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:151) [jboss-as-web-7.1.0.Beta1b.jar:]
> at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.3.Final.jar:]
> at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.3.Final.jar:]
> at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.3.Final.jar:]
> at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [jbossweb-7.0.3.Final.jar:]
> at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.3.Final.jar:]
> at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.3.Final.jar:]
> at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.3.Final.jar:]
> at java.lang.Thread.run(Thread.java:722) [:1.7.0_02]
> Caused by: javax.faces.el.EvaluationException: org.jboss.weld.exceptions.IllegalProductException: WELD-000052 Cannot return null from a non-dependent producer method: [method] @Produces @Typed @RequestScoped protected org.jboss.solder.servlet.http.ImplicitHttpServletObjectsProducer.getHttpServletRequest()
> at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:102) [jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:]
> at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102) [jsf-impl-2.1.3-b02-jbossorg-2.jar:]
> ... 28 more
> Caused by: org.jboss.weld.exceptions.IllegalProductException: WELD-000052 Cannot return null from a non-dependent producer method: [method] @Produces @Typed @RequestScoped protected org.jboss.solder.servlet.http.ImplicitHttpServletObjectsProducer.getHttpServletRequest()
> at org.jboss.weld.bean.AbstractProducerBean.checkReturnValue(AbstractProducerBean.java:217) [weld-core-1.1.4.Final.jar:]
> at org.jboss.weld.bean.AbstractProducerBean.create(AbstractProducerBean.java:300) [weld-core-1.1.4.Final.jar:]
> at org.jboss.weld.context.AbstractContext.get(AbstractContext.java:107) [weld-core-1.1.4.Final.jar:]
> at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:90) [weld-core-1.1.4.Final.jar:]
> at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:104) [weld-core-1.1.4.Final.jar:]
> at org.jboss.weld.proxies.HttpServletRequest$83012492$Proxy$_$$_WeldClientProxy.login(HttpServletRequest$83012492$Proxy$_$$_WeldClientProxy.java)
> at testcase.CustomerController.findCustomer(CustomerController.java:43) [classes:]
> at testcase.CustomerController$Proxy$_$$_WeldClientProxy.findCustomer(CustomerController$Proxy$_$$_WeldClientProxy.java) [classes:]
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.7.0_02]
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [:1.7.0_02]
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [:1.7.0_02]
> at java.lang.reflect.Method.invoke(Method.java:601) [:1.7.0_02]
> at org.apache.el.parser.AstValue.invoke(AstValue.java:196) [jbossweb-7.0.3.Final.jar:]
> at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276) [jbossweb-7.0.3.Final.jar:]
> at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:39) [weld-core-1.1.4.Final.jar:]
> at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50) [weld-core-1.1.4.Final.jar:]
> at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105) [jsf-impl-2.1.3-b02-jbossorg-2.jar:]
> at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88) [jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:]
> ... 29 more
--
This message was sent by Atlassian JIRA
(v6.2.6#6264)
10 years, 5 months