0

I have a java application that run with Apache tomcat 9. this app need an oracle database connection pool. this is my context in server.xml file.

<Context path="/app-develop" docBase="/some/path" >

        <Resource name="jdbc/RasaDS"
                auth="Container"
                type="oracle.jdbc.pool.OracleDataSource"
                driverClassName="oracle.jdbc.driver.OracleDriver"
                factory="oracle.jdbc.pool.OracleDataSourceFactory"
                url="jdbc:oracle:thin:@IP:1521:SID"
                user="schema_name"
                password="schema_pass"
        connectionCachingEnabled="true"
                connectionCacheName="myapp_test_connection_pool"/>

  <Resource
    auth="Container"
    name="mail/Session"
    type="javax.mail.Session"
    mail.smtp.host="IP"
    mail.smtp.password="smtp_pass"
    mail.smtp.port="smtp_port"
    mail.smtp.socketFactory.port="smtp_port"
    mail.smtp.user="user@a.com"
    mail.smtp.socketFactory.class="javax.net.ssl.SSLSocketFactory"
    mail.smtp.socketFactory.fallback="false"
    mail.transport.protocol="smtp"
    mail.smtp.auth="true"
    mail.smtp.starttls.enable="true"
        mail.debug="true"/>

                <Resource name="url/config"
                factory="com.pars.common.util.GeneralBeanFactory"
                auth="Container"
                type="java.net.URL"
                url="file:///Path/to/xml/config"/>
</Context>

As you see app needs a config file too. I'm new at Jenkins and CI/CD. I ran CI part using a pipeline. But deploy stage not working. my deploy stage in pipeline:

    stage('deploy to test') {
          steps {
              deploy adapters: [tomcat9(credentialsId: 'tomcat-deployer', path: '', url: 'https://tomcat_url/app-develop/')], contextPath: 'file_name.war', war: '**/*.war'
                }
          }
  1. The Jenkins plugin use webapps directory by default, but I need to use custom directory path in context.
  2. in "contextPath" Jenkins plugin just accept war/ear file, but in deploy I need to unzip war file to config index files. any suggestion?

I use "Deploy to container" plugin. I also have this application in Container. For application directory in docker-compose file I use a volume.

1 Answers1

0

After 5 days, I decide to use Ansible to run a child job that run a playbook. In playbook copy builds and stop/start tomcat is smoothly done.