T
T
tavi2016-01-22 18:25:50
Eclipse
tavi, 2016-01-22 18:25:50

Authentication under Jetty in Eclipse - a problem with redeploy. How to decide?

I am developing an application on GWT. I'm debugging it in Eclipse in DevMode, which in turn starts the Jetty server.
I decided to add user authentication to my application, and use the capabilities of Jetty for this. To do this, I wrote the following jetty-web.xml configuration file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">

<Configure class="org.eclipse.jetty.webapp.WebAppContext">
  <Get name="securityHandler">
    <Set name="loginService">
      <New class="org.eclipse.jetty.security.HashLoginService" id="DefaultLoginService">
            <Set name="name">Test Realm</Set>
            <Set name="config">realm.properties</Set>
            <Call name="start"/>
      </New>
    </Set>
    <Set name="checkWelcomeFiles">true</Set>
  </Get>

</Configure>

I created a realm.properties file, made a start page with login/password water fields, I launch it - everything works, users log in. But - when I try to re-deploy my application from eclipse to the server, I get an exception, after which the application becomes unavailable:
[WARN] Failed startup of context c.g.g.d.s.j.WebAppContextWithReload{/,file:/E:/workspace/WebApp1/WebContent/},E:\workspace\WebApp1\WebContent
java.lang.IllegalStateException: LoginService has different IdentityService to [email protected]
  at org.eclipse.jetty.security.SecurityHandler.doStart(SecurityHandler.java:354)
...

There is a feeling that when you re-deploy the LoginService is re-created and - something goes wrong (conflict with the previously created IdentityService?).
I could not find clear information on the syntax of jetty.xml, which would explain what an IdentityService is and how to configure it. Question - what to do? Does anyone have a working example of this file that can handle Jetty redeploy correctly?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question