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?

Changing my web.xml files to specify the same realm name fixed the
problem. Before, they had different realm names, only one of which
corresponded the LoginService name -- this worked fine for previous
version of Jetty, but broke in Jetty 8.1.7.

Before figuring out this simpler fix -- I had worked around the problem
by adding a new WebAppContext and LoginService to my jetty.xml -- This
worked OK, although I couldn't figure out a way to specify this in the
jetty-maven-plugin configuration in the pom.xml, so I needed to use an
external jetty.xml configuration file.

------------
<Ref id="Contexts">
  <Call name="addHandler">
   <Arg>
    <New class="org.eclipse.jetty.webapp.WebAppContext">
     <Set name="contextPath">/my-app</Set>
     <Set
name="war">${project.build.directory}/war/work/my-app-${war-version-numb
er}-jetty.war</Set>
     <Get name="securityHandler">
      <Set name="loginService">
       <New class="org.eclipse.jetty.security.HashLoginService">
        <Set name="name">My App</Set>
        <Set
name="config">${project.build.testOutputDirectory}/realm.properties</Set
>
       </New>
...
----------------

But, the solution you provided is much simpler anyways, so I'll use
that. Thanks!

- Aaron

-----Original Message-----
From: jetty-users-bounces@xxxxxxxxxxx
[mailto:jetty-users-bounces@xxxxxxxxxxx] On Behalf Of Jan Bartel
Sent: Thursday, October 11, 2012 7:17 PM
To: JETTY user mailing list
Subject: [SPAM] Re: [jetty-users] Running more than one webapp using
jetty-maven-plugin?
Importance: Low

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 


Back to the top