Skip to main content

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

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


Back to the top