10 Replies Latest reply on Apr 27, 2010 4:11 PM by Erick Jeronimo Diaz

    java.lang.ClassCastException: $Proxy25

    Erick Jeronimo Diaz Newbie

      Hi, i wonder if you could help me with this. I followed step by step the advanced samples:http://community.jboss.org/docs/DOC-13566 and it is great for beginers like me. Every things fine with attachments (MTOM/XOP and SwaRef). But when i try to test WS-Security, only the first scenario (the press release endpoint) , because i couldn't follow it, due to this error:

      java.lang.ClassCastException: $Proxy25 which is pointing to this code: ((StubExt)endpoint).setConfigName("Standard WSSecurity Client");

       

      i checked the use of jbossws jax-ws lib , with this:

      URL jaxwsThatIsUsed = javax.xml.ws.Service.class.getProtectionDomain().getCodeSource().getLocation();
      System.out.println("JAXWS that is used: " + jaxwsThatIsUsed);

      getting :

      JAXWS that is used: file:/D:/Programas/jboss-4.2.3.GA/client/jbossws-native-jaxws.jar

       

      So, i don't even imagine what else to do...

       

      Please, could you help me with this

       

      thanks a lot in advance,

       

       

      PD: I'm using JBossAS-4.2.3 and jbossws-native-3.1.1.GA

        • 1. Re: java.lang.ClassCastException: $Proxy25
          Richard Opalka Master

          Download JBossWS 3.1.1.GA native source distribution.

          You'll find the samples sources there and you can

          compare your code with the code in that distro.

          1 of 1 people found this helpful
          • 2. Re: java.lang.ClassCastException: $Proxy25
            Erick Jeronimo Diaz Newbie

            thanks for your rapid answer Opalka. I've downloaded and used that code and have the same error:

             

            java.lang.ClassCastException: $Proxy25
                at org.jboss.test.ws.jaxws.samples.news.SecureAgency.<init>(SecureAgency.java:39)
                at org.jboss.test.ws.jaxws.samples.news.SecureAgency.main(SecureAgency.java:48)

             

             

            i really wanna use WS-SECURITY!!!!!, i swear i've tried every solution i've found but without success

             

            Please have you any other idea about this problem???

             

            thanks a lot for your help

            • 3. Re: java.lang.ClassCastException: $Proxy25
              Richard Opalka Master

              Are you running your tests from IDE?

              Can you run the test from source distribution and are you able to reproduce the error?

              If yes, could you send us your environment settings (the test report file generated by maven surefire plugin)

              1 of 1 people found this helpful
              • 4. Re: java.lang.ClassCastException: $Proxy25
                Erick Jeronimo Diaz Newbie

                Thanks a lot for your rapid answer Opalka. Yes i'm running from the IDE (Eclipse) is where i get this:

                java.lang.ClassCastException: $Proxy25
                    at org.jboss.test.ws.jaxws.samples.news.SecureAgency.<init>(SecureAgency.java:39)
                    at org.jboss.test.ws.jaxws.samples.news.SecureAgency.main(SecureAgency.java:48)

                 

                but when i run from console with wsrunclient i get this:

                 

                E:\Windows\workspace\Newspaper\build\classes>wsrunclient org.jboss.test.ws.jaxws

                .samples.news.SecureAgency http://localhost:8080/news/pressRelease?wsdl title bo

                dy

                Exception in thread "main" java.lang.NoClassDefFoundError: javax/annotation/Post

                Construct

                        at org.jboss.wsf.common.javax.finders.PostConstructMethodFinder.<init>(P

                ostConstructMethodFinder.java:55)

                        at org.jboss.wsf.common.javax.JavaxAnnotationHelper.<clinit>(JavaxAnnota

                tionHelper.java:53)

                        at org.jboss.ws.core.jaxws.handler.HandlerResolverImpl.addHandler(Handle

                rResolverImpl.java:171)

                        at org.jboss.ws.core.jaxws.handler.HandlerResolverImpl.initHandlerChain(

                HandlerResolverImpl.java:149)

                        at org.jboss.ws.core.jaxws.client.ClientImpl.initBindingHandlerChain(Cli

                entImpl.java:154)

                        at org.jboss.ws.core.jaxws.client.ClientImpl.<init>(ClientImpl.java:132)

                 

                         at org.jboss.ws.core.jaxws.spi.ServiceDelegateImpl.createProxy(ServiceDe

                legateImpl.java:394)

                        at org.jboss.ws.core.jaxws.spi.ServiceDelegateImpl.getPortInternal(Servi

                ceDelegateImpl.java:273)

                        at org.jboss.ws.core.jaxws.spi.ServiceDelegateImpl.getPort(ServiceDelega

                teImpl.java:200)

                        at javax.xml.ws.Service.getPort(Service.java:141)

                        at org.jboss.test.ws.jaxws.samples.news.generated.agency.PressReleaseSer

                vice.getPressReleaseEndpointPort(PressReleaseService.java:55)

                        at org.jboss.test.ws.jaxws.samples.news.Agency.<init>(Agency.java:49)

                        at org.jboss.test.ws.jaxws.samples.news.SecureAgency.<init>(SecureAgency

                .java:38)

                        at org.jboss.test.ws.jaxws.samples.news.SecureAgency.main(SecureAgency.j

                ava:48)

                E:\Windows\workspace\Newspaper\build\classes>

                 

                what could it be? I hope this help you to help me. :-)  . i appreciate your help, i'm new with this stuff, thanks

                • 5. Re: java.lang.ClassCastException: $Proxy25
                  Richard Opalka Master

                  Do you jave -Djava.endorsed.dirs=%JBOSS_HOME%/lib/endorsed in your eclipse lunch command?

                  • 6. Re: java.lang.ClassCastException: $Proxy25
                    Erick Jeronimo Diaz Newbie

                    Upss, i tried to check java.endorsed.dirs value running this:

                    System.err.println("java.endorsed.dirs: "+ System.getProperty("java.endorsed.dirs"));

                     

                    getting this:

                     

                    java.endorsed.dirs: D:/Programas/jboss-4.2.3.GA/lib/endorsed

                     

                     

                    what else do i must to do to fix this

                     

                    java.lang.ClassCastException: $Proxy25
                        at org.jboss.test.ws.jaxws.samples.news.SecureAgency.<init>(SecureAgency.java:39)
                        at org.jboss.test.ws.jaxws.samples.news.SecureAgency.main(SecureAgency.java:49)

                    ????

                     

                    thanks in advance

                    • 7. Re: java.lang.ClassCastException: $Proxy25
                      Erick Jeronimo Diaz Newbie

                      OK, i tested to install JBossAS-5.0.1 with jbossws-native-3.2.2.GA and ran the same sample: "Security and attachments sample" and it worked!!!!!!!!!,

                       

                      Now i can not see the trace with TCPmon-1.0-bin (i could with JBossAS-4.2.3 and JBossws-3.1.1). i get this

                       

                      • Access Denied.

                        Access control configuration prevents your request from being allowed at this time.  Please contact your service provider if you feel this is incorrect.

                       

                      what do i'm missing??????

                       

                      Opalka, thanks a lot for your time,

                      • 8. Re: java.lang.ClassCastException: $Proxy25
                        Erick Jeronimo Diaz Newbie

                        i tried to modify location in <soap:address location="http://localhost:8080/news/pressRelease"/> to location="http://localhost:8081/news/pressRelease"

                        for tracing motive, i change the wsdl file located in \jboss-5.0.1.GA\server\default\data\wsdl\Newspaper.jar , but when i test : http://localhost:8080/news/pressRelease?wsdl i don't see the change i made, it seems to be in another place. Where do JBossAS-5.0.1 locate this generated wsdl???

                        • 9. Re: java.lang.ClassCastException: $Proxy25
                          Richard Opalka Master

                          You have to have the following jars in %JBOSS_HOME%\lib\endorsed:

                           

                          * jboss-saaj.jar (or jbossws-native-saaj.jar)

                          * jboss-jaxws.jar (or jbossws-native-jaxws.jar)

                          * jaxb-api.jar

                          • 10. Re: java.lang.ClassCastException: $Proxy25
                            Erick Jeronimo Diaz Newbie

                            Ohhhh my friend thankssss a lot man..... You're right . Now it works perfectly (refering to jbossas 4.2.3 with jbossws-3.1.1).

                             

                            thanks for your time Opalka.