[forge-dev] Scaffolding and class loading

Lincoln Baxter, III lincolnbaxter at gmail.com
Thu Dec 6 13:46:31 EST 2012


Well... we know this is a problem in Forge 1, which is one of the big
reasons we are working on Forge 2. But you might want to take a look at the
Spring MVC scaffold, which had to overcome this same issue:

https://github.com/forge/plugin-spring-mvc/blob/master/src/main/java/org/jboss/forge/scaffold/spring/SpringScaffold.java#L208

Note the special template resolver.

~Lincoln

PS. Sorry for the late reply.


On Tue, Dec 4, 2012 at 9:04 AM, Luca Masini <luca.masini at gmail.com> wrote:

> Ok, I've found the problem, is with the "SimpleResourceResolver" that
> tries to locate resources in a context where those are not available.
>
> This works fine with the faces scaffold because it is part of the forge
> standard modules (I think.....).
>
> Any comments or better explanation ??
>
>
>
> 2012/12/4 Luca Masini <luca.masini at gmail.com>
>
>> Hi guys, I'm facing a strange problem. Inside a facet which is a scaffold
>> provider I need to load a resource for MetaWidget. I can see printing this
>> from the method that needs the resource
>>
>>
>> this.getClass().getClassLoader().getResource("scaffold/errai/metawidget-formbean.xml")
>>
>> that the file is available:
>>
>>
>> file:/Users/lucamasini/.forge/plugins/org/jboss/forge/forge-scaffold-errai/1.0.6-SNAPSHOT-e0a249f3-6fe7-4ea1-8fd9-680f8e422af4/forge-scaffold-errai.jar!/scaffold/errai/metawidget-formbean.xml
>>
>> but inside the SimpleResourceResolver neither:
>>
>> ClassLoader loaderContext =
>> Thread.currentThread().getContextClassLoader();
>>
>> or:
>>
>> InputStream stream = getClass().getResourceAsStream( resource );
>>
>> can find the resource because the "forge-scaffold-errai.jar" is not one
>> of the JAR used by the current classloader (which is a JBoss's
>> ModuleClassloader).
>>
>> The current implementation of scaffolding for faces works because is
>> inside the forge itself, but I think we have some problems using it in an
>> external plugin.
>>
>> Do you think I need to declare it in some kind of manifest ??
>>
>> Thank you
>> L.
>>
>> --
>> ****************************************
>> http://www.lucamasini.net
>> http://twitter.com/lmasini
>> http://www.linkedin.com/pub/luca-masini/7/10/2b9
>> ****************************************
>>
>
>
>
> --
> ****************************************
> http://www.lucamasini.net
> http://twitter.com/lmasini
> http://www.linkedin.com/pub/luca-masini/7/10/2b9
> ****************************************
>
> _______________________________________________
> forge-dev mailing list
> forge-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/forge-dev
>
>


-- 
Lincoln Baxter, III
http://ocpsoft.org
"Simpler is better."
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/forge-dev/attachments/20121206/a36c1d8c/attachment.html 


More information about the forge-dev mailing list