关于重新部署Tomcat的Jersey客户端NullPointerException

时间:2014-11-02 23:39:38

标签: tomcat jersey redeploy

我在我的网站上使用泽西,为了获取和发布一些网址。 我在Quartz做了一个cron工作。

这将是每分钟运行的任务:

Client client=null;
        try {
            client = Client.create();
            WebResource webResource = client.resource("http://"+Props.vtiger_host+":8081/vtigercron.php");
            ClientResponse response = webResource.type("application/json").get(ClientResponse.class);
            if (response.getStatus() != 200) {
               throw new RuntimeException("Failed : HTTP error code : "
                + response.getStatus());
            }

            return;
        }catch (Exception e) {
            Log.log("Hubo un error al procesar el cron...");
            e.printStackTrace();
        }finally{

        }

这很好用,但是当我开发和重新部署tomcat时会给我一个错误,如下所示:

java.lang.NullPointerException
    at org.apache.catalina.loader.WebappClassLoader.findResources(WebappClassLoader.java:1002)
    at java.lang.ClassLoader.getResources(ClassLoader.java:1139)
    at com.sun.jersey.spi.service.ServiceFinder.getResources(ServiceFinder.java:306)
    at com.sun.jersey.spi.service.ServiceFinder.access$200(ServiceFinder.java:162)
    at com.sun.jersey.spi.service.ServiceFinder$AbstractLazyIterator.setConfigs(ServiceFinder.java:674)
    at com.sun.jersey.spi.service.ServiceFinder$AbstractLazyIterator.hasNext(ServiceFinder.java:685)
    at com.sun.jersey.spi.service.ServiceFinder.toClassArray(ServiceFinder.java:549)
    at com.sun.jersey.api.client.Client.init(Client.java:214)
    at com.sun.jersey.api.client.Client.access$000(Client.java:119)
    at com.sun.jersey.api.client.Client$1.f(Client.java:192)
    at com.sun.jersey.api.client.Client$1.f(Client.java:188)
    at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:193)
    at com.sun.jersey.api.client.Client.<init>(Client.java:188)
    at com.sun.jersey.api.client.Client.<init>(Client.java:160)
    at com.sun.jersey.api.client.Client.create(Client.java:673)
    at Tareas.CronVtiger.execute(CronVtiger.java:23)
    at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)

我正在使用jersey-bundle.1.8.jar

0 个答案:

没有答案