简体   繁体   English

Jetty9 - Jetty没有从单独的{jetty.base}运行

[英]Jetty9 - Jetty is not running from a separate {jetty.base}

I see the following warning while starting the jetty9 server as service. 启动jetty9服务器作为服务时,我看到以下警告。 I have no idea about this. 我不知道这个。

WARN:oejs.HomeBaseWarning:main: This instance of Jetty is not running from a separate {jetty.base} directory, this is not recommended. 警告:oejs.HomeBaseWarning:main:这个Jetty实例不是从单独的{jetty.base}目录运行,不建议这样做。 See documentation at http://www.eclipse.org/jetty/documentation/current/startup.html 请参阅http://www.eclipse.org/jetty/documentation/current/startup.html上的文档

Jetty recommends to run instances of Jetty not from jetty.home distribution folder directly but from jetty.base folder which should be defined separatedly Jetty建议不要直接从jetty.home分发文件夹运行Jetty实例,而是从jetty.base文件夹运行,该文件夹应该分开定义

1. See the chapter Declaring Jetty Base here: 1.请参阅此处声明Jetty Base一章:

http://www.eclipse.org/jetty/documentation/current/startup-base-and-home.html http://www.eclipse.org/jetty/documentation/current/startup-base-and-home.html

The Jetty Distribution's start.jar is the component that manages the behavior of this separation. Jetty Distribution的start.jar是管理这种分离行为的组件。

The Jetty start.jar and XML files always assume that both ${jetty.home} and ${jetty.base} are defined when starting Jetty. Jetty start.jar和XML文件总是假设在启动Jetty时定义$ {jetty.home}和$ {jetty.base}。

You can opt to manually define the ${jetty.home} and ${jetty.base} directories, such as this: 您可以选择手动定义$ {jetty.home}和$ {jetty.base}目录,例如:

 [jetty-distribution-9.3.7.v20160115]$ pwd
 /home/user/jetty-distribution-9.3.7.v20160115
 [jetty-distribution-9.3.7.v20160115]$ java -jar start.jar \
     jetty.home=/home/user/jetty-distribution-9.3.7.v20160115 \
     jetty.base=/home/user/my-base 2013-10-16 09:08:47.802:INFO:oejs.Server:main: jetty-9.3.7.v20160115 2013-10-16
 09:08:47.817:INFO:oejdp.ScanningAppProvider:main: Deployment monitor
 [file:/home/user/my-base/webapps/] at interval 1 ...

Or you can declare one directory and let the other one be discovered. 或者,您可以声明一个目录,然后发现另一个目录。

The following example uses default discovery of ${jetty.home} by using the parent directory of wherever start.jar itself is, and a manual declaration of ${jetty.base}. 以下示例使用start.jar本身所在位置的父目录以及$ {jetty.base}的手动声明来使用$ {jetty.home}的默认发现。

 [jetty-distribution-9.3.7.v20160115]$ pwd
 /home/user/jetty-distribution-9.3.7.v20160115
 [jetty-distribution-9.3.7.v20160115]$ java -jar start.jar
 jetty.base=/home/user/my-base 2013-10-16
 09:08:47.802:INFO:oejs.Server:main: jetty-9.3.7.v20160115 2013-10-16
 09:08:47.817:INFO:oejdp.ScanningAppProvider:main: Deployment monitor
 [file:/home/user/my-base/webapps/] at interval 1 ...

But Jetty recommends that you always start Jetty by sitting in the directory that is your ${jetty.base} and starting Jetty by referencing the start.jar remotely. 但Jetty建议您始终通过坐在$ {jetty.base}目录中启动Jetty,并通过远程引用start.jar启动Jetty。

2. ... and Creating a new Jetty Base here: 2. ...并在这里创建一个新的码头基地

http://www.eclipse.org/jetty/documentation/current/quickstart-running-jetty.html http://www.eclipse.org/jetty/documentation/current/quickstart-running-jetty.html

The demo-base directory described above is an example of the jetty.base mechanism added in Jetty 9.1. 上面描述的demo-base目录是Jetty 9.1中添加的jetty.base机制的一个例子。 A jetty base allows the configuration and web applications of a server instance to be stored separately from the jetty distribution, so that upgrades can be done with minimal disruption. jetty base允许将服务器实例的配置和Web应用程序与jetty分发分开存储,以便可以在最小的中断的情况下完成升级。 Jetty's default configuration is based on two properties: jetty.home The property that defines the location of the jetty distribution, its libs, default modules and default XML files (typically start.jar, lib, etc) jetty.base The property that defines the location of a specific instance of a jetty server, its configuration, logs and web applications (typically start.ini, start.d, logs and webapps) The jetty.home and jetty.base properties may be explicitly set on the command line, or they can be inferred from the environment if used with commands like: Jetty的默认配置基于两个属性:jetty.home定义jetty分发位置的属性,其libs,默认模块和默认XML文件(通常是start.jar,lib等)jetty.base定义该属性的属性jetty服务器的特定实例的位置,其配置,日志和Web应用程序(通常是start.ini,start.d,logs和webapps)可以在命令行上显式设置jetty.home和jetty.base属性,或者如果与以下命令一起使用,可以从环境中推断出它们:

 cd $JETTY_BASE
 java -jar $JETTY_HOME/start.jar

The following commands: create a new base directory; 以下命令:创建新的基目录; enables a HTTP connector and the web application deployer; 启用HTTP连接器和Web应用程序部署程序; copies a demo webapp to be deployed: 复制要部署的演示webapp:

 JETTY_BASE=/tmp/mybase
 mkdir $JETTY_BASE
 cd $JETTY_BASE
 java -jar $JETTY_HOME/start.jar
WARNING: Nothing to start, exiting ...

Usage: java -jar start.jar [options] [properties] [configs]
       java -jar start.jar --help  # for more information

> java -jar $JETTY_HOME/start.jar --add-to-startd=http,deploy
INFO: server          initialised (transitively) in ${jetty.base}/start.d/server.ini
INFO: http            initialised in ${jetty.base}/start.d/http.ini
INFO: security        initialised (transitively) in ${jetty.base}/start.d/security.ini
INFO: servlet         initialised (transitively) in ${jetty.base}/start.d/servlet.ini
INFO: webapp          initialised (transitively) in ${jetty.base}/start.d/webapp.ini
INFO: deploy          initialised in ${jetty.base}/start.d/deploy.ini
MKDIR: ${jetty.base}/webapps
INFO: Base directory was modified
> cp $JETTY_HOME/demo-base/webapps/async-rest.war webapps/ROOT.war
> java -jar $JETTY_HOME/start.jar
2015-06-04 11:10:16.286:INFO::main: Logging initialized @274ms
2015-06-04 11:10:16.440:INFO:oejs.Server:main: jetty-9.3.0.v20150601
2015-06-04 11:10:16.460:INFO:oejdp.ScanningAppProvider:main: Deployment monitor [file:///tmp/mybase/webapps/] at interval 1
2015-06-04 11:10:16.581:WARN::main: async-rest webapp is deployed. DO NOT USE IN PRODUCTION!
2015-06-04 11:10:16.589:INFO:oejw.StandardDescriptorProcessor:main: NO JSP Support for /, did not find org.eclipse.jetty.jsp.JettyJspServlet
2015-06-04 11:10:16.628:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@1a407d53{/,[file:///tmp/jetty-0.0.0.0-8080-ROOT.war-_-any-4510228025526425427.dir/webapp/, jar:file:///tmp/jetty-0.0.0.0-8080-ROOT.war-_-any-4510228025526425427.dir/webapp/WEB-INF/lib/example-async-rest-jar-9.3.0.v20150601.jar!/META-INF/resources],AVAILABLE}{/ROOT.war}
2015-06-04 11:10:16.645:INFO:oejs.ServerConnector:main: Started ServerConnector@3abbfa04{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
2015-06-04 11:10:16.646:INFO:oejs.Server:main: Started @634ms

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM