I want to run a JAX-RS 2.0 (Jersey) application on an embedded Tomcat (7). But I have not found an example or documentation about it.
我想在嵌入式Tomcat(7)上运行JAX-RS 2.0(Jersey)应用程序。但我还没有找到关于它的示例或文档。
How can I set up Tomcat 7 programatically and add a Servlet wrapping a JAX-RS application to it?
如何以编程方式设置Tomcat 7并添加一个包装JAX-RS应用程序的Servlet?
1 个解决方案
#1
0
If you want to start/stop Tomcat from Java environment, look at its startup scripts to see which classes are invoked. It's actually not that complex; I do this from my IntelliJ all the time. My IntelliJ startup config looks like this:
如果要从Java环境启动/停止Tomcat,请查看其启动脚本以查看调用的类。它实际上并不那么复杂;我一直都是从IntelliJ这样做的。我的IntelliJ启动配置如下所示:
Main Class: org.apache.catalina.startup.Bootstrap
主类:org.apache.catalina.startup.Bootstrap
VM parameters: -ea -cp $CLASSPATH:/path/to/tomcat/bin/bootstrap.jar -Dcatalina.base="/path/to/tomcat" -Dcatalina.home="/path/to/tomcat" -Djava.io.tmpdir="/path/to/tomcat/temp" -noverify -Xmx400M -XX:MaxPermSize=400M
VM参数:-ea -cp $ CLASSPATH:/path/to/tomcat/bin/bootstrap.jar -Dcatalina.base =“/ path / to / tomcat”-Dcatalina.home =“/ path / to / tomcat”-Djava .io.tmpdir =“/ path / to / tomcat / temp”-noverify -Xmx400M -XX:MaxPermSize = 400M
Program parameters: start
程序参数:启动
Working directory: /path/to/tomcat
工作目录:/ path / to / tomcat
If you want to stop Tomcat gracefully, the only different thing is program parameters, which is stop
.
如果你想优雅地停止Tomcat,唯一不同的是程序参数,即停止。
#1
0
If you want to start/stop Tomcat from Java environment, look at its startup scripts to see which classes are invoked. It's actually not that complex; I do this from my IntelliJ all the time. My IntelliJ startup config looks like this:
如果要从Java环境启动/停止Tomcat,请查看其启动脚本以查看调用的类。它实际上并不那么复杂;我一直都是从IntelliJ这样做的。我的IntelliJ启动配置如下所示:
Main Class: org.apache.catalina.startup.Bootstrap
主类:org.apache.catalina.startup.Bootstrap
VM parameters: -ea -cp $CLASSPATH:/path/to/tomcat/bin/bootstrap.jar -Dcatalina.base="/path/to/tomcat" -Dcatalina.home="/path/to/tomcat" -Djava.io.tmpdir="/path/to/tomcat/temp" -noverify -Xmx400M -XX:MaxPermSize=400M
VM参数:-ea -cp $ CLASSPATH:/path/to/tomcat/bin/bootstrap.jar -Dcatalina.base =“/ path / to / tomcat”-Dcatalina.home =“/ path / to / tomcat”-Djava .io.tmpdir =“/ path / to / tomcat / temp”-noverify -Xmx400M -XX:MaxPermSize = 400M
Program parameters: start
程序参数:启动
Working directory: /path/to/tomcat
工作目录:/ path / to / tomcat
If you want to stop Tomcat gracefully, the only different thing is program parameters, which is stop
.
如果你想优雅地停止Tomcat,唯一不同的是程序参数,即停止。