Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Fwd: Need Help with Embedded Jetty - Adding multiple context through Mutable Handle Collection

Varsha,

I'm not sure how those two code snippets you attached relate to each other, but some observations:

 * A HandlerList is not the same thing as a ContextHandlerCollection. Normally, if you're creating multiple contexts you would add them to a ContextHandlerCollection (which itself is added to a HandlerList). The ContextHandler collection has significant behavioural differences to a HandlerList. Have a read of http://www.eclipse.org/jetty/documentation/current/architecture.html for some pointers on that.

* I don't think that simultaneous deployment of webapps is particularly supported - usually the deployment process is single threaded so it's possible you might hit some funky behaviour.

cheers
Jan

On 11 April 2016 at 14:47, Varsha Gopal <varshapillai@xxxxxxxxx> wrote:

Any pointers for the below query?

---------- Forwarded message ----------
From: Varsha Gopal <varshapillai@xxxxxxxxx>
Date: Thu, Apr 7, 2016 at 11:47 AM
Subject: Need Help with Embedded Jetty - Adding multiple context through Mutable Handle Collection
To: jetty-users@xxxxxxxxxxx


Is it right to start a jetty instance with no context specified and no context handler, then keep adding context to it once the server has started. Although I was able to do this using mutable HandlerCollection and the logs says the Server and the Contexts are Started and Available, I am not able to access it with a URL with the context [ Not Found error / 404]. 

Should we add at least one root context and contexthandler to the server while starting it?

My main thread starts the server. Post that it will spawn couple of threads which each creates WebAppContext and start them. 

My jetty version is 9.3.7.v20160115

Bit of the code where I am starting the server and contexts are attached, along with few inline comments

P.S If I start Server and context in one go without any handlercollection, i.e each context in its own server instance and finally just start the server, it's working. I am able to access it with the contextpath for the same jars in the classpath.

Thanks in advance,
Varsha


_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users



--
Jan Bartel <janb@xxxxxxxxxxx>
www.webtide.com
Expert assistance from the creators of Jetty and CometD


Back to the top