If your application is deployed as a Enterprise ARchive (EAR), typically your domain objects will be in an EJB tier and your UI screens in a WAR tier. To use Metawidget-specific annotations on your domain objects (such as @UiComesAfter) you must therefore deploy Metawidget under ear/lib. Depending on your application server, you may encounter a few problems doing this. Specifically:
Some application servers have bugs whereby TLD files cannot be detected under ear/lib, only under WEB-INF/lib. A workaround is to copy just the TLD file you need (eg. metawidget-faces.tld) into your WEB-INF folder.
Some application servers have classloader issues if a class is not loaded by the correct classloader (eg. JSF components must be loaded by the WAR classloader) or if the same class is loaded by multiple classloaders (eg. annotation classes loaded by both the EJB and the WAR classloaders may not be recognised when passed between tiers).
Some application servers scan the classpath on startup, looking for JAR annotations. They may struggle with Metawidget classes that have optional dependencies (eg. they may throw ClassNotFoundException on SpringMetawidgetTag if you are not shipping Spring with your application).
All these problems can be resolved by not using metawidget-all.jar. Instead, switch to using fine-grained dependencies (eg. metawidget-facesannotation.jar in the EJB tier, metawidget-faces.jar in the WAR tier). A typical setup might be:
ear/lib # EJB tier annotations metawidget-annotation.jar metawidget-core.jar metawidget-facesannotation.jar ear/war/WEB-INF/lib # WAR tier inspectors/widgets metawidget-faces.jar metawidget-hibernatevalidator.jar metawidget-jpa.jar metawidget-richfaces.jar metawidget-tomahawk.jar
To use fine-grained dependencies, specify dependencies on a per-technology basis using Maven. For example:
Maven will automatically drag in related dependencies for you, such as org.metawidget.modules:metawidget-core. You can browse all available fine-grained dependencies at http://repository.jboss.org/nexus/content/groups/public-jboss/org/metawidget/modules. If you are not using Maven, you can also download and deploy the fine-grained dependencies manually.