2 fireboy9897 fireboy9897 于 2014.08.14 10:50 提问

tomcat6 http 能正常访问 https 报404错误

同url http能正常访问 https不能访问 报404错误
如:http://localhost/index.index 正常 https://localhost/index.html 为404
服务器环境:linux ,tomcat 6.0.36, jdk 1.6.0_37 64-Bit
本机模拟配置一切正常。推断可能服务器环境存在问题,求大神指出
server.xml
<?xml version='1.0' encoding='utf-8'?>

<!--APR library loader. Documentation at /docs/apr.html -->

<!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->

<!-- Prevent memory leaks due to use of particular java/javax APIs-->

<!-- JMX Support for the Tomcat server. Documentation at /docs/non-existent.html -->

<!-- Global JNDI resources
Documentation at /docs/jndi-resources-howto.html
-->

<!-- Editable user database that can also be used by
UserDatabaseRealm to authenticate users
-->
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" />

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

<!--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="80" protocol="HTTP/1.1" 
           connectionTimeout="20000" 
           redirectPort="8443" />
<Connector port="443" protocol="org.apache.coyote.http11.Http11Protocol" SSLEnabled="true" maxThreads="150" scheme="https"

secure="true" clientAuth="false" sslProtocol="TLS" keystoreFile="/home/cer/shcmctstore.jks"
keystorePass="12345678" truststoreFile="/home/cer/shcmctkeystore.jks" truststorePass="12345678" />

<!-- A "Connector" using the shared thread pool-->
<!--
<Connector executor="tomcatThreadPool"
           port="80" protocol="HTTP/1.1" 
           connectionTimeout="20000" 
           redirectPort="8443" />
-->           
<!-- Define a SSL HTTP/1.1 Connector on port 8443
     This connector uses the JSSE configuration, when using APR, the 
     connector should be using the OpenSSL style configuration
     described in the APR documentation -->
<!--
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
           maxThreads="150" 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"/>
  -->        

  <!-- The request dumper valve dumps useful debugging information about
       the request and response data received and sent by Tomcat.
       Documentation at: /docs/config/valve.html -->
  <!--
  <Valve className="org.apache.catalina.valves.RequestDumperValve"/>
  -->

  <!-- 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"/>

  <!-- Define the default virtual host
       Note: XML Schema validation will not work with Xerces 2.2.
   -->
  <Host name="localhost"  appBase="webapps"
        unpackWARs="true" autoDeploy="true"
        xmlValidation="false" xmlNamespaceAware="false">

    <!-- 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 -->
    <!--
    <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"  
           prefix="localhost_access_log." suffix=".txt" pattern="common" resolveHosts="false"/>
    -->

  </Host>
</Engine>



connectionTimeout="20000"
redirectPort="8443" />

resourceName="UserDatabase"/>
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">



tomcat启动log

Aug 14, 2014 10:34:43 AM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/java/jdk1.6.0_37/jre/lib/amd64/server:/usr/java/jdk1.6.0_37/jre/lib/amd64:/usr/java/jdk1.6.0_37/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
Aug 14, 2014 10:34:43 AM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-80
Aug 14, 2014 10:34:43 AM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-443
Aug 14, 2014 10:34:43 AM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-12345
Aug 14, 2014 10:34:43 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 591 ms
Aug 14, 2014 10:34:43 AM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Aug 14, 2014 10:34:43 AM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.36
Aug 14, 2014 10:34:43 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory ROOT
INFO [main] 10:34:44,364 (ContextLoader.java:189): -Root WebApplicationContext: initialization started
INFO [main] 10:34:44,391 (AbstractApplicationContext.java:411): -Refreshing org.springframework.web.context.support.XmlWebApplicationContext@7c33788d: display name [Root WebApplicationContext]; startup date [Thu Aug 14 10:34:44 CST 2014]; root of context hierarchy
INFO [main] 10:34:44,443 (XmlBeanDefinitionReader.java:323): -Loading XML bean definitions from class path resource [applicationContext.xml]
INFO [main] 10:34:44,627 (AbstractApplicationContext.java:426): -Bean factory for application context [org.springframework.web.context.support.XmlWebApplicationContext@7c33788d]: org.springframework.beans.factory.support.DefaultListableBeanFactory@79024994
INFO [main] 10:34:44,700 (DefaultListableBeanFactory.java:414): -Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@79024994: defining beans [org.springframework.context.annotation.CommonAnnotationBeanPostProcessor#0,dataSource,transactionManager,sqlMapClient,sqlMapClientTemplate,baseService,infoDao,infoService,index,companyNews,phoneNumber,services,businessNews,partyNews,aboutCompany,pictureNews,businessHire,troubleshooting,companyCer,managementCer,honor,GMWord,orgChart,performance,notice,employeeNews,managerDao,managerService,manager,fileUpload,viewContent,appsOfComp]; root of factory hierarchy
INFO [main] 10:34:44,894 (ContextLoader.java:209): -Root WebApplicationContext: initialization completed in 528 ms
INFO [main] 10:34:44,996 (CommonsLogger.java:31): -Parsing configuration file [struts-default.xml]
INFO [main] 10:34:50,728 (CommonsLogger.java:31): -Parsing configuration file [struts-plugin.xml]
INFO [main] 10:34:50,741 (CommonsLogger.java:31): -Parsing configuration file [struts.xml]
INFO [main] 10:34:50,797 (CommonsLogger.java:31): -Initializing Struts-Spring integration...
INFO [main] 10:34:50,797 (CommonsLogger.java:31): -Setting autowire strategy to name
INFO [main] 10:34:50,798 (CommonsLogger.java:31): -... initialized Struts-Spring integration successfully
Aug 14, 2014 10:34:51 AM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-80
Aug 14, 2014 10:34:51 AM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-443
Aug 14, 2014 10:34:51 AM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina1
Aug 14, 2014 10:34:51 AM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.36
Aug 14, 2014 10:34:51 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory ota
Aug 14, 2014 10:34:51 AM org.apache.catalina.core.ApplicationContext log
INFO: Set web app root system property: 'webapp.root' = [/usr/apache-tomcat-6.0.36/webapps1/ota/]
Aug 14, 2014 10:34:51 AM org.apache.catalina.core.ApplicationContext log
INFO: Initializing log4j from [classpath:log4j.properties]
Aug 14, 2014 10:34:51 AM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
Aug 14, 2014 10:34:54 AM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'dispatcher'
Aug 14, 2014 10:34:55 AM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-12345
Aug 14, 2014 10:34:55 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 11514 ms

2个回答

hinatarx
hinatarx   2014.08.16 19:02

这个是因为你的tomcat服务器还没有配置的原因吧!推荐看一下这篇文章http://wang153723482.blog.163.com/blog/static/1186498452012102162220245/

大体就是把server.xml文件中原有的这段配置改下
secure="true" clientAuth="false" sslProtocol="TLS" keystoreFile="/home/cer/shcmctstore.jks"
keystorePass="12345678" truststoreFile="/home/cer/shcmctkeystore.jks" truststorePass="12345678" />

fjgcxygmxxyx
fjgcxygmxxyx   2015.11.03 09:06

请问楼主解决这个问题了吗?我也遇到同样的问题了,求解决方案

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!