3 Replies Latest reply on May 23, 2011 1:56 AM by Alessio Soldano

    ClassCastException when trying to access web service

    Nate W Newbie



      I'm developing a client with maven-jaxws-tools-plugin and CXF.

      After successfully creating a client and deploying it on JBoss (5.1.0GA), I tried to access a web service with this client, but without success.

      I get the following error:


      java.util.ServiceConfigurationError: javax.xml.ws.spi.Provider: Provider org.jboss.ws.core.jaxws.spi.ProviderImpl could not be instantiated: java.lang.ClassCastException

                at java.util.ServiceLoader.fail(Unknown Source)

                at java.util.ServiceLoader.access$100(Unknown Source)

                at java.util.ServiceLoader$LazyIterator.next(Unknown Source)

                at java.util.ServiceLoader$1.next(Unknown Source)

                at javax.xml.ws.spi.Provider.getProviderUsingServiceLoader(Provider.java:146)

                at javax.xml.ws.spi.Provider.provider(Provider.java:106)

                at javax.xml.ws.Service.<init>(Service.java:57)


      Searching the web for help didn't come up with usefull results.


      Any suggestions?




        • 1. ClassCastException when trying to access web service
          Alessio Soldano Master

          Check your classpath and java.endorsed.dirs env property value; the jaxws provider above is trying to get a new instance of org.jboss.ws.core.jaxws.spi.ProviderImpl which is the JBossWS-Native jaxws provider, but I assume you properly installed jbossws-cxf, given you mentioned cxf before, right?

          • 2. ClassCastException when trying to access web service
            Nate W Newbie

            Hi there,

            I just got back from a 2 week vacation, this is why it took me some time to reply

            I do use cxf and I've installed jbossws-cxf-3.4.1.GA from http://www.jboss.org/jbossws/downloads/ but the problem is that it alters the jboss installation. I'm only writing a plugin for an application that resided on jboss and therefore I cannot change the jboss installation.

            In fact after installing jbossws-cxf-3.4.1.GA the jboss threw some errors on startup...

            Is there a way to use jbossws-cxf without changing the jboss installation?

            As for the endorsed dir, do you suggest avoiding it in the jboss startup script?


            • 3. ClassCastException when trying to access web service
              Alessio Soldano Master

              Please see http://community.jboss.org/wiki/JBossWS-SupportedTargetContainers

              JBossWS-CXF 3.4.1 is not meant for running on top of JBoss AS 5.1.0. That's most probably why the server is not booting. Try starting over from a vanilla 5.1.0 and installing jbossws-cxf 3.4.0 if you need for an update.

              Yes, of course the installation change some files on the server (especially installing jbws-cxf on top of an AS that includes jbossws-native), that the reason of updating ;-)


              The plugin is meant for using the stack that's available. Check the way the classpath it's build; generally speaking the java.endorsed.dirs setup influences the resolution of the jaxws provider. So if that's pointing to a dir containing jbossws-native libs, the plugin will end up trying to instanciate native jaxws implementation, etc.