Warning logs 2024-03-26

news2025/1/25 4:45:34

配置tomcat中的server.xml时遇到问题,会导致tomcat启动闪退。

server.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.
-->
<!-- 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" />
  <!-- 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
         Java AJP  Connector: /docs/config/ajp.html
         APR (HTTP/AJP) Connector: /docs/apr.html
         Define a non-SSL/TLS HTTP/1.1 Connector on port 8080
    -->
    <Connector port="80" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="443"
               maxParameterCount="1000"
               />
    <!-- A "Connector" using the shared thread pool-->
    <!--
    <Connector executor="tomcatThreadPool"
               port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443"
               maxParameterCount="1000"
               />
    -->
    <!-- Define an SSL/TLS HTTP/1.1 Connector on port 8443
         This connector uses the NIO implementation. The default
         SSLImplementation will depend on the presence of the APR/native
         library and the useOpenSSL attribute of the AprLifecycleListener.
         Either JSSE or OpenSSL style configuration may be used regardless of
         the SSLImplementation selected. JSSE style configuration is used below.
    -->
    <!--
    <Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
               maxThreads="150" SSLEnabled="true"
               maxParameterCount="1000"
               >
        <SSLHostConfig>
            <Certificate certificateKeystoreFile="conf/localhost-rsa.jks"
                         type="RSA" />
        </SSLHostConfig>
    </Connector>
    -->
    <!-- Define an SSL/TLS HTTP/1.1 Connector on port 8443 with HTTP/2
         This connector uses the APR/native implementation which always uses
         OpenSSL for TLS.
         Either JSSE or OpenSSL style configuration may be used. OpenSSL style
         configuration is used below.
    -->
    <!--
    <Connector port="8443" protocol="org.apache.coyote.http11.Http11AprProtocol"
               maxThreads="150" SSLEnabled="true"
               maxParameterCount="1000"
               >
        <UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" />
        <SSLHostConfig>
            <Certificate certificateKeyFile="conf/localhost-rsa-key.pem"
                         certificateFile="conf/localhost-rsa-cert.pem"
                         certificateChainFile="conf/localhost-rsa-chain.pem"
                         type="RSA" />
        </SSLHostConfig>
    </Connector>
    -->
    
	<Connector
       protocol="org.apache.coyote.http11.Http11NioProtocol"
       port="443" maxThreads="200"
       scheme="https" secure="true" SSLEnabled="true"
       keystoreFile="conf/prosetechnologies.com.jks" keystorePass="PROSETECH2024-2025"
       clientAuth="false" sslProtocol="TLS"/>
       
    <!-- Define an AJP 1.3 Connector on port 8009 -->
    <!--
    <Connector protocol="AJP/1.3"
               address="::1"
               port="8009"
               redirectPort="8443"
               maxParameterCount="1000"
               />
    -->

    <!-- 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="home"  appBase="webapps/home"
            unpackWARs="true" autoDeploy="true">
		<Context docBase="/ipkiss/apache-tomcat-9.0.85/webapps/home" path="" reloadable="true" ></Context>
        <!-- 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="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>
    </Engine>
  </Service>
</Server>

文件中配置两处Host标签,第一处会启动webapps/home项目,第二处会启动webapps下的所有项目,这样会导致home项目启动两次。

查看 catalina.out 证明home启动了两次

26-Mar-2024 21:00:27.360 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version name:   Apache Tomcat/9.0.85
26-Mar-2024 21:00:27.362 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built:          Jan 5 2024 08:28:07 UTC
26-Mar-2024 21:00:27.363 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version number: 9.0.85.0
26-Mar-2024 21:00:27.363 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name:               Linux
26-Mar-2024 21:00:27.363 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version:            5.15.0-76-generic
26-Mar-2024 21:00:27.363 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture:          amd64
26-Mar-2024 21:00:27.363 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home:             /ipkiss/java/jdk1.8.0_192/jre
26-Mar-2024 21:00:27.363 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version:           1.8.0_192-b12
26-Mar-2024 21:00:27.363 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor:            Oracle Corporation
26-Mar-2024 21:00:27.363 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE:         /ipkiss/apache-tomcat-9.0.85
26-Mar-2024 21:00:27.363 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME:         /ipkiss/apache-tomcat-9.0.85
26-Mar-2024 21:00:27.380 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/ipkiss/apache-tomcat-9.0.85/conf/logging.properties
26-Mar-2024 21:00:27.380 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
26-Mar-2024 21:00:27.380 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
26-Mar-2024 21:00:27.382 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
26-Mar-2024 21:00:27.382 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dorg.apache.catalina.security.SecurityListener.UMASK=0027
26-Mar-2024 21:00:27.382 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs=
26-Mar-2024 21:00:27.382 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/ipkiss/apache-tomcat-9.0.85
26-Mar-2024 21:00:27.382 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/ipkiss/apache-tomcat-9.0.85
26-Mar-2024 21:00:27.382 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/ipkiss/apache-tomcat-9.0.85/temp
26-Mar-2024 21:00:27.387 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The Apache Tomcat Native library which allows using OpenSSL was not found on the java.library.path: [/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib]
26-Mar-2024 21:00:28.118 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-80"]
26-Mar-2024 21:00:28.157 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["https-jsse-nio-443"]
26-Mar-2024 21:00:28.442 SEVERE [main] org.apache.catalina.util.LifecycleBase.handleSubClassException Failed to initialize component [Connector["https-jsse-nio-443"]]
	org.apache.catalina.LifecycleException: Protocol handler initialization failed
		at org.apache.catalina.connector.Connector.initInternal(Connector.java:1011)
		at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:127)
		at org.apache.catalina.core.StandardService.initInternal(StandardService.java:554)
		at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:127)
		at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:1039)
		at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:127)
		at org.apache.catalina.startup.Catalina.load(Catalina.java:724)
		at org.apache.catalina.startup.Catalina.load(Catalina.java:746)
		at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
		at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
		at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
		at java.lang.reflect.Method.invoke(Method.java:498)
		at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:307)
		at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:477)
	Caused by: java.lang.IllegalArgumentException: /ipkiss/apache-tomcat-9.0.85/conf/prosetechnologies.com.jks (No such file or directory)
		at org.apache.tomcat.util.net.AbstractJsseEndpoint.createSSLContext(AbstractJsseEndpoint.java:107)
		at org.apache.tomcat.util.net.AbstractJsseEndpoint.initialiseSsl(AbstractJsseEndpoint.java:71)
		at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:236)
		at org.apache.tomcat.util.net.AbstractEndpoint.bindWithCleanup(AbstractEndpoint.java:1332)
		at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:1345)
		at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:654)
		at org.apache.coyote.http11.AbstractHttp11Protocol.init(AbstractHttp11Protocol.java:75)
		at org.apache.catalina.connector.Connector.initInternal(Connector.java:1009)
		... 13 more
	Caused by: java.io.FileNotFoundException: /ipkiss/apache-tomcat-9.0.85/conf/prosetechnologies.com.jks (No such file or directory)
		at java.io.FileInputStream.open0(Native Method)
		at java.io.FileInputStream.open(FileInputStream.java:195)
		at java.io.FileInputStream.<init>(FileInputStream.java:138)
		at java.io.FileInputStream.<init>(FileInputStream.java:93)
		at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:90)
		at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:188)
		at org.apache.catalina.startup.CatalinaBaseConfigurationSource.getResource(CatalinaBaseConfigurationSource.java:118)
		at org.apache.tomcat.util.net.SSLUtilBase.getStore(SSLUtilBase.java:210)
		at org.apache.tomcat.util.net.SSLHostConfigCertificate.getCertificateKeystore(SSLHostConfigCertificate.java:237)
		at org.apache.tomcat.util.net.SSLUtilBase.getKeyManagers(SSLUtilBase.java:308)
		at org.apache.tomcat.util.net.SSLUtilBase.createSSLContext(SSLUtilBase.java:268)
		at org.apache.tomcat.util.net.AbstractJsseEndpoint.createSSLContext(AbstractJsseEndpoint.java:105)
		... 20 more
26-Mar-2024 21:00:28.446 INFO [main] org.apache.catalina.startup.Catalina.load Server initialization in [1505] milliseconds
26-Mar-2024 21:00:28.488 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
26-Mar-2024 21:00:28.489 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet engine: [Apache Tomcat/9.0.85]
26-Mar-2024 21:00:28.505 INFO [main] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive [/ipkiss/apache-tomcat-9.0.85/webapps/home.war]
26-Mar-2024 21:00:31.971 INFO [main] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.2.5.RELEASE)

2024-03-26 21:00:33.056  INFO 825386 --- [           main] com.prose.home.ServletInitializer        : Starting ServletInitializer v0.0.1-SNAPSHOT on hecs-283154 with PID 825386 (/ipkiss/apache-tomcat-9.0.85/webapps/home/WEB-INF/classes started by root in /ipkiss/apache-tomcat-9.0.85/bin)
2024-03-26 21:00:33.066  INFO 825386 --- [           main] com.prose.home.ServletInitializer        : No active profile set, falling back to default profiles: default
2024-03-26 21:00:35.673  INFO 825386 --- [           main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 2219 ms
2024-03-26 21:00:37.733  INFO 825386 --- [           main] .s.s.UserDetailsServiceAutoConfiguration : 

Using generated security password: a53c8849-b83e-43f5-a67b-e2dae34639f3

2024-03-26 21:00:37.880  INFO 825386 --- [           main] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: Ant [pattern='/static/**'], []
2024-03-26 21:00:37.975  INFO 825386 --- [           main] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: any request, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@756fd0aa, org.springframework.security.web.context.SecurityContextPersistenceFilter@7c5f244c, org.springframework.security.web.header.HeaderWriterFilter@3f31ff7a, org.springframework.web.filter.CorsFilter@1a9ea4d9, org.springframework.security.web.authentication.logout.LogoutFilter@7e7c780, org.springframework.security.web.session.ConcurrentSessionFilter@686aa9c9, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@77cfbbba, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@3be76b8d, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@59ca0db6, org.springframework.security.web.session.SessionManagementFilter@6593f4fd, org.springframework.security.web.access.ExceptionTranslationFilter@32eb46d7]
2024-03-26 21:00:38.535  INFO 825386 --- [           main] o.s.s.c.ThreadPoolTaskScheduler          : Initializing ExecutorService 'taskScheduler'
2024-03-26 21:00:38.623  INFO 825386 --- [           main] com.prose.home.ServletInitializer        : Started ServletInitializer in 6.352 seconds (JVM running for 12.065)
26-Mar-2024 21:00:38.673 INFO [main] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive [/ipkiss/apache-tomcat-9.0.85/webapps/home.war] has finished in [10,168] ms
26-Mar-2024 21:00:38.675 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/ipkiss/apache-tomcat-9.0.85/webapps/examples]
26-Mar-2024 21:00:39.013 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/ipkiss/apache-tomcat-9.0.85/webapps/examples] has finished in [338] ms
26-Mar-2024 21:00:39.013 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/ipkiss/apache-tomcat-9.0.85/webapps/docs]
26-Mar-2024 21:00:39.033 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/ipkiss/apache-tomcat-9.0.85/webapps/docs] has finished in [20] ms
26-Mar-2024 21:00:39.033 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/ipkiss/apache-tomcat-9.0.85/webapps/ROOT]
26-Mar-2024 21:00:39.052 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/ipkiss/apache-tomcat-9.0.85/webapps/ROOT] has finished in [19] ms
26-Mar-2024 21:00:39.053 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/ipkiss/apache-tomcat-9.0.85/webapps/host-manager]
26-Mar-2024 21:00:39.084 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/ipkiss/apache-tomcat-9.0.85/webapps/host-manager] has finished in [31] ms
26-Mar-2024 21:00:39.085 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/ipkiss/apache-tomcat-9.0.85/webapps/manager]
26-Mar-2024 21:00:39.114 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/ipkiss/apache-tomcat-9.0.85/webapps/manager] has finished in [28] ms
26-Mar-2024 21:00:41.769 INFO [main] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
26-Mar-2024 21:00:41.827 INFO [main] org.apache.catalina.core.ApplicationContext.log 2 Spring WebApplicationInitializers detected on classpath

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.2.5.RELEASE)

2024-03-26 21:00:42.596  INFO 825386 --- [           main] com.prose.home.ServletInitializer        : Starting ServletInitializer v0.0.1-SNAPSHOT on hecs-283154 with PID 825386 (/ipkiss/apache-tomcat-9.0.85/webapps/home/WEB-INF/classes started by root in /ipkiss/apache-tomcat-9.0.85/bin)
2024-03-26 21:00:42.605  INFO 825386 --- [           main] com.prose.home.ServletInitializer        : No active profile set, falling back to default profiles: default
26-Mar-2024 21:00:44.882 INFO [main] org.apache.catalina.core.ApplicationContext.log Initializing Spring embedded WebApplicationContext
2024-03-26 21:00:44.882  INFO 825386 --- [           main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 1952 ms
2024-03-26 21:00:46.824  INFO 825386 --- [           main] .s.s.UserDetailsServiceAutoConfiguration : 

Using generated security password: b3912e8b-a0d6-4584-b4a3-0c0421d0279f

2024-03-26 21:00:46.928  INFO 825386 --- [           main] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: Ant [pattern='/static/**'], []
2024-03-26 21:00:47.041  INFO 825386 --- [           main] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: any request, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@69b29de2, org.springframework.security.web.context.SecurityContextPersistenceFilter@77fa7d98, org.springframework.security.web.header.HeaderWriterFilter@99ee4f1, org.springframework.web.filter.CorsFilter@3627e490, org.springframework.security.web.authentication.logout.LogoutFilter@3ed71a9a, org.springframework.security.web.session.ConcurrentSessionFilter@2bcd4f3d, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@6df04f36, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@63e05408, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@321209b5, org.springframework.security.web.session.SessionManagementFilter@264c6a50, org.springframework.security.web.access.ExceptionTranslationFilter@d97c869]
2024-03-26 21:00:47.619  INFO 825386 --- [           main] o.s.s.c.ThreadPoolTaskScheduler          : Initializing ExecutorService 'taskScheduler'
2024-03-26 21:00:47.724  INFO 825386 --- [           main] com.prose.home.ServletInitializer        : Started ServletInitializer in 5.737 seconds (JVM running for 21.165)
26-Mar-2024 21:00:47.745 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-80"]
26-Mar-2024 21:00:47.786 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in [19340] milliseconds
2024-03-26 21:00:49.747  INFO 825386 --- [p-nio-80-exec-1] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2024-03-26 21:00:49.762  INFO 825386 --- [p-nio-80-exec-1] o.s.web.servlet.DispatcherServlet        : Completed initialization in 14 ms

在日志中可以看到没有报错,但如果home项目中,会开启一个端口,在第二处Host标签启动时,会出现ERROR,提示信息:端口号被占用(这里其实是因为第一处Host启动项目时,就已经占用了端口),随后tomcat会关闭。

所有在配置server.xml时,需要注意添加以下代码是否会导致端口号冲突等异常问题。

      <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>

tomcat9.0.31配置 .jks证书

第一步:将8080端口的代码修改为如下:

<!-- 将8080修改为80,端口重映射到443端口-->    
<Connector port="80" protocol="HTTP/1.1"
         connectionTimeout="20000"
         redirectPort="443" />

在server.xml中添加以下代码:

<Connector
       protocol="org.apache.coyote.http11.Http11NioProtocol"
       port="443" maxThreads="200"
       scheme="https" secure="true" SSLEnabled="true"
       keystoreFile="/path/to/***.jks" 
       keystorePass="密码"
       clientAuth="false" sslProtocol="TLS"/>

配置域名映射关系

在server.xml中添加以下代码:

       <Host name="www.xxxxxx.com" appBase="webapps/home"
            unpackWARs="true" autoDeploy="true">
		<Context docBase="/usr/local/apache-tomcat-9.0.31/webapps/home" path="" reloadable="true" ></Context>
        <!-- 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:域名 网址
  • appBase:项目的路径

Context标签

  • docBase:项目的路径
  • path: Web 应用程序的路径,如果path设置为 /app 则需要通过 www.xxxxxx.com/app 访问

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1547334.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

PHPCMS v9城市分站插件

PHPCMS自带的有多站点功能&#xff0c;但是用过的朋友都知道&#xff0c;自带的多站点功能有很多的不方便之处&#xff0c;例如站点栏目没法公用&#xff0c;每个站点都需要创建模型、每个站点都需要单独添加内容&#xff0c;还有站点必须静态化。如果你内容很多这些功能当然无…

【Frida】【Android】02_JAVA层HOOK

&#x1f6eb; 系列文章导航 【Frida】【Android】01_手把手教你环境搭建 https://blog.csdn.net/kinghzking/article/details/136986950【Frida】【Android】02_JAVA层HOOK https://blog.csdn.net/kinghzking/article/details/137008446【Frida】【Android】03_RPC https://bl…

【C语言】三种方法模拟实现 strlen 函数

前言 这篇文章将要带我们去实现模拟一个stelen()函数 首先我们要知道strlen()函数的定义 strlen()定义和用法 我们先看一下strlen在cplusplus网站中的定义 链接: 点击跳转 这里我们可以知道strlen的用法 size_t strlen ( const char * str );获取字符串长度 返回 C 字符串…

【分布式】——降级熔断限流

降级&熔断&限流 ⭐⭐⭐⭐⭐⭐ Github主页&#x1f449;https://github.com/A-BigTree 笔记仓库&#x1f449;https://github.com/A-BigTree/tree-learning-notes 个人主页&#x1f449;https://www.abigtree.top ⭐⭐⭐⭐⭐⭐ 如果可以&#xff0c;麻烦各位看官顺手点…

搭建 Apple Mac M1 stm32 开发环境

近期想学习 stm32 开发,看了些书和视频,买了开发板。开发板到了后就迫不及待的的进行尝试。由于我目前使用的电脑是 Apple M1 Pro,目前用的比较多的是 windows + keil。我先是在 mac 使用虚拟机,安装 win 环境来使用,但是我分别使用了 VMware 和 parallels desktop ,keil…

机器学习笔记(4)—逻辑回归(Logistic Regression)

文章目录 逻辑回归&#xff08;Logistic Regression&#xff09;分类问题假说表示判定边界代价函数简化的成本函数和梯度下降多类别分类&#xff1a;一对多 逻辑回归&#xff08;Logistic Regression&#xff09; 分类问题 分类问题中&#xff0c;我们要预测的变量 y y y是一…

论文阅读笔记——Rethinking Pointer Reasoning in Symbolic Execution

文章目录 前言Rethinking Pointer Reasoning in Symbolic Execution12.1、基本情况概述12.2、摘要12.3、引言12.4、方法12.4.1、基本版本12.4.1.1、内存加载和存储12.4.1.2、状态合并 12.4.2、改进12.4.2.1、地址范围选择12.4.2.2、内存清理12.4.2.3、符号化的未初始化内存12.4…

RelayAttention:让大型语言模型更高效地处理长提示符

一、前言 虽然大型语言模型 (LLM) 近年来取得了非常显著的进展&#xff0c;也在各种自然语言处理任务中展现出强大的能力。然而&#xff0c;LLM 的在实际的应用落地层面也面临着一些实际挑战&#xff0c;其中之一就是效率和成本问题&#xff0c;导致了在垂直行业实际落地的应用…

网际协议 - IP

文章目录 目录 文章目录 前言 1 . 网际协议IP 1.1 网络层和数据链路层的关系 2. IP基础知识 2.1 什么是IP地址? 2.2 路由控制 3. IP地址基础知识 3.1 IP地址定义 3.2 IP地址组成 3.3 IP地址分类 3.4 子网掩码 IP地址分类导致浪费? 子网与子网掩码 3.5 CIDR与…

笔记本如何调节亮度?笔记本亮度调节方法

对于经常长时间面对笔记本电脑的小伙伴们来说&#xff0c;屏幕亮度过暗或者过亮&#xff0c;都会对眼睛造成伤害。那么&#xff0c;我们如何调节笔记本亮度至适中呢?下面为大家介绍3种简单的调节屏幕亮度的方法&#xff0c;一起来看看吧! 笔记本亮度调节方法一&#xff1a; 1、…

【MySQL】4.MySQL日志管理与数据库的备份和恢复

备份的目的只要是为了灾难恢复&#xff0c;备份还可以测试应用&#xff0c;回滚数据&#xff0c;修改和查询历史数据&#xff0c;审计等 日志在备份、恢复中起着重要作用 一、数据库备份的重要性 在生产环境中&#xff0c;数据的安全性至关重要 任何数据丢失都可能产生严重的…

关系型数据库mysql(7)sql高级语句

目录 一.MySQL常用查询 1.按关键字&#xff08;字段&#xff09;进行升降排序 按分数排序 &#xff08;默认为升序&#xff09; 按分数升序显示 按分数降序显示 根据条件进行排序&#xff08;加上where&#xff09; 根据多个字段进行排序 ​编辑 2.用或&#xff08;or&…

centos 7 安装磐维(PanWeiDB)数据库(单机)

前置环境准备 文件系统环境要求 文件系统环境所要求的扇区必须为512bytes&#xff0c;查看方法如下&#xff1a; [rootdevops-core-highapp3-b-32 ~]#df -h /apps/ [rootdevops-core-highapp3-b-32 ~]#ll /dev/mapper/vg--docker-lvapp [rootdevops-core-highapp3-b-32 ~]#f…

Apache ActiveMQ OpenWire 协议反序列化命令执行漏洞分析 CVE-2023-46604

Apache ActiveMQ 是美国阿帕奇&#xff08;Apache&#xff09;软件基金会所研发的一套开源的消息中间件&#xff0c;它支持Java消息服务、集群、Spring Framework等。 OpenWire协议在ActiveMQ中被用于多语言客户端与服务端通信。在Apache ActiveMQ 5.18.2版本及以前&#xff0…

小程序富文本图片宽度自适应

解决这个问题 创建一个util.js文件,图片的最大宽度设置为100%就行了 function formatRichText(html) {let newContent html.replace(/\<img/gi, <img style"max-width:100%;height:auto;display:block;");return newContent; }module.exports {formatRichT…

2024-03-26 Android8.1 px30 WI-FI 模块rtl8821cu调试记录

一、kernel 驱动&#xff0c;我这里使用v5.8.1.2_35530.20191025_COEX20191014-4141这个版本&#xff0c;下载这个版本的驱动可以参考下面的文章。 2021-04-12 RK3288 Android7.1 USB wifi bluetooth 模块RTL8821CU 调试记录_rk平台rtl8821cu蓝牙调试-CSDN博客 二、Makefile文…

基于nodejs+vue考试信息报名系统python-flask-django-php

本文拟采用nodejs技术和express 搭建系统框架&#xff0c;后台使用MySQL数据库进行信息管理&#xff0c;设计开发的考试信息报名系统。通过调研和分析&#xff0c;系统拥有管理员、学生和教师三个角色&#xff0c;主要具备登录注册、个人信息修改、对系统首页、个人中心、学生管…

在项目中数据库如何优化?【MySQL主从复制(创建一个从节点复制备份数据)】【数据库读写分离ShardingJDBC(主库写,从库读)】

MySQL主从复制 MySQL主从复制介绍MySQL复制过程分成三步&#xff1a;1). MySQL master 将数据变更写入二进制日志( binary log)2). slave将master的binary log拷贝到它的中继日志&#xff08;relay log&#xff09;3). slave重做中继日志中的事件&#xff0c;将数据变更反映它自…

JS等比压缩图片方法

AI给出来的答案&#xff0c;AI真的能改变世界&#xff0c;以后程序员这个职业真的有可能不存在了。 function compressImage(image, callback) {// 创建一个 canvas 元素const canvas document.createElement(canvas);canvas.width 48;canvas.height 48;// 获取 canvas 的绘…

【学海拾贝】| 关于Python的 PEP 484规则了解:类型提示,函数注解

在实际的工厂在实际的工程代码的开发中&#xff0c;常常可以碰到这种情况 上网查了之后发现这是PEP484规则~ 文章目录 1 Type Hints for Variables&#xff08;变量在这里插入图片描述2 Function Annotations&#xff08;函数注解&#xff09;3 Type Checking Tools&#xff08…