Skip to main content

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

Thank you so much!

I've been through that page many times... just reviewing plugins again. Noticed CM and Events were missing and have added them to my target now but no difference. 

Maybe time for a new workspace and start again (again!).

I'll post back when I've had another go with clean configs and new bundles.

Regards,
Gordon

On Mon, 6 Jul 2020 at 09:15, Jan Bartel <janb@xxxxxxxxxxx> wrote:
And a follow up to my previous post: the instructions at https://examples.javacodegeeks.com/enterprise-java/jetty/jetty-osgi-example/ are for an old version of jetty, 9.2.11.  Jetty osgi has changed significantly, so I urge you to follow the instructions in our documentation for 9.4 instead: https://www.eclipse.org/jetty/documentation/9.4.30.v20200611/framework-jetty-osgi.html.  

Jan

On Mon, 6 Jul 2020 at 10:09, Jan Bartel <janb@xxxxxxxxxxx> wrote:
Hi Gordon,

As the org.eclipse.jetty.osgi.boot.jsp bundle is added as a fragment to the org.eclipse.jetty.osgi.boot bundle, it won't show up as started, as you can't start a fragment.

Just to make certain we're on the same page, you don't need to add the boot bundles or any of the jetty jars, nor any jar that they depend on as Require-Bundle in your webapp:  that would put those bundles onto the equivalent on the webapp's classpath, instead of the equivalent of the server's classpath. You should just need to generate your Import headers as normal, and let the boot bundles work out the rest.

Let me know if you make progress.

Jan

On Mon, 6 Jul 2020 at 01:05, Gordon Jahn <gjahn@xxxxxxxxxxxxxxxxx> wrote:
Thanks Jan - org.eclipse.jetty.osgi.boot.jsp in the list of plugins within the launcher, but as a fragment I can't make that a dependency - it shows in OSGi as being resolved (bundle 56 below) and not active though, even though the master bundle (26 -  org.eclipse.jetty.osgi.boot) is active and shows that it has the fragment there ("ss" output below).

At first look through the tests I notice the pom generates a manifest that imports all jetty packages so maybe I'm just missing something - just needing to figure out what.

I'll take a further look through the tests tomorrow and see if I can figure out what's going on - whatever it is, it's consistent though as my Mac with Eclipse Oxygen and Java 8, and my Windows 10 machine with Java 11 and Eclipse 2020.06 both fail at the same point!

Regards,
Gordon

id State       Bundle

0 ACTIVE      org.eclipse.osgi_3.12.100.v20180210-1608

            Fragments=34, 13

1 RESOLVED    org.eclipse.jetty.servlet_9.4.30.v20200611

2 RESOLVED    org.objectweb.asm.tree.analysis_8.0.1

4 ACTIVE      org.eclipse.equinox.common_3.9.0.v20170207-1454

5 RESOLVED    org.objectweb.asm_8.0.1

6 RESOLVED    org.eclipse.osgi.services_3.6.0.v20170228-1906

7 RESOLVED    org.apache.xml.serializer_2.7.1.v201005080400

8 RESOLVED    org.mortbay.jasper.apache-el_8.5.54

9 ACTIVE      org.eclipse.core.runtime_3.13.0.v20170207-1030

10 RESOLVED    org.objectweb.asm.util_8.0.1

11 ACTIVE      org.eclipse.jdt.core_3.13.102.v20180330-0919

            Fragments=23, 43

12 RESOLVED    org.eclipse.jetty.plus_9.4.30.v20200611

13 RESOLVED    org.eclipse.osgi.compatibility.state_1.1.0.v20170516-1513

            Master=0

14 ACTIVE      org.eclipse.core.jobs_3.9.3.v20180115-1757

15 RESOLVED    org.apache.xerces_2.9.0.v201101211617

16 STARTING    org.eclipse.core.filesystem_1.7.0.v20170406-1337

            Fragments=33

17 RESOLVED    org.eclipse.jetty.xml_9.4.30.v20200611

18 RESOLVED    org.objectweb.asm.tree_8.0.1

19 RESOLVED    javax.annotation-api_1.3.0

21 RESOLVED    org.eclipse.jetty.io_9.4.30.v20200611

22 RESOLVED    org.eclipse.jetty.security_9.4.30.v20200611

23 RESOLVED    org.eclipse.jdt.compiler.apt_1.3.110.v20180329-0935

            Master=11

25 ACTIVE      org.eclipse.equinox.preferences_3.7.0.v20170126-2132

26 ACTIVE      org.eclipse.jetty.osgi.boot_9.4.30.v20200611

            Fragments=56

30 RESOLVED    org.apache.xml.resolver_1.2.0.v201005080400

31 RESOLVED    org.eclipse.core.commands_3.9.0.v20170530-1048

32 RESOLVED    org.eclipse.text_3.6.100.v20170203-0814

33 RESOLVED    org.eclipse.core.filesystem.macosx_1.3.0.v20140124-1940

            Master=16

34 RESOLVED    javax.transaction_1.1.1.v201105210645

            Master=0

35 RESOLVED    javax.xml_1.3.4.v201005080400

36 RESOLVED    org.eclipse.jetty.util_9.4.30.v20200611

37 ACTIVE      org.eclipse.equinox.registry_3.7.0.v20170222-1344

38 RESOLVED    org.eclipse.jetty.schemas_3.1.0.M0

39 RESOLVED    org.eclipse.jetty.http_9.4.30.v20200611

40 ACTIVE      org.apache.felix.gogo.runtime_0.10.0.v201209301036

41 ACTIVE      org.eclipse.core.contenttype_3.6.0.v20170207-1037

42 RESOLVED    org.w3c.dom.events_3.0.0.draft20060413_v201105210656

43 RESOLVED    org.eclipse.jdt.compiler.tool_1.2.101.v20180329-0935

            Master=11

44 STARTING    com.ibm.icu_58.2.0.v20170418-1837

45 RESOLVED    jetty-config-bundle_1.0.0.qualifier

46 ACTIVE      org.apache.felix.gogo.command_0.10.0.v201209301215

47 ACTIVE      org.eclipse.core.resources_3.12.0.v20170417-1558

48 RESOLVED    org.apache.aries.spifly.dynamic.bundle_1.3.0

49 RESOLVED    org.eclipse.jetty.server_9.4.30.v20200611

50 ACTIVE      org.eclipse.equinox.app_1.3.400.v20150715-1528

51 RESOLVED    org.eclipse.jetty.deploy_9.4.30.v20200611

52 RESOLVED    org.eclipse.osgi.util_3.4.0.v20170111-1608

53 RESOLVED    org.mortbay.jasper.apache-jsp_8.5.54

54 RESOLVED    org.objectweb.asm.commons_8.0.1

55 STARTING    org.eclipse.core.expressions_3.6.0.v20170207-1037

56 RESOLVED    org.eclipse.jetty.osgi.boot.jsp_9.4.30.v20200611

            Master=26

57 RESOLVED    org.eclipse.jetty.webapp_9.4.30.v20200611

59 RESOLVED    org.eclipse.jetty.jndi_9.4.30.v20200611

60 ACTIVE      org.eclipse.jetty.annotations_9.4.30.v20200611

65 ACTIVE      org.apache.taglibs.taglibs-standard-spec_1.2.5

68 RESOLVED    org.apache.servicemix.bundles.bcel_5.2.0.4

69 ACTIVE      org.apache.taglibs.standard-impl_1.2.5

74 RESOLVED    org.apache.servicemix.bundles.xalan_2.7.1.4

75 RESOLVED    org.apache.servicemix.bundles.xalan-serializer_2.7.2.1

77 ACTIVE      org.apache.felix.gogo.shell_0.10.0.v201212101605

78 ACTIVE      org.eclipse.equinox.console_1.1.300.v20170512-2111

82 RESOLVED    org.eclipse.jetty.apache-jsp_9.4.30.v20200611

83 RESOLVED    org.eclipse.jetty.apache.jstl_9.4.30.v20200611

85 RESOLVED    org.eclipse.jetty.continuation_9.4.30.v20200611

86 RESOLVED    javax.servlet-api_3.1.0

100 RESOLVED    test-product_1.0.0.qualifier

101 ACTIVE      common_1.0.0.qualifier


On Sun, 5 Jul 2020 at 13:51, Jan Bartel <janb@xxxxxxxxxxx> wrote:
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.


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

Jan


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: https://examples.javacodegeeks.com/enterprise-java/jetty/jetty-osgi-example/ 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: 
java.lang.NullPointerException
    at org.apache.jasper.JspCompilationContext.getTldResourcePath(JspCompilationContext.java:563)
    at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:430)
    at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:489)

The problem is almost exactly that described at http://bengreen.eu/fancyhtml/quickreference/jettyjsp9error.html, 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">
        <Arg>org.eclipse.jetty.containerInitializers</Arg>
        <Arg>
            <Call class="java.util.Arrays" name="asList">
                <Array type="org.eclipse.jetty.plus.annotation.ContainerInitializer">
                    <Item>
                        <New
                            class="org.eclipse.jetty.plus.annotation.ContainerInitializer">
                            <Arg>
                                <New class="org.eclipse.jetty.apache.jsp.JettyJasperInitializer"></New>
                            </Arg>
                            <Arg></Arg>
                        </New>
                    </Item>
                </Array>
            </Call>
        </Arg>
    </Call>
    <Call name="addBean">
        <Arg>
            <New class="org.eclipse.jetty.annotations.ServletContainerInitializersStarter">
                <Arg>
                    <Ref refid="webappctxt" />
                </Arg>
            </New>
        </Arg>
    </Call>
    <Get name="ServletContext">
        <Call name="setAttribute">
            <Arg>org.apache.tomcat.InstanceManager</Arg>
            <Arg>
                <New class="org.apache.tomcat.SimpleInstanceManager"></New>
            </Arg>
        </Call>
    </Get>
</Configure>

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 org.eclipse.jetty.plus.annotation.ContainerInitializer:

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",
 org.mortbay.jasper.apache-jsp;bundle-version="8.5.54",
 org.eclipse.jetty.server;bundle-version="9.4.30",
 org.eclipse.jetty.deploy;bundle-version="9.4.30",
 org.eclipse.jetty.http;bundle-version="9.4.30",

 org.eclipse.jetty.io;bundle-version="9.4.30",
 org.eclipse.jetty.osgi.boot;bundle-version="9.4.30",
 org.eclipse.jetty
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jetty-users


--
Jan Bartel <janb@xxxxxxxxxxx>
www.webtide.com
Expert assistance from the creators of Jetty and CometD



--
Jan Bartel <janb@xxxxxxxxxxx>
www.webtide.com
Expert assistance from the creators of Jetty and CometD

_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jetty-users

Back to the top