【问题标题】:WebSphere Liberty Profile: Context Root Not FoundWebSphere Liberty Profile:找不到上下文根
【发布时间】:2015-05-22 00:20:40
【问题描述】:

我似乎无法让它在本地工作,即使同一个 WAR 在远程服务器上工作。当我去本地访问我的应用程序时,我收到“找不到上下文根”错误。 Liberty 配置文件版本是 8.5.5.5。

以下是相关文件:

服务器.xml

<?xml version="1.0" encoding="UTF-8"?>
<server description="tlc server">
  <!-- Enable features -->
  <featureManager>
    <feature>jsp-2.2</feature>
    <feature>ssl-1.0</feature>
    <feature>localConnector-1.0</feature>
    <feature>restConnector-1.0</feature>
    <feature>json-1.0</feature>
    <feature>jaxrs-1.1</feature>
    <feature>servlet-3.0</feature>
    <feature>jpa-2.0</feature>
    <feature>beanValidation-1.0</feature>
    <feature>jndi-1.0</feature>
    <feature>jdbc-4.0</feature>
    <feature>monitor-1.0</feature>
  </featureManager>
  <httpEndpoint id="defaultHttpEndpoint" host="*" httpPort="9080" httpsPort="9443" virtualHost="default_host" />
  <jdbcDriver id="DerbyJDBCDriver">
    <library name="DerbyLib">
      <fileset dir="C:\tools\servers\wlp\lib" includes="derbyclient-10.6.1.0.jar" />
    </library>
  </jdbcDriver>
  <dataSource jndiName="jdbc/TLCDataSource" id="derbyDataSource" jdbcDriverRef="DerbyJDBCDriver">
    <properties.derby.client databaseName="TLC" password="APP" user="APP" />
  </dataSource>
  <applicationMonitor updateTrigger="mbean" />
  <application id="TLC_war" context-root="/TLC" location="C:\Users\nd26434\gitrepos\tlc\target\TLC-1.0.0-SNAPSHOT.war" name="TLC_war" type="war">
    <classloader delegation="parentLast">
      <privateLibrary>
        <fileset dir="C:\tools\servers\wlp\lib" includes="aspectjweaver-1.8.0.jar" />
      </privateLibrary>
    </classloader>
  </application>
</server>

message.log

[3/18/15 20:19:54:789 EDT] 0000001b com.ibm.ws.app.manager.AppMessageHelper                      A CWWKZ0022W: Application TLC_war has not started in 30.018 seconds.
[3/18/15 20:20:03:174 EDT] 0000001f com.ibm.ws.webcontainer.osgi.webapp.WebGroup                 I SRVE0169I: Loading Web Module: TLC-1.0.0-SNAPSHOT.
[3/18/15 20:20:03:175 EDT] 0000001f com.ibm.ws.webcontainer                                      I SRVE0250I: Web Module TLC-1.0.0-SNAPSHOT has been bound to tlc_host.

ibm-web-bnd.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-bnd xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://websphere.ibm.com/xml/ns/javaee"
    xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-web-bnd_1_0.xsd"
    version="1.0">
    <virtual-host name="tlc_host"/>
    <resource-ref name="jdbc/TLCDataSource"
        binding-name="jdbc/TLCDataSource" />
</web-bnd>

ibm-web-ext.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-ext
    xmlns="http://websphere.ibm.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-web-ext_1_0.xsd"
    version="1.0">
    <reload-interval value="3"/>
    <context-root uri="TLC" />
    <enable-directory-browsing value="false"/>
    <enable-file-serving value="true"/>
    <enable-reloading value="true"/>
    <enable-serving-servlets-by-class-name value="false" />
</web-ext>

【问题讨论】:

    标签: websphere-liberty


    【解决方案1】:

    从您的 ibm-web-ext.xml 文件中删除 &lt;virtual-host name="tlc_host"/&gt;。因为你没有tlc_host,但是default_host

    【讨论】:

      【解决方案2】:

      找不到上下文根是由于其中一个配置文件中的问题引起的。 在我的例子中,web.xml 有一个未关闭的评论,因为战争没有正确构建。

      这导致 EAR 文件没有更新。

      解决方案:

      1. 将 web.xml 与以前的版本进行比较,看看有什么变化。
      2. 将war而不是ear文件添加到服务器以查看错误。 (如果在 Liberty 服务器上运行)

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2012-08-21
        • 2013-02-03
        • 1970-01-01
        • 1970-01-01
        • 2018-05-03
        • 2016-01-16
        • 1970-01-01
        相关资源
        最近更新 更多