1 Reply Latest reply on Dec 4, 2009 7:22 PM by Juergen Zimmermann

    Error with registering a RESTeasy Providerfactory

    Heinrich Hermann Newbie

      Hi,

      I get the following error:

      java.lang.ClassCastException: com.sun.jersey.server.impl.provider.RuntimeDelegateImpl cannot be cast to org.jboss.resteasy.spi.ResteasyProviderFactory
       at org.jboss.resteasy.spi.ResteasyProviderFactory.getInstance(ResteasyProviderFactory.java:330)
       at de.webshop.test.util.RegisterResteasy.register(RegisterResteasy.java:11)
       at de.webshop.test.BestellverwaltungTest.setup(BestellverwaltungTest.java:56)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
       at java.lang.reflect.Method.invoke(Method.java:617)
       at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
       at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
       at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
       at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
       at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
       at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
       at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
       at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
       at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
       at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
       at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)


      After I run this code:

      package de.webshop.test.util;
      
      import org.jboss.resteasy.plugins.providers.RegisterBuiltin;
      import org.jboss.resteasy.spi.ResteasyProviderFactory;
      
      public abstract class RegisterResteasy {
       private static boolean registered = false;
      
       public static void register() {
       if (!registered) {
       ResteasyProviderFactory resteasyProviderFactory = ResteasyProviderFactory.getInstance();
       RegisterBuiltin.register( resteasyProviderFactory );
       registered = true;
       }
       }
      }


      What can be the reason ? Thanks for help in advance.