Return-Path: X-Original-To: apmail-cxf-users-archive@www.apache.org Delivered-To: apmail-cxf-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9770510413 for ; Thu, 20 Jun 2013 05:29:09 +0000 (UTC) Received: (qmail 36954 invoked by uid 500); 20 Jun 2013 05:29:07 -0000 Delivered-To: apmail-cxf-users-archive@cxf.apache.org Received: (qmail 36844 invoked by uid 500); 20 Jun 2013 05:28:59 -0000 Mailing-List: contact users-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@cxf.apache.org Delivered-To: mailing list users@cxf.apache.org Received: (qmail 36834 invoked by uid 99); 20 Jun 2013 05:28:54 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Jun 2013 05:28:54 +0000 X-ASF-Spam-Status: No, hits=2.0 required=5.0 tests=SPF_NEUTRAL,URI_HEX X-Spam-Check-By: apache.org Received-SPF: error (athena.apache.org: encountered temporary error during SPF processing of domain of vasudhagholap@gmail.com) Received: from [216.139.236.26] (HELO sam.nabble.com) (216.139.236.26) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Jun 2013 05:28:49 +0000 Received: from [192.168.236.26] (helo=sam.nabble.com) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1UpXPl-0004mr-DC for users@cxf.apache.org; Wed, 19 Jun 2013 22:28:09 -0700 Date: Wed, 19 Jun 2013 22:28:09 -0700 (PDT) From: nicky123 To: users@cxf.apache.org Message-ID: <1371706089372-5729540.post@n5.nabble.com> Subject: Annotation based WS-SecurityPolicy throwing exception MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Hello, I am working on annotation base ws-securityPolicy and have the following annotation on the service bean. Note: using cxf version of 2.7.5 @WebService(endpointInterface = "com.apachecxf.services.HelloWorldService") @Policy(uri = "policies/TestImplPolicy.xml") @EndpointProperty(key="ws-security.ut.validator", value="com.apachecxf.services.CustomUserTokenValidator") public class HelloWorldServiceBean implements HelloWorldService { public String sayHello() { System.out.println("Hello World!!!"); return "Hello my service is working"; } } The bean configuration file have just the bean definition of the above bean. Rest all required data is in place. When I run this i get following exception java.lang.ClassCastException: java.lang.String cannot be cast to org.apache.ws.security.validate.Validator from UsernameTokenProcessor at line Validator validator = data.getValidator(WSSecurityEngine.USERNAME_TOKEN); which gets the validator from UsernameTokenInterceptor.getPrincipal() method On debugging, it seems that the CustomUserTokenValidator is not loaded via annotation. If the same example i did with bean configuration it works fine. Bean configuration as follows Please advise for any missing step. -- View this message in context: http://cxf.547215.n5.nabble.com/Annotation-based-WS-SecurityPolicy-throwing-exception-tp5729540.html Sent from the cxf-user mailing list archive at Nabble.com.