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

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.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:324)
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
at org.eclipse.jetty.io.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


Back to the top