classloader - embedded Jetty in Eclipse RCP -
i have problem embeding jetty eclipse rcp application.
in rcp application, when user click button, browser opened , jsp page shown. jsp files in separated directory, web application, can run in tomcat well.
i have managed in main() method this:
import org.eclipse.jetty.server.server; import org.eclipse.jetty.webapp.webappcontext; public class simplestserver { public static void main(string[] args) throws exception { int port = 8080; server server = new server(port); string webapp = "d:/workspace/preview"; webappcontext context = new webappcontext(); context.setdefaultsdescriptor(webapp + "/web-inf/web.xml"); // ------- // sorry! add question in 1 post, think might clue // if not use setdefaultsdescriptor, got error this: // java.io.filenotfoundexception: d:\bv\eupgrade\testenv\eclipse4-2\org\eclipse\jetty\webapp\webdefault.xml // why not go web.xml, goes path like: org\eclipse\jetty\webapp\webdefault.xml? // , in case, when access jsp files, got http 503 error. // context.setdescriptor(webapp + "/web-inf/web.xml"); // ------ context.setresourcebase(webapp); context.setcontextpath("/preview"); context.setparentloaderpriority(true); server.sethandler(context); try { server.start(); server.join(); } catch (exception e) { e.printstacktrace(); } } }
it works me if in main method. i.e., after jetty started, can access of pages in web app.
but when put snippet plugin, not work.
i created sample eclipse rcp project (with mail template), , put above code activator.java. start eclipse application, saw error :
... 19:01:03.762 [main] debug o.e.jetty.webapp.webappclassloader - loaded interface javax.servlet.filter 19:01:03.762 [main] debug o.e.jetty.webapp.webappclassloader - loaded interface javax.servlet.filter org.eclipse.osgi.internal.baseadaptor.defaultclassloader@2a49d3b5[javax.servlet:3.0.0.v201112011016(id=4)] 19:01:03.762 [main] debug o.e.jetty.webapp.webappclassloader - loaded class java.lang.object 19:01:03.762 [main] debug o.e.jetty.webapp.webappclassloader - loaded class java.lang.object null 19:01:03.762 [main] debug o.e.jetty.webapp.webappclassloader - loaded class com.broadvision.ssp.webflow.setcharacterencodingfilter webappclassloader=855125537@32f82e21 19:01:03.762 [main] debug org.eclipse.jetty.servlet.holder - holding class com.broadvision.ssp.webflow.setcharacterencodingfilter 19:01:03.762 [main] debug o.e.jetty.webapp.webappclassloader - loaded class java.lang.throwable 19:01:03.762 [main] debug o.e.jetty.webapp.webappclassloader - loaded class java.lang.throwable null 19:01:03.762 [main] debug o.e.jetty.webapp.webappclassloader - loaded class java.lang.exception 19:01:03.762 [main] debug o.e.jetty.webapp.webappclassloader - loaded class java.lang.exception null ...
it seems classes in web-inf\lib*.jar can loaded, classes in jre cannot loaded in runtime.
the result is:
jetty server (i checked port being used javaw.exe), of page returns: http 404 error. web application has not been deployed successfully.
i have read these: embed jetty in eclipse rcp
eclipse rcp plugin + embedded jetty + jsf
https://stackoverflow.com/questions/12530256/eclipse-rcp-with-jetty-integration
but cannot find answer question.
any appreicated!! in advance.
to started embedded jetty server start basic tutorials. these guide serve single static html file.
once got working can move on expand stuff serving application.
Comments
Post a Comment