1 Reply Latest reply on Feb 25, 2013 3:04 PM by M Longman

    Error with registering a RESTeasy Providerfactory

    M Longman 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. And don't just say 'You're mixing Jersey and Resteasy', I don't know what that means and there's no Jersey dependencies in my pom.

        • 1. Re: Error with registering a RESTeasy Providerfactory
          M Longman Newbie

          To anyone out there experiencing this error: Check your pom.xml to see if it contains this dependency:

           

                  <dependency>

                      <groupId>org.apache.cxf</groupId>

                      <artifactId>cxf-bundle-jaxrs</artifactId>

                      <version>2.7.0</version>

                  </dependency>

           

          This is the jar for jersey I guess, kill it with fire if you want to use resteasy.