I have some difficulties deploying my web app on JBoss AS 6.1. My current Project is separated into the main web app (controller/managed beans & web frontend using JSF 2 facelets) and one jar with the composite components + backing beans. But when I try to access the page I got an error that the specified component type could not be instantiated.
Copying the backing bean into the main web app solves the problem, but this isn’t what I want. So is there anything to pay attention to?
The backing bean looks like
@FacesComponent(value = "elementBase")
public class ElementBase extends UINamingContainer {
...
}
and the composite components interface
<composite:interface componentType="elementBase">
... some attributes
</composite:interface>
The structure of the jar is the following
-- META-INF
|-- resources
| |-- components
| |-- elementBase.xhtml
-- com
|-- example
| |-- ElementBase.class
I’ve also tried to add faces-config.xml within META-INF folder, with the component type, but the component type was still not found.
Through the BalusC’s answer to the question JEE6> Packaging JSF facelets (xhtml) and ManagedBeans as JAR
and Java EE6 Tutorial: Application Configuration Resource File
.. I could fix my problem.
Step by step solution
Create backing bean
and a composite components with the following interface
provide a
faces-config.xmlwithin the deployed jar, to indicate that the jar contains annotated classes. The structure of the deployed jar should look likedeploy the jar within the
/WEB-INF/libfolder of the web application.Research/Related links and topics