Good point. Provide us with a sample makes it far more easier :)

JLouis


2014-02-19 22:16 GMT+01:00 Martin Funk <[email protected]>:

> I boiled my question down to a tiny Eclipse project containing 4 classes
> and published that on github.
>
> https://github.com/mafulafunk/FooJaxRs
>
> Quite happy if someone could put an eye on that.
>
> mf
>
> Am 19.02.2014 um 18:36 schrieb Martin Funk <[email protected]>:
>
> > Working my way through, "Java Web Services" up and running.
> >
> > On Page 69 i stumble over a @Context Annotation
> >
> > [...]
> > import javax.ws.rs.core.Context;
> > import javax.ws.rs.core.MediaType;
> > import javax.ws.rs.core.Response;
> >
> > import com.fasterxml.jackson.databind.ObjectMapper;
> >
> > @Path("/predict")
> > public class PredictionsRS {
> >       @Context
> >       private ServletContext sctx; // dependency injection
> >       private static PredictionsList plist; // set in populate()
> > [...]
> >
> > the ServletContext sctx doesnt get initialized, on request the Server
> logs:
> >
> >       ... 37 more
> > Caused by: javax.naming.NameNotFoundException: Name
> [comp/env/de.martinfunk.predictions3.PredictionsRS/sctx] is not bound in
> this Context. Unable to find [comp].
> >       at org.apache.naming.NamingContext.lookup(NamingContext.java:820)
> >       at org.apache.naming.NamingContext.lookup(NamingContext.java:168)
> >
> >
> > I'm most likely missing something, just not sure what.
> > Is there some configuration needed for TomEE to pick up the annotated
> field 'sctx' and inject a ServletContext into it?
> >
> > mf
>
>


-- 
Jean-Louis

Reply via email to