本文介绍了在 Apache Tomcat 中部署 eHour的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要您的帮助,因为我尝试在我的服务器(它是 Windows 服务器)上安装 eHour 没有成功:

I need your help because I try to install eHour on my server (it is a windows server) without success:

文档中所述,有两种类型的安装:

as described in the documentation, there are two types of installations:

  • 独立
  • War 文件(文档链接似乎不好,请转到旧的安装说明,新的是 这里 )

首先,我尝试了独立方式,但即使 eHour 服务正在运行,我也没有任何网页.
所以我卸载eHour并尝试使用War文件方式

First, I try Standalone way but even if eHour service was running, I didn't have any web pages.
So I uninstall eHour and try to use the War file way

因为它是一个新服务器,我安装了 Apache Tomcat(版本 10.0.4)和 mysql然后,我复制 WAR 分发并将其解压缩到我的 C 驱动器(我还将文件夹从 ehour-1.4.3 重命名为 ehour)
然后我创建一个 setevn.bat 文件并创建一个变量 EHOUR_HOME
set EHOUR_HOME=c:\ehour"

as it is a new server, I install Apache Tomcat (version 10.0.4) and mysqlThen, I copy WAR distribution and I unzip it to my C drive (I also renamed the folder from ehour-1.4.3 to ehour)
Then I create a setevn.bat file and create a variable EHOUR_HOME
set EHOUR_HOME="c:\ehour"

然后我下载mysql连接器并将文件mysql-connector-java-8.0.23.jar复制到Tomcat 10.0/lib目录

Then I download mysql connector and copy file mysql-connector-java-8.0.23.jar to Tomcat 10.0/lib directory

最后,我将war文件从ehour-1.4.3.war重命名为ehour.war并复制到Tomcat 10.0/webapps目录

Finally, I rename the war file from ehour-1.4.3.war to ehour.war and copy it to Tomcat 10.0/webapps directory

我启动了apache,Tomcat 10.0/webapps目录下添加了一个ehour目录但是 localhost:8080/ehour 结果是 404 : 请求的资源 [/ehour] 不可用.

I start apache and a directory ehour has been added to Tomcat 10.0/webapps directorybut localhost:8080/ehour result is 404 : The requested resource [/ehour] is not available.

我查看了 catalina 日志,但没有看到任何对我有帮助的内容

I look in catalina log but see nothing that help me

有什么提示吗?

看来我确实有与 此处相同的错误 :在文件 localhost.log 中我确实有类似的错误:

it seems I do have same error than here :in file localhost.log I do have similar error:

EHOUR_HOME environment variable or context parameter not defined
nested exception is java.io.FileNotFoundException: ${EHOUR_HOME}\conf\ehour.properties (The system cannot find the path specified)

但是,我确实在 Tomcat/bin 目录中创建了一个文件 setenv.bat它的内容是:
set EHOUR_HOME=c:\ehour"
我想念的东西?

Howerver, I do create a file setenv.bat in Tomcat/bin directoryits contents is :
set EHOUR_HOME="c:\ehour"
something I miss?

推荐答案

您使用的是 Windows,因此您可能正在使用 Procrun (Commons Daemon/Tomcat Monitor) 将 Tomcat 作为 Windows 服务启动.Procrun 根本不使用 *.bat 文件,一切都通过图形界面 prunmgr 配置(检查 此答案 用于截图).

You are using Windows, so you are probably using Procrun (Commons Daemon/Tomcat Monitor) to start Tomcat as a Windows service. Procrun doesn't use the *.bat files at all, everything is configured through the graphical interface prunmgr (check this answer for screenshots).

很遗憾,您无法通过图形界面配置环境变量,因此:

Unfortunately you can't configure environment variables through the graphical interface, so either:

  • 将环境变量全局(适用于所有用户)添加到您的系统中,

  • add the environment variable globally (for all users) to your system,

或者将环境变量添加到 procrun:

or add the environment variable to procrun either:

  • 运行
Tomcat10.exe update "++Environment=C:\ehour"

(Tomcat10.exe是procrun的拷贝,在Tomcat安装的bin目录下),

  • 向 Windows 注册表项 HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Apache Software Foundation\Procrun 2.0\\Parameters 添加一个名为 Environment 的新值,类型 REG_MULTI_SZ 带有数据 EHOUR_HOME=C:\ehour.
  • (Tomcat10.exe is a copy of procrun and is in the bin directory of Tomcat's installation),

  • add to the windows registry key HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Apache Software Foundation\Procrun 2.0\<service_name>\Parameters a new value named Environment of type REG_MULTI_SZ with data EHOUR_HOME=C:\ehour.
  • EHOUR_HOME 配置参数实际上有三个不同的来源(参见 UtilEnvInitListener),按以下顺序查找:

    There are actually three different sources for the EHOUR_HOME configuration parameter (cf. EhourHomeUtil and EnvInitListener), which are looked up in this order:

    1. Java 系统属性 EHOUR_HOME,您可以在例如配置$CATALINA_BASE/conf/catalina.properties,
    2. 操作系统环境变量 EHOUR_HOME,按上述配置,
    3. servlet上下文初始化参数EHOUR_HOME,可以在适当的上下文文件:
    1. the Java system property EHOUR_HOME, which you can configure in e.g. $CATALINA_BASE/conf/catalina.properties,
    2. the OS environment variable EHOUR_HOME, configured as explained above,
    3. the servlet context init parameter EHOUR_HOME, which can be configured in the appropriate context file:
    <Parameter name="EHOUR_HOME" value="/path/to/ehour" />
    

    这篇关于在 Apache Tomcat 中部署 eHour的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

    08-13 00:53