问题
I try to rebuild a scaffold faces plugin separately for some reasons, but found a really annoying bug, that I cannot solve.
java.lang.NoSuchMethodException: class org.metawidget.inspector.impl.BaseObjectInspectorConfig.setPropertyStyle(ForgePropertyStyle). Did you mean setPropertyStyle(PropertyStyle)?
at org.metawidget.config.impl.BaseConfigReader$ConfigHandler.classGetMethod(BaseConfigReader.java:1633)
After trying some tricks, review the metawidget config codes, not found how to solve the problem.
scaffold setup --scaffoldType customfaces
works fine, but the
scaffold from-entity com.domain.entity.* --scaffoldType customfaces
fails.
Is anybody has a same issue? May I mess-up something?
Update#1:
The resource loading fails only, when run within forge console. JUnit test works fine. I assume, that metawidget plugin resource loader try to load metawidget-*.xml not from the new plugin but from the original scaffold-api's context.
Update#2:
The problem is somewehere deep in metawidget and forge relation. I found that if I use directly the SimpleResourceResolver.openResource()
, the result is valid. But If I add the StaticHtmlWidget.setConfig()
, the result is Unable to locate com/domain/customfaces/metawidget-entity.xml on CLASSPATH
at the firs write()
call. I have no idea, how to resolve this behavior.
回答1:
Possibly you're including the Metawidget JARs more than once? Forge uses JBoss Modules, so you must be careful how your classpath gets constructed.
The Metawidget error is basically saying that 'ForgePropertyStyle' is not of type 'PropertyStyle'. But (unless you've changed that code in your customfaces) ForgePropertyStyle does indeed extend PropertyStyle. So you must have two PropertyStyles on your classpath somehow?
来源:https://stackoverflow.com/questions/12622849/creating-own-scaffold-plugin-metawidget-resource-loading-exception-only-when-ru