Can you provide some more stack trace? Here is the code from TapestryFilter:
registry = appInitializer.createRegistry(); context.setAttribute(REGISTRY_CONTEXT_NAME, registry); ServletApplicationInitializer ai = registry.getService("ServletApplicationInitializer", ServletApplicationInitializer.class); // Sets request globals ai.initializeApplication(filterConfig.getServletContext()); // collects eager load services and creates the underlying objects. registry.performRegistryStartup(); Can you create a small example app that reproduces the problem? On Thu, Jun 23, 2011 at 7:37 AM, Erik Fäßler <erik.faess...@uni-jena.de> wrote: > 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 > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org