发表于: 2020-05-17 23:36:13
1 1384
今天完成的事情:
1. 服务器安装 jetty 并部署服务。
wget 下载 jetty 的压缩包到服务器上,
解压:
tar xf jetty-distribution-9.4.28.v20200408.zip
复制到安装路径:
cp jetty-distribution-9.4.28 /usr/local/jetty
上传到目录:
/usr/local/jetty/webapps/RestfulSpringMVC.war
开启服务:
/usr/local/jetty/bin/jetty.sh start
然后就能在浏览器打开网页了,但是这个时候只能在端口后面带上项目名来访问。
想要解决这个问题就需要在 webapps 下面添加一个与 war 包同名的 xml 文件,我的 war 包名为:RestfulSpringMVC.war
对应的 RestfulSpringMVC.xml 文件内容如下:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath">/</Set>
<Set name="war">/usr/local/jetty/webapps/RestfulSpringMVC.war</Set>
</Configure>
遇到的问题:
1. jetty 下我没设置好自动跳转 index.jsp
2. resin 部署 war 失败
resin 安装:
从官网 wget 下载压缩包
解压:
tar xf resin-4.0.64.tar.gz
安装 gcc:
yum install gcc -y
进目录开始安装:
cd resin-4.0.64
./configure --prefix=/usr/local/resin --with-java-home=/usr/local/java/jdk1.8.0_202
(这个时候有的机器可能会报错缺少 opelssl 组件,安装就是了)
yum install openssl openssl-devel -y
接着安装:
make
make install
开启 resin,有两种方式:
(a)/etc/init.d/resin start
(b)/usr/local/resin/bin/resin.sh start
这个时候可以看到 hello page 是没有问题的。
然后我开始修改 resin 配置
nano /usr/local/resin/conf/resin.xml
<!-- the default host, matching any host name -->
<host id="" root-directory=".">
<!--
- webapps can be overridden/extended in the resin.xml
-->
<web-app id="/" root-directory="webapps/RestfulSpringMVC"/>
</host>
上传 war 包:
/usr/local/resin/webapps/RestfulSpringMVC.war
重启 resin:
/etc/init.d/resin restart
然后我就打不开页面了···
今天又折腾这个折腾了一天。
评论