HLS example code gives null pointer exception

7 views
Skip to first unread message

Damian Helme

unread,
Dec 18, 2023, 4:45:13 AM12/18/23
to gstreamer-java

When I try to run the GStreamer HLS Java example from the GStreamer repo: https://github.com/gstreamer-java/gst1-java-examples/tree/master/HLS I get the Null Pointer exception below.

To reproduce the problem:

$ git clone https://github.com/gstreamer-java/gst1-java-examples.git
$ cd gst1-java-examples/HLS
$ ./gradlew run


Looking in a debugger it appears the Jetty _context is null, which makes the ResourceHandler.getResource() return null.

HLS_–_ResourceHandler_java__Gradle__org_eclipse_jetty_jetty-server_9_4_40_v20210413_.jpg

I'm running on OSX Ventura 13.5, with Java Corretto 21

Any suggestions appreciated!

[qtp638169719-30] INFO io.javalin.Javalin - Exception occurred while handling static resource kotlin.KotlinNullPointerException at io.javalin.http.staticfiles.PrefixableHandler.getResource(JettyResourceHandler.kt:107) at io.javalin.http.staticfiles.JettyResourceHandler.handle(JettyResourceHandler.kt:42) at io.javalin.http.JavalinServlet$service$2$1.invoke(JavalinServlet.kt:52) at io.javalin.http.JavalinServlet$service$2$1.invoke(JavalinServlet.kt:24) at io.javalin.http.JavalinServlet$service$1.invoke(JavalinServlet.kt:136) at io.javalin.http.JavalinServlet$service$2.invoke(JavalinServlet.kt:40) at io.javalin.http.JavalinServlet.service(JavalinServlet.kt:81) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at io.javalin.websocket.JavalinWsServlet.service(JavalinWsServlet.kt:51) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:791) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:550) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233) at io.javalin.core.JavalinServer$start$wsAndHttpHandler$1.doHandle(JavalinServer.kt:49) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:501) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1350) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) at org.eclipse.jetty.server.handler.StatisticsHandler.handle(StatisticsHandler.java:179) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) at org.eclipse.jetty.server.Server.handle(Server.java:516) at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:388) at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:633) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:380) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277) at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311) at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105) at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:135) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:882) at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1036) at java.base/java.lang.Thread.run(Thread.java:833)

Neil C Smith

unread,
Dec 18, 2023, 6:09:28 AM12/18/23
to gstream...@googlegroups.com
Hi,

On Mon, 18 Dec 2023 at 09:45, Damian Helme <damia...@gmail.com> wrote:
> When I try to run the GStreamer HLS Java example from the GStreamer repo: https://github.com/gstreamer-java/gst1-java-examples/tree/master/HLS I get the Null Pointer exception below.
...
> I'm running on OSX Ventura 13.5, with Java Corretto 21

Yes, unfortunately the HLS example doesn't seem to work correctly on
macOS, and is a bit hit and miss on Windows. The paths configuration
needs looking at, and also if there's an issue with the temp folder
configuration.

Try rewriting it to use a folder in your user directory, and checking
the paths passed in to GStreamer are as expected.

Best wishes,

Neil

--
Neil C Smith
Codelerity Ltd.
www.codelerity.com

Codelerity Ltd. is a company registered in England and Wales
Registered company number : 12063669
Registered office address : 3rd Floor Suite, 207 Regent Street,
London, W1B 3HH, England

Damian Helme

unread,
Dec 21, 2023, 3:59:49 AM12/21/23
to gstreamer-java
Yes setting the playlistRoot to a folder in my user directory worked!

I'll dig around a bit to see if I can work out why  Files.createTempDirectory is causing a problem.

thanks for your help!

Damian.
Reply all
Reply to author
Forward
0 new messages