Hi Joakim, I just changed the existing code in jetty6 to jetty9 accordingly by referring some document. Also in my application the value of warpath in below line is 'webapps' . webAppDeployer.setWebAppDir(warpath);
So I changed webAppDeployer class in Jetty6 to webAppprovider in Jetty9 as per the document and used Deploymentmanager class. I'm using embedded jetty. I will try with webAppContext. Thanks On Tue, Sep 1, 2015 at 11:14 PM, Joakim Erdfelt <[email protected]> wrote: > Can't you just create the WebAppContext directly and add it to your server? > Why bother with the DeploymentManager steps? > > Joakim Erdfelt / [email protected] > > On Tue, Sep 1, 2015 at 10:41 AM, Arun Kumar <[email protected]> > wrote: > >> Hi Team, >> >> I have changed the following code in Jetty6 to Jetty9 migration. I'm >> facing an issue that Illegal StateException :'No contexts found" >> >> *Existing code in Jetty6:* >> this.jettyWebServer = new Server(); //org.mortbay.jetty.Server >> >> ThreadPool threadPool = new ThreadPool(threadPoolSize); >> >> jettyWebServer.setThreadPool(threadPool); >> >> Connector connector = new SelectChannelConnector(); >> >> connector.setPort(port); >> >> this.jettyWebServer.setConnectors(new Connector[]{connector}); >> >> WebAppDeployer webAppDeployer = new WebAppDeployer(); >> >> webAppDeployer.setContexts(this.jettyWebServer); /// setContexts >> method is not available in Jetty9 >> >> webAppDeployer.setWebAppDir(warpath); >> >> webAppDeployer.setExtract(true); >> >> webAppDeployer.setParentLoaderPriority(true); >> >> webAppDeployer.start(); >> >> this.jettyWebServer.setStopAtShutdown(true); >> >> this.jettyWebServer.setSendServerVersion(false); >> >> >> this.jettyWebServer.start(); >> this.jettyWebServer.join(); >> >> I have modified the above code for Jetty9 as follows:: >> >> >> * Jetty9 code:*DeploymentManager deploymentManager = new >> DeploymentManager(); // added DeploymentManager in Jetty9 >> QueuedThreadPool threadPool = new >> QueuedThreadPool(threadPoolSize);// Thread pool >> threadPool.setMaxThreads(500); >> >> this.jettyWebServer = new Server(threadPool);// >> org.eclipse.jetty.Server >> >> ContextHandlerCollection contexts = new >> ContextHandlerCollection(); >> >> contexts.setHandlers(new Handler[] { context}); >> >> this.jettyWebServer.setHandler(contexts); >> >> ServerConnector connector = new ServerConnector(jettyWebServer); >> >> connector.setPort(port); >> >> this.jettyWebServer.setConnectors(new Connector[]{connector}); >> >> WebAppProvider webAppDeployer = new WebAppProvider();// >> WebAppProvider replaced webAppDeployer in Jetty6 >> >> webAppDeployer.setExtractWars(true); >> >> webAppDeployer.setParentLoaderPriority(true); >> >> webAppDeployer.setMonitoredDirName(warpath); >> >> deploymentManager.addAppProvider(webAppDeployer); >> this.jettyWebServer.addBean(deploymentManager); >> this.jettyWebServer.setStopAtShutdown(true); >> this.jettyWebServer.start(); >> this.jettyWebServer.join(); >> >> In Jetty 9 code I have deploymentmanager and webAppProvider classes. >> Since there is no setContexts method in Jetty9 How can we set the context?. >> Also the jetty9 code is correct ?. Could you please help me ?. >> >> >> Thanks, >> Arun >> >> _______________________________________________ >> jetty-users mailing list >> [email protected] >> To change your delivery options, retrieve your password, or unsubscribe >> from this list, visit >> https://dev.eclipse.org/mailman/listinfo/jetty-users >> > > > _______________________________________________ > jetty-users mailing list > [email protected] > To change your delivery options, retrieve your password, or unsubscribe > from this list, visit > https://dev.eclipse.org/mailman/listinfo/jetty-users >
_______________________________________________ jetty-users mailing list [email protected] To change your delivery options, retrieve your password, or unsubscribe from this list, visit https://dev.eclipse.org/mailman/listinfo/jetty-users
