作为debian服务启动jetty失败

问题描述:

我已经安装了jetty 9,但是我无法启动/停止它作为服务。 从命令行运行。作为debian服务启动jetty失败

[email protected]:/opt/jetty# service jetty start 
Job for jetty.service failed. See 'systemctl status jetty.service' and 'journalctl -xn' for details. 
[email protected]:/opt/jetty# systemctl status jetty.service 
● jetty.service - LSB: Jetty start script. 
    Loaded: loaded (/etc/init.d/jetty) 
    Active: failed (Result: exit-code) since Fri 2016-12-16 10:14:47 UTC; 6min ago 
    Process: 11826 ExecStart=/etc/init.d/jetty start (code=exited, status=1/FAILURE) 
Dec 16 10:14:43 backend jetty[11826]: JETTY_PID  = /var/run/jetty.pid 
Dec 16 10:14:43 backend jetty[11826]: JETTY_START = /opt/jetty/start.jar 
Dec 16 10:14:43 backend jetty[11826]: JETTY_ARGS  = --add-to-start=console-capture jetty.state=/opt/jetty/jetty.state jetty-logging.xml jetty-started.xml 
Dec 16 10:14:43 backend jetty[11826]: JAVA_OPTIONS = -Dorg.eclipse.jetty.LEVEL=DEBUG -Djetty.logging.dir=/opt/jetty/logs -Djetty.home=/opt/jetty -Djetty.base=/opt/jetty -Djava.io.tmpdir=/tmp 
Dec 16 10:14:43 backend jetty[11826]: JAVA   = /usr/bin/java 
Dec 16 10:14:43 backend jetty[11826]: RUN_CMD  = /usr/bin/java -Dorg.eclipse.jetty.LEVEL=DEBUG -Djetty.logging.dir=/opt/jetty/logs -Djetty.home=/opt/jetty -Djetty.base=/opt/jetty -Djava.io.tmpdir=/tmp -jar /opt/jetty/start.jar --add-to-st...ml jetty-started.xml 
Dec 16 10:14:47 backend jetty[11826]: Starting Jetty: FAILED Fri Dec 16 10:14:47 UTC 2016 
Dec 16 10:14:47 backend systemd[1]: jetty.service: control process exited, code=exited status=1 
Dec 16 10:14:47 backend systemd[1]: Failed to start LSB: Jetty start script.. 
Dec 16 10:14:47 backend systemd[1]: Unit jetty.service entered failed state. 
Hint: Some lines were ellipsized, use -l to show in full. 
[email protected]:/opt/jetty# 
[email protected]:/opt/jetty# ls /var/log/jetty/ 
[email protected]:/opt/jetty# 

目前使用jetty 9.3.14,因为我第一次尝试9.4.0具有相同的结果。

不能说,码头是非常有用的,告诉为什么它不想作为服​​务开始。找到了一些与file/dir拥有者相同问题的其他人。但我已经检查过了。

糟糕我发现它会根据我的意愿记录到/ opt/jetty/logs而不是/ var/logs/jetty。所以现在我有一些更多的信息.​​..

StartLog Establishing /opt/jetty/logs/start.log on Fri Dec 16 13:40:16 UTC 2016 
org.eclipse.jetty.start.graph.GraphException: Missing referenced dependency: console-capture 
     at org.eclipse.jetty.start.graph.Graph.selectNodes(Graph.java:470) 
     at org.eclipse.jetty.start.BaseBuilder.build(BaseBuilder.java:152) 
     at org.eclipse.jetty.start.Main.start(Main.java:407) 
     at org.eclipse.jetty.start.Main.main(Main.java:75) 

-Djetty.home=/opt/jetty -Djetty.base=/opt/jetty 

不要使用jetty.homejetty.base同一目录下。

作为文档和启动警告(自Jetty 9.2.0以来)告诉你。

一般建议(你会很高兴,当你做到这一点,而这一切开始变得有意义):

拆开新分配到${jetty.home}目录。

单独留下${jetty.home}目录,不要编辑它,不要重命名,不要删除东西,不要添加任何东西,不要改变任何东西。

在某处设置合适的${jetty.base}目录,确保它不以任何方式与您的${jetty.home}目录重叠。

现在将您的jetty实例完全配置在您的${jetty.base}目录中。

例子:

# Initialize a fresh base directory (only need to do this once, ever) 
$ mkdir /path/to/mybase 
$ cd /path/to/mybase 

# Prepare the jetty.base directory (this just creates directories, and adds start.d/*.ini for you) 
$ java -jar /path/to/jetty-dist/start.jar --add-to-start=http,deploy,resources,ext,jmx,requestlog,console-capture,annotations,jsp 
MKDIR : ${jetty.base}/start.d 
INFO : webapp   transitively enabled, ini template available with --add-to-start=webapp 
INFO : ext    initialized in ${jetty.base}/start.d/ext.ini 
INFO : server   transitively enabled, ini template available with --add-to-start=server 
INFO : requestlog  initialized in ${jetty.base}/start.d/requestlog.ini 
INFO : servlet   transitively enabled 
INFO : jsp    initialized in ${jetty.base}/start.d/jsp.ini 
INFO : resources  initialized in ${jetty.base}/start.d/resources.ini 
INFO : annotations  initialized in ${jetty.base}/start.d/annotations.ini 
INFO : plus   transitively enabled 
INFO : deploy   initialized in ${jetty.base}/start.d/deploy.ini 
INFO : security  transitively enabled 
INFO : jmx    initialized in ${jetty.base}/start.d/jmx.ini 
INFO : apache-jsp  transitively enabled 
INFO : console-capture initialized in ${jetty.base}/start.d/console-capture.ini 
INFO : jndi   transitively enabled 
INFO : http   initialized in ${jetty.base}/start.d/http.ini 
MKDIR : ${jetty.base}/lib 
MKDIR : ${jetty.base}/lib/ext 
MKDIR : ${jetty.base}/logs 
MKDIR : ${jetty.base}/resources 
MKDIR : ${jetty.base}/webapps 
INFO : Base directory was modified 

$ ls -F 
lib/ logs/ resources/ start.d/ webapps/ 

# Configure your jetty.base instance 
$ cp /tmp/mywebapp.war webapps/ 
$ edit start.d/http.ini 

# Start your server instance (manually) 
$ java -jar /path/to/jetty-dist/start.jar 

因为你是通过服务启动...

启动脚本,在${jetty.home}/bin/jetty.sh需要找到进入你适当/etc/目录(太多选项,一一列举出来这里)。

然后您将在您惯常的/etc/default/jetty文件中配置您的JETTY_HOMEJETTY_BASE目录。

未来,当新版本的Jetty发布时......

  1. 拆开新码头分布成新的,空的,目录,如/opt/jetty-dist-9.5.0
  2. 编辑您的/etc/default/jetty并设置JETTY_HOME=/opt/jetty-dist-9.5.0
  3. 开始码头

你不必须编辑您的${jetty.base}才能进行升级。