2014-12-04 48 views
0

雖然按照說明啓用CAS的REST API @http://jasig.github.io/cas/4.0.0/protocol/REST-Protocol.html,在我的行家覆蓋的部署我嘗試發佈到CAS 4.0.0 REST API設置:記錄錯誤

/cas/v1/tickets 

,我也得到一個

500 Internal Server Error 

和充滿

WARNING: Exception or error caught in server resource 
Internal Server Error (500) - The server encountered an unexpected condition which prevented it from fulfilling the request 
    at org.restlet.resource.ServerResource.doHandle(ServerResource.java:517) 
    at org.restlet.resource.ServerResource.doHandle(ServerResource.java:552) 
    at org.restlet.resource.ServerResource.post(ServerResource.java:1185) 
    at org.restlet.resource.ServerResource.doHandle(ServerResource.java:437) 
    at org.restlet.resource.ServerResource.doConditionalHandle(ServerResource.java:350) 
    at org.restlet.resource.ServerResource.handle(ServerResource.java:951) 
    at org.restlet.resource.Finder.handle(Finder.java:246) 
    at org.restlet.routing.Filter.doHandle(Filter.java:159) 
    at org.restlet.routing.Filter.handle(Filter.java:206) 
    at org.restlet.routing.Router.doHandle(Router.java:431) 
    at org.restlet.routing.Router.handle(Router.java:648) 
    at org.restlet.routing.Filter.doHandle(Filter.java:159) 
    at org.restlet.routing.Filter.handle(Filter.java:206) 
    at org.restlet.routing.Filter.doHandle(Filter.java:159) 
    at org.restlet.routing.Filter.handle(Filter.java:206) 
    at org.restlet.routing.Filter.doHandle(Filter.java:159) 
    at org.restlet.engine.application.StatusFilter.doHandle(StatusFilter.java:155) 
    at org.restlet.routing.Filter.handle(Filter.java:206) 
    at org.restlet.routing.Filter.doHandle(Filter.java:159) 
    at org.restlet.routing.Filter.handle(Filter.java:206) 
    at org.restlet.engine.CompositeHelper.handle(CompositeHelper.java:211) 
    at org.restlet.engine.application.ApplicationHelper.handle(ApplicationHelper.java:84) 
    at org.restlet.Application.handle(Application.java:381) 
    at org.restlet.ext.servlet.ServletAdapter.service(ServletAdapter.java:206) 
    at org.restlet.ext.spring.RestletFrameworkServlet.doService(RestletFrameworkServlet.java:124) 
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936) 
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:838) 
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:646) 
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812) 
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) 
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) 
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) 
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) 
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) 
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:343) 
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:260) 
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) 
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) 
    at com.github.inspektr.common.web.ClientInfoThreadLocalFilter.doFilter(ClientInfoThreadLocalFilter.java:63) 
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) 
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) 
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) 
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) 
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501) 
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170) 
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98) 
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950) 
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) 
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) 
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040) 
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607) 
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:313) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) 
    at java.lang.Thread.run(Thread.java:745) 
Caused by: java.lang.NoSuchMethodError: org.apache.commons.lang.StringUtils.join(Ljava/util/Collection;Ljava/lang/String;)Ljava/lang/String; 
    at org.jasig.cas.integration.restlet.TicketResource.logFormRequest(TicketResource.java:132) 
    at org.jasig.cas.integration.restlet.TicketResource.obtainCredentials(TicketResource.java:112) 
    at org.jasig.cas.integration.restlet.TicketResource.acceptRepresentation(TicketResource.java:71) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:606) 
    at org.restlet.resource.ServerResource.doHandle(ServerResource.java:503) 
    ... 54 more 

日誌我檢查了代碼@https://github.com/Jasig/cas/blob/master/cas-server-integration-restlet/src/main/java/org/jasig/cas/integration/restlet/TicketResource.java,它看起來像

/** 
* Log the form request. 
* 
* @param form the form 
*/ 
private void logFormRequest(final Form form) { 
    if (LOGGER.isDebugEnabled()) { 
     final Set<String> pairs = new HashSet<String>(); 
     for (final String name : form.getNames()) { 
      final StringBuilder builder = new StringBuilder(); 
      builder.append(name); 
      builder.append(": "); 
      if (!"password".equalsIgnoreCase(name)) { 
       builder.append(form.getValues(name)); 
      } else { 
       builder.append("*****"); 
      } 
      pairs.add(builder.toString()); 
     } 
     LOGGER.debug(StringUtils.join(pairs, ", ")); 
    } 
} 

任何人有任何想法?謝謝!

回答

1

Maven引入了commons-lang-2.5.jar和commons-lang-2.1.jar。 2.1不包括Restlet框架提供的方法簽名。我刪除了2.1版本的jar,衝突得到解決。我正在使用的CAS 4.0 maven覆蓋模板將其拉入。我確實告訴它會自動解決依賴關係,因此最終導致我的錯誤。

如果你想知道我刪除:

overlays/org.jasig.cas.cas-server-webapp-4.0.0/WEB-INF/lib/commons-lang-2.1.jar