You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Christian Schlichtherle <ch...@schlichtherle.de> on 2013/08/22 18:03:56 UTC
JAX-RS Exception Mapper doesn't like injected constructors
Hi,
on another subject, I get an exception at startup when deploying a JAX-RS exception mapper which has a public constructor with an inject context. The exception is:
SEVERE: can't instantiate net.java.trueupdate.jax.rs.server.UpdateServiceExceptionMapper
java.lang.InstantiationException: net.java.trueupdate.jax.rs.server.UpdateServiceExceptionMapper
at java.lang.Class.newInstance(Class.java:359)
at org.apache.openejb.server.cxf.rs.CxfRsHttpListener.providers(CxfRsHttpListener.java:178)
at org.apache.openejb.server.cxf.rs.CxfRsHttpListener.configureFactory(CxfRsHttpListener.java:220)
at org.apache.openejb.server.cxf.rs.CxfRsHttpListener.deploy(CxfRsHttpListener.java:146)
at org.apache.openejb.server.cxf.rs.CxfRsHttpListener.deployEJB(CxfRsHttpListener.java:120)
at org.apache.openejb.server.rest.RESTService.deployEJB(RESTService.java:448)
at org.apache.openejb.server.rest.RESTService.afterApplicationCreated(RESTService.java:215)
at org.apache.tomee.webservices.TomeeJaxRsService.afterApplicationCreated(TomeeJaxRsService.java:51)
The constructor looks like this:
public UpdateServiceExceptionMapper(
final @Context HttpHeaders headers) {
this.headers = Objects.requireNonNull(headers);
}
As soon as I refactor to private field injection instead, the exception does not appear.
In either case, the JAX-RS exception mapper works when needed, so I guess this is just an annoyance.
Regards,
Christian Schlichtherle
Re: JAX-RS Exception Mapper doesn't like injected constructors
Posted by Romain Manni-Bucau <rm...@gmail.com>.
hi
it is not yet supported
*Romain Manni-Bucau*
*Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
*Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*
2013/8/22 Christian Schlichtherle <ch...@schlichtherle.de>
> Hi,
>
> on another subject, I get an exception at startup when deploying a JAX-RS
> exception mapper which has a public constructor with an inject context. The
> exception is:
>
> SEVERE: can't instantiate
> net.java.trueupdate.jax.rs.server.UpdateServiceExceptionMapper
> java.lang.InstantiationException:
> net.java.trueupdate.jax.rs.server.UpdateServiceExceptionMapper
> at java.lang.Class.newInstance(Class.java:359)
> at
> org.apache.openejb.server.cxf.rs.CxfRsHttpListener.providers(CxfRsHttpListener.java:178)
> at
> org.apache.openejb.server.cxf.rs.CxfRsHttpListener.configureFactory(CxfRsHttpListener.java:220)
> at
> org.apache.openejb.server.cxf.rs.CxfRsHttpListener.deploy(CxfRsHttpListener.java:146)
> at
> org.apache.openejb.server.cxf.rs.CxfRsHttpListener.deployEJB(CxfRsHttpListener.java:120)
> at
> org.apache.openejb.server.rest.RESTService.deployEJB(RESTService.java:448)
> at
> org.apache.openejb.server.rest.RESTService.afterApplicationCreated(RESTService.java:215)
> at
> org.apache.tomee.webservices.TomeeJaxRsService.afterApplicationCreated(TomeeJaxRsService.java:51)
>
> The constructor looks like this:
>
> public UpdateServiceExceptionMapper(
> final @Context HttpHeaders headers) {
> this.headers = Objects.requireNonNull(headers);
> }
>
> As soon as I refactor to private field injection instead, the exception
> does not appear.
>
> In either case, the JAX-RS exception mapper works when needed, so I guess
> this is just an annoyance.
>
> Regards,
> Christian Schlichtherle
>
>
Re: JAX-RS Exception Mapper doesn't like injected constructors
Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi
This is not supported ATM
Le 22 août 2013 18:04, "Christian Schlichtherle" <ch...@schlichtherle.de>
a écrit :
> Hi,
>
> on another subject, I get an exception at startup when deploying a JAX-RS
> exception mapper which has a public constructor with an inject context. The
> exception is:
>
> SEVERE: can't instantiate
> net.java.trueupdate.jax.rs.server.UpdateServiceExceptionMapper
> java.lang.InstantiationException:
> net.java.trueupdate.jax.rs.server.UpdateServiceExceptionMapper
> at java.lang.Class.newInstance(Class.java:359)
> at
> org.apache.openejb.server.cxf.rs.CxfRsHttpListener.providers(CxfRsHttpListener.java:178)
> at
> org.apache.openejb.server.cxf.rs.CxfRsHttpListener.configureFactory(CxfRsHttpListener.java:220)
> at
> org.apache.openejb.server.cxf.rs.CxfRsHttpListener.deploy(CxfRsHttpListener.java:146)
> at
> org.apache.openejb.server.cxf.rs.CxfRsHttpListener.deployEJB(CxfRsHttpListener.java:120)
> at
> org.apache.openejb.server.rest.RESTService.deployEJB(RESTService.java:448)
> at
> org.apache.openejb.server.rest.RESTService.afterApplicationCreated(RESTService.java:215)
> at
> org.apache.tomee.webservices.TomeeJaxRsService.afterApplicationCreated(TomeeJaxRsService.java:51)
>
> The constructor looks like this:
>
> public UpdateServiceExceptionMapper(
> final @Context HttpHeaders headers) {
> this.headers = Objects.requireNonNull(headers);
> }
>
> As soon as I refactor to private field injection instead, the exception
> does not appear.
>
> In either case, the JAX-RS exception mapper works when needed, so I guess
> this is just an annoyance.
>
> Regards,
> Christian Schlichtherle
>
>