Creating own scaffold plugin: metawidget resource loading exception only when run within forge console

拥有回忆 提交于 2019-12-24 20:23:27

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!