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

ClassCastException when proxied class return this

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 2.1.0.Beta2
    • 1.1.3.Final, 2.0.3.Final
    • Proxies
    • None

      Using Infinispan Cache via CDI cause ClassCastException

      Setup

      @Produces @ApplicationScoped
      public EmbeddedCacheManager create() {
      	return new DefaultCacheManager(...);
      }
      
      @Produces @ApplicationScoped
      public Cache<String, Attachment> create(EmbeddedCacheManager manager) {
      	return manager.getCache();
      }
      
      @Inject
      private Cache<String, Attachment> cache;
      
      public Attachment store(Attachment entity) {
          cache.getAdvancedCache().put(entity.getId(), entity);
          return entity;
      }
      

      cache.getAdvancedCache() cause ClassCastException

      Caused by: java.lang.ClassCastException: org.jboss.weld.proxies.BasicCache$Cache$ConcurrentMap$Lifecycle$Listenable$Map$449205494$Proxy$_$$_WeldClientProxy cannot be cast to org.infinispan.AdvancedCache
      at org.jboss.weld.proxies.BasicCache$Cache$ConcurrentMap$Lifecycle$Listenable$Map$449205494$Proxy$_$$_WeldClientProxy.getAdvancedCache(BasicCache$Cache$ConcurrentMap$Lifecycle$Listenable$Map$449205494$Proxy$_$$_WeldClientProxy.java) [weld-core-1.1.13.Final-redhat-1.jar:]
      at org.cedj.geekseek.domain.attachment.AttachmentRepository.store(AttachmentRepository.java:32) [df4da6a4-e82c-403c-9815-03a170096317.jar:]
      

              hwellmann.de Harald Wellmann (Inactive)
              aslak@redhat.com Aslak Knutsen
              Votes:
              1 Vote for this issue
              Watchers:
              10 Start watching this issue

                Created:
                Updated:
                Resolved: