【发布时间】:2011-06-02 13:48:05
【问题描述】:
我在使用 RESTEasy 提供的客户端框架调用 RESTful Web 服务时遇到了一些问题。当我尝试注册 ResteasyProviderFactory 时,我得到了一个 ClassCastException 并且没有其他工作。
代码如下:
RegisterBuiltin.register(ResteasyProviderFactory.getInstance());
LifeGoalClient leClient = ProxyFactory.create(LifeGoalClient.class, "http://localhost:8080/TutorFinanceiro");
List<LifeGoal> lifeGoals = leClient.getLifeGoals();
JOptionPane.showMessageDialog(null, lifeGoals);
return lifeGoals;
还有一个例外:
java.lang.ClassCastException: com.sun.jersey.server.impl.provider.RuntimeDelegateImpl cannot be cast to org.jboss.resteasy.spi.ResteasyProviderFactory
我正在使用 Glassfish 3.0.1 和 Resteasy 2.2.1。
我在网上搜索,但没有找到解决方案或没有相关信息。 如果有人有解决方案或替代方法,请帮助我!
提前致谢
【问题讨论】:
-
我对此进行了大量研究,但没有发现任何无用的东西,只是解决方法不起作用。我认为在这种情况下将 Jersey 换成 RestEasy 是更好的选择。
标签: java rest httpclient resteasy