0 Replies Latest reply on Nov 24, 2015 12:15 PM by caro82

    JBoss 7 and CDI - Wrong bean injected when there is class name collision

    caro82

      I'm using JBoss 7.1.1 AS.

       

      I have class A in package a.b.c.

      I'm injecting class A into a SLB,  say ASLB class from the same package.

      Classes A and ASLB are packed into a.jar.

       

      I have another class A in package a.d.e.

      I'm injecting class A into a SLB,  say BSLB class from the same package, a.d.e.

      Classes A and BSLB are packed into b.jar.

       

      The two jars a.jar and b.jar are packed into an ear and deployed in jboss 7.1.1 AS.

       

      On rare occasions, after a server restart I got class A (from package a.b.c and a.jar) injected into BSLB class (from b.jar)

      instead of A from a.d.e. The issue is always fixed by another restart.

       

      Is this non-deterministic behaviour expected under these conditions (same class name, different packages,

      different jars)? I'm not using qualifiers.

      As a workaround I renamed class A within each package to avoid collision.

      I would appreciate any insights into this matter.