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

余生颓废 提交于 2020-03-18 06:23:53

问题


I see the following warning while starting the jetty9 server as service. 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. See documentation at http://www.eclipse.org/jetty/documentation/current/startup.html


回答1:


Jetty recommends to run instances of Jetty not from jetty.home distribution folder directly but from jetty.base folder which should be defined separatedly

1. See the chapter Declaring Jetty Base here:

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.

The Jetty start.jar and XML files always assume that both ${jetty.home} and ${jetty.base} are defined when starting Jetty.

You can opt to manually define the ${jetty.home} and ${jetty.base} directories, such as this:

 [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}.

 [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.

2. ... and Creating a new Jetty Base here:

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. 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'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:

 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; copies a demo webapp to be deployed:

 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


来源:https://stackoverflow.com/questions/30257978/jetty9-jetty-is-not-running-from-a-separate-jetty-base

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!