0
votes

I am using Liquibase maven plugin for Oracle 12c database and I am getting the following error on running the update command:

Failed to execute goal org.liquibase:liquibase-maven-plugin:3.4.1:update (default) on project liquibase: Error setting up or running Liquibase: liquibase.exception.DatabaseException: java.sql.SQLException: ORA-28040: No matching authentication protocol

I saw the relevant stack overflow posts regarding this issue which suggested making changes to the sqlnet.ora file but the following command works perfect through command line by using the exactly same changelog:

java -jar ~/.m2/repository/org/liquibase/liquibase-core/3.5.3/liquibase-core-3.5.3.jar --driver=oracle.jdbc.OracleDriver --classpath=/Users/nsalvi/Downloads/ojdbc6.jar --url="fake url" --username="fake username" --password="fake password" --changeLogFile=/Users/nsalvi/Downloads/liquibase-example-master-2/src/main/resources/db/dbChangelog.xml update

Above I am referencing the driver class path present on my local.

My pom snippet looks as follows:

    <plugin>
        <groupId>org.liquibase</groupId>
        <artifactId>liquibase-maven-plugin</artifactId>
        <version>${liquibase.version}</version>
        <configuration>
            <propertyFileWillOverride>true</propertyFileWillOverride>
            <propertyFile>src/main/resources/liquibase.properties</propertyFile>
        </configuration>
        <executions>
            <execution>
                <phase>process-resources</phase>
                <goals>
                     <goal>update</goal>
                </goals>
            </execution>
         </executions>
         <dependencies>
            <dependency>
                <groupId>com.oracle</groupId>
                <artifactId>ojdbc6</artifactId>
                <version>${oracle.version}</version>
            </dependency>
         </dependencies>
    </plugin>

When I run maven install I get the non authentication protocol error. My database changelog is as follows:

liquibase.properties:

contexts: local 
changeLogFile: db/dbChangelog.xml
driver: oracle.jdbc.OracleDriver
url: fake url
username: fake username
password: fake password
verbose: true 
dropFirst: false 

dbChangelog.xml:

    <databaseChangeLog
  xmlns="http://www.liquibase.org/xml/ns/dbchangelog/1.8"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog/1.8
         http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-1.8.xsd">
    <preConditions>
        <dbms type="oracle" />
        <runningAs username="fake" />
    </preConditions>

    <changeSet id="1" author="nishant">
        <preConditions onFail="WARN">
            <sqlCheck expectedResult="9">select count(*) from CA_PROJECT_T</sqlCheck>
        </preConditions>
        <comment>Comments should go after preCondition. If they are before then liquibase usually gives error.</comment>
    </changeSet>
</databaseChangeLog>

Is there anything that I am missing. P.S.- The maven plugin worked perfectly when the database in question was mysql instead of oracle and I don't think making changes in the sqlnet.ora file is the issue here since the query works perfectly when run from command line.

Thanks in advance!

1

1 Answers

0
votes

You can use one of the following phases (taken from maven website): validate - validate the project is correct and all necessary information is available

  • compile - compile the source code of the project
  • test - test the compiled source code using a suitable unit testing framework. These tests should not require the code be packaged or deployed
  • package - take the compiled code and package it in its distributable format, such as a JAR.
  • verify - run any checks on results of integration tests to ensure quality criteria are met
  • install - install the package into the local repository, for use as a dependency in other projects locally
  • deploy - done in the build environment, copies the final package to the remote repository for sharing with other developers and projects.