Registering a provider programmatically in jersey which implements exceptionmapper

I'm guessing you don't have a ResourceConfig, since you seem to not be sure how to use it. For one, it is not required. If you do use it, it should be it's own separate class. There you can register the mapper.

public class AppConfig extends ResourceConfig {
    public AppConfig() {
        register(new MyProvider());
    }
}

But you are probably using a web.xml. In which case, you can register the provider, with the following <init-param>

<servlet>
    <servlet-name>MyApplication</servlet-name>
    <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
    <init-param>
        <param-name>jersey.config.server.provider.classnames</param-name>
        <param-value>
            org.foo.providers.MyProvider
        </param-value>
    </init-param>
</servlet>

Have a look at Application Deployment and Runtime Environments for more information on different deployment models. There are a few different ways to deploy applications. You can even mix and match (web.xml and ResourceConfig).