且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何为JSF类编写Arquillian测试

更新时间:2023-12-04 21:02:52

您在部署中缺少faces-config.xml. Java EE 6规范要求WEB-INF目录中存在faces-config.xml描述符,以触发JSF.

You are missing the faces-config.xml in your Deployment. The Java EE 6 specification requires a faces-config.xml descriptor to be present in your WEB-INF-directory to trigger JSF.

与已经包含faces-config.xml描述符的beans.xml不同,该文件不能为空文件.它必须至少包含根节点和version属性,以指定使用中的JSF版本.

Unlike beans.xml which you already included the faces-config.xml descriptor cannot be an empty file. It must contain at least the root node and the version attribute to specify the JSF version in use.

因此,您需要将以下代码添加到ShrinkWrap构建器中:

So you need to add the following code to your ShrinkWrap builder:

.addAsWebInfResource(new StringAsset("<faces-config version=\"2.0\"/>"), "faces-config.xml");