Return-Path:
Problem accessing /api/v1/clusters/cl1. Reason:
>>> HTTP ERROR: 400
>>> Bad Request
Another related question...= ..is there something I missed in the log file that would have pointed me to= the missing header, or do we need another JIRA opened to that?Thanks,-ChrisOn Fri, Jan 17, 2014 at 12:28 PM, Yusaku Sako = <yusaku@hort= onworks.com> wrote:
Please add the HTTP header "X-Requested-By: ambari" to any POST= /PUT calls you make.This change in the API behavior was made to prevent CSRF (Cross-Site Reques= t Forgery).YusakuOn Fri, Jan 17, 2014 at 12:17 PM, Chris Mildebrandt <= chris@woodenrhino.com> wrote:
Hey,I= 39;ve been using Ambari 1.4.1.25 for a while. I tried Ambari 1.4.3.38 today= and I'm not able to create a cluster using the REST services. Here'= ;s the call I expected to work:curl -i -X POST -= d '{"Clusters": {"version": "HDP-2.0.6"}}= ' --user admin:admin http://hadoop1.robinsystems.com:8080/a= pi/v1/clusters/cl1
I get the following response:<title>Error 400 Bad= Request</title></head><body><h2>HTTP ERROR: 400</h2> <p>Problem acces= sing /api/v1/clusters/cl1. Reason:<pre> =A0 =A0Bad Request&l= t;/pre></p><hr /><i><small>Powered by Jetty://</small></i&= gt;However, I'm able to create the cluster from = the web UI. Here are the relevant log entries from the POST:
=11:47:59,601 DEBUG [q= tp139607202-15 - /api/v1/clusters/cl1] Server:358 - REQUEST /api/v1/cluster= s/cl1 on AsyncHttpConnection@a42a751,g=3DHttpGenerator{s=3D0,h=3D-1,b=3D-1,= c=3D-1},p=3DHttpParser{s=3D2,l=3D33,c=3D38},r=3D111:47:59,601 DEBUG [qtp139607202= -15 - /api/v1/clusters/cl1] ContextHandler:894 - scope null||/api/v1/cluste= rs/cl1 @ o.e.j.s.ServletContextHandler{/,file:/usr/lib/ambari-server/web/}<= /font>11:47:59,601 DEBUG [qtp139607202= -15 - /api/v1/clusters/cl1] ContextHandler:966 - context=3D||/api/v1/cluste= rs/cl1 @ o.e.j.s.ServletContextHandler{/,file:/usr/lib/ambari-server/web/}<= /font>11:47:59,601 DEBUG [qtp139607202= -15 - /api/v1/clusters/cl1] session:183 - sessionManager=3Dorg.eclipse.jett= y.server.session.HashSessionManager@775c024c11:47:59,601 DEBUG [qtp139607202-15 - /api/v1/clus= ters/cl1] session:184 - session=3Dnull11:47:59,601 DEBUG [qtp139607202= -15 - /api/v1/clusters/cl1] ServletHandler:360 - servlet |/api/v1|/clusters= /cl1 -> com.sun.jersey.spi.container.servlet.ServletContainer-1821413125=11:47:59,601 DEBUG [qtp139607202= -15 - /api/v1/clusters/cl1] ServletHandler:422 - chain=3Dorg.apache.ambari.= server.api.AmbariPersistFilter-452688583->org.springframework.web.filter= .DelegatingFilterProxy-1399975832->com.sun.jersey.spi.container.servlet.= ServletContainer-182141312511:47:59,602 DEBUG [qtp139607202= -15 - /api/v1/clusters/cl1] ServletHandler:1297 - call filter org.apache.am= bari.server.api.AmbariPersistFilter-452688583 =A011:47:59,602 DEBUG [qtp139607202-15 - /api/v1= /clusters/cl1] ServletHandler:1297 - call filter org.springframework.web.fi= lter.DelegatingFilterProxy-139997583211:47:59,602 DEBUG [qtp139607202= -15 - /api/v1/clusters/cl1] FilterChainProxy:337 - /api/v1/clusters/cl1 at = position 1 of 8 in additional filter chain; firing Filter: 'SecurityCon= textPersistenceFilter'11:47:59,602 DEBUG [qtp139607202= -15 - /api/v1/clusters/cl1] HttpSessionSecurityContextRepository:127 - No H= ttpSession currently exists11:47:59,602 DEBUG [qtp139607202-15 - /api/v1/clusters/cl1] HttpSes= sionSecurityContextRepository:85 - No SecurityContext was available from th= e HttpSession: null. A new one will be created.11:47:59,602 DEBUG [qtp139607202= -15 - /api/v1/clusters/cl1] FilterChainProxy:337 - /api/v1/clusters/cl1 at = position 2 of 8 in additional filter chain; firing Filter: 'BasicAuthen= ticationFilter'11:47:59,602 DEBUG [qtp139607202= -15 - /api/v1/clusters/cl1] BasicAuthenticationFilter:161 - Basic Authentic= ation Authorization header found for user 'admin'11:47:59,602 DEBUG [qtp139607202-15 -= /api/v1/clusters/cl1] ProviderManager:152 - Authentication attempt using o= rg.springframework.security.authentication.dao.DaoAuthenticationProvider11:47:59,603 =A0INFO [qtp1396072= 02-15 - /api/v1/clusters/cl1] AmbariLocalUserDetailsService:62 - Loading us= er by name: admin11= :47:59,607 DEBUG [qtp139607202-15 - /api/v1/clusters/cl1] BasicAuthenticati= onFilter:171 - Authentication success: org.springframework.security.authent= ication.UsernamePasswordAuthenticationToken@63215be: Principal: org.springf= ramework.security.core.userdetails.User@586034f: Username: admin; Password:= [PROTECTED]; Enabled: true; AccountNonExpired: true; credentialsNonExpired= : true; AccountNonLocked: true; Granted Authorities: ADMIN; Credentials: [P= ROTECTED]; Authenticated: true; Details: org.springframework.security.web.a= uthentication.WebAuthenticationDetails@ffffe21a: RemoteIpAddress: 10.7.200.= 2; SessionId: null; Granted Authorities: ADMIN =A011:47:59,607 DEBUG [qtp139607202= -15 - /api/v1/clusters/cl1] FilterChainProxy:337 - /api/v1/clusters/cl1 at = position 3 of 8 in additional filter chain; firing Filter: 'RequestCach= eAwareFilter' =A011:47:59,607 DEBUG [qtp139607202= -15 - /api/v1/clusters/cl1] FilterChainProxy:337 - /api/v1/clusters/cl1 at = position 4 of 8 in additional filter chain; firing Filter: 'SecurityCon= textHolderAwareRequestFilter'11:47:59,607 DEBUG [qtp139607202= -15 - /api/v1/clusters/cl1] FilterChainProxy:337 - /api/v1/clusters/cl1 at = position 5 of 8 in additional filter chain; firing Filter: 'AnonymousAu= thenticationFilter'11:47:59,607 DEBUG [qtp139607202= -15 - /api/v1/clusters/cl1] AnonymousAuthenticationFilter:107 - SecurityCon= textHolder not populated with anonymous token, as it already contained: = 9;org.springframework.security.authentication.UsernamePasswordAuthenticatio= nToken@63215be: Principal: org.springframework.security.core.userdetails.Us= er@586034f: Username: admin; Password: [PROTECTED]; Enabled: true; AccountN= onExpired: true; credentialsNonExpired: true; AccountNonLocked: true; Grant= ed Authorities: ADMIN; Credentials: [PROTECTED]; Authenticated: true; Detai= ls: org.springframework.security.web.authentication.WebAuthenticationDetail= s@ffffe21a: RemoteIpAddress: 10.7.200.2; SessionId: null; Granted Authoriti= es: ADMIN' =A011:47:59,607 DEBUG [qtp139607202= -15 - /api/v1/clusters/cl1] FilterChainProxy:337 - /api/v1/clusters/cl1 at = position 6 of 8 in additional filter chain; firing Filter: 'SessionMana= gementFilter' =A011:47:59,607 DEBUG [qtp139607202= -15 - /api/v1/clusters/cl1] HttpSessionSecurityContextRepository:336 - Http= Session being created as SecurityContext is non-default11:47:59,608 DEBUG [qtp139607202-15 -= /api/v1/clusters/cl1] session:85 - new session & id 1n12cpwlh9zb143gov= wif9ub6 1n12cpwlh9zb143govwif9ub611:47:59,608 DEBUG [qtp139607202-15 - /api/v1/clusters/cl1] H= ttpSessionSecurityContextRepository:292 - SecurityContext stored to HttpSes= sion: 'org.springframework.security.core.context.SecurityContextImpl@63= 215be: Authentication: org.springframework.security.authentication.Username= PasswordAuthenticationToken@63215be: Principal: org.springframework.securit= y.core.userdetails.User@586034f: Username: admin; Password: [PROTECTED]; En= abled: true; AccountNonExpired: true; credentialsNonExpired: true; AccountN= onLocked: true; Granted Authorities: ADMIN; Credentials: [PROTECTED]; Authe= nticated: true; Details: org.springframework.security.web.authentication.We= bAuthenticationDetails@ffffe21a: RemoteIpAddress: 10.7.200.2; SessionId: nu= ll; Granted Authorities: ADMIN' =A011:47:59,608 DEBUG [qtp139607202= -15 - /api/v1/clusters/cl1] FilterChainProxy:337 - /api/v1/clusters/cl1 at = position 7 of 8 in additional filter chain; firing Filter: 'ExceptionTr= anslationFilter' =A011:47:59,608 DEBUG [qtp139607202= -15 - /api/v1/clusters/cl1] FilterChainProxy:337 - /api/v1/clusters/cl1 at = position 8 of 8 in additional filter chain; firing Filter: 'FilterSecur= ityInterceptor'11:47:59,608 DEBUG [qtp139607202= -15 - /api/v1/clusters/cl1] AntPathRequestMatcher:85 - Request 'POST /a= pi/v1/clusters/cl1' doesn't match 'GET /**11:47:59,608 DEBUG [qtp139607202-15 -= /api/v1/clusters/cl1] FilterSecurityInterceptor:194 - Secure object: Filte= rInvocation: URL: /api/v1/clusters/cl1; Attributes: [hasRole('ADMIN'= ;)]11:47:59,609 DEBUG [qtp139607202= -15 - /api/v1/clusters/cl1] FilterSecurityInterceptor:310 - Previously Auth= enticated: org.springframework.security.authentication.UsernamePasswordAuth= enticationToken@63215be: Principal: org.springframework.security.core.userd= etails.User@586034f: Username: admin; Password: [PROTECTED]; Enabled: true;= AccountNonExpired: true; credentialsNonExpired: true; AccountNonLocked: tr= ue; Granted Authorities: ADMIN; Credentials: [PROTECTED]; Authenticated: tr= ue; Details: org.springframework.security.web.authentication.WebAuthenticat= ionDetails@ffffe21a: RemoteIpAddress: 10.7.200.2; SessionId: null; Granted = Authorities: ADMIN11:47:59,609 DEBUG [q= tp139607202-15 - /api/v1/clusters/cl1] AffirmativeBased:65 - Voter: org.spr= ingframework.security.web.access.expression.WebExpressionVoter@2844a541, re= turned: 1 =A011:47:59,609 DEBUG [qtp139607202= -15 - /api/v1/clusters/cl1] FilterSecurityInterceptor:215 - Authorization s= uccessful11:47:59,6= 09 DEBUG [qtp139607202-15 - /api/v1/clusters/cl1] FilterSecurityInterceptor= :227 - RunAsManager did not change Authentication object11:47:59,609 DEBUG [qtp139607202= -15 - /api/v1/clusters/cl1] FilterChainProxy:323 - /api/v1/clusters/cl1 rea= ched end of additional filter chain; proceeding with original chain<= /div>11:47:59,610 DEBUG [qtp139607202= -15 - /api/v1/clusters/cl1] ServletHandler:1328 - call servlet com.sun.jers= ey.spi.container.servlet.ServletContainer-182141312511:47:59,610 DEBUG [qtp139607202-15 - /api= /v1/clusters/cl1] HttpSessionSecurityContextRepository:292 - SecurityContex= t stored to HttpSession: 'org.springframework.security.core.context.Sec= urityContextImpl@63215be: Authentication: org.springframework.security.auth= entication.UsernamePasswordAuthenticationToken@63215be: Principal: org.spri= ngframework.security.core.userdetails.User@586034f: Username: admin; Passwo= rd: [PROTECTED]; Enabled: true; AccountNonExpired: true; credentialsNonExpi= red: true; AccountNonLocked: true; Granted Authorities: ADMIN; Credentials:= [PROTECTED]; Authenticated: true; Details: org.springframework.security.we= b.authentication.WebAuthenticationDetails@ffffe21a: RemoteIpAddress: 10.7.2= 00.2; SessionId: null; Granted Authorities: ADMIN'11:47:59,613 DEBUG [qtp139607202= -15 - /api/v1/clusters/cl1] ExceptionTranslationFilter:115 - Chain processe= d normally11:47:59,= 613 DEBUG [qtp139607202-15 - /api/v1/clusters/cl1] SecurityContextPersisten= ceFilter:97 - SecurityContextHolder now cleared, as request processing comp= leted =A011:47:59,613 DEBUG [qtp139607202= -15 - /api/v1/clusters/cl1] Server:360 - RESPONSE /api/v1/clusters/cl1 =A04= 00 handled=3Dtrue =A010.7.200.2:33434)<->r(/10.7.200.1:8080),d=3Dtrue,open=3Dtrue,ishut=3Dfalse,= oshut=3Dfalse,rb=3Dfalse,wb=3Dfalse,w=3Dtrue,i=3D0r}-{AsyncHttpConnection@a= 42a751,g=3DHttpGenerator{s=3D4,h=3D0,b=3D0,c=3D-1},p=3DHttpParser{s=3D0,l= =3D33,c=3D38},r=3D1}11:47:59,614 DEBUG [qtp139607202= -15] ChannelEndPoint:118 - ishut SCEP@5511e6b9{l(/10.7.200.2:33434)<->r(/10.7.200.1:8080),d=3Dtrue,open= =3Dtrue,ishut=3Dfalse,oshut=3Dfalse,rb=3Dfalse,wb=3Dfalse,w=3Dtrue,i=3D0r}-= {AsyncHttpConnection@a42a751,g=3DHttpGenerator{s=3D0,h=3D-1,b=3D-1,c=3D-1},= p=3DHttpParser{s=3D-14,l=3D0,c=3D-3},r=3D1}11:47:59,614 DEBUG [qtp139607202= -15] HttpParser:281 - filled -1/011:47:59,614 DEBUG [qtp139607202-15] AsyncHttpConnection:145 = - Disabled read interest while writing response SCEP@5511e6b9{l(/10.7.200.2:33434)<->r= (/10.7.200.1:8080)= ,d=3Dtrue,open=3Dtrue,ishut=3Dtrue,oshut=3Dfalse,rb=3Dfalse,wb=3Dfalse,w=3D= true,i=3D0r}-{AsyncHttpConnection@a42a751,g=3DHttpGenerator{s=3D0,h=3D-1,b= =3D-1,c=3D-1},p=3DHttpParser{s=3D0,l=3D0,c=3D-3},r=3D1}11:47:59,614 DEBUG [qtp139607202= -15] ChannelEndPoint:209 - close SCEP@5511e6b9{l(/10.7.200.2:33434)<->r(/10.7.200.1:8080),d=3Dtrue,open= =3Dtrue,ishut=3Dtrue,oshut=3Dfalse,rb=3Dfalse,wb=3Dfalse,w=3Dtrue,i=3D0r}-{= AsyncHttpConnection@a42a751,g=3DHttpGenerator{s=3D0,h=3D-1,b=3D-1,c=3D-1},p= =3DHttpParser{s=3D0,l=3D0,c=3D-3},r=3D1}Any ideas?Thanks, -Chris
CONFIDENTIALITY NOTICE
NOTICE: This message is intended for the use of the individual or e= ntity to which it is addressed and may contain information that is confiden= tial, privileged and exempt from disclosure under applicable law. If the re= ader of this message is not the intended recipient, you are hereby notified= that any printing, copying, dissemination, distribution, disclosure or for= warding of this communication is strictly prohibited. If you have received = this communication in error, please contact the sender immediately and dele= te it from your system. Thank You.