<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    On 12-03-02 11:20 AM, Lincoln Baxter, III wrote:
    <blockquote
cite="mid:CAEp_U4GtV46RK7GE7zjijEBJjhn9Ut-GuLu6eTWqx8DKicmn1w@mail.gmail.com"
      type="cite">This surprises me, since SpringProvider's ClassLoader
      should already be the current classloader:<br>
      <br>
      <a moz-do-not-send="true"
href="https://github.com/forge/core/blob/master/shell/src/main/java/org/jboss/forge/shell/command/Execution.java#L148">https://github.com/forge/core/blob/master/shell/src/main/java/org/jboss/forge/shell/command/Execution.java#L148</a><br>
      <br>
      AHA! But since this is actually being executed from the
      ScaffoldPlugin, which is BUILT IN, the classloader is actually
      still that of the scaffold-impl (ScaffoldPlugin) - Ok. This means
      that we need an internal utility to wrap external invocations in a
      new TCCL.<br>
    </blockquote>
    I think that this can be generalized by a) using provider's CL as
    the TCCL; b) ensuring that providers get the CL of scaffold-impl as
    a dependency when they're loaded.<br>
    <blockquote
cite="mid:CAEp_U4GtV46RK7GE7zjijEBJjhn9Ut-GuLu6eTWqx8DKicmn1w@mail.gmail.com"
      type="cite">
      <br>
      <a moz-do-not-send="true"
        href="https://issues.jboss.org/browse/FORGE-487">https://issues.jboss.org/browse/FORGE-487</a><br>
      <br>
      ~Lincoln<br>
      <br>
      <div class="gmail_quote">On Fri, Mar 2, 2012 at 10:43 AM, Ryan
        Bradley <span dir="ltr">&lt;<a moz-do-not-send="true"
            href="mailto:rbradley@redhat.com">rbradley@redhat.com</a>&gt;</span>
        wrote:<br>
        <blockquote class="gmail_quote" style="margin:0 0 0
          .8ex;border-left:1px #ccc solid;padding-left:1ex">
          <div class="im">On 03/02/2012 01:12 AM, Richard Kennard wrote:<br>
            &gt; 5. Class loading: getClass().getResourceAsStream()
            works differently depending on which JAR the class was
            loaded from. So for example the<br>
            &gt; getClass().getResourceAsStream() that lives inside
            metawidget.jar couldn't see the resources that were declared
            in my plugin.jar<br>
          </div>
          Richard,<br>
          <br>
          I've experienced this ClassLoader problem with my plugin as
          well. &nbsp;The<br>
          solution thus far has been to force the current thread to use
          of the<br>
          ScaffoldProvider's ClassLoader in the generateFromEntity()
          method. &nbsp;That<br>
          is, save the current thread's ClassLoader at the beginning of
          the<br>
          method, encapsulate the rest of the method in a try block
          (changing the<br>
          thread's class loader to that of the ScaffoldProvider), and
          add a<br>
          finally block which restores the original class loader.<br>
          <br>
          The code can be found here:<br>
          <a moz-do-not-send="true"
href="https://github.com/forge/plugin-spring-mvc/blob/master/src/main/java/org/jboss/forge/scaffold/spring/SpringScaffold.java"
            target="_blank">https://github.com/forge/plugin-spring-mvc/blob/master/src/main/java/org/jboss/forge/scaffold/spring/SpringScaffold.java</a><br>
          <br>
          Cheers,<br>
          Ryan<br>
          <div class="HOEnZb">
            <div class="h5">_______________________________________________<br>
              forge-dev mailing list<br>
              <a moz-do-not-send="true"
                href="mailto:forge-dev@lists.jboss.org">forge-dev@lists.jboss.org</a><br>
              <a moz-do-not-send="true"
                href="https://lists.jboss.org/mailman/listinfo/forge-dev"
                target="_blank">https://lists.jboss.org/mailman/listinfo/forge-dev</a><br>
            </div>
          </div>
        </blockquote>
      </div>
      <br>
      <br clear="all">
      <br>
      -- <br>
      Lincoln Baxter, III<br>
      <a moz-do-not-send="true" href="http://ocpsoft.com">http://ocpsoft.com</a><br>
      <a moz-do-not-send="true" href="http://scrumshark.com">http://scrumshark.com</a><br>
      "Keep it Simple"<br>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
forge-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:forge-dev@lists.jboss.org">forge-dev@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/forge-dev">https://lists.jboss.org/mailman/listinfo/forge-dev</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>