12 Replies Latest reply on Aug 13, 2012 4:27 PM by Aleš Bregar

    Upgrade weld to 1.1.9 broke my app's cache instantiation

    Aleš Bregar Newbie

      Hi,

       

       

      I am following 7.1 BR and recently weld went upgraded to version 1.1.9. It seem that something is changed which breaks up my app. I have checked jira but don't see anything helpful under solved issues.

      Looks like that getCache is called before infinispan service is instantiated (please see the attached log).

       

      Cache is injected to some @Singleton annotated bean. Only difference to other application's patterns is that in this (only) case some other Singleton is marked @DependsOn to first - like:

       

       

      @Singleton(name = "A")
      @Startup
      @Lock(LockType.READ)
      public class ABean implements ALocal, ARemote {
         
          @Inject
          @MessagesCache
          private Cache<String, Message> messagesCache;
      

       

       

      @Singleton
      @Startup
      @DependsOn("A")
      @Lock(LockType.READ)
      public class BBean implements BLocal {
      
          @EJB
          ARemote a;
      

       

      And looks like that fails with attached ex, but worked fine with weld 1.1.8. Would be very glad for some hint.

      Thank you in advance.

        • 1. Re: Upgrade weld to 1.1.9 broke my app's cache instantiation
          Ales Justin Master

          Can you just post the relevant part of exception's stack-trace?

          • 3. Re: Upgrade weld to 1.1.9 broke my app's cache instantiation
            Ales Justin Master

            Nah, I don't want to unzip the *whole* stuff.

            Copy/paste the *relevant* stack trace ... if too big, find the relevant part first. ;-)

            • 4. Re: Upgrade weld to 1.1.9 broke my app's cache instantiation
              Aleš Bregar Newbie

              okidoki. Zip contains only the single stacktrace, now pasted here:

               

               

              
              
              
              11:51:39,076 ERROR [fail] (ServerService Thread Pool -- 54) MSC00001: Failed to start service jboss.deployment.subunit."msdp-all-4.0.3.1-SNAPSHOT.ear"."msdp-msgpush-ejb.jar".component.MessagepushSwitchboard.START: org.jboss.msc.service.StartException in service jboss.deployment.subunit."msdp-all-4.0.3.1-SNAPSHOT.ear"."msdp-msgpush-ejb.jar".component.MessagepushSwitchboard.START: java.lang.IllegalStateException: JBAS011048: Failed to construct component instance
                  ...
                  at tv.beesmart.msdp.msgpush.resources.Resources$Proxy$_$$_Weld$Proxy$.getMessagesCache(Resources$Proxy$_$$_Weld$Proxy$.java)
                  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_33]
                  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [rt.jar:1.6.0_33]
                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_33]
                  at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_33]
                  at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:267)
                  at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52)
                  at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:137)
                  at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:263)
                  at org.jboss.weld.introspector.jlr.WeldMethodImpl.invokeOnInstance(WeldMethodImpl.java:170)
                  at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstance(MethodInjectionPoint.java:137)
                  at org.jboss.weld.bean.ProducerMethod$ProducerMethodProducer.produce(ProducerMethod.java:136)
                  at org.jboss.weld.bean.AbstractProducerBean$AbstractProducer.produce(AbstractProducerBean.java:319)
                  at org.jboss.weld.bean.AbstractProducerBean.create(AbstractProducerBean.java:307)
                  at org.jboss.weld.context.unbound.DependentContextImpl.get(DependentContextImpl.java:68)
                  at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:599)
                  at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:665)
                  at org.jboss.weld.injection.FieldInjectionPoint.inject(FieldInjectionPoint.java:136)
                  at org.jboss.weld.util.Beans.injectBoundFields(Beans.java:686)
                  at org.jboss.weld.util.Beans.injectFieldsAndInitializers(Beans.java:695)
                  at org.jboss.weld.bean.SessionBean$SessionBeanInjectionTarget$1.proceed(SessionBean.java:179)
                  at org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:48)
                  at org.jboss.weld.bean.SessionBean$SessionBeanInjectionTarget.inject(SessionBean.java:176)
                  at org.jboss.as.weld.injection.WeldEEInjection.inject(WeldEEInjection.java:78)
                  at org.jboss.as.weld.injection.WeldInjectionInterceptor.processInvocation(WeldInjectionInterceptor.java:60)
                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                  at org.jboss.as.ee.component.ManagedReferenceFieldInjectionInterceptorFactory$ManagedReferenceFieldInjectionInterceptor.processInvocation(ManagedReferenceFieldInjectionInterceptorFactory.java:112)
                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                  at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)
                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                  at org.jboss.as.ee.component.ManagedReferenceInterceptorFactory$ManagedReferenceInterceptor.processInvocation(ManagedReferenceInterceptorFactory.java:95)
                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                  at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)
                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                  at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)
                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                  at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:227)
                  at org.jboss.as.ejb3.tx.CMTTxInterceptor.requiresNew(CMTTxInterceptor.java:332)
                  at org.jboss.as.ejb3.tx.SingletonLifecycleCMTTxInterceptor.processInvocation(SingletonLifecycleCMTTxInterceptor.java:57)
                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                  at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)
                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                  at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45)
                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                  at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
                  at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:161)
                  ... 11 more
              Caused by: java.lang.NullPointerException
                  at tv.beesmart.msdp.msgpush.resources.Resources.getMessagesCache(Resources.java:56)
                  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_33]
                  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [rt.jar:1.6.0_33]
                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_33]
                  at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_33]
                  at org.jboss.as.ee.component.ManagedReferenceMethodInterceptorFactory$ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptorFactory.java:72)
                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                  at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:374)
                  at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.doMethodInterception(Jsr299BindingsInterceptor.java:129)
                  at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.processInvocation(Jsr299BindingsInterceptor.java:137)
                  at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:36)
                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                  at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)
                  at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:36)
                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                  at org.jboss.as.ejb3.component.invocationmetrics.ExecutionTimeInterceptor.processInvocation(ExecutionTimeInterceptor.java:43)
                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                  at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:374)
                  at org.jboss.as.ejb3.concurrency.ContainerManagedConcurrencyInterceptor.processInvocation(ContainerManagedConcurrencyInterceptor.java:104)
                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                  at org.jboss.as.weld.ejb.EjbRequestScopeActivationInterceptor.processInvocation(EjbRequestScopeActivationInterceptor.java:94)
                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                  at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21)
                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                  at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
                  at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:53)
                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                  at org.jboss.as.ejb3.component.singleton.SingletonComponentInstanceAssociationInterceptor.processInvocation(SingletonComponentInstanceAssociationInterceptor.java:53)
                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                  at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInCallerTx(CMTTxInterceptor.java:201)
                  ... 90 more
              
              ...
              11:51:39,163 INFO  [GlobalComponentRegistry] (ServerService Thread Pool -- 78) ISPN000128: Infinispan version: Infinispan 'Brahma' 5.1.5.FINAL
              
              • 5. Re: Upgrade weld to 1.1.9 broke my app's cache instantiation
                Ales Justin Master

                How does this line look like?

                 

                Caused by: java.lang.NullPointerException
                    at tv.beesmart.msdp.msgpush.resources.Resources.getMessagesCache(Resources.java:56)

                • 6. Re: Upgrade weld to 1.1.9 broke my app's cache instantiation
                  Aleš Bregar Newbie

                  l.56 in red with whole relevant Resources snippet:

                   

                  @Singleton
                  @Lock(LockType.READ)
                  public class Resources {
                  
                      @Resource(mappedName = "java:jboss/infinispan/container/msgcontainer")
                      private static EmbeddedCacheManager ecm;
                  
                      @SuppressWarnings("all")
                      @Produces
                      @MessagesCache
                      public Cache getMessagesCache() {
                                    return ecm.getCache("messages");
                      }
                  

                   

                  Cache is configured via standalone.xml as local cache with some eviction.

                  • 8. Re: Upgrade weld to 1.1.9 broke my app's cache instantiation
                    Aleš Bregar Newbie

                    possible if Resources are declared as @Singleton AFAIK. Unless something changed?

                    • 9. Re: Upgrade weld to 1.1.9 broke my app's cache instantiation
                      Ales Justin Master

                      I don't see what Weld upgrade has to do with this. ;-)

                      • 10. Re: Upgrade weld to 1.1.9 broke my app's cache instantiation
                        Aleš Bregar Newbie

                        Do you have any other idea where to look for the problem cause?

                        I can maybe try to identify which commit to jboss tree broke my app but building as7 is is quite timeconsuming for me.

                        • 11. Re: Upgrade weld to 1.1.9 broke my app's cache instantiation
                          Ales Justin Master

                          Perhaps do a custom JNDI lookup for this embedded cache manager?

                          Or change to non "private static"; make it plain "public".

                          Or delete deployment's .jandex file -- if it exists.

                          Debug if this @Resource field is actually handled.

                          etc ... ;-)

                          1 of 1 people found this helpful
                          • 12. Re: Upgrade weld to 1.1.9 broke my app's cache instantiation
                            Aleš Bregar Newbie

                            I was just getting myself into debugging against AS7-1294 (Don't inject into static fields/methods) fix.

                            Also changed my code from private static to plain public as suggested.

                             

                             

                            And it did the trick. So here it goes - my first debugging against as7 code - not needed (gosh, that was close ...).

                             

                            And tnx, problem solved.