<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Florian,<br>
      The best approach that I could figure out is to use the
      ServiceLoader.<br>
      <br>
      It is not a good approach from a OSGi point of view.... but it
      will work on both words...<br>
      <br>
      check:<br>
      <br>
      -
      <a class="moz-txt-link-freetext" href="http://docs.oracle.com/javase/6/docs/api/java/util/ServiceLoader.html">http://docs.oracle.com/javase/6/docs/api/java/util/ServiceLoader.html</a><br>
      - the OSGi Enterprise Spec 5, RFC 133 - Service Loader Mediator
      Specification and its RI implementation here:
      <a class="moz-txt-link-freetext" href="http://aries.apache.org/modules/spi-fly.html">http://aries.apache.org/modules/spi-fly.html</a><br>
      <br>
      <br>
      regards<br>
      <br>
      <br>
      On 21/06/13 19:21, Florian.Pirchner wrote:<br>
    </div>
    <blockquote
      cite="mid:B2C5C33C-C587-4F55-96D8-8690EB04AD75@gmail.com"
      type="cite">
      <meta http-equiv="content-type" content="text/html;
        charset=ISO-8859-1">
      <div style="-webkit-text-size-adjust: auto; ">hi cristiano,</div>
      <div style="-webkit-text-size-adjust: auto; "><br>
      </div>
      <div style="-webkit-text-size-adjust: auto; ">yep. class#forname
        is just one issue.</div>
      <div style="-webkit-text-size-adjust: auto; ">i agree that the
        modularity issue is an important one too.</div>
      <div style="-webkit-text-size-adjust: auto; "><br>
      </div>
      <div style="-webkit-text-size-adjust: auto; ">to provide a
        framework for non osgi and osgi environments is really a
        challenge. my prefered way would be the use of osgi services to
        avoid the classloading issues. so the problems with dependencies
        would not influence the system. only api is required as import
        package. the impl is invisible for the consumer.</div>
      <div style="-webkit-text-size-adjust: auto; ">but for now i have
        no idea how a proper implementation could look like. &nbsp;</div>
      <div style="-webkit-text-size-adjust: auto; "><br>
      </div>
      <div style="-webkit-text-size-adjust: auto; ">peter kriens
        suggested the use of&nbsp;<span style="font-family:
          '.HelveticaNeueUI'; font-size: 15px; line-height: 19px;
          white-space: nowrap; -webkit-tap-highlight-color: rgba(26, 26,
          26, 0.296875); -webkit-composition-fill-color: rgba(175, 192,
          227, 0.230469); -webkit-composition-frame-color: rgba(77, 128,
          180, 0.230469); -webkit-text-size-adjust: none; "><a
            moz-do-not-send="true"
            href="http://code.google.com/p/pojosr/">http://code.google.com/p/pojosr/</a>
          to build an osgi like system in non osgi environments.</span></div>
      <div><font face=".HelveticaNeueUI"><span style="font-size: 15px;
            line-height: 19px; white-space: nowrap;
            -webkit-tap-highlight-color: rgba(26, 26, 26, 0.292969);
            -webkit-composition-fill-color: rgba(175, 192, 227,
            0.230469); -webkit-composition-frame-color: rgba(77, 128,
            180, 0.230469);">but never used it. and i also do not know
            whether it might help with osgi integration. does anybody
            have experience with pojosr?</span></font></div>
      <div><br>
      </div>
      <div>@mark: what are your current ideas about integrating osgi
        properly?</div>
      <div><br>
      </div>
      <div><span style="-webkit-text-size-adjust: auto;">best florian</span></div>
      <div style="-webkit-text-size-adjust: auto; "><br>
        Am 21.06.2013 um 23:49 schrieb Cristiano Gavi&atilde;o &lt;<a
          moz-do-not-send="true" href="mailto:cvgaviao@gmail.com">cvgaviao@gmail.com</a>&gt;:<br>
        <br>
      </div>
      <blockquote type="cite" style="-webkit-text-size-adjust: auto; ">
        <div>
          <meta content="text/html; charset=ISO-8859-1"
            http-equiv="Content-Type">
          <div class="moz-cite-prefix">Florian,<br>
            <br>
            Don't think that the problem that we are facing in Drools6
            is because the Class.forName on its own. <br>
            <br>
            But the problem is from which bundle it is being called and
            where resides the class that it is trying to load...<br>
            <br>
            Definitively one bundle CAN'T load classes that resides in
            another bundle, unless you specify a import of the
            package... That is why currently kie-api has an import to
            org.drools.compiler.kie.builder.impl <br>
            <br>
            so the solution must be composed by two steps: Repackage
            some classes, so a class will be loaded by its own bundle
            and use services... <br>
            <br>
            On 21/06/13 03:30, Florian Pirchner wrote:<br>
          </div>
          <blockquote cite="mid:51C3F302.1080701@gmail.com" type="cite">
            <meta content="text/html; charset=ISO-8859-1"
              http-equiv="Content-Type">
            <div class="moz-cite-prefix">Hi Mark,<br>
              <br>
              i did some research. Indeed a very complex issue.<br>
              Tried to find out the difference about
              Class.forName(String) and Class.forName(String, boolean,
              ClassLoader). Both of them are delegating to native jvm
              methods and the difference seems to be in resolving the
              class and the way that caches work.<br>
              <br>
              In <a moz-do-not-send="true"
                href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6500212">http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6500212</a>
              they are pointing to use Class.forName(String, boolean,
              ClassLoader). Could find that method call in some drools
              and jbpm classes. For instance compiler...<br>
              <br>
              But there are also a lot of Class.forName(String) calls
              too. Specialy in parts of code where no array-types come
              into play.<br>
              For instance JavaHandlerWorkItemHandler calls&nbsp;
              (Class&lt;JavaHandler&gt;) Class.forName(className).<br>
              <br>
              Maybe it would be a good idea to replace Class.forName()
              for issues that exclude array-types by
              classloader.loadClass().<br>
              <br>
              WDYT?<br>
              <br>
              Best Florian<br>
              <br>
              <br>
              <br>
              Am 20.06.13 17:28, schrieb Mark Proctor:<br>
            </div>
            <blockquote
              cite="mid:DFABF683-D826-4BDC-BE50-093D9910D593@codehaus.org"
              type="cite">
              <meta http-equiv="Content-Type" content="text/html;
                charset=ISO-8859-1">
              There are bugs with loadClass and serialisation :(
              <div><a moz-do-not-send="true"
href="http://lists.jboss.org/pipermail/rules-dev/2011-November/003681.html">http://lists.jboss.org/pipermail/rules-dev/2011-November/003681.html</a></div>
              <div><br>
              </div>
              <div><a moz-do-not-send="true"
                  href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6500212">http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6500212</a></div>
              <div>"<span style="background-color: rgb(255, 255, 255);
                  font-size: 12px; text-align: -webkit-left;
                  white-space: pre-wrap; ">Thus, we highly recommend
                  replacement of this code:</span></div>
              <pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; list-style: none; white-space: pre-wrap; word-wrap: break-word; font-size: 12px; text-align: -webkit-left; background-color: rgb(255, 255, 255); position: static; z-index: auto; ">  myClassLoader.loadClass(className);

With this code:

  Class.forName(className,false,myClassLoader);"</pre>
              <div><br>
              </div>
              <div>Mark<br>
                <div>
                  <div>On 20 Jun 2013, at 15:01, Florian Pirchner &lt;<a
                      moz-do-not-send="true"
                      href="mailto:florian.pirchner@gmail.com">florian.pirchner@gmail.com</a>&gt;


                    wrote:</div>
                  <br class="Apple-interchange-newline">
                  <blockquote type="cite">Hi,<br>
                    <br>
                    i also saw all the Class.forName. Class.forName
                    additionally uses a very <br>
                    aggressive class caching policy.<br>
                    See here:<br>
                    <a moz-do-not-send="true"
href="http://blog.osgi.org/2011/05/what-you-should-know-about-class.html">http://blog.osgi.org/2011/05/what-you-should-know-about-class.html</a><br>
                    <a moz-do-not-send="true"
                      class="moz-txt-link-freetext"
href="http://blog.bjhargrave.com/2007/09/classforname-caches-defined-class-in.html">http://blog.bjhargrave.com/2007/09/classforname-caches-defined-class-in.html</a><br>
                    <br>
                    I do not understand why API imports compiler.impl?
                    Maybe to enable <br>
                    class#forname i guess.<br>
                    <br>
                    <br>
                    Is there an intention to use a more modularized way
                    in v6 beta4 when <br>
                    OSGi support will be implemented?<br>
                    <br>
                    Thanks Florian<br>
                    <br>
                    <br>
                    Am 20.06.13 15:43, schrieb Cristiano Gavi&atilde;o:<br>
                    <blockquote type="cite">Hi,<br>
                      <br>
                      Well, besides the fact that the services that we
                      used on version 5.x is<br>
                      still there, I'm not that optimist with Drools 6
                      running well in an OSGi<br>
                      container... at least not currently...<br>
                      <br>
                      Last week I played a bit too with Jbosgi and
                      Wildfly and got a lot of<br>
                      classloading errors due some factory classes
                      trying to load classes that<br>
                      are in another bundles...<br>
                      <br>
                      what surprise me most was that kie-api has an
                      import to<br>
                      org.drools.compiler.kie.builder.impl ! :)<br>
                      <br>
                      regards,<br>
                      <br>
                      John<br>
                      On 17/06/13 19:39, Florian.Pirchner wrote:<br>
                      <blockquote type="cite">hi,<br>
                        <br>
                        i got a question about osgi support.<br>
                        is beta 3 already useable in osgi environments?
                        could see that activators are registering v5 api
                        as services.<br>
                        <br>
                        is it possible to consume osgi services in the
                        script tasks and rules by context? is this
                        planned for version 6? would be a great feature.<br>
                        <br>
                        thanks a lot for answer<br>
                        florian<br>
                        _______________________________________________<br>
                        rules-users mailing list<br>
                        <a moz-do-not-send="true"
                          class="moz-txt-link-abbreviated"
                          href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
                        <a moz-do-not-send="true"
                          class="moz-txt-link-freetext"
                          href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
                      </blockquote>
                      _______________________________________________<br>
                      rules-users mailing list<br>
                      <a moz-do-not-send="true"
                        class="moz-txt-link-abbreviated"
                        href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
                      <a moz-do-not-send="true"
                        class="moz-txt-link-freetext"
                        href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
                    </blockquote>
                    <br>
                    <br>
                    _______________________________________________<br>
                    rules-users mailing list<br>
                    <a moz-do-not-send="true"
                      class="moz-txt-link-abbreviated"
                      href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
                    <a moz-do-not-send="true"
                      class="moz-txt-link-freetext"
                      href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
                  </blockquote>
                </div>
                <br>
              </div>
              <br>
              <fieldset class="mimeAttachmentHeader"></fieldset>
              <br>
              <pre wrap="">_______________________________________________
rules-users mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a></pre>
            </blockquote>
            <br>
            <br>
            <pre class="moz-signature" cols="72">-- 
Mit besten Gr&uuml;&szlig;en
Florian Pirchner
Fohlenweg 22
2301 Probstdorf
Tel: +43 650 7772338
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:florian.pirchner@gmail.com">florian.pirchner@gmail.com</a></pre>
            <br>
            <fieldset class="mimeAttachmentHeader"></fieldset>
            <br>
            <pre wrap="">_______________________________________________
rules-users mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a></pre>
          </blockquote>
          <br>
        </div>
      </blockquote>
      <blockquote type="cite" style="-webkit-text-size-adjust: auto; ">
        <div><span>_______________________________________________</span><br>
          <span>rules-users mailing list</span><br>
          <span><a moz-do-not-send="true"
              href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a></span><br>
          <span><a moz-do-not-send="true"
              href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a></span></div>
      </blockquote>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
rules-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a></pre>
    </blockquote>
    <br>
  </body>
</html>