我已经在我的机器上安装了Tomcat,运行良好。 我可以login到pipe理经理。 我已经部署了一个.war文件,可以在Tomcatpipe理器上查看。 该文件的名称是shim (实际上我正在安装freeshim )。
当我尝试使用192.168.1.65:8080/shim访问浏览器上的Shim时,我得到了shim的Webpipe理界面。 这是我得到的消息:
这是FreeSHIM的Webpipe理界面。 Web服务位于“这里”。
当我点击“这里”为了我configurationFreeshim我得到一个错误:
HTTP状态403 – 访问请求的资源已被拒绝。
我哪里错了? 我怎样才能改变这个权限?
HTTP状态403(对请求的资源的访问已被拒绝)可能表示您input了3+不正确的凭据(尝试另一个Web浏览器),或者您在configuration方面有问题。
如果您没有更改任何configuration文件,请检查安装文件conf/tomcat-users.xml ( locate tomcat-users.xml )。 该文件必须包含允许您使用Tomcat webapp的凭据。
例如,要将manager-guiangular色添加到名为tomcat的用户名为s3cret的密码,请将以下内容添加到上面列出的configuration文件中:
<role rolename="manager-gui"/> <user username="tomcat" password="s3cret" roles="manager-gui"/>
然后你可以从/manager/html访问你的webappspipe理/manager/html (例如,在configuration更改后重新加载)。
阅读更多: 经理应用程序如何
如果你试图实现你自己的安全约束(在web.xml ),请尝试下面的例子(在</web-app>结束之前):
<!-- This security constraint protects your webapp interface. --> <login-config> <!-- Define the Login Configuration --> <auth-method>BASIC</auth-method> <realm-name>Webapp</realm-name> </login-config> <security-constraint> <web-resource-collection> <web-resource-name>Admin</web-resource-name> <url-pattern>/*</url-pattern> <http-method>GET</http-method> <http-method>POST</http-method> </web-resource-collection> <auth-constraint> <role-name>*</role-name> </auth-constraint> <!-- Specifying a Secure Connection --> <user-data-constraint> <!-- transport-guarantee can be CONFIDENTIAL (forced SSL), INTEGRAL, or NONE --> <transport-guarantee>NONE</transport-guarantee> </user-data-constraint> </security-constraint> <!-- Authorization, see: tomcat-users.xml --> <security-role> <role-name>*</role-name> </security-role>
如果仍有问题,请尝试:
catalina.sh configtest或xmlstarlet val /etc/tomcat?/*.xml /var/lib/tomcat7/webapps/*/WEB-INF/*.xml , <url-pattern>匹配你的<security-constraint>或设置为/* , /var/log/tomcat7 ), logging.properties或log4j.properties (INFO,SEVERE,WARNING,INFO,CONFIG,FINE,FINER,FINEST或ALL)中增加日志级别 ( INFO > FINE / FINEST ),重新启动Tomat并检查日志, sudo lsof | grep -E "java.*(out|txt|log)$" , tail -f /var/log/tomcat7/*.log /var/log/tomcat7/*.txt /var/log/tomcat7/*.out ), log4j日志logging系统时,确保通过将libs和log4j.properties放入正确的文件夹并进行configuration来正确初始化它, 用cURLtestingBASICauthentication:
没有证书:
$ curl -vv http://example.com:8983/solr/
通常,请求应该返回HTTP / 1.1 401 Unauthorized ,并且“ WWW-Authenticate ”标头应该指示需要基本身份validation。
凭证:
$ curl -vv -u tomcat:tomcat http://example.com:8983/solr/
该请求应该与“授权”头一起发送,并且应该进行authentication。 如果您的凭证无效,您应该得到: HTTP / 1.1 401 Unauthorized 。 如果用户通过身份validation,但无法查看资源,则应该获得: HTTP / 1.1 403 Forbidden 。
也许一个用户locking机制已经被激活了太多失败的authentication尝试 ( LockOutRealm ),
请手动停止并运行Tomcat(与ps wuax | grep ^tomcat : ps wuax | grep ^tomcat ),例如:
# ps wuax | grep ^tomcat tomcat7 884 /usr/lib/jvm/java-7-openjdk-amd64/bin/java -Djava.util.logging.config.file=/var/lib/tomcat7/conf/logging.properties ... org.apache.catalina.startup.Bootstrap start $ /etc/init.d/tomcat7 stop $ sudo sudo -u tomcat7 /usr/lib/jvm/java-7-openjdk-amd64/bin/java ... -Dorg.apache.catalina.level=FINEST org.apache.catalina.startup.Bootstrap start
或者开始使用catalina.sh脚本,如:
$ . /etc/default/tomcat7 $ export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64 CATALINA_HOME=/usr/share/tomcat7 CATALINA_BASE=/var/lib/tomcat7 CATALINA_PID=/var/run/tomcat7.pid CATALINA_TMPDIR=/tmp LOGGING_CONFIG="-Dorg.apache.catalina.level=FINEST" $ /usr/share/tomcat7/bin/catalina.sh run
或者在debugging模式下 :
$ JPDA_SUSPEND=y catalina.sh jpda start
并检查你的catalina.out日志。
最后的办法是通过debugging过程: sudo strace -fp PID 。