Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] (no subject)

I don't see the org.eclipse.jetty.osgi.jetty-osgi-boot-jsp bundle on your list of dependencies. You should use that, then you won't have to mess around with ServletContainerIntializersStarters, org.eclipse.jetty.containerInitializers or any of the things you've added to your jetty-web.xml file. In fact, I think the jetty-web.xml file would be interpreted too late to be of use here.

Here's a pointer to the docs to help you out:

Also might be useful to take a look at our osgi tests to see which bundles we deploy along with the WAB:


On Sun, 5 Jul 2020 at 11:12, Gordon Jahn <gjahn@xxxxxxxxxxxxxxxxx> wrote:

Good morning!

(This is a repost of a Stack Overflow question I posted on Friday - I then realised this was a better place to ask..)

I'm trying to get Jetty 9.4.30 running as an OSGi Service (following this: with updated versions) that can host WebApp Bundles. I can deploy and servlets work fine, but JSPs aren't working and I keep hitting an exception for TLD loading caused by:

Caused by: 
    at org.apache.jasper.JspCompilationContext.getTldResourcePath(
    at org.apache.jasper.compiler.Parser.parseTaglibDirective(
    at org.apache.jasper.compiler.Parser.parseDirective(

The problem is almost exactly that described at, except that in this case the author is using Jetty as Embedded and is able to set org.eclipse.jetty.containerInitializers using code where the server is started.

In OSGi, I don't have a place where I'm starting it - it's all happening in the bundles. After a lot of tweaking (and untweaking) config files the closest I feel I've got is when I copied the configuration performed in code into the jetty-web.xml file (which would be deployed in each WAB and isn't ideal in itself) as follows:

<Configure id="webappctxt" class="org.eclipse.jetty.webapp.WebAppContext">
    <New id="initList" class="java.util.ArrayList"></New>
    <Call name="setAttribute">
            <Call class="java.util.Arrays" name="asList">
                <Array type="">
                                <New class="org.eclipse.jetty.apache.jsp.JettyJasperInitializer"></New>
    <Call name="addBean">
            <New class="org.eclipse.jetty.annotations.ServletContainerInitializersStarter">
                    <Ref refid="webappctxt" />
    <Get name="ServletContext">
        <Call name="setAttribute">
                <New class="org.apache.tomcat.SimpleInstanceManager"></New>

When running, I can see the org.eclipse.jetty.annotations.ServletContainerInitializersStarter, and it has the TLDs from the platform (so all my dependencies seem to be there!) but the XML version of the code fails because there are two constructors for

ContainerInitializer(java.lang.ClassLoader loader, java.lang.String toString)   
ContainerInitializer(javax.servlet.ServletContainerInitializer target, java.lang.Class<?>[] classes)

...and the Jetty XML code picks the first one and throws a "java.lang.IllegalArgumentException: argument type mismatch".

Plugins currently "required" by my WAB are:

Require-Bundle: org.eclipse.jetty.jndi;bundle-version="9.4.30",

...and only the WAB bundle is set to auto-start.

For completeness, the VM arguments to configure plugins are:

-Djetty.home.bundle=jetty-config-bundle -Djava.naming.factory.url.pkgs=org.eclipse.jetty.jndi -Djava.naming.factory.initial=org.eclipse.jetty.jndi.InitialContextFactory

And jetty-config-bundle does contain the jetty.xml, etc. files and they are being processed.

Can anyone tell me if they've got this working, and how? Is it configurable to just work without needing a jetty-web.xml in each WAB, or am I missing a dependency bundle on my plugin?

Thanks in advance,

Gordon Jahn

jetty-users mailing list
To unsubscribe from this list, visit

Jan Bartel <janb@xxxxxxxxxxx>
Expert assistance from the creators of Jetty and CometD

Back to the top