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