Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Running more than one webapp using jetty-maven-plugin?

Aaron,

I can't see in that plugin configuration where you are configuring the
loginservice? Do you have one configured at all? Do you have a realm
name in the web.xml of any of the webapps?

The algorithm for finding a suitable LoginService did change in the
bug you pointed out, but if you had a realm name configured and a
loginservice configured already, then the change shouldn't have
affected you, so I'm slightly puzzled.

You can always define the loginservices you want in the plugin config
(see the http://wiki.eclipse.org/Jetty/Feature/Jetty_Maven_Plugin page
under Configuring the Container heading). Here's an example from the
test-jetty-webapp
(https://github.com/eclipse/jetty.project/blob/master/test-jetty-webapp/pom.xml):

 <plugin>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>jetty-maven-plugin</artifactId>
        <version>${project.version}</version>
        <configuration>
          <stopPort>8087</stopPort>
          <stopKey>foo</stopKey>
          <scanIntervalSeconds>1</scanIntervalSeconds>
          <systemProperties>
            <systemProperty>
              <name>fooprop</name>
              <value>222</value>
            </systemProperty>
          </systemProperties>
          <!-- useTestScope>true</useTestScope -->
          <webAppConfig>
            <contextPath>/test</contextPath>
            <tempDirectory>${project.build.directory}/work</tempDirectory>
            <sessionHandler
implementation="org.eclipse.jetty.server.session.SessionHandler">
              <sessionManager
implementation="org.eclipse.jetty.server.session.HashSessionManager">
                <storeDirectory>${basedir}/target/sessions</storeDirectory>
              </sessionManager>
            </sessionHandler>
          </webAppConfig>
          <loginServices>
            <loginService
implementation="org.eclipse.jetty.security.HashLoginService">
              <name>Test Realm</name>
              <config>src/main/config/etc/realm.properties</config>
            </loginService>
          </loginServices>
        </configuration>
      </plugin>


Jan

On 12 October 2012 05:07, Pieper, Aaron <PieperA@xxxxxxxxxxxxxx> wrote:
> The documentation for the Jetty Maven Plugin at
> http://wiki.eclipse.org/Jetty/Feature/Jetty_Maven_Plugin#Running_more_than_one_webapp
> describes how to configure the pom.xml to configure more than one webapp….
>
>
>
> ------------------
>
> <plugin>
>
> <groupId>org.mortbay.jetty</groupId>
>
> <artifactId>jetty-maven-plugin</artifactId>
>
> <configuration>
>
>   <scanIntervalSeconds>10</scanIntervalSeconds>
>
>   <webApp>
>
>    <contextPath>/test</contextPath>
>
>   </webApp>
>
>   <contextHandlers>
>
>    <contextHandler implementation="org.eclipse.jetty.webapp.WebAppContext">
>
>     <war>${basedir}../../B.war</war>
>
>     <contextPath>/B</contextPath>
>
>    </contextHandler>
>
>    <contextHandler implementation="org.eclipse.jetty.webapp.WebAppContext">
>
>     <war>${basedir}../../C.war</war>
>
>     <contextPath>/B</contextPath>
>
>    </contextHandler>
>
>   </contextHandlers>
>
>  </configuration>
>
> </plugin>
>
> ------------------
>
>
>
> This configuration worked OK in Jetty v7.5.1.v20110908, but it no longer
> works in Jetty v8.1.7.v20120910. When running configurations like this in
> newer versions of Jetty, you get an error…
>
>
>
> ------------------
>
> java.lang.IllegalStateException: No LoginService for
> org.eclipse.jetty.security.authentication.FormAuthenticator@61234e59 in
> org.eclipse.jetty.security.ConstraintSecurityHandler@54ece6e1
>
>         at
> org.eclipse.jetty.security.authentication.LoginAuthenticator.setConfiguration(LoginAuthenticator.java:45)
>
>         at
> org.eclipse.jetty.security.authentication.FormAuthenticator.setConfiguration(FormAuthenticator.java:129)
>
>         at
> org.eclipse.jetty.security.SecurityHandler.doStart(SecurityHandler.java:376)
>
>         at
> org.eclipse.jetty.security.ConstraintSecurityHandler.doStart(ConstraintSecurityHandler.java:233)
>
> ------------------
>
>
>
> This error seems to stem from a fix which was put in for Bug #368773
> (https://bugs.eclipse.org/bugs/show_bug.cgi?id=368773) where
> SecurityHandlers will no longer just pick the first LoginService they find.
> It looks like now, you need to explicitly define a LoginService for each
> additional webapp context. So for each additional ContextHandler, you need
> to also define a corresponding LoginService. There are some examples for how
> to do this in the jetty.xml, but I can’t find any examples which describe
> this process using the maven-jetty-plugin configuration in the pom.xml – I’m
> not sure if it’s possible?
>
>
>
> Is it still possible to configure additional ContextHandlers in the
> maven-jetty-plugin configuration in the pom.xml using Jetty 8.1.7? Should
> the Jetty Maven Plugin documentation be updated to reflect the new process
> for setting up additional ContextHandlers?
>
>
>
> -          Aaron
>
>
> _______________________________________________
> jetty-users mailing list
> jetty-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/jetty-users
>



-- 
Jan Bartel <janb@xxxxxxxxxxx>
www.webtide.com – Developer advice, services and support
from the Jetty & CometD experts.


Back to the top