Randahl Fink Isaksen [
https://community.jboss.org/people/randahl] created the discussion
"Remote access works fine, but local does not – any ideas?"
To view the discussion, visit:
https://community.jboss.org/message/726367#726367
--------------------------------------------------------------
I have created a business interface called SurveillanceFunctionality which is implemented
by an EJB called SurveillanceBean. I am able to invoke the bean through the business
interface from a remote, standalone application, but for some reason I cannot invoke the
very same bean locally from a managed bean in my web war, which is deployed in the same
EAR has the ejb.jar where the SurveillanceBean resides.
In my web app, I am trying to inject the EJB like this
@RequestScoped
@ManagedBean
public class AlarmEventView {
@EJB
SurveillanceFunctionality surveillanceFunctionality;
...
}
But when I do this, I get the exception shown at the bottom of this post, saying "Can
not set com.wefend.services.surveillance.SurveillanceFunctionality field
com.wefend.web.events.AlarmEventView.surveillanceFunctionality to
com.wefend.services.surveillance.SurveillanceFunctionality$$$view19"
As I understand the specs, injecting an EJB which is part of the same App should work like
a breeze, so I am a bit puzzled here. If anyone has any ideas to things I could try out, I
would be grateful.
Randahl
-----------------------------
My SurveillanceBean looks like this
@Stateful
public class SurveillanceBean implements SurveillanceFunctionality {
...
}
The business interface looks like this
public interface SurveillanceFunctionality {
public List<AlarmEvent> findRecentAlarms();
...
}
Note: I have tried declaring the SurveillanceFunctionality interface as @Local – that
gives me the exact same exception.
-------------------------
The Exception
18:17:24,880 SEVERE [javax.enterprise.resource.webcontainer.jsf.application]
(http--10.0.0.110-8080-2) Error Rendering View[/iphone/alarms.xhtml]:
java.lang.IllegalStateException: JBAS011048: Failed to construct component instance
at
org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:163)
[jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
at
org.jboss.as.ee.component.BasicComponent.createInstance(BasicComponent.java:95)
[jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
at
org.jboss.as.web.deployment.component.WebComponentInstantiator$2.<init>(WebComponentInstantiator.java:96)
[jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
at
org.jboss.as.web.deployment.component.WebComponentInstantiator.initializeInstance(WebComponentInstantiator.java:94)
[jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
at
org.jboss.as.web.deployment.WebInjectionContainer.newInstance(WebInjectionContainer.java:86)
[jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
at
org.jboss.as.web.deployment.jsf.JsfInjectionProvider.invokePostConstruct(JsfInjectionProvider.java:69)
[jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
at com.sun.faces.mgbean.BeanBuilder.invokePostConstruct(BeanBuilder.java:223)
[jsf-impl-2.1.7-jbossorg-2.jar:]
at com.sun.faces.mgbean.BeanBuilder.build(BeanBuilder.java:105)
[jsf-impl-2.1.7-jbossorg-2.jar:]
at com.sun.faces.mgbean.BeanManager.createAndPush(BeanManager.java:409)
[jsf-impl-2.1.7-jbossorg-2.jar:]
at com.sun.faces.mgbean.BeanManager.create(BeanManager.java:269)
[jsf-impl-2.1.7-jbossorg-2.jar:]
at
com.sun.faces.el.ManagedBeanELResolver.resolveBean(ManagedBeanELResolver.java:244)
[jsf-impl-2.1.7-jbossorg-2.jar:]
at
com.sun.faces.el.ManagedBeanELResolver.getValue(ManagedBeanELResolver.java:116)
[jsf-impl-2.1.7-jbossorg-2.jar:]
at
com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
[jsf-impl-2.1.7-jbossorg-2.jar:]
at
com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
[jsf-impl-2.1.7-jbossorg-2.jar:]
at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:72)
[jbossweb-7.0.13.Final.jar:]
at org.apache.el.parser.AstValue.getTarget(AstValue.java:94)
[jbossweb-7.0.13.Final.jar:]
at org.apache.el.parser.AstValue.getType(AstValue.java:82)
[jbossweb-7.0.13.Final.jar:]
at org.apache.el.ValueExpressionImpl.getType(ValueExpressionImpl.java:176)
[jbossweb-7.0.13.Final.jar:]
at org.jboss.weld.el.WeldValueExpression.getType(WeldValueExpression.java:93)
[weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at
com.sun.faces.facelets.el.TagValueExpression.getType(TagValueExpression.java:98)
[jsf-impl-2.1.7-jbossorg-2.jar:]
at org.primefaces.component.datatable.DataTable.isLazy(DataTable.java:922)
[primefaces-3.1.1.jar:]
at
org.primefaces.component.datatable.DataTableRenderer.encodeMarkup(DataTableRenderer.java:177)
[primefaces-3.1.1.jar:]
at
org.primefaces.component.datatable.DataTableRenderer.encodeEnd(DataTableRenderer.java:103)
[primefaces-3.1.1.jar:]
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875)
[jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1786)
[jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782)
[jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782)
[jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
at
com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:402)
[jsf-impl-2.1.7-jbossorg-2.jar:]
at
org.apache.myfaces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:285)
[myfaces-impl-2.1.6.jar:2.1.6]
at
javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288)
[jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
at
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)
[jsf-impl-2.1.7-jbossorg-2.jar:]
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
[jsf-impl-2.1.7-jbossorg-2.jar:]
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
[jsf-impl-2.1.7-jbossorg-2.jar:]
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
[jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
[jbossweb-7.0.13.Final.jar:]
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
[jbossweb-7.0.13.Final.jar:]
at
org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62)
[weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
[jbossweb-7.0.13.Final.jar:]
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
[jbossweb-7.0.13.Final.jar:]
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
[jbossweb-7.0.13.Final.jar:]
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
[jbossweb-7.0.13.Final.jar:]
at
org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50)
[jboss-as-jpa-7.1.1.Final.jar:7.1.1.Final]
at
org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)
[jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
[jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
[jbossweb-7.0.13.Final.jar:]
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
[jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)
[jbossweb-7.0.13.Final.jar:]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
[jbossweb-7.0.13.Final.jar:]
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)
[jbossweb-7.0.13.Final.jar:]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)
[jbossweb-7.0.13.Final.jar:]
at java.lang.Thread.run(Thread.java:680) [classes.jar:1.6.0_29]
Caused by: java.lang.IllegalArgumentException: Can not set
com.wefend.services.surveillance.SurveillanceFunctionality field
com.wefend.web.events.AlarmEventView.surveillanceFunctionality to
com.wefend.services.surveillance.SurveillanceFunctionality$$$view19
at
sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:146)
[classes.jar:1.6.0_29]
at
sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:150)
[classes.jar:1.6.0_29]
at
sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:63)
[classes.jar:1.6.0_29]
at java.lang.reflect.Field.set(Field.java:657) [classes.jar:1.6.0_29]
at
org.jboss.as.ee.component.ManagedReferenceFieldInjectionInterceptorFactory$ManagedReferenceFieldInjectionInterceptor.processInvocation(ManagedReferenceFieldInjectionInterceptorFactory.java:111)
[jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.as.ee.component.ManagedReferenceInterceptorFactory$ManagedReferenceInterceptor.processInvocation(ManagedReferenceInterceptorFactory.java:106)
[jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45)
[jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:161)
[jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
... 50 more
--------------------------------------------------------------
Reply to this message by going to Community
[
https://community.jboss.org/message/726367#726367]
Start a new discussion in EJB3 at Community
[
https://community.jboss.org/choose-container!input.jspa?contentType=1&...]