Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Jetty-Maven-Plugin reads jettyXml and still starts default context

Dirk,

You can define your resourcehandler in jetty.xml, however you
shouldn't define your webapp in jetty.xml, as the purpose of the jetty
maven plugin is to make development easier by automatically deploying
your unassembled webapp. So if you take your webapp definition out of
jetty.xml things should work.

Note, if you think its worthwhile, you could raise a bugzilla @
eclipse for an enhancement for the maven jetty plugin so that all it
does is execute a jetty.xml file.

cheers
Jan

On 28 July 2012 21:55, Dirk Kirsten <dk@xxxxxxxxx> wrote:
> Hello list,
>
> I am using Jetty 8.1.4.v20120524 and Maven 3. I have the following
> configuration in my pom:
>
>       <plugin>
>         <groupId>org.mortbay.jetty</groupId>
>         <artifactId>jetty-maven-plugin</artifactId>
>         <version>8.1.4.v20120524</version>
>         <configuration>
>
> <jettyXml>${project.basedir}/src/main/resources/jetty.xml</jettyXml>
>         </configuration>
>       </plugin>
>
> In my jetty.xml, I define a context:
>
>     <Set name="handler">
>       <New class="org.eclipse.jetty.server.handler.HandlerList">
>         <Set name="handlers">
>           <Array type="org.eclipse.jetty.server.Handler">
>             <Item>
>               <New class="org.eclipse.jetty.server.handler.ResourceHandler">
>                 <Set name="welcomeFiles">
>                   <Array
> type="String"><Item>index.xml,index.xhtml,index.html</Item></Array>
>                 </Set>
>               </New>
>             </Item>
>             <Item>
>               <New id="Contexts"
> class="org.eclipse.jetty.webapp.WebAppContext">
>                 <Set name="resourceBase"><SystemProperty name="jetty.home"
> default="src/main/webapp" /></Set>
>                 <Set name="contextPath">/</Set>
>               </New>
>             </Item>
>           </Array>
>         </Set>
>       </New>
>     </Set>
>
> This works as expected and starts my application at /:
>
>     INFO:oejs.Server:jetty-8.1.4.v20120524
>     INFO:oejsh.ContextHandler:started
> o.e.j.w.WebAppContext{/,file:/<MY_DIRECTORY>/src/main/webapp/}
>     INFO:oejsh.ContextHandler:started
> o.e.j.w.WebAppContext{/,file:/<MY_DIRECTORY>/src/main/webapp/}
>
> However, after this the jetty-maven-plugin seems to try to start a default
> context, which fails with class not found - It also tries to bind to "/",
> which I obviously don't want.
>
>     WARN:oejs.Holder:java.lang.ClassNotFoundException:
> org.basex.http.rest.RESTServlet
>     INFO:oejpw.PlusConfiguration:No Transaction manager found - if your
> webapp requires one, please configure one.
>     INFO:oejsh.ContextHandler:started
> o.m.j.p.JettyWebAppContext{/,file:/<MY_DIRECTORY>/src/main/webapp/},file:/<MY_DIRECTORY>/src/main/webapp/
>     INFO:oejsh.ContextHandler:started
> o.m.j.p.JettyWebAppContext{/,file:/<MY_DIRECTORY>/src/main/webapp/},file:/<MY_DIRECTORY>/src/main/webapp/
>     INFO:oejsh.ContextHandler:started
> o.m.j.p.JettyWebAppContext{/,file:/<MY_DIRECTORY>/src/main/webapp/},file:/<MY_DIRECTORY>/src/main/webapp/
>
> How can I stop this context to be started? Any help is greatly appreciated.
>
> Please note, that I asked this question also on SO
> (http://stackoverflow.com/questions/11664682/jetty-maven-plugin-reads-jettyxml-and-still-starts-default-context).
> I hope this cross-posting is ok with you as I doen't seem to get any answer
> on SO at all.
>
> Cheers,
> Dirk
>
>
> _______________________________________________
> 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