title: spring social connectivity with Facebook and accessing user data
body: <p>I have started to work with spring social and following the tutorial from <a href="http://docs.spring.io/spring-social/docs/1.0.x/reference/html/overview.html" rel="nofollow">here</a>. and pages that follow.
  My java file looks like this.</p>
  
  <pre><code>import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
  
  //import org.springframework.boot.SpringApplication;
  //import org.springframework.context.annotation.Bean;
  import org.springframework.context.annotation.ComponentScan;
  import org.springframework.context.annotation.Configuration;
  import org.springframework.context.annotation.Import;
  import org.springframework.social.connect.Connection;
  import org.springframework.social.connect.ConnectionFactory;
  import org.springframework.social.connect.ConnectionFactoryLocator;
  import org.springframework.social.connect.support.ConnectionFactoryRegistry;
  import org.springframework.social.facebook.api.Comment;
  import org.springframework.social.facebook.api.CommentOperations;
  import org.springframework.social.facebook.connect.FacebookConnectionFactory;
  import org.springframework.social.facebook.api.Facebook;
  import org.springframework.social.facebook.api.impl.FacebookTemplate;
  import org.springframework.social.oauth2.AccessGrant;
  import org.springframework.social.oauth2.GrantType;
  import org.springframework.social.oauth2.OAuth2Operations;
  import org.springframework.social.oauth2.OAuth2Parameters;
  //import org.springframework.social.UserIdSource;
  //import org.springframework.social.connect.ConnectionFactoryLocator;
  //import org.springframework.social.connect.ConnectionRepository;
  //import org.springframework.social.connect.web.ConnectController;
  
  @Configuration
  @EnableAutoConfiguration
  @Import(FacebookConfig.class)
  @ComponentScan
  public class App {
  
     static private String accessToken = "accesstoken";
     static private String secretKey = "secretkey"; 
     static private String clientId = "clientid";
     public static void main(String[] args) {
          FacebookConnectionFactory connectionFactory = new FacebookConnectionFactory(clientId, secretKey);
          OAuth2Operations oauthOperations = connectionFactory.getOAuthOperations();
          OAuth2Parameters params = new OAuth2Parameters();
          params.setRedirectUri("http://facebook.com");
          String authorizeUrl = oauthOperations.buildAuthorizeUrl(GrantType.IMPLICIT_GRANT, params);
          AccessGrant accessGrant = new AccessGrant(accessToken);
          System.out.println(accessGrant.getAccessToken());
          System.out.println(accessGrant.getExpireTime());
          System.out.println(accessGrant.getScope());
          ConnectionFactoryRegistry registry = new ConnectionFactoryRegistry();
          registry.addConnectionFactory(connectionFactory);
          Facebook facebook = new FacebookTemplate(accessToken);
  }
  
  }
  </code></pre>
  
  <p>When i run this code i get the error as stated.
  Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2:exec (default-cli) on project mavenproject3: Command execution failed. Process exited with an error: 1(Exit value: 1) -> [Help 1]</p>
  
  <p>To see the full stack trace of the errors, re-run Maven with the -e switch.
  Re-run Maven using the -X switch to enable full debug logging.</p>
  
  <p>For more information about the errors and possible solutions, please read the following articles:
  [Help 1] <a href="http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException" rel="nofollow">http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException</a></p>
  
  <p>When i comment out this line: </p>
  
  <pre><code>Facebook facebook = new FacebookTemplate(accessToken);
  </code></pre>
  
  <p>It works fine.
  Can someone suggest me the requisite. I am a newbie so please bear with me. </p>