| Summary: | Jetty server complains about missing context root | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [RT] Jetty | Reporter: | Steven Hung <sghung> | ||||
| Component: | server | Assignee: | Jesse McConnell <jesse.mcconnell> | ||||
| Status: | CLOSED INVALID | QA Contact: | |||||
| Severity: | blocker | ||||||
| Priority: | P3 | CC: | eyuen7, janb, jetty-inbox, tjwatson | ||||
| Version: | unspecified | ||||||
| Target Milestone: | 7.6.x | ||||||
| Hardware: | PC | ||||||
| OS: | Windows 7 | ||||||
| Whiteboard: | |||||||
| Bug Depends on: | |||||||
| Bug Blocks: | 366092 | ||||||
| Attachments: |
|
||||||
|
Description
Steven Hung
Hi Steven, Can you paste (or can you point me to the repository) the code for how you create the Jetty server, and then create and deploy the webapp? Are there any exceptions printed? You might also try turning up the debug level. If you're using jetty's stderr logger, then you do that by setting the system property -D-Dorg.eclipse.jetty.LEVEL=DEBUG, although you may be using some other slf4j plugin, in which case you control the debug level according to that particular logging framework. You've probably also aready seen it, but just in case, here's the link to the porting docs from jetty 6-to jetty-7, which are also valid for porting to jetty-8: http://wiki.eclipse.org/Jetty/Starting/Porting_to_Jetty_7 thanks Jan Created attachment 215489 [details] Web project example The repository is :pserver:anonymous@dev.eclipse.org:/cvsroot/webtools The plug-ins are: 1. org.eclipse.jst.server.preview.adapter 2. org.eclipse.wst.server.preview The server is created via org.eclipse.wst.server.preview.internal.PreviewStarter.run() An outline of what we do in this method is: org.eclipse.jetty.server.Server server; server = new Server(config.getPort()); // we use a preview.xml file to store the port server.setStopAtShutdown(true); ... server.setHandler(handlers); // We add a handler, used to handle errors server.start(); Publishing copies the web project to a location specified in the preview.xml that we generated. For example: <?xml version="1.0" encoding="UTF-8" standalone="no"?> <server port="8080"> <module context="TestPreviewServer" name="TestPreviewServer" path="D:/WTP34/eclipse/workspace/runtime-New_configuration/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/TestPreviewServer" type="j2ee"/> </server> An example of the directory it points to is the attachment I have provided. For publishing, I'll need to look into it more to provide more details. Since right now, it doesn't seem to be using the preview.xml file (I'll need to look at a working version of the preview server in pre-Juno) to see how it's done. I didn't see any errors either. I will try with the vm argument to see what happens. Thanks, I will continue to investigate and provide updates. The issue is related to how the modules are being published. In pre-Juno, the publishing code is: WebAppContext wac = new WebAppContext(); wac.setContextPath(module.getContext()); wac.setWar(module.getPath()); wac.setErrorHandler(errorHandler); handlers.addHandler(wac); In Juno, the publishing code is: ContextHandler wac = new ContextHandler(); wac.setContextPath(module.getContext()); // wac.setWar(module.getPath()); wac.setErrorHandler(errorHandler); handlers.addHandler(wac); What should be used for publishing in Jetty 7 and above? Is ContextHandler the correct API? Also, is there an equivalent to ".setWar" that would let the server know where the resources to publish are located? Thanks Steven, If you were using a WebAppContext with jetty-6, then you should continue to use one for jetty-7/8, as this is the correct way to set up a web app in jetty. The ContextHandler is intended for lighter-weight setups without the full support for webapps (ie sessions, servlets, WEB-INF/web.xml etc etc). regards, Jan (In reply to comment #3) > The issue is related to how the modules are being published. > > In pre-Juno, the publishing code is: > > WebAppContext wac = new WebAppContext(); > wac.setContextPath(module.getContext()); > wac.setWar(module.getPath()); > wac.setErrorHandler(errorHandler); > handlers.addHandler(wac); > > In Juno, the publishing code is: > > ContextHandler wac = new ContextHandler(); > wac.setContextPath(module.getContext()); > // wac.setWar(module.getPath()); > wac.setErrorHandler(errorHandler); > handlers.addHandler(wac); > > What should be used for publishing in Jetty 7 and above? Is ContextHandler the > correct API? Also, is there an equivalent to ".setWar" that would let the > server know where the resources to publish are located? > > Thanks Thanks for the information The following are installed by default into Juno: org.eclipse.jetty.continuation, org.eclipse.jetty.http, org.eclipse.jetty.io, org.eclipse.jetty.security, org.eclipse.jetty.server, org.eclipse.jetty.servlet, and org.eclipse.jetty.util However, to get the servlet case to work, the plug-ins org.eclipse.jetty.xml and org.eclipse.jetty.webapp also need to be installed. I used the p2 update site http://download.eclipse.org/jetty/updates/jetty-bundles-8.x to get all the plug-ins. Note: WebAppContext is from org.eclipse.jetty.webapp Can org.eclipse.jetty.xml and org.eclipse.jetty.webapp (both version 8) be added to Juno? There is an issue with JSPs that I am still investigating, but at least the servlet works. For the JSP issue, that is caused by Bug 377886. Even if we set the system property org.apache.jasper.compiler.disablejsr199 to true, it will complain that "PWC6349: Cannot find a java compiler for compilation." Therefore, I believe the work required here is to add the plug-ins mentioned in comment 5 into Juno. *** Bug 366092 has been marked as a duplicate of this bug. *** Since the J2EE preview server is broken in Juno due to the missing plug-ins, is there any plan to add org.eclipse.jetty.xml and org.eclipse.jetty.webapp (both version 8) into Juno? Jesse, Can you comment on how jetty jars can get added into Juno. thanks Jan I think this is equinox decision on what they are pulling in. I am cc'ing him on this bug (In reply to comment #11) > I think this is equinox decision on what they are pulling in. > > I am cc'ing him on this bug The Eclipse/Equinox projects pull in only the minimum jetty bundles to get the Eclipse help system to work as well as our OSGi HttpService implementation to work. If WTP needs additional jetty bundles then they would need to pull those in themselves. We will not be adding any more jetty bundles than necessary for our usecases. so my understanding of these things is that WTP can resolve this problem themselves by pulling those jetty bundles that they need.. correct? (In reply to comment #13) > so my understanding of these things is that WTP can resolve this problem > themselves by pulling those jetty bundles that they need.. > > correct? That is my understand from comment 5. WTP should ensure that all the jetty bundles they need to function are included when WTP is installed. That is not up to the "classic" eclipse download (EPP etc.) to provide in its features. closing as not a jetty issue |