2013-02-25 115 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