How can i include a master changelog file inside another master changelog file in liquibase - maven-plugin

I have a requirement where am pulling changelog files containing changesets as a maven dependency from other project module. I need to include the master changelog file of other project (which has reference to all the changesets in it)in current project from where i will execute the maven liquibase update / rollback or spring boot liuqibase setup. Is there a way to make it work?
I tried to do that like shown below
<?xml version="1.0" encoding="UTF-8" standalone="no"?><databaseChangeLog
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangeloghttp://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.0.xsd">
<property name="blob" value="bytea" dbms="postgresql"/>
<property name="blob" value="blob" dbms="derby"/>
<preConditions>
<or>
<dbms type="derby"/>
<dbms type="postgresql"/>
</or>
</preConditions>
<include file="db/changelog/db.changelog-master.xml"/>
<include file="db/changelog/changesets/2019-06-001-modeler.changelog.xml"/>
</databaseChangeLog>
But i get error
Error setting up or running Liquibase: liquibase.exception.SetupException:
Error Reading Migration File: Found 2 files that match db/changelog/db.changelog-master.xml
I have same folder structure in all the projects.

This was a reported bug a while back and is now fixed with the later versions of Liquibase.
Please try to use the latest Liquibase version and see if the issue goes away.
Below is a reference for Liquibase releases.
https://github.com/liquibase/liquibase/releases

Liquibase can't understand which of your files with same name it should use.
If it's possible you should change path to your changelog.
So if your changelogs are both on path db/changelog/db.changelog-master.xml try to rename the paths at least. For example use db/changelog/module1/db.changelog-master.xml or db/changelog/db.changelog-module1-master.xml.

Related

can data-import-handler use HikariCP?

I'm using solr4.5.1 in work.
The trouble is that a lot of getConnection occurred, when I execute data-import(full-import). So I thought if HikariCP could be used in data-import, but I haven't found similar problem.
Is it possible? If so please advice.
Solr 4.5.1 with Tomcat
data-config.xml
<dataSource driver="oracle.jdbc.driver.OracleDriver"
name="jdbc"
url="jdbc:oracle:thin:#address/mydb"
user="user" password="pass"/>
Heavily borrowed from David H Nebinger's post: Tomcat and HikariCP.
Install HikariCP
To make use of JNDI, you need to declare the JNDI datasource with all its' settings, password and cache options within the JNDI declaration. This has nothing to do with Solr at this point. This is a Tomcat mechanism. How you do this is described in this tutorial that also makes use of HikariCP.
First is to download the .zip or .tar.gz file from http://brettwooldridge.github.io/HikariCP/. This is actually a source release that you'll need to build yourself.
Second option is to download the built jar from a source like Maven Central, https://mvnrepository.com/artifact/com.zaxxer/HikariCP
Once you have the jar, copy to the Tomcat lib/ext directory. Note that Hikari CP does have a dependency on SLF4J, so you'll need to put that jar into lib/ext too.
Do not forget to place your datasource's JDBC driver in the lib/ext folder.
Configure the JNDI datasource
Location of your JNDI datasource <Resource /> definitions depends upon the scope for the connections. You can define them globally by specifying them in Tomcat's conf/server.xml and conf/context.xml, or you can scope them to individual applications by defining them in conf/Catalina/localhost/WebAppContext.xml (where WebAppContext is the web application context for the app, basically the directory name from Tomcat's webapps directory).
Create the file conf/Catalina/localhost/ROOT.xml if it doesn't already exist. Use the table from https://github.com/brettwooldridge/HikariCP#popular-datasource-class-names to find your data source class name, we'll need it when we define the element.
<Resource name="jdbc/SolrPool" auth="Container"
factory="com.zaxxer.hikari.HikariJNDIFactory"
type="javax.sql.DataSource"
minimumIdle="5"
maximumPoolSize="10"
connectionTimeout="300000"
dataSourceClassName="oracle.jdbc.pool.OracleDataSource"
dataSource.url="jdbc:oracle:thin:#address/mydb"
dataSource.implicitCachingEnabled="true"
dataSource.user="user"
dataSource.password="pass" />
Make use of the JNDI datasource in Solr
After you have followed this tutorial, you will need to use the declared JNDI datasource, this would be like described in the Solr Wiki:
<dataSource
jndiName="java:jdbc/SolrPool"
type="JdbcDataSource"
user="" password=""/> <!-- leave out user/password here -->

NuGet does not add dependencies to package

I'm trying to package my WPF application with the NuGet pack command. So far I found out that adding -IncludeReferencedProjects resolves the problem of referenced projects not getting packed.
./nuget.exe pack {path}.csproj -NonInteractive -OutputDirectory C:\test -Properties Configuration=release -version 0.1.0 -Verbosity Detailed -IncludeReferencedProjects
The problem I face is that the project's dependencies are not getting packed. They however do show up in the log as you can see below. Dependencies: EntityFramework.
But the dependencies are never added to the package. Even when I manually inspect or deploy the package only Data.dll and {name}.exe are deployed.
What I've already tried (by searching Google/SO):
Adding a NuSpec file for the csproj file
NuGet.config with a reference to the correct packages folder (in case NuGet did not find it)
EDIT: added generated .nuspec
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>{path}.UpgradeDatabase</id>
<version>0.1.4</version>
<title>{path}.UpgradeDatabase</title>
<authors>stephanbisschop</authors>
<owners>stephanbisschop</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Description</description>
<copyright>Copyright © 2016</copyright>
<dependencies>
<dependency id="EntityFramework" version="6.1.3" />
</dependencies>
</metadata>
</package>
Thank you in advance,
Stephan
Problem solved.
It wasn't my NuGet package that was missing the dependencies.. it was Octopus Deploy that wasn't restoring the packages. We fixed it by adding entries in the appropriate .NuSpec files. Now all the .dll, .config , etc.. files get packaged with the package.

ChangeSet for Oracle plugin in Liquibase always empty

I've downloaded Oracle Plugin for Liquibase, I've built it with maven and copied liquibase-oracle-3.3-SNAPSHOT.jar in /lib directory in Liquibase home.
I've added namespace into changeLog file, as reported in documentation, and this is my changeLog file:
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ora="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
<changeSet author="myAuthor" id="xxx">
<ora:encapsulateTableWithView tableName="TABLENAME"/>
</changeSet>
</databaseChangeLog>
Update operation via CLI is always successful, but nothing happens on DB: the row in the DATABASECHANGELOG table referring this operation is correct but reports "empty" in description column.
I also added liquibase-oracle-3.3-SNAPSHOT.jar to classpath in liquibase.properties file, but it's useless.
Every changeSet traced in DATABASECHANGELOG table with specific Oracle plugin tag has the same checksum (7:d41d8cd98f00b204e9800998ecf8427e) and reports "empty" in DESCRIPTION.
Any idea?
I found what was the problem: i launched by CLI command
java -jar liquibase.jar --changeLogFile=myChangeLog.xml update
but the changeSet resulted always empty: this because liquibase.jar didn't take classes from liquibase-oracle-3.3-SNAPSHOT.jar. I added liquibase.bat at environment variables in PATH and new command is
liquibase --changeLogFile=myChangeLog.xml update
and it works fine.

How to install solr-4.6.1 on ubuntu using tomcat7?

I want step by step instructions for installation of solr search engine using tomcat7 on ubuntu. I searched on google but I am not getting proper reference. Please help me to install it.
1- Download Solr dist: here. Unzip it anywhere.
2- find $EXTRACTEDDIR/solr/dist/solr-4.6.1.war and copy it to the location you want to configure solr.
3- configure the solr.xml as explained here. You will need to change your hostport to 8080(or what ever port tomcat7 is configured) and put it where you put solr-4.6.1.war
4- create /etc/tomcat7/Catalina/localhost/solr.xml and put
<?xml version="1.0" encoding="UTF-8"?>
<Context docBase="$SOLRBASE/solr-4.6.1.war" debug="0" privileged="true" allowLinking="true" crossContext="true">
<Environment name="solr/home" type="java.lang.String" value="$SOLRBASE" override="true" />
</Context>
replace SOLRBASE with the loacation you put solr.war and solr.xml.
5- copy $EXTRACTEDDIR/example/lib/ext/* . * to /usr/share/tomcat7/lib(for loging libs)
6- give permissions of the folder where you put solr.war and solr.xml to "tomcat7" user.
7- restart tomcat and you are done.
copy the solr files to ubuntu.
copy the file "solr.war" into "%tomcat_home%/webapps/" and add the solr service's context to the "%tomcat_home%/server.xml"
set the environment value "solr/home" int server.xml or web.xml
visit here for detail:https://wiki.apache.org/solr/SolrTomcat
it's a piece of cake, may you succeed!

Why tomcat7 can't read my context.xml?

I'm trying to integrate apache solr4.5 with tomcat7.0.
Here is my prob, I make a directory named "solr" under $CATALINA_BASE/webapps, and create an context.xml under the path, which the directory structure looks like.
$CATALINA_BASE/webapps/solr/META-INF/context.xml
The context.xml looks like as follow:
<?xml version="1.0" encoding="utf-8" ?>
<Context docBase="/solr/home/root/solr.war">
<Environment name="solr/home" type="java.lang.String" value="/solr/home/root" />
</Context>
I was expecting when I visit "localhost:8080/solr/", the solr webapp should work fine, but what I got is some errors like this:
HTTP Status 404 - /solr/
type Status report
message /solr/
description The requested resource (/solr/) is not available.
Apache Tomcat/7.0.26
But according to the apache tomcat7.0 document,
Individual Context elements may be explicitly defined:
In an individual file at /META-INF/context.xml inside the application files. Optionally (based on the Host's copyXML
attribute) this may be copied to
$CATALINA_BASE/conf/[enginename]/[hostname]/ and renamed to
application's base file name plus a ".xml" extension.
In individual files (with a ".xml" extension) in the $CATALINA_BASE/conf/[enginename]/[hostname]/ directory. The context
path and version will be derived from the base name of the file (the
file name less the .xml extension). This file will always take
precedence over any context.xml file packaged in the web
application's META-INF directory.
Inside a Host element in the main conf/server.xml.
So, please anyone give me some clues, thanks.
If you check the catalina log file located in /logs, you will probably see some errors from Solr, one of which will be:
SEVERE: Error filterStart
This is due to a change in the way that logging in general is now implemented within Solr as of version 4.3. Please refer to SolrLogging - Using the example logging setup in containers other than Jetty for the necessary steps to setup logging within Tomcat.
This should resolve your issue.
Try placing your context.xml (for all webapps) or solr.xml (solr only) file in Catalina/localhost folder instead.
For instance:
<Context docBase="webapps/solr.war" allowLinking="true" reloadable="true">
<Environment name="solr/home" type="java.lang.String" value="/opt/solr" override="true" />
</Context>
Troubleshooting:
check your logs, e.g.:
cd /var/log/tomcat? && tail -f *.log *.out *.txt

Resources