title: $Proxy$_$$_WeldClientProxy cannot be cast to javassist.util.proxy.ProxyObject when inject cdi bean to jax-rs controller
body: <p>I am trying to create a Jax-rs controller and injecting a CDI bean into this contoller but application gives the following exception.</p>
  
  <p>It works fine when i dont inject the bean.</p>
  
  <p>The project also uses Hibernate and it has javassist dependency. When i remove this dependency, i can inject the bean into the controller without a problem but of course hibernate not working in this situation.</p>
  
  <p>What might be causing this exception?</p>
  
  <p>I am using weblogic 12.1.3 server.</p>
  
  <p>This is the service bean i want to inject</p>
  
  <pre><code>@Named("AccountBcImpl")
  public class AccountBcImpl extends AccountBaseBcImpl implements AccountBc {
     ...
  }
  </code></pre>
  
  <p>This is the jax-rs controller</p>
  
  <pre><code>@Named
  @javax.enterprise.context.ApplicationScoped
  @Path("/build")
  public class BuildCotroller {
  
      @Inject
      private AccountBc accountBc;
  
  
  
      public String getBuilding(@QueryParam("buildId") Long buildId) throws BaseException {
          return "Hello";
      }
  }
  </code></pre>
  
  <p>Stacktrace:  </p>
  
  <pre><code>]] Root cause of ServletException.
  org.jboss.weld.exceptions.WeldException: WELD-000830 Unable to load the cache value for the key Managed Bean [class com.aaa.bbb.web.rest.BuildController] with qualifiers [@Default @Any]
      at org.jboss.weld.util.cache.LoadingCacheUtils.getCacheValue(LoadingCacheUtils.java:73)
      at org.jboss.weld.util.cache.LoadingCacheUtils.getCastCacheValue(LoadingCacheUtils.java:112)
      at org.jboss.weld.util.cache.LoadingCacheUtils.getCastCacheValue(LoadingCacheUtils.java:93)
      at org.jboss.weld.bean.proxy.ClientProxyProvider.getClientProxy(ClientProxyProvider.java:102)
      at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:621)
      Truncated. see log file for complete stacktrace
  Caused By: com.google.common.util.concurrent.UncheckedExecutionException: java.lang.ClassCastException: com.aaa.bbb.web.rest.BuildController$Proxy$_$$_WeldClientProxy cannot be cast to javassist.util.proxy.ProxyObject
      at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2234)
      at com.google.common.cache.LocalCache.get(LocalCache.java:3965)
      at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3969)
      at com.google.common.cache.LocalCache$LocalManualCache.get(LocalCache.java:4829)
      at org.jboss.weld.util.cache.LoadingCacheUtils.getCacheValue(LoadingCacheUtils.java:71)
      Truncated. see log file for complete stacktrace
  Caused By: java.lang.ClassCastException: com.aaa.bbb.web.rest.BuildController$Proxy$_$$_WeldClientProxy cannot be cast to javassist.util.proxy.ProxyObject
      at org.jboss.weld.bean.proxy.ProxyFactory.create(ProxyFactory.java:249)
      at org.jboss.weld.bean.proxy.ClientProxyFactory.create(ClientProxyFactory.java:105)
      at org.jboss.weld.bean.proxy.ClientProxyProvider.createClientProxy(ClientProxyProvider.java:87)
      at org.jboss.weld.bean.proxy.ClientProxyProvider.access$000(ClientProxyProvider.java:43)
      at org.jboss.weld.bean.proxy.ClientProxyProvider$1.load(ClientProxyProvider.java:53)
      Truncated. see log file for complete stacktrace
  </code></pre>