我想部署一个JSF 2.1 web应用到WebLogic 12.1应用程序服务器,但部署失败与以下异常
<javax.enterprise.resource.webcontainer.jsf.config> <BEA-000000>
<Critical error during deployment:
com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED!
com.oracle.injection.integration.jsf.WeblogicFacesConfigResourceProvider
cannot be cast to com.sun.faces.spi.ConfigurationResourceProvider
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:377)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:223)
at weblogic.servlet.internal.EventsManager$FireContextListenerAction.run(EventsManager.java:582)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
Truncated. see log file for complete stacktrace
我现在用的钻嘴鱼科实现版本2.1.13 -这里是相应的pom.xml
条目:
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.1.13</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.1.13</version>
</dependency>
我添加了以下行weblogic.xml
,以防止在WebLogic Server从装载运JSF实现:
<container-descriptor>
<prefer-web-inf-classes>false</prefer-web-inf-classes>
<prefer-application-packages>
<package-name>javax.faces.*</package-name>
<package-name>com.sun.faces.*</package-name>
<package-name>com.bea.faces.*</package-name>
</prefer-application-packages>
<prefer-application-resources>
<resource-name>javax.faces.*</resource-name>
<resource-name>com.sun.faces.*</resource-name>
<resource-name>com.bea.faces.*</resource-name>
<resource-name>META-INF/services/javax.servlet.ServletContainerInitializer</resource-name>
</prefer-application-resources>
</container-descriptor>
该WeblogicFacesConfigResourceProvider
包含在weblogic.jar
。
所以,这是怎么回事错在这里? - 任何提示?
解
好吧,我找到了解决办法:你必须在添加META-INF/services/com.sun.faces.spi.FacesConfigResourceProvider
到prefer-application-resources
在-section weblogic.xml
。 这种配置工作对我来说:假javax.faces。 com.sun.faces。 com.bea.faces。*
<prefer-application-resources>
<resource-name>javax.faces.*</resource-name>
<resource-name>com.sun.faces.*</resource-name>
<resource-name>com.bea.faces.*</resource-name>
<resource-name>META-INF/services/javax.servlet.ServletContainerInitializer</resource-name>
<resource-name>META-INF/services/com.sun.faces.spi.FacesConfigResourceProvider</resource-name>
</prefer-application-resources>
</container-descriptor>