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

ClassCastException when proxied class return this

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 1.1.3.Final, 2.0.3.Final
    • Fix Version/s: 2.1.0.Beta2
    • Component/s: Proxies
    • Labels:
      None

      Description

      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:]
      

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  hwellmann.de Harald Wellmann
                  Reporter:
                  aslak Aslak Knutsen
                • Votes:
                  1 Vote for this issue
                  Watchers:
                  10 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: