The Hortonworks Community Connection is now live. A completely rebuilt Q&A forum, Knowledge Base, Code Hub and more, backed by the experts in the industry.

You will be redirected here in 10 seconds. If your are not redirected, click here to visit the new site.

The legacy Hortonworks Forum is now closed. You can view a read-only version of the former site by clicking here. The site will be taken offline on January 31,2016

HDP on Linux – Installation Forum

Problem on installing HDP using Ambari

  • #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

  • Author
    Replies
  • #38185
    Dave
    Moderator

    Hi Dong,

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

    Thanks

    Dave

The forum ‘HDP on Linux – Installation’ is closed to new topics and replies.

Support from the Experts

A HDP Support Subscription connects you experts with deep experience running Apache Hadoop in production, at-scale on the most demanding workloads.

Enterprise Support »

Become HDP Certified

Real world training designed by the core architects of Hadoop. Scenario-based training courses are available in-classroom or online from anywhere in the world

Training »

Hortonworks Data Platform
The Hortonworks Data Platform is a 100% open source distribution of Apache Hadoop that is truly enterprise grade having been built, tested and hardened with enterprise rigor.
Get started with Sandbox
Hortonworks Sandbox is a self-contained virtual machine with Apache Hadoop pre-configured alongside a set of hands-on, step-by-step Hadoop tutorials.
Modern Data Architecture
Tackle the challenges of big data. Hadoop integrates with existing EDW, RDBMS and MPP systems to deliver lower cost, higher capacity infrastructure.