2013-02-25 116 views
1

添加https對tomcat的支持後。我不能運行該應用程序Tomcat安全約束不起作用

我的web.xml配置

<display-name>EBaySignin</display-name> 
<welcome-file-list> 
    <welcome-file>credentials.jsp</welcome-file> 
</welcome-file-list> 
<security-constraint> 
    <web-resource-collection> 
     <web-resource-name>All Access</web-resource-name> 
     <url-pattern>/*</url-pattern> 
     <http-method>GET</http-method> 
     <http-method>POST</http-method> 
    </web-resource-collection> 
    <user-data-constraint> 
     <transport-guarantee>CONFIDENTIAL</transport-guarantee> 
    </user-data-constraint> 
</security-constraint> 

(Tomcat)的server.xml中配置:

<!-- 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" SSLEnabled="true" 
       maxThreads="150" scheme="https" secure="true" 
     keystoreFile="/Users/ArunAbraham/.keystore" keystorePass="password" 
     protocol="org.apache.coyote.http11.Http11NioProtocol" 
       clientAuth="false" sslProtocol="TLS" /> 

現在我已經無法訪問應用程序,我收到一個錯誤:無法連接到服務器。我可能會錯過什麼? ("https://localhost:8443/EBaySignin/")

回答

0

有幾件事情可能是錯的。 也可以更具體地說明錯誤並檢查服務器日誌。 可能的問題:

  1. 檢查密鑰庫文件的路徑,密碼和內容。 它需要一個SSL條目,通過匹配主機名來標識服務器。
  2. 最初移除「web.xml」安全約束。 首先讓SSL在端口8443上工作,然後在SSL工作後重新添加SSL。
  3. 確保客戶端可以通過端口8443上的網絡到達服務器。
  4. 回到Tomcat SSL設置的每個點。 我已經使用了很多次,它的工作原理。 http://tomcat.apache.org/tomcat-6.0-doc/ssl-howto.html
+0

我沒有檢查聲明,SSL工作正常。但是,一旦我添加聲明,這些應用程序都不起作用。即使是非安全的人也不會工作。它只是給了HTTP 404錯誤。 – 2013-02-25 01:09:28

+0

我能夠訪問此https:// localhost:8443,但我無法訪問該Web應用程序,我收到服務器未找到錯誤(404)。 – 2013-02-25 01:24:14

+0

好的,所以SSL不是問題。所以現在到了安全限制。再次檢查如何實現的基本文檔,但檢查「web.xml」中條件的URL模式,並且如果使用基於角色的安全性,則安全角色名稱與設置的內容匹配在接收方。請記住,元素阻止未經授權的用戶進入應用程序,因此他們必須被授權(用戶/密碼),他們的角色,檢查等。 – 2013-02-25 01:42:12