1

I want to deploy multiple webapps and run either the maven jetty plugin or tomcat plugin. But I can't seem to get them to work. My main aim is to start the server will all the webapps since they are dependent on each other. How do I achieve this? I tried with the maven jetty plugin- created a separate project with multiple contextHandlers

<plugin>
        <groupId>org.mortbay.jetty</groupId>    
        <artifactId>jetty-maven-plugin</artifactId>
        <version>8.1.2.v20120308</version>
        <configuration>
            <contextHandlers>
                <contextHandler implementation="org.eclipse.jetty.webapp.WebAppContext">
                    <contextPath>/data-emulator</contextPath>
                    <resourceBase>${basedir}/../data-emulator/target/</resourceBase>

                </contextHandler>

                <contextHandler implementation="org.eclipse.jetty.webapp.WebAppContext">
                    <contextPath>/service</contextPath>
                    <resourceBase>${basedir}/../service/target/</resourceBase>

                </contextHandler>

                <contextHandler implementation="org.eclipse.jetty.webapp.WebAppContext">
                    <contextPath>/client</contextPath>
                    <resourceBase>${basedir}/../client/target/</resourceBase>

                </contextHandler>
            </contextHandlers>
            <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector"> 
                <port>8080</port>
                <maxIdleTime>60000</maxIdleTime>
            </connector>

        </configuration>
    </plugin>
Duncan Jones
  • 67,400
  • 29
  • 193
  • 254
12rad
  • 829
  • 2
  • 13
  • 28
  • take a look at this http://stackoverflow.com/questions/10567699/getting-http-500-when-running-servlet-in-jetty/10609507#10609507 , you want to setup multiple instances or deploy more wars on the same instance? – ant Aug 02 '12 at 22:32

1 Answers1

2

your resourceBase parameter is incorrect. the target folder doesnt contain your webpages and the WEB-INF folder (unless you have special post-build tasks that copies the output files over).

you should use the war parameter instead. example below:

<contextHandler implementation="org.eclipse.jetty.webapp.WebAppContext">
    <contextPath>/data-emulator</contextPath>
    <war>${basedir}/../data-emulator/target/data-emulator.war</war>    
</contextHandler>
happymeal
  • 1,373
  • 14
  • 24
  • > it is essential that you use an org.eclipse.jetty.maven.plugin.JettyWebAppContext instance rather than a standard org.eclipse.jetty.webapp.WebAppContext instance. Only the former will allow the webapp to function correctly in the maven environment. – Jerry Chin Apr 01 '17 at 08:40