Open GoogleCodeExporter opened 9 years ago
Or perhaps the same thing in Development stage?
Original comment by mathias....@gmail.com
on 19 Mar 2009 at 2:24
Hmm.
1) null returned by binding at
com.google.inject.servlet.InternalServletModule.configure(InternalServletModule.
java:71)
but parameter 0 of
com.processtrend.frontend.WebModule$FreeMarkerConfigurationProvider.<init>() is
not
@Nullable
while locating javax.servlet.ServletContext
for parameter 0 at
com.processtrend.frontend.WebModule$FreeMarkerConfigurationProvider.<init>(WebMo
dule.java:127)
Original comment by mathias....@gmail.com
on 19 Mar 2009 at 4:23
Can you test with your debugger to see if GuiceFilter has been initialized? You
won't be able to access the
ServletContext binding until that's happened...
Original comment by limpbizkit
on 19 Mar 2009 at 5:35
Ok I feel a stupid. Indeed, it seems that was the problem.
If GuiceServletContextListener would bind the servletContext, the problem would
be
solved.
Original comment by mathias....@gmail.com
on 19 Mar 2009 at 6:12
Solution:
The InternalServletModule's ServletContext provider should first try
GuiceServletContextListener that has a static WeakReference to the
ServletContext. If
it's null, go with GuiceFilter's one. I'll create a patch.
Original comment by mathias....@gmail.com
on 19 Mar 2009 at 6:21
Thanks Mathias, I've added a slightly different fix for this in rev 909. Please
let me know if this works for you and
thanks for this suggestion.
Original comment by dha...@gmail.com
on 21 Mar 2009 at 10:35
Your fix is ok, but wouldn't it be handier if it's set before the getInjector()
call?
Original comment by mathias....@gmail.com
on 21 Mar 2009 at 5:06
Dhanji?
Original comment by mathias....@gmail.com
on 26 Mar 2009 at 5:34
Are you using it in an eager singleton or something?
Original comment by dha...@gmail.com
on 26 Mar 2009 at 11:25
Indeed. I'm initializing my FreeMarker context upon startup, and it needs a
ServletContext to preload/parse
templates.
Original comment by mathias....@gmail.com
on 26 Mar 2009 at 11:51
Done.
Original comment by dha...@gmail.com
on 27 Mar 2009 at 12:41
Original issue reported on code.google.com by
mathias....@gmail.com
on 19 Mar 2009 at 1:43