Cannot run multiple executions and have custom tool
---------------------------------------------------

                 Key: MHIBERNATE-63
                 URL: http://jira.codehaus.org/browse/MHIBERNATE-63
             Project: Maven 2.x Hibernate Plugin
          Issue Type: Bug
    Affects Versions: 2.0-alpha-2
            Reporter: James Olsen
            Assignee: Johann Reyes


If the plugin is configured to have multiple executions you cannot use a 
hibernate toolclass such as:

        <hibernatetool.reveng.toolclass>
                com.xxx.hibernate.tools.reveng.ReverseEngineeringTool
        </hibernatetool.reveng.toolclass>

The second execution will fail with an error as shown below.  This seems to be 
a ClassLoader issue.  I think FreeMarker is using a static/singleton cache of 
method information and is loaded with the plugin ClassLoader.  The tool however 
is loaded via a different ClassLoader managed by the plugin.  During the second 
execution FreeMarker determines that the tool class has been reloaded via a 
different ClassLoader and therefore it's cached copy of method info for the 
tool could be wrong so it clears it's caches - unfortunately it clears all of 
it's cached info!  It is then unable to find method info for anything.

I've tried placing the tool class in a separate jar in the plugin's extensions 
but the plugin doesn't look in that ClassLoader when trying to load tools.

11:17:53,090  INFO freemarker.beans - Detected a reloaded class 
[com.xxx.hibernate.tools.reveng.ReverseEngineeringTool]. Clearing BeansWrapper 
caches.
11:17:53,090 ERROR freemarker.runtime - get(getMetaAttribAsBool) failed on 
instance of org.hibernate.tool.hbm2x.pojo.EntityPOJOClass
The problematic instruction:
----------
==> if pojo.getMetaAttribAsBool(property, "gen-property", true) [on line 3, 
column 1 in src/main/resources/pojo-query-keys/PojoPropertyAccessors.ftl]
 in include "PojoPropertyAccessors.ftl" [on line 4, column 1 in 
src/main/resources/pojo-query-keys/Pojo.ftl]
----------

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to