Can';t将外部应用程序部署到jetty 9.0.6.v20130930
当我通过在jetty/webapps中复制应用程序来部署应用程序时,它部署正常。但我想从外部目录部署它。为此,我创建了以下myconf.xml:Can';t将外部应用程序部署到jetty 9.0.6.v20130930,jetty,Jetty,当我通过在jetty/webapps中复制应用程序来部署应用程序时,它部署正常。但我想从外部目录部署它。为此,我创建了以下myconf.xml: <?xml version="1.0"?> <!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd"> <Configure id="myapp" class="org.ecl
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
<Configure id="myapp" class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="server">
<Ref refid="Server" />
</Set>
<Set name="contextPath">/myapp</Set>
<Set name="war">
<SystemProperty name="myapp.war" /><!-- points to the external war -->
</Set>
</Configure>
/myapp
然后,使用以下设备运行码头:
java-XX:-UseSplitVerifier-jarstart.jar myconf.xml
在控制台中,我看到应用程序正在部署,它访问db等,但当我试图访问它时,我得到了404。非常感谢您的帮助:)
向你问好,尤金 那不是你使用码头的方式 选项1:标准自动部署
myconf.xml
myapp.war
复制到${jetty.home}/webapps/
目录中myconf.xml
复制到${jetty.home}/webapps/myapp.xml
(注意名称更改)myapp.war
复制到${jetty.home}/webapps/myapp.war
(注意,此文件的基本名称应与XML相同)${jetty.home}/webapps/myapp.xml
以更改部署行为(例如:/app/1
)${jetty.home}/webapps/
以外的其他位置,您仍需要执行以下操作:
myconf.xml
复制到${jetty.home}/webapps/myconf.xml
myapp.war
放在你想要的地方。例如/opt/webapps/myapp.war
${jetty.home}/webapps/myconf.xml
以设置contextPath
和war
条目
/myapp
选项4:码头基地自动部署(在Jetty 9.1+中提供)
还有另一种技术,从Jetty 9.1开始,使用拆分${Jetty.home}
和${Jetty.base}
概念+上面的自动部署
假设您将jetty-distribution-9.1.x解包到/opt/jetty/
中,并在/opt/myapps/
中配置webapp+。您可以执行以下命令
[user]$ cd /opt/myapps
[myapps]$ java -jar /opt/jetty/start.jar --add-to-start=server,deploy,websocket,ext,resources
server initialised in ${jetty.base}/start.ini (appended)
server enabled in ${jetty.base}/start.ini
deploy initialised in ${jetty.base}/start.ini (appended)
deploy enabled in ${jetty.base}/start.ini
MKDIR: ${jetty.base}/webapps
server enabled in ${jetty.base}/start.ini
websocket initialised in ${jetty.base}/start.ini (appended)
websocket enabled in ${jetty.base}/start.ini
server enabled in ${jetty.base}/start.ini
ext initialised in ${jetty.base}/start.ini (appended)
ext enabled in ${jetty.base}/start.ini
MKDIR: ${jetty.base}/lib
MKDIR: ${jetty.base}/lib/ext
resources initialised in ${jetty.base}/start.ini (appended)
resources enabled in ${jetty.base}/start.ini
MKDIR: ${jetty.base}/resources
[myapps]$ ls -l
total 16
drwxrwxr-x 3 user group 4096 Oct 31 08:32 lib/
drwxrwxr-x 2 user group 4096 Oct 31 08:32 resources/
-rw-rw-r-- 1 user group 369 Oct 31 08:30 start.ini
drwxrwxr-x 2 user group 4096 Oct 31 08:30 webapps/
[myapps]$ cat start.ini
--module=server
threads.min=10
threads.max=200
threads.timeout=60000
jetty.dump.start=false
jetty.dump.stop=false
--module=deploy
--module=websocket
--module=ext
--module=resources
[myapps]$ java -jar /opt/jetty/start.jar --list-config | grep -E "jetty.(base|home)="
jetty.home=/opt/jetty
jetty.base=/opt/myapps
[myapps]$ cp /home/user/project/myapp/target/myapp-1.0.war /opt/myapps/webapps/myapp.war
[myapps]$ java -jar /opt/jetty/start.jar
2013-10-31 08:35:58.919:INFO:oejs.Server:main: jetty-9.1.0.RC0
2013-10-31 08:35:58.939:INFO:oejdp.ScanningAppProvider:main: Deployment monitor [file:/opt/myapps/webapps/] at interval 1
2013-10-31 08:35:59.109:INFO:oejw.StandardDescriptorProcessor:main: NO JSP Support for /myapp, did not find org.apache.jasper.servlet.JspServlet
2013-10-31 08:35:59.189:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@223ff173{/myapp,file:/tmp/jetty-myapp.war-_myapp-any-/webapp/,AVAILABLE}{/myapp.war}
您会注意到,您有两个位置可以使用
-您的jetty发行版所在的位置${jetty.home}
-应用程序的特定配置和WAR所在的位置${jetty.base}
这是一个非常强大的选项,我只触及了它功能的表面。你确定我不能避免将war复制到${jetty.home}/webapps/?那么WebAppContext的war属性的用途是什么?您提供的链接(配置特定的WebApp部署)暗示外部war位置(/opt/myapp/myapp.war)会更新额外问题的答案。