Hi everyone!

I build a web app using T5.2.5 and employing the T5 IoC container.
I have a contribution to a service which gets the ApplicationGlobals service injected. Everything works fine - until I want to eagerload the service with the afore mentioned contribution. When I eagerload the service, sometimes everything is alright. But sometimes I get a NullPointerException here:

ServletContext context = applicationGlobals.getServletContext();
InputStream is = context.getResourceAsStream("/WEB-INF" + SemedicoSymbolProvider.CONFIG_FILE_NAME); // Here sometimes null pointer

Thus, the ServletContext is null (I have tested that). I'm not sure how this works, it seems to me the eager load is so fast sometimes, that the servlet container (Jetty) has not started its services yet.
In the stack trace there is this snippet:
---------------- SNIP -----------------------
at org.apache.tapestry5.TapestryFilter.init(TapestryFilter.java:102)
at org.eclipse.jetty.servlet.FilterHolder.doStart(FilterHolder.java:110) at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55) at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:747) at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:250)
---------------- SNAP -----------------------

This sounds like it would be tried to initialize the context. Perhaps this is a concurrency thing, I really don't know. Does anyone of you have some ideas on how to avoid this error? For me it would suffice if I could delay the eagerload until a later point where the ServletContext is surely initialized. But I wouldn't like to abandon the eager load at all, because then the first call to my web app takes quite some time (30sec or so). But again, when not using eager load, no errors are thrown.

Best regards,

    Erik

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to