Home Forums HDP on Linux – Installation Problem on installing HDP using Ambari

This topic contains 1 reply, has 2 voices, and was last updated by  Dave 1 year, 1 month ago.

  • Creator
    Topic
  • #38093

    Dong Shen
    Member

    I have successed in deploying HDP using the curl commands. Now I am trying to use RestTemplate Model in Java project. But it failed. Following is my code.
    String authorisation = user + “:” + password;
    String encodedAuthorisation = Base64.encodeBase64String(authorisation.getBytes()); encodedAuthorisation = encodedAuthorisation.replaceAll(“\r\n”, “”);
    HttpHeaders headers = new HttpHeaders();
    headers.add(“Authorization”, “Basic ” + encodedAuthorisation);
    HttpEntity requestEntity = new HttpEntity(null, headers);
    JSONObject object = new JSONObject(); object.put(“version”, “HDP-1.2.0″);
    JSONObject object2 = new JSONObject();
    object2.put(“Clusters”, object);
    String fullUrl = “http://” + host + “/api/v1/clusters/” + clusterName;
    String reString = (String) restTemplate.exchange(fullUrl, HttpMethod.POST, requestEntity, String.class, object2).getBody();
    Following is the server log.
    10:09:11,535 DEBUG session:85 – new session & id ud4qkpfeoo6h1sq1saptd0q55 ud4qkpfeoo6h1sq1saptd0q55
    10:09:11,535 DEBUG HttpSessionSecurityContextRepository:292 – SecurityContext stored to HttpSession: ‘org.springframework.security.core.context.SecurityContextImpl@6323390: Authentication: org.springframework.security.authentication.UsernamePasswordAuthenticationToken@6323390: Principal: org.springframework.security.core.userdetails.User@586034f: Username: admin; Password: [PROTECTED]; Enabled: true; AccountNonExpired: true; credentialsNonExpired: true; AccountNonLocked: true; Granted Authorities: ADMIN; Credentials: [PROTECTED]; Authenticated: true; Details: org.springframework.security.web.authentication.WebAuthenticationDetails@ffffc434: RemoteIpAddress: 10.6.1.110; SessionId: null; Granted Authorities: ADMIN’
    10:09:11,536 DEBUG FilterChainProxy:337 – /api/v1/clusters/ch at position 7 of 8 in additional filter chain; firing Filter: ‘ExceptionTranslationFilter’
    10:09:11,536 DEBUG FilterChainProxy:337 – /api/v1/clusters/ch at position 8 of 8 in additional filter chain; firing Filter: ‘FilterSecurityInterceptor’
    10:09:11,536 DEBUG AntPathRequestMatcher:85 – Request ‘POST /api/v1/clusters/ch’ doesn’t match ‘GET /**
    10:09:11,536 DEBUG FilterSecurityInterceptor:194 – Secure object: FilterInvocation: URL: /api/v1/clusters/ch; Attributes: [hasRole('ADMIN')]
    10:09:11,537 DEBUG FilterSecurityInterceptor:310 – Previously Authenticated: org.springframework.security.authentication.UsernamePasswordAuthenticationToken@6323390: Principal: org.springframework.security.core.userdetails.User@586034f: Username: admin; Password: [PROTECTED]; Enabled: true; AccountNonExpired: true; credentialsNonExpired: true; AccountNonLocked: true; Granted Authorities: ADMIN; Credentials: [PROTECTED]; Authenticated: true; Details: org.springframework.security.web.authentication.WebAuthenticationDetails@ffffc434: RemoteIpAddress: 10.6.1.110; SessionId: null; Granted Authorities: ADMIN
    10:09:11,537 DEBUG AffirmativeBased:65 – Voter: org.springframework.security.web.access.expression.WebExpression

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.

  • Author
    Replies
  • #38185

    Dave
    Moderator

    Hi Dong,

    What are you trying to do via the REST api and how did it fail?

    Thanks

    Dave

    Collapse
Viewing 1 replies (of 1 total)