使用捆绑libs websphere liberty

vbopmzt1  于 2021-07-07  发布在  Java
关注(0)|答案(1)|浏览(445)

我正在使用WebSphereLiberty和Java8Docker映像,但是在尝试了一切之后。根据我的假设和日志,我无法加载我自己的捆绑lib,而不是liberty内置lib WEB-INF/lib 我的war文件中的目录
这是我正在使用的配置

<?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

有人能告诉我需要在配置中做些什么才能让它工作吗

kuarbcqp

kuarbcqp1#

这里的问题是 javaee-8.0 功能包括 jsf-2.3 包括jsfapi和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 feature包含大量的特性—其中许多特性您可能不需要,但不幸的是,您需要指定您确实需要的所有特性(除了 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应该在你的应用程序中找到并使用jsf实现——你也不需要在你的应用程序中使用parentlast委托。

相关问题