精华内容
下载资源
问答
  • tomcat指定配置文件路径方法
    千次阅读
    2019-09-27 03:42:55

    1.在catalina.sh 中设置JAVA_OPTS,例如:

    JAVA_OPTS='-server -Xms1024m -Xmx1024m -XX:NewSize=128m -XX:MaxPermSize=256m -XX:MaxDirectMemorySize=256m -XX:+UseConcMarkSweepGC -XX:+UseCMSCompactAtFullCollection -XX:CMSFullGCsBeforeCompaction=5 -Dglobal.config.path=/temp/www/config/ 

    2.在setclasspath.sh中添加:

    export CLASSPATH=/temp/www/config:$CLASSPATH

     

    转载于:https://www.cnblogs.com/davidwang456/p/6277065.html

    更多相关内容
  • 主要介绍了Springboot内置tomcat配置虚拟路径过程解析,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
  • tomcat配置虚拟路径保存访问图片, 一些项目中往往需要上传一些图片文件之类,一般不建议直接保存在数据库内,往往是讲图片等资源保存在服务器的某个文件夹下
  • tomcat如何配置文件读取路径

    千次阅读 2017-10-23 09:23:03
    第一步:在WebContent下...第二步:如何读取文件路径并加载 String Basepath = Test.class.getResource("/").getPath().substring(0, Test.class.getResource("/").getPath().indexOf("WEB-INF"))+File.separator +"con

    第一步:在WebContent下创建你的配置文件夹,我这里起名为conf
    这里写图片描述

    第二步:如何读取文件路径并加载

     String Basepath = Test.class.getResource("/").getPath().substring(0, Test.class.getResource("/").getPath().indexOf("WEB-INF"))+File.separator +"conf"+File.separator;
     String testPath= Basepath +"test.txt";
    展开全文
  • Tomcat配置文件—配置访问指定路径下的项目 <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distribute

    Tomcat配置文件—配置访问指定路径下的项目
    进入tomcat的安装目录下的conf文件夹下,找到server.xml文件有vi打开
    配置项目的访问路径(事例中的项目为maven项目的路径)

    <?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.
    -->
    <!-- Note:  A "Server" is not itself a "Container", so you may not
         define subcomponents such as "Valves" at this level.
         Documentation at /docs/config/server.html
     -->
    <Server port="8005" shutdown="SHUTDOWN">
      <Listener className="org.apache.catalina.startup.VersionLoggerListener" />
      <!-- Security listener. Documentation at /docs/config/listeners.html
      <Listener className="org.apache.catalina.security.SecurityListener" />
      -->
      <!--APR library loader. Documentation at /docs/apr.html -->
      <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
      <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
      <Listener className="org.apache.catalina.core.JasperListener" />
      <!-- Prevent memory leaks due to use of particular java/javax APIs-->
      <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
      <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
      <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
    
      <!-- Global JNDI resources
           Documentation at /docs/jndi-resources-howto.html
      -->
      <GlobalNamingResources>
        <!-- Editable user database that can also be used by
             UserDatabaseRealm to authenticate users
        -->
        <Resource name="UserDatabase" auth="Container"
                  type="org.apache.catalina.UserDatabase"
                  description="User database that can be updated and saved"
                  factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
                  pathname="conf/tomcat-users.xml" />
      </GlobalNamingResources>
    
      <!-- A "Service" is a collection of one or more "Connectors" that share
           a single "Container" Note:  A "Service" is not itself a "Container",
           so you may not define subcomponents such as "Valves" at this level.
           Documentation at /docs/config/service.html
       -->
      <Service name="Catalina">
    
        <!--The connectors can use a shared executor, you can define one or more named thread pools-->
        <!--
        <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
            maxThreads="150" minSpareThreads="4"/>
        -->
    
    
        <!-- A "Connector" represents an endpoint by which requests are received
             and responses are returned. Documentation at :
             Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
             Java AJP  Connector: /docs/config/ajp.html
             APR (HTTP/AJP) Connector: /docs/apr.html
             Define a non-SSL HTTP/1.1 Connector on port 8080
        -->
        <Connector port="8080" protocol="HTTP/1.1"
                   connectionTimeout="20000"
                   redirectPort="8443" URIEncoding="UTF-8" />
        <!-- A "Connector" using the shared thread pool-->
        <!--
        <Connector executor="tomcatThreadPool"
                   port="8080" protocol="HTTP/1.1"
                   connectionTimeout="20000"
                   redirectPort="8443" />
        -->
        <!-- Define a SSL HTTP/1.1 Connector on port 8443
             This connector uses the BIO implementation that requires the JSSE
             style configuration. When using the APR/native implementation, the
             OpenSSL style configuration is required as described in the APR/native
             documentation -->
        <!--
        <Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol"
                   maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
                   clientAuth="false" sslProtocol="TLS" />
        -->
    
        <!-- Define an AJP 1.3 Connector on port 8009 -->
        <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
    
    
        <!-- An Engine represents the entry point (within Catalina) that processes
             every request.  The Engine implementation for Tomcat stand alone
             analyzes the HTTP headers included with the request, and passes them
             on to the appropriate Host (virtual host).
             Documentation at /docs/config/engine.html -->
    
        <!-- You should set jvmRoute to support load-balancing via AJP ie :
        <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
        -->
        <Engine name="Catalina" defaultHost="localhost">
    
          <!--For clustering, please take a look at documentation at:
              /docs/cluster-howto.html  (simple how to)
              /docs/config/cluster.html (reference documentation) -->
          <!--
          <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
          -->
    
          <!-- Use the LockOutRealm to prevent attempts to guess user passwords
               via a brute-force attack -->
          <Realm className="org.apache.catalina.realm.LockOutRealm">
            <!-- This Realm uses the UserDatabase configured in the global JNDI
                 resources under the key "UserDatabase".  Any edits
                 that are performed against this UserDatabase are immediately
                 available for use by the Realm.  -->
            <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
                   resourceName="UserDatabase"/>
          </Realm>
    
          <Host name="baidu.liv.net"  appBase="webapps"
                unpackWARs="true" autoDeploy="true"
                xmlValidation="false" xmlNamespaceAware="false">
             <Context path="" reloadable="true" docBase="/home/workspace/live-parent/live-webapp/target/live-webapp/" />
          </Host>
    
          <Host name="admin.baidu.liv.net"  appBase="webapps"
                unpackWARs="true" autoDeploy="true"
                xmlValidation="false" xmlNamespaceAware="false">
             <Context path="" reloadable="true" docBase="/home/workspace/live-parent/live-admin/target/live-admin/" />
          </Host>
    
          <Host name="grab.baidu.net"  appBase="webapps"
                unpackWARs="true" autoDeploy="true"
                xmlValidation="false" xmlNamespaceAware="false">
             <Context path="" reloadable="true" docBase="/home/workspace/grab/target/oauth2/" />
          </Host>
    
        </Engine>
      </Service>
    </Server>
    
    

    例子2

    <?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.
    -->
    <!-- Note:  A "Server" is not itself a "Container", so you may not
         define subcomponents such as "Valves" at this level.
         Documentation at /docs/config/server.html
     -->
    <Server port="8005" shutdown="SHUTDOWN">
      <Listener className="org.apache.catalina.startup.VersionLoggerListener" />
      <!-- Security listener. Documentation at /docs/config/listeners.html
      <Listener className="org.apache.catalina.security.SecurityListener" />
      -->
      <!--APR library loader. Documentation at /docs/apr.html -->
      <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
      <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
      <Listener className="org.apache.catalina.core.JasperListener" />
      <!-- Prevent memory leaks due to use of particular java/javax APIs-->
      <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
      <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
      <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
    
      <!-- Global JNDI resources
           Documentation at /docs/jndi-resources-howto.html
      -->
      <GlobalNamingResources>
        <!-- Editable user database that can also be used by
             UserDatabaseRealm to authenticate users
        -->
        <Resource name="UserDatabase" auth="Container"
                  type="org.apache.catalina.UserDatabase"
                  description="User database that can be updated and saved"
                  factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
                  pathname="conf/tomcat-users.xml" />
      </GlobalNamingResources>
    
      <!-- A "Service" is a collection of one or more "Connectors" that share
           a single "Container" Note:  A "Service" is not itself a "Container",
           so you may not define subcomponents such as "Valves" at this level.
           Documentation at /docs/config/service.html
       -->
      <Service name="Catalina">
    
        <!--The connectors can use a shared executor, you can define one or more named thread pools-->
        <!--
        <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
            maxThreads="150" minSpareThreads="4"/>
        -->
    
    
        <!-- A "Connector" represents an endpoint by which requests are received
             and responses are returned. Documentation at :
             Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
             Java AJP  Connector: /docs/config/ajp.html
             APR (HTTP/AJP) Connector: /docs/apr.html
             Define a non-SSL HTTP/1.1 Connector on port 8080
        -->
        <Connector port="8080" protocol="HTTP/1.1"
                   connectionTimeout="20000"
                   redirectPort="8443" />
        <!-- A "Connector" using the shared thread pool-->
        <!--
        <Connector executor="tomcatThreadPool"
                   port="8080" protocol="HTTP/1.1"
                   connectionTimeout="20000"
                   redirectPort="8443" />
        -->
        <!-- Define a SSL HTTP/1.1 Connector on port 8443
             This connector uses the BIO implementation that requires the JSSE
             style configuration. When using the APR/native implementation, the
             OpenSSL style configuration is required as described in the APR/native
             documentation -->
        <!--
        <Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol"
                   maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
                   clientAuth="false" sslProtocol="TLS" />
        -->
    
        <!-- Define an AJP 1.3 Connector on port 8009 -->
        <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
    
    
        <!-- An Engine represents the entry point (within Catalina) that processes
             every request.  The Engine implementation for Tomcat stand alone
             analyzes the HTTP headers included with the request, and passes them
             on to the appropriate Host (virtual host).
             Documentation at /docs/config/engine.html -->
    
        <!-- You should set jvmRoute to support load-balancing via AJP ie :
        <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
        -->
        <Engine name="Catalina" defaultHost="localhost">
    
          <!--For clustering, please take a look at documentation at:
              /docs/cluster-howto.html  (simple how to)
              /docs/config/cluster.html (reference documentation) -->
          <!--
          <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
          -->
    
          <!-- Use the LockOutRealm to prevent attempts to guess user passwords
               via a brute-force attack -->
          <Realm className="org.apache.catalina.realm.LockOutRealm">
            <!-- This Realm uses the UserDatabase configured in the global JNDI
                 resources under the key "UserDatabase".  Any edits
                 that are performed against this UserDatabase are immediately
                 available for use by the Realm.  -->
            <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
                   resourceName="UserDatabase"/>
          </Realm>
    
          <Host name="localhost"  appBase="webapps"
                unpackWARs="true" autoDeploy="true">
    
            <!-- SingleSignOn valve, share authentication between web applications
                 Documentation at: /docs/config/valve.html -->
            <!--
            <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
            -->
    
            <!-- Access log processes all example.
                 Documentation at: /docs/config/valve.html
                 Note: The pattern used is equivalent to using pattern="common" -->
            <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
                   prefix="localhost_access_log." suffix=".txt"
                   pattern="%h %l %u %t &quot;%r&quot; %s %b" />
    
          </Host>
    
          <Host name="baidu.vicc.net"  appBase="webapps" unpackWARs="true" autoDeploy="true"
                                  xmlValidation="false" xmlNamespaceAware="false">
                   <Context path="" reloadable="true" docBase="/home/workspace/jiji/target/jiji/" />
          </Host>
        </Engine>
      </Service>
    </Server>
    
    
    展开全文
  • 配置tomcat 文件服务器路径; 打开tomcat/conf/server.xml文件: 添加文件路径 <Context path="/download" docBase="/usr/local/download"> </Context>

    配置tomcat 文件服务器路径;

    打开tomcat/conf/server.xml文件:

    添加文件路径

    <Context path="/download" docBase="/usr/local/download"> </Context>

    展开全文
  • 第一种[推荐] 在[tomcat]/conf/Catalina/localhost目录下新建一个xml文件,其中文件名为当前web应用虚拟路径, 在xml文件的内部,用<...如: game.xml配置文件 <Context docBase="g:/test...
  • 初学Tomcat,记录整理Tomcat的简介和配置文件信息
  • Tomcat配置虚拟路径不生效?tomcat 配置图片虚拟路径不起作用问题 1.前言 作为web开发人员,经常需要做一个功能,那就是上传下载。 在本地开发的时候,往往将tomcat作为服务器,那么需要设置虚拟路径,上传到...
  • 前端代码引用静态文件都是用相对路径,点点杠点点杠有没有,放到后台项目中,尤其配置域名以后,完全...首先大家都知道tomcat配置域名都在conf/server.xml文件中修改host即可。 如下是我最终成功的版本,供大家参考。
  • 所以将项目中的配置文件独立出来,tomcat中指定配置文件路径的方法如下: 在tomcat的bin目录下,在setclasspath.**添加: 说明:CLASSPATH目录即为新的配置文件指定目录 1、windows在setclasspath
  • Tomcat配置文件

    千次阅读 2019-11-17 16:42:15
    Tomcat配置文件由4个 xml 文件组成,分别是 context.xml、web.xml、server.xml、tomcat-users.xml 文件组成。
  • tomcat配置访问项目根路径

    千次阅读 2022-04-11 07:47:42
    方法一:在server.xml中做如下配置 方法二: 在tomcat的localhost中加入如下文件
  • Tomcat配置项目路径以及配置多项目

    万次阅读 2018-06-27 11:25:09
    先上配置 &amp;amp;amp;amp;amp;amp;lt;Service name=&amp;amp;amp;amp;amp;quot;servicename&amp;amp;amp;amp;amp;quot;&amp;amp;amp;amp;amp;amp;gt; &amp;amp;amp;amp;amp;amp;lt;...
  • 在个人的项目中,遇到一个需求,需要实现文件在线查看,也就是需要给前端返回文件的...简单来讲,我们通过配置一个路径,可以让tomcat收到这个路径对应的请求后不是去tomcat的目录下去找这个资源,而是找这个路径...
  • tomcat 配置虚拟路径

    千次阅读 2018-07-13 22:58:47
    当项目重新部署或者tomcat由于其他原因重启后,这些文件将会消失,势必会影响到现网的生产,所以我们需要把这些文件放到服务器的其他物理路径下,通过tomcat的server.xml 文件配置来对这个路径做映射,使其通过ip...
  • 修改Tomcat日志文件路径

    千次阅读 2019-03-15 17:59:37
    Tomcat日志文件一共有6个,分别为:catalina.2018-09-02.log、catalina.out 、host-manager.2018-09-02.log 、localhost.2018-09-02.log 、localhost_access_log.2018-09-02.txt、 manager.2018-09-02.log ...
  • Tomcat配置路径

    千次阅读 2018-10-18 21:09:21
    如何把一个项目发布到tomcat中? &gt;需求:如何能让其他的电脑访问我这台电脑上的资源。eg:stu.xml localhost:本机地址 1、拷贝这个文件到webapps/ROOT底下,在浏览器中访问:  ...
  • linux修改tomcat日志文件路径

    千次阅读 2019-07-01 19:47:45
    tomcat默认的日志文件在 logs 目录下,如果我们要修改日志文件存放路径,需要以下两个步骤 修改 tomcat 下 conf 文件夹中的 logging.properties 文件,将 ${catalina.base} 修改为你想要存放的路径 1catalina.org....
  • Tomcat配置外部资源路径

    千次阅读 2019-06-15 12:32:20
    Tomcat配置外部资源路径
  • Tomcat配置外置路径

    千次阅读 2016-07-20 08:57:38
    平时作为用户的数据不能因为...找到tomcat配置文件(\conf\server.xml)并打开 第二步: 在【host】与【/host】之间加入如下代码:【="/file"  docBase="E:\test" debug="0" reloadable="true"/>】其中:【path
  • tomcat配置上传文件的保存路径

    千次阅读 2018-07-25 20:00:35
    解决方法:通过配置Tomcta的虚拟路径,即将请求映射到实际的物理路径下,实现上传文件的保存地址和服务器的分离。 配置虚拟路径文件:Tomcat/conf/server.xml 修改文件配置: &amp;lt;Host ...
  • tomcat配置默认路径

    千次阅读 2017-08-15 16:46:44
    tomcat 默认是放在webapp目录下的...可以在tomcat 的conf/server.xml 中配置Host ,添加一个工程顶级目录,然后在tomcat 目录下添加项目名称文件夹,把项目放入新文件中;对应访问路径:www+项目名称+域名+端口即可访问
  • Tomcat配置文件信息泄露

    千次阅读 2019-10-12 09:55:16
    是由于server.xml内的appBase置空导致。 <Host name="localhost" appBase="" ...这样会导致Tomcat配置文件config下的文件信息泄露,如下图所示: 解决方法: <Host name="localhost" appBase=" " unpackW...
  • 解决| tomcat 配置访问路径不生效

    千次阅读 2020-06-22 16:35:11
    tomcat配置访问路径不生效 问题:已经在tomcat的conf/Catalina/localhost/文件夹下xml文件中修改了path为项目路径,但是浏览器访问该项目路径还是报错 解决方法:修改conf/Catalina/localhost/的xml文件名和项目名...
  • 超详细Tomcat配置文件解读

    万次阅读 2018-10-10 10:05:08
    但是由于Tomcat遵循apache开源协议,并且对当前Java开发框架开源组件Structs、Spring和Hibernate等实现完美支持,因此tomcat被众多企业用来部署配置众多的Java应用程序,实现替代一些商业的Java应用服务器。...
  • Tomcat \server.xml文件,在<HOST></HOST>间加入: <Context path="/test" docBase="C:\tstest" reloadable="true" debug="0" /> 解决办法: 以下是 Tomcat \conf\web.xml文件内容: <init-...
  • tomcat关于虚拟路径配置深入思考

    千次阅读 2018-08-30 18:25:43
    很多朋友都会很疑惑,既然我们都知道在Tomcat服务器上部署项目只要将项目打包,然后放到webapps目录下就可以了,为什么还需要配置虚拟路径?的确,把项目放到webapps目录下非常方便,至少在部署一个项目时,直接把...
  • Tomcat的虚拟路径就是通过修改Tomcat配置文件,实现将 对Tomcat的访问请求 映射到非tomcat的部署目录下。 例如:我有一个项目叫做project1,部署目录是tomcat的安装目录下的webapps目录,那么在未配置虚拟路径之前...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 243,937
精华内容 97,574
关键字:

tomcat配置文件路径