This surprises me, since SpringProvider&#39;s ClassLoader should already be the current classloader:<br><br><a 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>
<br><a 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 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&#39;t see the resources that were declared in my plugin.jar<br>
</div>Richard,<br>
<br>
I&#39;ve experienced this ClassLoader problem with my plugin as well.  The<br>
solution thus far has been to force the current thread to use of the<br>
ScaffoldProvider&#39;s ClassLoader in the generateFromEntity() method.  That<br>
is, save the current thread&#39;s ClassLoader at the beginning of the<br>
method, encapsulate the rest of the method in a try block (changing the<br>
thread&#39;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 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 href="mailto:forge-dev@lists.jboss.org">forge-dev@lists.jboss.org</a><br>
<a 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 href="http://ocpsoft.com">http://ocpsoft.com</a><br><a href="http://scrumshark.com">http://scrumshark.com</a><br>&quot;Keep it Simple&quot;<br>