<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">
<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>
                                <td>
                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="https://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>
                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px; -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sts': Invocation of init method failed; nested exception is java.lang.NoSuchMethodError:
</h3>
<span style="margin-bottom: 10px;">
created by <a href="https://community.jboss.org/people/mpag1980">Anu Raj</a> in <i>JBoss Web Services Development</i> - <a href="https://community.jboss.org/message/826599#826599">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p>Hi, I am trying to publish Apache CXF STS in Jboss soa-p 5.1.3 G.A. I am following the sample program in the below link.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><a class="" href="https://community.jboss.org/wiki/WS-TrustWithJBossWS-CXFOnJBossAS71/diff?secondVersionNumber=4">https://community.jboss.org/wiki/WS-TrustWithJBossWS-CXFOnJBossAS71/diff?secondVersionNumber=4</a></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I am getting the following error when I try to access my token service wsdl endpoint</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sts': Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)V</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>My web.xml looks like this</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><?xml version="1.0" encoding="UTF-8"?></p><p><span><web-app xmlns:xsi="</span><a class="jive-link-external-small" href="http://www.w3.org/2001/XMLSchema-instance" rel="nofollow" target="_blank">http://www.w3.org/2001/XMLSchema-instance</a><span>" xmlns="</span><a class="jive-link-external-small" href="http://java.sun.com/xml/ns/javaee" rel="nofollow" target="_blank">http://java.sun.com/xml/ns/javaee</a><span>" xmlns:web="</span><a class="jive-link-external-small" href="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" rel="nofollow" target="_blank">http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd</a><span>" xsi:schemaLocation="</span><a class="jive-link-external-small" href="http://java.sun.com/xml/ns/javaee" rel="nofollow" target="_blank">http://java.sun.com/xml/ns/javaee</a><span> </span><a class="jive-link-external-small" href="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" rel="nofollow" target="_blank">http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd</a><span>" id="WebApp_ID" version="2.5"></span></p><p>  <display-name>CXFworkingSTS</display-name></p><p>  <welcome-file-list></p><p>    <welcome-file>index.html</welcome-file></p><p>    <welcome-file>index.htm</welcome-file></p><p>    <welcome-file>index.jsp</welcome-file></p><p>    <welcome-file>default.html</welcome-file></p><p>    <welcome-file>default.htm</welcome-file></p><p>    <welcome-file>default.jsp</welcome-file></p><p>  </welcome-file-list></p><p>  <servlet></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>        </p><p>    <description>Apache CXF Endpoint</description>  </p><p>    <display-name>cxf</display-name>  </p><p>    <servlet-name>cxf</servlet-name>  </p><p>    <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>  </p><p>    <load-on-startup>1</load-on-startup>  </p><p>  </servlet>  </p><p>  <servlet-mapping>  </p><p>    <servlet-name>cxf</servlet-name>  </p><p>    <url-pattern>/services/*</url-pattern>  </p><p>  </servlet-mapping>  </p><p>    </p><p>  <session-config>  </p><p>    <session-timeout>60</session-timeout>  </p><p>  </session-config>  </p><p>     </p><p>  <context-param>  </p><p>    <param-name>contextConfigLocation</param-name>  </p><p>    <param-value>WEB-INF/cxf-servlet.xml</param-value>  </p><p>  </context-param>  </p><p>  <servlet>  </p><p>      <servlet-name>SecurityTokenService</servlet-name>  </p><p>      <servlet-class>STS.SampleSTS</servlet-class>  </p><p>   </servlet>  </p><p>   <servlet-mapping>  </p><p>      <servlet-name>SecurityTokenService</servlet-name>  </p><p>      <url-pattern>/SecurityTokenService/*</url-pattern>  </p><p>   </servlet-mapping>  </p><p>  <listener>  </p><p>    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>  </p><p>  </listener>  </p><p></web-app>  </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>My cxf-servlet.xml looks like this</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><?xml version="1.0" encoding="UTF-8"?>  </p><p><span><beans xmlns="</span><a class="jive-link-external-small" href="http://www.springframework.org/schema/beans" rel="nofollow" target="_blank">http://www.springframework.org/schema/beans</a><span>"  </span></p><p><span>    xmlns:xsi="</span><a class="jive-link-external-small" href="http://www.w3.org/2001/XMLSchema-instance" rel="nofollow" target="_blank">http://www.w3.org/2001/XMLSchema-instance</a><span>" xmlns:jaxws="</span><a class="jive-link-external-small" href="http://cxf.apache.org/jaxws" rel="nofollow" target="_blank">http://cxf.apache.org/jaxws</a><span>"  </span></p><p><span>    xsi:schemaLocation="</span><a class="jive-link-external-small" href="http://www.springframework.org/schema/beans" rel="nofollow" target="_blank">http://www.springframework.org/schema/beans</a><span> </span><a class="jive-link-external-small" href="http://www.springframework.org/schema/beans/spring-beans-2.5.xsd" rel="nofollow" target="_blank">http://www.springframework.org/schema/beans/spring-beans-2.5.xsd</a><span> </span><a class="jive-link-external-small" href="http://cxf.apache.org/jaxws" rel="nofollow" target="_blank">http://cxf.apache.org/jaxws</a><span> </span><a class="jive-link-external-small" href="http://cxf.apache.org/schemas/jaxws.xsd" rel="nofollow" target="_blank">http://cxf.apache.org/schemas/jaxws.xsd</a><span>">  </span></p><p>    </p><p><span>    <jaxws:endpoint xmlns:tns="</span><a class="jive-link-external-small" href="http://docs.oasis-open.org/ws-sx/ws-trust/200512/" rel="nofollow" target="_blank">http://docs.oasis-open.org/ws-sx/ws-trust/200512/</a><span>"  </span></p><p>        id="sts" implementor="STS.SampleSTS"  </p><p>        wsdlLocation="wsdl/ws-trust-1.4-service.wsdl" endpointName="tns:UT_Port"  </p><p>        serviceName="tns:SecurityTokenService" address="/UT_Port">  </p><p>        <jaxws:features>  </p><p>            <bean class="org.apache.cxf.feature.LoggingFeature" />  </p><p>        </jaxws:features>  </p><p>    </jaxws:endpoint>  </p><p></beans> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>SampleSTS.java</p><p>+++++++++++++++</p><p>/*</p><p> * JBoss, Home of Professional Open Source.</p><p> * Copyright 2012, Red Hat Middleware LLC, and individual contributors</p><p> * as indicated by the @author tags. See the copyright.txt file in the</p><p> * distribution for a full listing of individual contributors.</p><p> *</p><p> * This is free software; you can redistribute it and/or modify it</p><p> * under the terms of the GNU Lesser General Public License as</p><p> * published by the Free Software Foundation; either version 2.1 of</p><p> * the License, or (at your option) any later version.</p><p> *</p><p> * This software is distributed in the hope that it will be useful,</p><p> * but WITHOUT ANY WARRANTY; without even the implied warranty of</p><p> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</p><p> * Lesser General Public License for more details.</p><p> *</p><p> * You should have received a copy of the GNU Lesser General Public</p><p> * License along with this software; if not, write to the Free</p><p> * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA</p><p><span> * 02110-1301 USA, or see the FSF site: </span><a class="jive-link-external-small" href="http://www.fsf.org" rel="nofollow" target="_blank">http://www.fsf.org</a><span>.</span></p><p> */</p><p>package STS;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>import java.util.Arrays;</p><p>import java.util.LinkedList;</p><p>import java.util.List;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>import javax.servlet.annotation.WebServlet;</p><p>import javax.xml.ws.WebServiceProvider;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>import org.apache.cxf.annotations.EndpointProperties;</p><p>import org.apache.cxf.annotations.EndpointProperty;</p><p>import org.apache.cxf.interceptor.InInterceptors;</p><p>import org.apache.cxf.sts.StaticSTSProperties;</p><p>import org.apache.cxf.sts.operation.TokenIssueOperation;</p><p>import org.apache.cxf.sts.operation.TokenValidateOperation;</p><p>import org.apache.cxf.sts.service.ServiceMBean;</p><p>import org.apache.cxf.sts.service.StaticService;</p><p>import org.apache.cxf.sts.token.provider.SAMLTokenProvider;</p><p>import org.apache.cxf.sts.token.validator.SAMLTokenValidator;</p><p>import org.apache.cxf.ws.security.sts.provider.SecurityTokenServiceProvider;</p><p>import org.jboss.wsf.stack.cxf.client.configuration.JBossWSBusFactory;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>@WebServiceProvider(serviceName = "SecurityTokenService",</p><p>      portName = "UT_Port",</p><p><span>      targetNamespace = "</span><a class="jive-link-external-small" href="http://docs.oasis-open.org/ws-sx/ws-trust/200512/" rel="nofollow" target="_blank">http://docs.oasis-open.org/ws-sx/ws-trust/200512/</a><span>",</span></p><p>      wsdlLocation = "WEB-INF/wsdl/ws-trust-1.4-service.wsdl")</p><p>@EndpointProperties(value = {</p><p>      @EndpointProperty(key = "ws-security.signature.username", value = "mystskey"),</p><p>      @EndpointProperty(key = "ws-security.signature.properties", value = "stsKeystore.properties"),</p><p>      @EndpointProperty(key = "ws-security.callback-handler", value = "STSCallbackHandler")      </p><p>})</p><p>@InInterceptors(interceptors = {"org.jboss.wsf.stack.cxf.security.authentication.SubjectCreatingPolicyInterceptor"})</p><p>@WebServlet(name = "SampleSTSServlet", urlPatterns = "/*")</p><p>public class SampleSTS extends SecurityTokenServiceProvider</p><p>{</p><p>   @SuppressWarnings("deprecation")</p><p>public SampleSTS() throws Exception</p><p>   {</p><p>      super();</p><p>      </p><p>      StaticSTSProperties props = new StaticSTSProperties();</p><p>      props.setSignaturePropertiesFile("stsKeystore.properties");</p><p>      props.setSignatureUsername("mystskey");</p><p>      props.setCallbackHandlerClass(STSCallbackHandler.class.getName());</p><p>      props.setIssuer("DoubleItSTSIssuer");</p><p>      </p><p>      List<ServiceMBean> services = new LinkedList<ServiceMBean>();</p><p>      StaticService service = new StaticService();</p><p><span>      service.setEndpoints(Arrays.asList("</span><a class="jive-link-external-small" href="http://localhost:9090/CXFworking/services/SecurityServicePort" rel="nofollow" target="_blank">http://localhost:9090/CXFworking/services/SecurityServicePort</a><span>"));</span></p><p>      services.add(service);</p><p>      </p><p>      TokenIssueOperation issueOperation = new TokenIssueOperation();</p><p>      issueOperation.setServices(services);</p><p>      issueOperation.getTokenProviders().add(new SAMLTokenProvider());</p><p>      issueOperation.setStsProperties(props);</p><p>      </p><p>      TokenValidateOperation validateOperation = new TokenValidateOperation();</p><p>      validateOperation.getTokenValidators().add(new SAMLTokenValidator());</p><p>      validateOperation.setStsProperties(props);</p><p>      </p><p>      this.setIssueOperation(issueOperation);</p><p>      this.setValidateOperation(validateOperation);</p><p>   }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>}</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I have a callback handler.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>/**</p><p> * Licensed to the Apache Software Foundation (ASF) under one</p><p> * or more contributor license agreements. See the NOTICE file</p><p> * distributed with this work for additional information</p><p> * regarding copyright ownership. The ASF licenses this file</p><p> * to you under the Apache License, Version 2.0 (the</p><p> * "License"); you may not use this file except in compliance</p><p> * with the License. You may obtain a copy of the License at</p><p> *</p><p><span> * </span><a class="jive-link-external-small" href="http://www.apache.org/licenses/LICENSE-2.0" rel="nofollow" target="_blank">http://www.apache.org/licenses/LICENSE-2.0</a></p><p> *</p><p> * Unless required by applicable law or agreed to in writing,</p><p> * software distributed under the License is distributed on an</p><p> * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY</p><p> * KIND, either express or implied. See the License for the</p><p> * specific language governing permissions and limitations</p><p> * under the License.</p><p> */</p><p>package STS;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>import java.io.IOException;</p><p>import javax.security.auth.callback.Callback;</p><p>import javax.security.auth.callback.CallbackHandler;</p><p>import javax.security.auth.callback.UnsupportedCallbackException;</p><p>import org.apache.ws.security.WSPasswordCallback;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>public class STSCallbackHandler implements CallbackHandler {</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>    public void handle(Callback[] callbacks) throws IOException,</p><p>            UnsupportedCallbackException {</p><p>        for (int i = 0; i < callbacks.length; i++) {</p><p>            if (callbacks[i] instanceof WSPasswordCallback) {</p><p>                WSPasswordCallback pc = (WSPasswordCallback) callbacks[i];</p><p>                if ("mystskey".equals(pc.getIdentifier())) {</p><p>                    pc.setPassword("stskpass");</p><p>                    break;</p><p>                } else if ("alice".equals(pc.getIdentifier())) {</p><p>                    pc.setPassword("clarinet");</p><p>                    break;</p><p>                }</p><p>            }</p><p>        }</p><p>    }</p><p>}</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I see there is an issue with my web.xml file. Please help me out.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Thanks,</p><p>Abarna</p></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Reply to this message by <a href="https://community.jboss.org/message/826599#826599">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JBoss Web Services Development at <a href="https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2047">Community</a></p>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>