5 Replies Latest reply on Aug 13, 2009 6:31 PM by soboko

    Beginners problem with ((StubExt)port).setSecurityConfig()

      Hi!

      Im a newbe trying to complete a web service client tutorial.

      I ran into a

      java.lang.ClassCastException: $Proxy30 cannot be cast to org.jboss.ws.core.StubExt

      when trying to execute line

      ((StubExt)port).setSecurityConfig(_securityURL.toExternalForm())

      The _securityURL contains a URL to the jboss-wsse-client.xml. I cant find what is wrong and would appreciate any pointers or reference to where I can find out what is going wrong. Also please if I am in the wrong forum where should I go?

      Thanks in advance

      Yoshi

        • 1. Re: Beginners problem with ((StubExt)port).setSecurityConfig
          peterj

          According to the code you posted, you are try to cast 'port' to StubExt. Given the lack of details about how port got set, and what StubExt is, it is hard to say what the problem is.

          • 2. Re: Beginners problem with ((StubExt)port).setSecurityConfig

            Hi

            Thank you for you reply. I am using the following code:

            WSTestService service = new WSTestService (_wsdlURL,
            new QName(_ServiceUrl, "WSTestService"));
            TestService port = service.getWSTestServicePort ();
            BindingProvider bp = (BindingProvider)port;
            bp.getRequestContext().put(StubExt.PROPERTY_CLIENT_TIMEOUT,
            new Integer(10000));
            bp.getRequestContext()
            .put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
            _endpointUrl);
            bp.getRequestContext()
            .put(StubExt.PROPERTY_AUTH_TYPE,
            StubExt.PROPERTY_AUTH_TYPE_WSSE);

            The StubExt is of type import org.jboss.ws.core.StubExt; which i import into my project.

            BR
            Yoshi

            • 3. Re: Beginners problem with ((StubExt)port).setSecurityConfig
              ropalka

              Hi,

              I bet you're using wrong classpath. Aren't you using IDE to run the JAX-WS sample?
              Please check your classpath and ensure you're using JBossWS-Native libraries to run the JAX-WS samples.

              • 4. Re: Beginners problem with ((StubExt)port).setSecurityConfig

                Hi!

                Thanks for your reply, yes im using eclipse version 3.4.2 to build.

                In my Java Build Path i have inluded the jbossws-client-3.0.1-native-2.0.4.GA.jar under the Library folder

                In my Run|Run Configuration the classpath contains the same jar under the User Entries, WSTestServiceClient project (default classpath)

                Is there something missing or is there somewhere else I need to setup?

                Also when i debug the row Eclipse throws the followig error
                Thread.dispatchUncaughtException(Throwable)line: not available

                And I get a view with the text

                Source not found.
                And a button "Edit Source Lookup path"

                I tried to recconect the Jar file and put it in a simpler path (c:/temp) but without success.

                Thank you in advance on any tip or pointers.

                BR
                Yoshi

                • 5. Re: Beginners problem with ((StubExt)port).setSecurityConfig

                  I was running into a similar ClassCastException. The difference is that I'm using Maven and NetBeans 6.7 to generate my test client.

                  To get this to work, I had to change my project dependencies from this (which was generated by NetBeans)...

                  <dependency>
                   <groupId>com.sun.xml.ws</groupId>
                   <artifactId>webservices-rt</artifactId>
                   <version>1.4</version>
                   <scope>provided</scope>
                   </dependency>


                  ...to this:

                  <dependency>
                   <groupId>org.jboss.javaee</groupId>
                   <artifactId>jboss-ejb-api</artifactId>
                   <version>3.0.0.GA</version>
                   </dependency>
                  
                   <dependency>
                   <groupId>org.jboss</groupId>
                   <artifactId>jbossxb</artifactId>
                   <version>2.0.1.GA</version>
                   </dependency>
                  
                   <dependency>
                   <groupId>org.jboss.ws.native</groupId>
                   <artifactId>jbossws-native-client</artifactId>
                   <version>3.1.2.SP3</version>
                   </dependency>


                  Along the way, I tried using:

                  <dependency>
                   <groupId>jboss.jbossws</groupId>
                   <artifactId>jbossws-core</artifactId>
                   <version>3.0.1-native-2.0.4.GA</version>
                   </dependency>


                  Which corresponds to your jbossws-client-3.0.1-native-2.0.4.GA.jar. That one did not work for me, I had to change the dependencies as described above.

                  I still don't know if those are the right dependencies, but those are my best guesses. Figuring out all these dependencies has been purely trial-and-error and it's been a bit frustrating. Other aspects of the setup process were pretty well documented, but figuring out what dependencies I need to include to use annotations like @WebContext, @EndpointConfig, etc. was not. I had to use findjar.com (which gave me misleading info a lot of the time) and decompress random jars in order to find the right dependencies!

                  I ended up adding these dependencies to my server-side EJB project in order to use those annotations:

                  <dependency>
                   <groupId>org.jboss.ws</groupId>
                   <artifactId>jbossws-spi</artifactId>
                   <version>1.1.2.GA</version>
                   <scope>provided</scope>
                   </dependency>
                  
                   <dependency>
                   <groupId>jboss.jbossws</groupId>
                   <artifactId>jbossws-core</artifactId>
                   <version>3.0.1-native-2.0.4.GA</version>
                   <scope>provided</scope>
                   </dependency>


                  And, to resolve these dependencies, I need this:

                  <repository>
                   <id>jboss</id>
                   <url>http://repository.jboss.org/maven2</url>
                   </repository>
                  


                  I don't know if this is correct or not. If anyone has better information, I would greatly appreciate it!