Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Migration help to Jersey 3 / Jetty 11

Thank you Joakim, I have adopted your suggestions in the pom.

Kind regards,

Chris


On 2022-02-08 17:01, Joakim Erdfelt wrote:
Some observations on your example project.

Use the jetty-bom

            <dependency>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-bom</artifactId>
                <version>11.0.8</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

Use the enforcer plugin to check for duplicate classes, and important
step before you use the shade plugin (you had quite a few before your
last change).

Your shade plugin should be updated to version 3.2.4 (the 3.2.0
version is problematic with jpms and multirelease-jars)
Setup the filters/filter/excludes properly on your shade plugin.

You can see these changes at ...

https://github.com/joakime/ModernREST/blob/joakim-cleanup/pom.xml

Joakim Erdfelt / joakim@xxxxxxxxxxx

On Tue, Feb 8, 2022 at 11:51 AM <chris@xxxxxxxxxxxxxxxx> wrote:

Thank you both for your suggestions. I've now got a working
JakartaEE /
Jersey 3 / Jetty 11 webapp with sessions, static resources, and all
configuration by code:


https://github.com/chriswhocodes/ModernREST/blob/main/src/main/java/com/chrisnewland/modernrest/webapp/WebServer.java
https://github.com/chriswhocodes/ModernREST/blob/main/pom.xml

Kind regards,

Chris

On 2022-02-08 14:42, chris@xxxxxxxxxxxxxxxx wrote:
SSCCE: https://github.com/chriswhocodes/ModernREST

On trying to access the HttpServletRequest injected by:

@Context private HttpServletRequest servletRequest;

I get an NPE:

HttpSession session = servletRequest.getSession(true);

I'm trying to create a modern JakartaEE / Jersey 3 / Jetty 11
webapp
with all configuration in code, no XML wiring, like I did here:



https://github.com/chriswhocodes/JaCoLine/blob/master/src/main/java/com/chrisnewland/jacoline/web/WebServer.java
https://github.com/chriswhocodes/JaCoLine/blob/master/pom.xml

Thanks,

Chris

2022-02-08T14:11:19.574897Z ERR
com.chrisnewland.modernrest.webapp.filter.RequestFilter Could not
filter request
java.lang.NullPointerException
at


com.chrisnewland.modernrest.webapp.filter.RequestFilter.filter(RequestFilter.java:24)
at


org.glassfish.jersey.server.ContainerFilteringStage.apply(ContainerFilteringStage.java:108)
at


org.glassfish.jersey.server.ContainerFilteringStage.apply(ContainerFilteringStage.java:44)
at


org.glassfish.jersey.process.internal.Stages.process(Stages.java:173)
at


org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:247)
at
org.glassfish.jersey.internal.Errors$1.call(Errors.java:248)
at
org.glassfish.jersey.internal.Errors$1.call(Errors.java:244)
at
org.glassfish.jersey.internal.Errors.process(Errors.java:292)
at
org.glassfish.jersey.internal.Errors.process(Errors.java:274)
at
org.glassfish.jersey.internal.Errors.process(Errors.java:244)
at


org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:265)
at


org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:234)
at


org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:684)
at


org.glassfish.jersey.jetty.JettyHttpContainer.handle(JettyHttpContainer.java:175)
at


org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
at org.eclipse.jetty.server.Server.handle(Server.java:567)
at


org.eclipse.jetty.server.HttpChannel.lambda$handle$0(HttpChannel.java:404)
at
org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:661)
at
org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:396)
at


org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:289)
at
org.eclipse.jetty.io

[1].AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:324)
at org.eclipse.jetty.io
[1].FillInterest.fillable(FillInterest.java:105)
at
org.eclipse.jetty.io
[1].SocketChannelEndPoint$1.run(SocketChannelEndPoint.java:106)
at


org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:790)
at


org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:912)
at java.base/java.lang.Thread.run(Thread.java:829)


On 2022-02-08 12:03, chris@xxxxxxxxxxxxxxxx wrote:
Thank you both, I'm working on an SSCCE to reproduce the null
injected
request. Once I've got that on GitHub I'll try and update my pom
from
your project until it works.

Kind regards,

Chris

On 2022-02-08 11:16, hantsy bai wrote:
I have created a starter template project to start Jakarta EE 9
servlet web application, but I used an external Jetty to serve
the
application in this project,

see:
https://github.com/hantsy/jakartaee9-servlet-starter-boilerplate

Hantsy Bai

Self-employed consultant, fullstack developer, agile coach

GitHub: https://github.com/hantsy

Twitter: https://twitter.com/@hantsyMedium:
https://medium.com/@hantsy

On Tue, Feb 8, 2022 at 12:13 PM Jan Bartel <janb@xxxxxxxxxxx>
wrote:

It would be useful if you could provide either a pointer to
your
project or a minimum reproducible example. The exact stacktrace
you
get would also be useful.

Jan

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


Links:
------
[1] http://org.eclipse.jetty.io
_______________________________________________
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