Mantis - Resin
Viewing Issue Advanced Details
5915 minor always 06-04-15 09:56 07-17-17 14:30
alex  
ferg  
normal  
closed 4.0.38  
fixed  
none    
none 4.0.54  
0005915: CDI: Can't find a bean. Sporadic exception
Error from the Resin infrastructure. Notice that the bean it is complaining about is there as this code works and it actually may succeed for one request and fail for another within the same session.

ERROR [gateway.api.GatewayServlet] : API GatewayResponseError
com.cellectivity.gateway.api.GatewayResponseError: GatewayError: 500 com.cellectivity.gateway.api.betting.BettingServiceImpl.m_vaultService: Can't find a be
an for 'interface com.cellectivity.gateway.api.vault.VaultService' because no beans match the type and qualifiers [@Default()].
Beans:
    ManagedBeanImpl[VaultServiceDao, {@Default(), @Any()}, @ApplicationScoped]
        at com.cellectivity.gateway.api.GatewayServlet.processException(GatewayServlet.java:221)
        at com.cellectivity.gateway.api.GatewayServlet.doPost(GatewayServlet.java:158)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:159)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:97)
        at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:109)
        at com.cellectivity.gateway.api.TokenAuthenticationFilter.doFilter(TokenAuthenticationFilter.java:93)
        at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:89)
        at com.cellectivity.gateway.api.log.LogActionFilter.doFilter(LogActionFilter.java:37)
        at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:89)
        at com.caucho.server.httpcache.ProxyCacheFilterChain.doFilter(ProxyCacheFilterChain.java:170)
        at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:156)
        at com.caucho.server.webapp.AccessLogFilterChain.doFilter(AccessLogFilterChain.java:95)
        at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:289)
        at com.caucho.server.hmux.HmuxRequest.handleInvocation(HmuxRequest.java:476)
        at com.caucho.server.hmux.HmuxRequest.handleRequestImpl(HmuxRequest.java:374)
        at com.caucho.server.hmux.HmuxRequest.handleRequest(HmuxRequest.java:341)
        at com.caucho.network.listen.TcpSocketLink.dispatchRequest(TcpSocketLink.java:1346)
        at com.caucho.network.listen.TcpSocketLink.handleRequest(TcpSocketLink.java:1302)
        at com.caucho.network.listen.TcpSocketLink.handleRequestsImpl(TcpSocketLink.java:1286)
        at com.caucho.network.listen.TcpSocketLink.handleRequests(TcpSocketLink.java:1194)
        at com.caucho.network.listen.TcpSocketLink.handleAcceptTaskImpl(TcpSocketLink.java:993)
        at com.caucho.network.listen.TcpSocketLink.handleAcceptTask(TcpSocketLink.java:945)
        at com.caucho.network.listen.ConnectionTask.runThread(ConnectionTask.java:114)
        at com.caucho.network.listen.ConnectionTask.run(ConnectionTask.java:93)
        at com.caucho.network.listen.SocketLinkThreadLauncher.handleTasks(SocketLinkThreadLauncher.java:169)
        at com.caucho.network.listen.TcpSocketResumeThread.run(TcpSocketResumeThread.java:62)
        at com.caucho.env.thread2.ResinThread2.runTasks(ResinThread2.java:173)
        at com.caucho.env.thread2.ResinThread2.run(ResinThread2.java:118)
Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: com.cellectivity.gateway.api.betting.BettingServiceImpl.m_vaultService: Can't find a bean for 'interface com.cellectivity.gateway.api.vault.VaultService' because no beans match the type and qualifiers [@Default()].
Beans:
    ManagedBeanImpl[VaultServiceDao, {@Default(), @Any()}, @ApplicationScoped]
        at com.caucho.config.inject.InjectionTargetBuilder$FieldInjectProgram.bind(InjectionTargetBuilder.java:1015)
        at com.caucho.config.inject.CandiProducer.bind(CandiProducer.java:144)
        at com.caucho.config.inject.InjectionTargetBuilder.bind(InjectionTargetBuilder.java:207)
        at com.caucho.config.inject.InjectionTargetBuilder.inject(InjectionTargetBuilder.java:234)
        at com.caucho.config.xml.XmlInjectionTarget.inject(XmlInjectionTarget.java:107)
        at com.caucho.config.inject.ManagedBeanImpl.create(ManagedBeanImpl.java:148)
        at com.caucho.config.scope.AbstractScopeContext.create(AbstractScopeContext.java:118)
        at com.caucho.config.scope.AbstractScopeContext.get(AbstractScopeContext.java:109)
        at com.caucho.config.inject.InjectManager$NormalInstanceReferenceFactory.create(InjectManager.java:4740)
        at com.caucho.config.inject.InjectManager$ReferenceFactory.create(InjectManager.java:4489)
        at com.cellectivity.gateway.api.betting.BettingServiceImpl__ResinScopeProxy.getBalance(Unknown Source)
        at com.cellectivity.gateway.api.betting.BettingModule.postGetBalance(BettingModule.java:116)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at com.cellectivity.gateway.api.GatewayServlet.doPost(GatewayServlet.java:151)
        ... 26 more
Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Can't find a bean for 'interface com.cellectivity.gateway.api.vault.VaultService' because no beans match the type and qualifiers [@Default()].
Beans:
    ManagedBeanImpl[VaultServiceDao, {@Default(), @Any()}, @ApplicationScoped]
        at com.caucho.config.inject.InjectManager.unsatisfiedException(InjectManager.java:2475)
        at com.caucho.config.inject.InjectManager.resolveByInjectionPoint(InjectManager.java:2656)
        at com.caucho.config.inject.InjectManager.getReferenceFactory(InjectManager.java:2614)
        at com.caucho.config.inject.InjectManager.getReferenceFactory(InjectManager.java:2593)
        at com.caucho.config.inject.InjectionTargetBuilder$FieldInjectProgram.bind(InjectionTargetBuilder.java:1007)
        ... 42 more

Notes
(0006639)
alex   
06-08-15 11:11   
Jose Fernandez:

Well I have seen cases on beans not found just after a new release. Which is annoying but bearable.

But in this case the web-app was deployed for days. And still having problems. This is a semi-rest
API implementation of our application, which means lots of small requests from the client. It seems that this issue occurs during high throughput. The other difference is that you had multiple injection points for the same bean:
 SA <-- A
 SB <-- B <-- A

So here servlets SA, and SB injected their corresponding services (A, B). But B also requires service A. Notice that all the exceptions seem to come from this injection of A on B, it seems to get confused.


SA, and SA are servlets declared on the web.xml in the normal fashion.

The injections are simple @Inject no qualifiers or annotations as A and B are marked as @ApplicationScope and declared on the resin-web.xml.

We only use qualifiers for data-sources which are injected into A but those I think they are fine.