Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-1779

Unsafe proxies and custom scope cause NoSuchFieldException

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 3.0.0.Alpha2, 2.2.7.Final
    • 2.2.4.Final
    • Proxies
    • None
    • Hide

      Take the test for WELD-1766 and add addAsManifestResource(EmptyAsset.INSTANCE, ArchivePaths.create("org.jboss.weld.enableUnsafeProxies") to the ShrinkWrap

      Show
      Take the test for WELD-1766 and add addAsManifestResource(EmptyAsset.INSTANCE, ArchivePaths.create("org.jboss.weld.enableUnsafeProxies") to the ShrinkWrap

      The Exception that is throw is:

      java.lang.NoSuchFieldException: BEAN_INSTANCE_CACHE
      	at java.lang.Class.getDeclaredField(Class.java:1948)
      	at org.jboss.weld.security.GetDeclaredFieldAction.run(GetDeclaredFieldAction.java:33)
      	at org.jboss.weld.security.GetDeclaredFieldAction.run(GetDeclaredFieldAction.java:22)
      	at java.security.AccessController.doPrivileged(AccessController.java:-2)
      	at org.jboss.weld.bean.proxy.ClientProxyFactory.create(ClientProxyFactory.java:118)
      	at org.jboss.weld.bean.proxy.ClientProxyProvider.createClientProxy(ClientProxyProvider.java:180)
      	at org.jboss.weld.bean.proxy.ClientProxyProvider.createClientProxy(ClientProxyProvider.java:170)
      	at org.jboss.weld.bean.proxy.ClientProxyProvider.access$100(ClientProxyProvider.java:45)
      	at org.jboss.weld.bean.proxy.ClientProxyProvider$CreateClientProxy.load(ClientProxyProvider.java:56)
      	at org.jboss.weld.bean.proxy.ClientProxyProvider$CreateClientProxy.load(ClientProxyProvider.java:52)
      	at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3524)
      	at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2317)
      	at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2280)
      	at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2195)
      	at com.google.common.cache.LocalCache.get(LocalCache.java:3934)
      	at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3938)
      	at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4821)
      	at org.jboss.weld.util.cache.LoadingCacheUtils.getCacheValue(LoadingCacheUtils.java:49)
      	at org.jboss.weld.util.cache.LoadingCacheUtils.getCastCacheValue(LoadingCacheUtils.java:74)
      	at org.jboss.weld.bean.proxy.ClientProxyProvider.getClientProxy(ClientProxyProvider.java:204)
      	at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:734)
      	at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:760)
      	at org.jboss.weld.bean.builtin.InstanceImpl.getBeanInstance(InstanceImpl.java:86)
      	at org.jboss.weld.bean.builtin.InstanceImpl.get(InstanceImpl.java:76)
      

      The problem is in org.jboss.weld.bean.proxy.ClientProxyFactory.create(BeanInstance) where the thread local cache field CACHE_FIELD is accessed if unsafe proxies are used even if the scope is not cacheable.

              kgaevski@redhat.com Kirill Gaevskii
              rbaradari Ramin Baradari (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: