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

beanmanager wont respect java classlaoders?

    XMLWordPrintable

Details

    • Hide

      load a class twice with different classloaders , follow the spinet above once for each class,
      the second instance is of the first class and of the second class

      Show
      load a class twice with different classloaders , follow the spinet above once for each class, the second instance is of the first class and of the second class

    Description

      Hi,
      i have a bit of a strange setup ,
      im running wildfly 10 (with weld) and in some point while the server starts - it loads a class from external jar , i'm loading these class using a different classloader for each jar,
      i'm facing the current issue , i have a jar loaded with class A , and then another jar loaded with the same class A (but a different version ) the two A classes are using different class loaders and so they are not equal,
      when creating an instance of an A i obtain the correct A class (lets call them A1 and A2)
      i create them using this snippet(ensuring they injection services for these instances are working)
      AnnotatedType<T> plugType = beanManager.createAnnotatedType(type);
      InjectionTarget<T> it = beanManager.createInjectionTarget(plugType);
      CreationalContext<T> ctx = beanManager.createCreationalContext(null);
      T plug = it.produce(ctx);
      it.inject(plug, ctx);
      it.postConstruct(plug);
      everything works fine for A1,
      but then while trying to instantiate A2 i notice that the backtype of plugType is actually A1 and so the instance created is of A1 and not A2,
      please help
      Thanks.

      Attachments

        Activity

          People

            Unassigned Unassigned
            asafbennatan Asaf Ben Natan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: