我正在使用websphere liberty和java 8 docker image,但在尝试了所有方法之后。根据我的假设,我无法加载我自己的捆绑库,而不是内置的liberty,我的jsp和其他库在war文件中的WEB-INF/lib目录中。
下面是我正在使用的配置
<?xml version="1.0" encoding="UTF-8"?>
<server description="Default server">
<!-- Enable features -->
<featureManager>
<feature>javaee-8.0</feature>
<feature>microProfile-3.0</feature>
</featureManager>
<basicRegistry id="basic" realm="BasicRealm">
<!-- <user name="yourUserName" password="" /> -->
</basicRegistry>
<logging traceSpecification="com.ibm.ws.webcontainer*=all:com.ibm.wsspi.webcontainer*=all:HTTPChannel=all:GenericBNF=all:HTTPDispatcher=all"
traceFileName="trace.log"
maxFileSize="20"
maxFiles="10"
traceFormat="BASIC" />
<library id="OJDBC5Lib">
<fileset dir="/config/ojdbc5.jar" includes="ojdbc5.jar"/>
</library>
<!-- To allow access to this server from a remote client host="*" has been added to the following element -->
<httpEndpoint id="defaultHttpEndpoint"
host="*"
httpPort="9080"
httpsPort="9443" />
<webApplication id="e-app" name="e-app" location="/apps/e-app.war" contextRoot="/e-app">
<classloader delegation="parentLast" />
</webApplication>当我跑的时候。我得到一个异常的应用程序
[AUDIT ] CWWKF0011I: The defaultServer server is ready to run a smarter planet. The defaultServer server started in 14.831 seconds.
[ERROR ] SRVE0271E: Uncaught init() exception created by servlet [Faces Servlet] in application [e-app]: java.lang.IllegalStateException: Could not find ba
ckup for factory javax.faces.context.FacesContextFactory.
at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:1004)
at [internal classes]
[ERROR ] SRVE0276E: Error while initializing Servlet [Faces Servlet]: javax.servlet.ServletException: SRVE0207E: Uncaught initialization exception created by servlet
at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:360)
at [internal classes]
Caused by: java.lang.IllegalStateException: Could not find backup for factory javax.faces.context.FacesContextFactory.
at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:1004)
... 1 more谁能告诉我在config中需要做些什么才能使它工作
发布于 2020-12-01 23:44:19
这里的问题是,javaee-8.0特性包括jsf-2.3特性,其中包括JSF和Liberty的JSF实现。为了提供您自己的JSF实现,您将需要删除jsf-2.3特性并使用jsfContainer-2.3特性。本文档有更多详细信息:https://www.ibm.com/support/knowledgecenter/SSEQTP_liberty/com.ibm.websphere.wlp.doc/ae/twlp_jsf23_implementations.html
javaee-8.0特性包括大量特性--其中许多特性您可能不需要,但不幸的是,您需要指定您确实需要的所有特性(除了jsfContainer-2.3之外)。因此,server.xml的<featureManager>元素最终可能如下所示:
<featureManager>
<!-- webprofile-8.0 features but using jsfContainer instead of jsf -->
<feature>appSecurity-3.0</feature>
<feature>beanValidation-2.0</feature>
<feature>cdi-2.0</feature>
<feature>ejbLite-3.2</feature>
<feature>el-3.0</feature>
<feature>jaspic-1.1</feature>
<feature>jaxrs-2.1</feature>
<feature>jdbc-4.2</feature>
<feature>jndi-1.0</feature>
<feature>jpa-2.2</feature>
<feature>jsfContainer-2.3</feature>
<feature>jsonb-1.0</feature>
<feature>jsonp-1.1</feature>
<feature>jsp-2.3</feature>
<feature>managedBeans-1.0</feature>
<feature>servlet-4.0</feature>
<feature>transaction-1.2</feature>
<feature>websocket-1.1</feature>
<!-- full profile 8 features not in web profile -->
<feature>appClientSupport-1.0</feature>
<feature>batch-1.0</feature>
<feature>concurrent-1.0</feature>
<feature>ejb-3.2</feature>
<feature>jacc-1.5</feature>
<feature>javaMail-1.6</feature>
<feature>javax.persistence.base-2.2</feature>
<feature>jaxws-2.2</feature>
<feature>jca-1.7</feature>
<feature>jcaInboundSecurity-1.0</feature>
<feature>jms-2.0</feature>
<feature>j2eeManagement-1.1</feature>
<feature>wasJmsClient-2.0</feature>
<feature>wasJmsSecurity-1.0</feature>
<feature>wasJmsServer-1.0</feature>
</featureManager>这是一个很大的列表,所以您可能希望对其进行一些删减(例如,如果您不使用JMS,则删除所有与JMS相关的特性)。但是,一旦你将jsf-2.3换成了jsfContainer-2.3,那么Liberty就应该在你的应用中找到并使用parentLast实现--而且你也不需要在你的应用中使用JSF委托。
https://stackoverflow.com/questions/65089728
复制相似问题