users@jersey.java.net

Re: [Jersey] Cannot Instantiate new provider

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Fri, 19 Jun 2009 13:19:59 +0200

On Jun 19, 2009, at 12:51 PM, Jonathan Cook - FM&T wrote:

> Hi,
>
> I have a problem were I have written my own
> FreeMarkerTemplateProcessor. Everything works nicely but when I
> deploy my application it registers the new provider successfully but
> then it complains that it can't instantiate the new class and then
> goes on to fail I assume because it can't do the freemarker
> initialisation.
>
> 19-Jun-2009 11:11:58 com.sun.ws.rest.api.core.PackagesResourceConfig
> init
> INFO: Provider classes found:
> class
> com
> .bbc.newsi.feeds.sport.webservice.providers.FreemarkerTemplateProcess
> or
> 19-Jun-2009 11:11:58
> com.sun.ws.rest.impl.application.ComponentProviderCache get
> Component
> WARNING: The provider class, class
> com.bbc.newsi.feeds.sport.webservice.provider
> s.FreemarkerTemplateProcessor, could not be instantiated

Is any stack trace provided as to why it cannot instantiate?

Can you send the code for the class?


>
> 2009-06-19 11:11:58.110::WARN: /football/includepathgenerator:
> java.io.IOExcept
> ion: The template name, /include_path_generator.ftl, could not be
> resolved to th
> e path of a template
>
> Should I have a default constructor explicitly in the class? Is
> there some condition when accessing the application remotely that
> the templateprocessor won't get instantiated because as I say it all
> works locally? I'm using an embedded instance of jetty as the web
> server.
>

Are your dependencies correct for the remote deployment?

Paul.


>
> I'm using the following annotations at the top of the class:
> @Provider
> @Singleton
>
> Any ideas?
>
> Thanks
> Jonathan