[AMPS] How to use custom context.xml for jira started with maven-jira-plugin:run?

Tomasz Stec
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 18, 2018

Hi,
How to start jira (its tomcat to be precise) with custom conf/context.xml?

Long story:

In my testing environment i need to start two JIRAs. The problem is that, each JIRA lease the same session cookie file because its base urls are:

  • http://localhost:2990/jira
  • http://localhost:2991/jira

So acording to https://confluence.atlassian.com/jirakb/user-is-constantly-logged-out-of-jira-192872663.html i decided to try to change session cookie file name. I want to set custom session cookie file name for each instance. I am using tomcat8 right now. As far as i know to change this session cookie file name i need to set in <Context> element of my web application (JIRA in my case). So i did it manually and it works perfect. Here is my context.xml file:

<?xml version="1.0" encoding="UTF-8"?>

<Context sessionCookieName="JIRA2990SESSIONID">
<Resource name="jdbc/JiraDS" type="javax.sql.DataSource" auth="Container" driverClassName="org.postgresql.Driver" factory="org.apache.tomcat.dbcp.dbcp2.BasicDataSourceFactory" password="xxxxxxx" url="jdbc:postgresql://localhost:5432/jira2990" username="jira2990"/>
<Resource name="UserTransaction" type="javax.transaction.UserTransaction" auth="Container" factory="org.objectweb.jotm.UserTransactionFactory" jotm.timeout="60"/>
</Context>

How to configure my pom.xml to tell maven-jira-plugin/maven-amps-plugin to start jira with my custom context.xml?

I figured out it uses cargo-maven2-plugin under the hood but can i add/modify its configuration? How to do it?

 

1 answer

0 votes
Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 23, 2018

I haven't experimented with a custom context.xml but there is another workaround you can try. You can use different context paths.

"--context-path /jira1" will set the context path of your first JIRA instances to http://localhost:2990/jira1 and so on. That should fix the session issue.

Check out https://developer.atlassian.com/server/framework/atlassian-sdk/atlas-run/ for the available options for atlas-run.

Tomasz Stec
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 23, 2018

I already figured it out, but anyway, thanks Jobin!

Suggest an answer

Log in or Sign up to answer