码迷,mamicode.com
首页 > 编程语言 > 详细

SpringMVC+Maven+tomcat配置----2.tomcat的配置

时间:2017-11-13 17:01:05      阅读:231      评论:0      收藏:0      [点我收藏+]

标签:配置   limit   lifecycle   except   delegate   recommend   home   java   cti   

------------ tomcat\conf\context.xml ---------------------------

 

<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
--><!-- The contents of this file will be loaded for each web application --><Context>

<!-- Default set of monitored resources -->
<WatchedResource>WEB-INF/web.xml</WatchedResource>

<!-- Uncomment this to disable session persistence across Tomcat restarts -->
<!--
<Manager pathname="" />
-->

<!-- Uncomment this to enable Comet connection tacking (provides events
on session expiration as well as webapp lifecycle) -->
<!--
<Valve className="org.apache.catalina.valves.CometConnectionManagerValve" />
-->
<!--
Caused by: java.lang.NoSuchMethodException: org.apache.catalina.deploy.WebXml addFilter
解决办法为:在tomcat目录下conf下的context.xml中添加<Loader delegate="true"/> 属性。
经过查询资料显示,该属性含义如下 。
True,表示tomcat将遵循JVM的delegate机制,即一个WebAppClassLoader在加载类文件时,会先递交给SharedClassLoader加载,SharedClassLoader无法加载成功,会继续向自己的父类委托,一直到BootstarpClassLoader,如果都没有加载成功,则最后由WebAppClassLoader自己进行加载。
False,表示将不遵循这个delegate机制,即WebAppClassLoader在加载类文件时,会优先自己尝试加载,如果加载失败,才会沿着继承链,依次委托父类加载。
-->
<Loader delegate="true"/>

</Context>

-----------------------------------------      tomcat\conf\tomcat-users.xml      -------------------------------------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
--><tomcat-users>
<!--
NOTE: By default, no user is included in the "manager-gui" role required
to operate the "/manager/html" web application. If you wish to use this app,
you must define such a user - the username and password are arbitrary. It is
strongly recommended that you do NOT use one of the users in the commented out
section below since they are intended for use with the examples web
application.
-->
<!--
NOTE: The sample user and role entries below are intended for use with the
examples web application. They are wrapped in a comment and thus are ignored
when reading this file. If you wish to configure these users for use with the
examples web application, do not forget to remove the <!.. ..> that surrounds
them. You will also need to set the passwords to something appropriate.
-->
<!--
<role rolename="tomcat"/>
<role rolename="role1"/>
<user username="tomcat" password="<must-be-changed>" roles="tomcat"/>
<user username="both" password="<must-be-changed>" roles="tomcat,role1"/>
<user username="role1" password="<must-be-changed>" roles="role1"/>
-->

<role rolename="admin-gui"/>
<role rolename="admin-script"/>
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>
<role rolename="maven"/>

<user username="admin" password="admin" roles="manager-gui,manager-script,manager-jmx,manager-status,admin-script,admin-gui,maven"/>
<user username="maven" password="123456" roles="manager-gui,manager-script,manager-jmx,manager-status,admin-script,admin-gui,maven"/>

</tomcat-users>

 

----------------------------------------  tomcat\conf\Catalina\localhost\manager.xml  -----------------------------------------

<?xml version="1.0" encoding="UTF-8"?>
<Context privileged="true" antiResourceLocking="false"
docBase="${catalina.home}/webapps/mavenDemo"
path="${catalina.home}/webapps/mavenDemo"
reloadable="true">
<Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="^.*$" />
</Context>

 

SpringMVC+Maven+tomcat配置----2.tomcat的配置

标签:配置   limit   lifecycle   except   delegate   recommend   home   java   cti   

原文地址:http://www.cnblogs.com/mzxl1987/p/7826303.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!