您的位置:首页 > 运维架构 > Tomcat

win10 下eclipse tomcat 热部署问题?

2016-12-30 10:33 369 查看

前言:

问题的描述:

用的环境是maven,java,tomcat,win10

tomcat server配置如下



项目发布之后,修改jsp,报错,错误详情如下:



解决办法。勾选server options中的前两个复选框



一、配置

默认前两个是没有勾选的,应该勾选上:





在Cotext节点中有一个reloadable='true'属性,将它改为false,可以在修改java文件后不用重启服务器即可生效,但是不包括新建java文件、添加方法和变量的操作


为了在开发时,让tomcat能够自动重新加载,我们修改过的代码和配置,需要对Tomcat的context.xml文件进行设置。

在<context>标签中,加上reloadable属性,并且将值设为true

<Context reloadable="true">

<!--注意: reloadable设为true,目的是为了方便开发阶段, 它会影响tomcat性能;当在正式部署服务时,需要改成false -->

二、浏览文件

如果勾选第二个就会在Context节点单独生成的文件:




三、原因

1.勾选第一个是为了防止出现警告:


警告: A docBase D:/Tomcat/webapps/Shop inside the host appBase has been specified, and will be ignored


勾选后表示让tomcat直接使用eclipse中的WebContent下的东西
省去publish到<workspace>.metadata.pluginsorg.eclipse.wst.server.coretmp0webapps
并将tmp0webapps下相关的resources删除,
同时会修改<workspace>.metadata.pluginsorg.eclipse.wst.server.coreservers.xml中的serveModulesWithoutPublish=true以及tmp0/conf/server.xml中的<Context>配置

2.勾选第二个是为了防止出现警告:


警 告: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.j2ee.server:strut2demo' did not find a matching property.


[SetPropertiesRule]警告的原因是Tomcat6.0以上的server.xml的context节点中不再支持source属性了。具体说明如下:


For Tomcat 6, unlike Tomcat 4.x, it is NOT recommended to place <Context> elements directly in the server.xml file. This is because it makes modifying the Context configuration more invasive since the main conf/server.xml file cannot be reloaded without restarting Tomcat.



内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐