0

My Requirement is I want to connect to a perforce server "abc.def.com:1689" to access it requires my public and private key (identity basically) Now I want to achieve same using the Java Program.

I want to connect to the Perforce server and perform actions programmatically its not a username and password base model it uses the private key to authenticate user and allow access to the repository.

Can someone guide me on this I have already tried few suggestions mentioned in the other stackoverflow links but its not working.

String uri = "p4javassl://abc.def.com:1689";
            IOptionsServer server = ServerFactory.getOptionsServer(uri, null);
            server.addTrust("somefingerPrint");
            server.connect();
            IServerInfo sInfo = server.getServerInfo();
            System.out.println("user "+sInfo.getUserName());

com.perforce.p4java.exception.ConnectionException: Unable to connect to Perforce server

Vikki Lohana
  • 39
  • 2
  • 10

1 Answers1

0

If I understand correctly you want to authenticate to a Helix server with a client cert. That's not possible.

The Perforce/Helix server always needs a user for authorization as file/resource protections are based on your user. You will always need to set your user:

server.setUserName('Vikki');
J Brown
  • 396
  • 1
  • 4
  • I have a username but firstly I need to connect to the Helix Server through the identity certificate and then other information like fetching file or other perforce action – Vikki Lohana Feb 27 '19 at 06:27
  • What's the whole exception and stack trace. – J Brown Mar 01 '19 at 00:13
  • Also, on the machine where you are running java, install the p4 command line. Then run "p4 -p ssl:abc.def.com:1689 info" What does that return? If you can't connect to the helix server with the p4 command line then you can't connect using P4Java. – J Brown Mar 01 '19 at 00:21