tomcat web项目的部署-gy

1

//启动服务的脚本

/etc/init.d/tomcat-oa-building.xml  配置脚本


export tomcatName=tomcat-oa-apkbuilding //项目名称
export JRE_HOME=/data/jdk1.8.0_92//未改动
export CATALINA_HOME=/data/tomcat-source//未改动
export CATALINA_BASE=/data/tomcat-oa-apkbuilding//存放位置

2

/data/tomcat-oa-apkbuilding复制一个其他项目进行修改

/data/tomcat-oa-apkbuilding/conf/server.xml 配置了host和war包位置等 我配置的是9172

<Connector port="9172" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
   
    <Connector port="9172" protocol="AJP/1.3" redirectPort="8443" />

------------------------------

<Host name="localhost"  appBase="/data/tomcat-oa-apkbuilding/webapps/apkbuilding-ui"
            unpackWARs="true" autoDeploy="true">

        
<Context docBase="/data/tomcat-oa-apkbuilding/webapps/apkbuilding-ui.war" path="/" reloadable="true"/>

3

/data/conf/apkbuilding.oa.gyyx.cn/放置了项目用到的配置文件 链接数据库配置参数等


其它

为了可以在服务器上和本机测试时使用不同的路径。

web.xml中 development代表本地,上传时改为production

<context-param>
 <param-name>spring.profiles.active</param-name>
 <param-value>development</param-value>
</context-param>

--------------------------------------------------------------------------

spring-root.xml中添加配置

<beans profile="development">
<bean id="propertyConfig"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>file:D:/DataConfig/sqlServer.properties</value>
<value>file:D:/DataConfig/apkBuildingValues.properties</value>
</list>
</property>
</bean>
</beans> 
<beans profile="production">
<bean id="propertyConfig"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>file:/data/conf/apkbuilding.oa.gyyx.cn/sqlServer.properties</value>
<value>file:/data/conf/apkbuilding.oa.gyyx.cn/apkBuildingValues.properties</value>
</list>
</property>
</bean>
</beans>

--------------------------------------------------------------------------------------------------

以上配置开始没有问题,后来在java代码通过注解获取apkBuildingValues.properties属性时获取不到
@Value("${apk.building.resources.path}")
protected String resourcesPath;

我的理解是在java代码中获取需要context相关。

在servlet.xml添加,配置之后可以了

<beans:beans profile="development">
<!-- <context:property-placeholder location="file:D:/DataConfig/sqlServer.properties"/> -->
<context:property-placeholder location="file:D:/DataConfig/apkBuildingValues.properties"/>
</beans:beans>
<beans:beans profile="production">
<context:property-placeholder location="file:/data/conf/apkbuilding.oa.gyyx.cn/apkBuildingValues.properties"/>
<!-- <context:property-placeholder location="file:/data/conf/mobile.oa.gyyx.cn/sqlServer.properties"/> -->
</beans:beans>


/data/conf/apkbuilding.oa.gyyx.cn/放置了项目用到的配置文件

重启服务

切换到/data/init.d/   执行 ./tomcat-oa-apkbuilding restart
service tomcat-oa-apkbuilding-10 start

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值