users@jersey.java.net

Re: [Jersey] ExceptionMapper and constructor injection of _at_Context UriInfo ?

From: Morten <mortench2004_at_yahoo.dk>
Date: Thu, 23 Jul 2009 13:12:32 +0000 (GMT)

--- Den tors 23/7/09 skrev Paul Sandoz <Paul.Sandoz@Sun.COM>: > > Unfortunately, jersey gives an error that the class > can't be instantiated (assumingly because it does not > support injection of the provider). > > Any more information on the error? stack trace? Sorry for leaving this out. Here is the stack trace: SEVERE: The provider class, class com.test.ws.controller.CustomExceptionMapper, could not be instantiated. Processing will continue but the class will not be utilized java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at com.sun.jersey.core.spi.component.ComponentConstructor._getInstance(ComponentConstructor.java:160) at com.sun.jersey.core.spi.component.ComponentConstructor.getInstance(ComponentConstructor.java:140) at com.sun.jersey.core.spi.component.ProviderFactory.__getComponentProvider(ProviderFactory.java:159) at com.sun.jersey.core.spi.component.ProviderFactory._getComponentProvider(ProviderFactory.java:152) at com.sun.jersey.core.spi.component.ioc.IoCProviderFactory.wrap(IoCProviderFactory.java:106) at com.sun.jersey.core.spi.component.ioc.IoCProviderFactory._getComponentProvider(IoCProviderFactory.java:87) at com.sun.jersey.core.spi.component.ProviderFactory.getComponentProvider(ProviderFactory.java:146) at com.sun.jersey.core.spi.component.ProviderServices.getComponent(ProviderServices.java:185) at com.sun.jersey.core.spi.component.ProviderServices.getProviders(ProviderServices.java:95) at com.sun.jersey.server.impl.application.ExceptionMapperFactory.<init>(ExceptionMapperFactory.java:67) at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:570) at com.sun.jersey.api.container.ContainerFactory.createContainer(ContainerFactory.java:168) > Many of the internal providers supplied by Jersey use > constructor injection. I did a quick test and it works for > me e.g. i modified the helloworld sample [1] resource class > to be: Hmm. Stange. Are you using another sw cfg then I am (I am using newest releases 1.1.1-ea with Sun's HTTPServer on JDK1.6_0_13 on Mac OS 10.5 ) P.S. Thanks for your prompt replies to my mails on this mailing list. Great support! Cheers, Morten Trænger du til at se det store billede? Kelkoo giver dig gode tilbud på LCD TV! Se her http://dk.yahoo.com/r/pat/lcd