Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

P4java connect to server with ticket

Mamikon Papikyan
Contributor
August 11, 2020

Hello, I'm using scriptrunner in my jira software. In my listener I wrote sample groovy code, where I want to connect to perforce server with ticket. Here is my code:

String p4url = "perforce:1666"
final String p4hosturl = ServerFactory.DEFAULT_PROTOCOL_NAME + "://" + p4url
IServer server = ServerFactory.getServer(p4hosturl, null)
AuthTicket auth = AuthTicketsHelper.getTicket(p4url, server.getTicketsFilePath())
if (auth == null) {
log.info("log in")
server.connect()
server.setUserName(p4User)
server.login(p4Passwd)
return server
} else {
log.info("ticket")
server.connect()
server.setAuthTicket(auth)
return server
}

 

In case where auth is null works perfectly, but when I want to connect to server using ticket, it gave me:

Perforce password %P4PASSWD% invalid or unset. 

0 answers

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Product Admin
TAGS
loom essentials certification, loom training, get certified in loom, atlassian certification, loom async video, video messaging skills, atlassian learning, loom for teams, online certification, loom badge, loom for business, atlassian education

Get Certified in Loom! 🧑‍🎓

Time to up your Loom game! The new Loom Essentials Certification is here! Show off your skills, learn pro tips, and get officially recognized. Perfect for taking your video messaging to the next level.

Learn more
AUG Leaders

Atlassian Community Events