<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Hi Jason,<br>
      <br>
      Many thanks for your help last Thursday at Devoxx. I have done
      Friday the modifications that we discussed together but I finally
      get another problem (
      <meta charset="utf-8">
      <span style="color: rgb(38, 38, 38); font-family: arial,
        sans-serif; font-size: 12.727272033691406px; font-style: normal;
        font-variant: normal; font-weight: normal; letter-spacing:
        normal; line-height: 15.994318008422852px; orphans: auto;
        text-align: start; text-indent: 0px; text-transform: none;
        white-space: normal; widows: auto; word-spacing: 0px;
        -webkit-text-stroke-width: 0px; background-color: rgb(255, 255,
        255); display: inline !important; float: none;">Weld-001333:
        BeanManager method getBeans is not available after shutdown</span>).
      As the code of camel-cdi is complex and must be re-factored, I
      will take the time this week or next week (with help of Antoine)
      to develop a new CDI extension<br>
      <br>
      Regards,<br>
      <br>
      Charles<br>
      <br>
      <br>
      <br>
      On 19/11/13 01:39, Jason Porter wrote:<br>
    </div>
    <blockquote
      cite="mid:294612005.25920238.1384821555099.JavaMail.root@redhat.com"
      type="cite">
      <pre wrap="">Any luck with this Charles?

For others: We spent some time hacking and debugging this at Devoxx, but were not able to implement the solution before we had to part ways.

----- Original Message -----
</pre>
      <blockquote type="cite">
        <pre wrap="">From: "Jozef Hartinger" <a class="moz-txt-link-rfc2396E" href="mailto:jharting@redhat.com">&lt;jharting@redhat.com&gt;</a>
To: "Charles Moulliard" <a class="moz-txt-link-rfc2396E" href="mailto:cmoulliard@redhat.com">&lt;cmoulliard@redhat.com&gt;</a>
Cc: <a class="moz-txt-link-abbreviated" href="mailto:weld-dev@lists.jboss.org">weld-dev@lists.jboss.org</a>, "Antoine Sabot-Durand" <a class="moz-txt-link-rfc2396E" href="mailto:asabotdu@redhat.com">&lt;asabotdu@redhat.com&gt;</a>, "Jason Porter" <a class="moz-txt-link-rfc2396E" href="mailto:jporter@redhat.com">&lt;jporter@redhat.com&gt;</a>,
"Peter Muir" <a class="moz-txt-link-rfc2396E" href="mailto:pmuir@redhat.com">&lt;pmuir@redhat.com&gt;</a>
Sent: Monday, November 11, 2013 1:01:04 AM
Subject: Re: [weld-dev] Issue with weld 2.1.0.Final on OSGI

Hi Charles,

Weld uses Pax CDI provided BundleResourceLoader[1] to load classes in an
OSGi bundle. It loads only those that are discovered by BeanScanner[2].

When you call getBeans() Weld does not load the parameter class anyhow
since you already provided a loaded class. Weld will try to match the
type you pass to getBeans() with the types of beans it had loaded.

Jozef

[1]
<a class="moz-txt-link-freetext" href="https://github.com/ops4j/org.ops4j.pax.cdi/blob/master/pax-cdi-weld/src/main/java/org/ops4j/pax/cdi/weld/impl/bda/BundleResourceLoader.java">https://github.com/ops4j/org.ops4j.pax.cdi/blob/master/pax-cdi-weld/src/main/java/org/ops4j/pax/cdi/weld/impl/bda/BundleResourceLoader.java</a>
[2]
<a class="moz-txt-link-freetext" href="https://github.com/ops4j/org.ops4j.pax.cdi/blob/master/pax-cdi-spi/src/main/java/org/ops4j/pax/cdi/spi/scan/BeanScanner.java">https://github.com/ops4j/org.ops4j.pax.cdi/blob/master/pax-cdi-spi/src/main/java/org/ops4j/pax/cdi/spi/scan/BeanScanner.java</a>

On 11/08/2013 07:11 PM, Charles Moulliard wrote:
</pre>
        <blockquote type="cite">
          <pre wrap="">Hi,

The following code which is working fine and returns a bean when we run
Junit Test with DeltaSpike does not work when Weld 2.1.0.Final is
deployed on Karaf (OSGI v4.3) with Pax-CDI. Apparently the bean is not
retrieved when we call "beanManager.getBeans("


      protected CamelContext getCamelContext(String context, BeanManager
beanManager) {
          if (camelContextMap == null) {
              Set&lt;Bean&lt;?&gt;&gt; beans =
beanManager.getBeans(CamelContextMap.class, new AnyLiteral()); // return
null
              Bean&lt;?&gt; bean = beanManager.resolve(beans); // return null
              CreationalContext&lt;?&gt; creationalContext =
beanManager.createCreationalContext(bean);
              camelContextMap = (CamelContextMap)
beanManager.getReference(bean, bean.getBeanClass(), creationalContext);
              ObjectHelper.notNull(camelContextMap, "Could not resolve
CamelContextMap");
          }
          return camelContextMap.getCamelContext(context);
      }

Question : How does WeldContainer loads the class when we use getBeans
as I suspect that we have a problem with the classloader used ?

Regards,

Charles
_______________________________________________
weld-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:weld-dev@lists.jboss.org">weld-dev@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/weld-dev">https://lists.jboss.org/mailman/listinfo/weld-dev</a>
</pre>
        </blockquote>
        <pre wrap="">

</pre>
      </blockquote>
    </blockquote>
    <br>
  </body>
</html>