Jetty returning 403 Forbidden

2019-06-24 06:22发布

问题:

Hi I am porting my web app from tomcat to Jetty. I am using the Jetty runner to launch it. I am using the following command to launch Jetty:

java -jar jetty-runner.jar --port --path url-path path-to-war

However when I try to browse to the from the browser I get the following error:

HTTP ERROR 403

Problem accessing . Reason:

Forbidden

In the logs i see the following Warning:

WARN:oejs.SecurityHandler:No authenticator for: {RoleInfo,C[*, all_auth_users]}

I am trying to use Jetty out of the box and haven't customized any config anywhere. Is there any additional configuration required to make this work?

回答1:

Likely cause: your war/webapp has security constraints defined, but you haven't specified what authentication type to use on the server side.

Either:

  • Remove your <security-constraint> in your war/webapp WEB-INF/web.xml file. or..
  • Add an Authentication scheme on the server side. Look at etc/jetty-testrealm.xml for an example using the HashLoginService authenticator.


回答2:

In my case I forget that paste the index.html example page. Its all.



标签: java Jetty