Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] jetty embedded in JRuby app

Thanks for your feedback!


I'm building a jar, but I'm initialising the server as this, which uses WebAppContext:

    @server = Server.new(8080)
    #
    # get external path for resources in jar
    static_content=@server.getClass().getClassLoader().getResource("eu/webtoolkit/jwt/wt-resources").toExternalForm()
    web_context=WebAppContext.new(static_content, '/wt-resources')

    context = ServletContextHandler.new(ServletContextHandler::SESSIONS)
    context.addEventListener(ServletInit.new);
    servlet = HelloMain.new()
    holder = ServletHolder.new(servlet)
    context.addServlet(holder, '/')

    handler_list= HandlerList.new
    handler_list.setHandlers([web_context,context])
    @server.setHandler(handler_list);

Is this the correct way to do it?


I added the call to Server.setDumpAfterStart(true), and pasted the output at http://pastie.org/8642199
I think I could use a hint as to what the problem could be....

thanks

raph



On Thu, Jan 16, 2014 at 2:00 PM, Joakim Erdfelt <joakim@xxxxxxxxxxx> wrote:
Your linked Paste has no mention of IntrospectionCleaner ?

Anyway, it seems that the InspectionCleaner is not being found.
Note, your stacktrace contains a WebAppClassLoader, which is the webapp isolation classloader, that IntrospectionCleaner class might be filtered or isolated away from being found because of it.
The existence of the StandardDescriptorProcessor also means you are deploying a standard WAR/WebApp, so that might definitely be the case.  

If you can control the Server instance in your JRuby startup, try adding a call to Server.setDumpAfterStart(true) before the server is started, that will show you what is in the classloaders at the server side and at the webapp side, it should help you figure out what is going on.

--
Joakim Erdfelt <joakim@xxxxxxxxxxx>
Expert advice, services and support from from the Jetty & CometD experts


On Tue, Jan 14, 2014 at 1:39 AM, Raphael Bauduin <rblists@xxxxxxxxx> wrote:
Hi,

I've developped a JRuby app that starts a Jetty server. The application runs fine from the console, but when I package it as a jar, I get errors about unfound classes org.eclipse.jetty.servlet.listener.ELContextCleaner and org.eclipse.jetty.servlet.listener.IntrospectorCleaner:


2754 [main] WARN org.eclipse.jetty.webapp.StandardDescriptorProcessor - Could not instantiate listener org.eclipse.jetty.servlet.listener.IntrospectorCleaner
java.lang.ClassNotFoundException: org.eclipse.jetty.servlet.listener.IntrospectorCleaner
        at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
        at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:430)
        at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:383)
        at org.eclipse.jetty.server.handler.ContextHandler.loadClass(ContextHandler.java:1517)
        at org.eclipse.jetty.webapp.StandardDescriptorProcessor.visitListener(StandardDescriptorProcessor.java:1864)

The full error message is available at http://pastie.org/8629602

The jetty-all-8.1.9 jar file is included in the built jar, and I see those two classes in there.
I can also load the classes in the JRuby code.
The jar is packaged with warbler, and the code of the main class of the jar is https://github.com/jruby/warbler/blob/master/ext/JarMain.java


Is there a way to make jetty find these too?

Thx in advance

Raph

PS: I asked on the JRuby mailing list, but it seems the setup is ok on the Jruby side. here's the discussion: https://www.ruby-forum.com/topic/4419936

_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users



_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users




--
Web database: http://www.myowndb.com
Free Software Developers Meeting: http://www.fosdem.org

Back to the top