Liquibase "Cannot find the declaration of element 'databaseChangeLog'" in xml changeLog file - xml-parsing

Following This guide from Liquibase's official website I've created my own changelog-master.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="https://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd">
<includeAll path="/home/username/liquibase/examples/sqlite-test" filter="sql"/>
</databaseChangeLog>
I've then created the liquibase.properties file in the same folder:
# Enter the path for your changelog file.
changeLogFile=changelog-master.xml
#### Enter the Target database 'url' information ####
url=jdbc:sqlite://home/username/liquibase/examples/sqlite-test/testdb
Which is correct because if I run a normal .sql changelog it runs correctly and updates my DB.
I've then created a changelog file in sql which has to be automatically executed when launching liquibase update which is 000020-changelog.sql
--liquibase formatted sql
--changeset daniel:3
create table phonebook(name TEXT, surname TEXT, type TEXT, phone_number TEXT);
But when I go and launch liquibase update I get an error from the XML parser:
Unexpected error running Liquibase: cvc-elt.1.a: Cannot find the declaration of element 'databaseChangeLog'.
And I can't understand what the problem is. I've checked multiple times if the changelog-master.xml file is correct and it looks like it is. And from what I can find the cvc-elt.1.a is an XML Parsing error, like databaseChangeLog it's not declared in the xml schema.
I'm doing this so that in the future I can create as many changelogs as I want and have them executed one after the other automatically.
I've been looking for some solutions for this problem but I can't find anything. I've found a link to the official forums but it's now a dead link.
Extra info:
Liquibase version 4.0.0
Installed JRE: openjdk 11.0.8 2020-07-14
OS: Debian 10
SQLite version 3.27.2
08/09/2020 edit:
as asked in the comments this is the project's structure:
root#dev-machine:/home/username/liquibase/examples/sqlite-test# ls -la
total 68
drwxr-xr-x 2 root root 4096 Sep 4 17:28 .
drwxr-xr-x 5 username username 4096 Sep 4 17:02 ..
-rw-r--r-- 1 root root 139 Sep 4 13:35 000020-changelog.sql
-rw-r--r-- 1 root root 118 Sep 4 13:36 000030-changelog.sql
-rw-r--r-- 1 root root 201 Sep 4 17:05 000040-changelog.sql
-rw-r--r-- 1 root root 240 Sep 4 17:28 000050-changelog.sql
-rw-r--r-- 1 root root 456 Sep 4 14:22 changelog-master.xml
-rw-r--r-- 1 root root 2637 Sep 4 16:36 liquibase.properties
-rw-r--r-- 1 root root 32768 Sep 4 17:28 testdb
testdb is the sqlite database I'm using to test liquibase. The .sql files are the consecutive changelogs that must be run to update the DB

What was causing the issue I was having was the fact that in my changelog-master.xml I had an outdated XSD version, which was causing something to break into the XML Parser. To fix it I've changed it with the following:
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd
http://www.liquibase.org/xml/ns/pro
http://www.liquibase.org/xml/ns/pro/liquibase-pro-4.0.xsd
http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.0.xsd
">
<includeAll path="schema/"/>
</databaseChangeLog>
and moved all my *.sql files into the schema/ folder. Other than that I've renamed all my .sql files using the *.databasetype.sql namescheme, in my case 000020-changelog.sqlite.sql. Had to do this because otherwise the files that used --liquibase formatted sql wouldn't be executed.

For me, this issue is more related to http and https. The following shows the successful config:
<?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog" <-- NOT HTTPS!
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <-- NOT HTTPS!
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog <-- NOT HTTPS!
https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.4.xsd">
<includeAll path="changelogs/" relativeToChangelogFile="true"/>
</databaseChangeLog>
If http in any one of the three line is changed to https, it will throw the exception:
liquibase.exception.ChangeLogParseException: Error parsing line 6 column 70
of classpath:db/main.xml: cvc-elt.1.a: Cannot find the declaration of
element 'databaseChangeLog'.

Related

Docker can't find bind source path for entrypoint script, even though file exists

I'm trying to build a service (Google Cloud Composer, which is basically just Airflow) locally via Docker. However, I'm getting the following error message:
│ http+docker://localhost/v1.41/containers/create?name=composer-local-dev-gcp_composer_locally: Bad Request ("invalid mount │
│ config for type "bind": bind source path does not exist: │
│ /opt/homebrew/lib/python3.10/site-packages/composer_local_dev/docker_files/entrypoint.sh")
However, such a file does exist and is executable:
16777233 2895095 -rwxr-xr-x 1 <my_unix_name> admin 0 1281 "Feb 13 14:26:24 2023" "Feb 13 14:26:24 2023" "Feb 13 14:26:24 2023" "Feb 10 17:04:20 2023" 4096 8 0 /opt/homebrew/lib/python3.10/site-packages/composer_local_dev/docker_files/entrypoint.sh
I've confirmed my user is a member of the "admin" group, so I don't think this is a file permissions error.
How can I get Docker to recognize this entrypoint and run the relevant script?

import and Parse syslog file to elastisearch

I need to import a set of SYSLOG files to elasticsearch. I'am using a filebeat agent.
I succeeded the data importation, however the data in elasticsearch is not parsed.
This is the input file:
Feb 14 03:43:40 my_host_name run-parts(/etc/cron.daily)[1544] finished rhsmd
Feb 14 03:43:40 my_host_name anacron[240673]: Job `cron.daily' terminated (produced output)
Feb 14 03:43:41 my_host_name anacron[240673]: Normal exit (1 job run)
Feb 14 03:43:41 my_host_name postfix/pickup[241860]: 7E8CFC00BB50: uid=0 from=<root>
I work on the 7.15.2 version of Filebeat and Elasticsearch. I get an index output with the field message not parsed. That contain for example the hole line " Feb 14 03:43:41 my_host_name anacron[240673]: Normal exit (1 job run)".
On the versions 8.0 there is a processor option to add to the configuration file that parse this field:
processors:
- syslog:
field: message
However in the version 7.15.2 this option is not available.
How can I parse this Field in the Filebeat configuration ?
Thank you for your help.
What you could do is either use the dissect or script processors to parse the values according to your needs. Not saying this is the best option, but it is an option

ROS Launcher File Results in Error with roslaunch

I have a ROS project that I'm trying out. I have the following folder structure:
catkin_ws
- src
- beginner_tutorials
- src
- listener.cpp
- talker.cpp
- config
- config.conf
- launch
- my.launch
- srv
- ModifyText.srv
- CMakeLists.txt
Assume that I have the remaining folders in the catkin_ws like the devel etc.,
Here is the CMakeLists.txt looks like:
cmake_minimum_required(VERSION 2.8.3)
project(beginner_tutorials)
## Find catkin and any catkin packages
find_package(catkin REQUIRED COMPONENTS roscpp rospy std_msgs genmsg)
## Declare ROS messages and services
#add_message_files(FILES Num.msg)
add_service_files(FILES modifyText.srv)
## Generate added messages and services
generate_messages(DEPENDENCIES std_msgs)
## Declare a catkin package
catkin_package()
## Build talker and listener
include_directories(include ${catkin_INCLUDE_DIRS})
add_executable(talker src/talker.cpp)
target_link_libraries(talker ${catkin_LIBRARIES})
add_dependencies(talker beginner_tutorials_generate_messages_cpp)
add_executable(listener src/listener.cpp)
target_link_libraries(listener ${catkin_LIBRARIES})
add_dependencies(listener beginner_tutorials_generate_messages_cpp)
Now when I tried to launch the listener and talker using the launcher file as below, I get the error as below:
joesan#joesan-InfinityBook-S-14-v5:~/Projects/ros-projects/catkin_ws$ roslaunch beginner_tutorials my.launch
... logging to /home/joesan/.ros/log/4df614ca-ebaa-11ea-b08a-3fbc143c4e1a/roslaunch-joesan-InfinityBook-S-14-v5-7071.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.
started roslaunch server http://joesan-InfinityBook-S-14-v5:37169/
SUMMARY
========
PARAMETERS
* /rosdistro: noetic
* /rosversion: 1.15.8
NODES
/
listener (beginner_tutorials/listener)
talker (beginner_tutorials/talker)
ROS_MASTER_URI=http://localhost:11311
process[talker-1]: started with pid [7085]
RLException: Roslaunch got a 'No such file or directory' error while attempting to run:
gnome-terminal -e /home/joesan/Projects/ros-projects/catkin_ws/devel/lib/beginner_tutorials/listener __name:=listener __log:=/home/joesan/.ros/log/4df614ca-ebaa-11ea-b08a-3fbc143c4e1a/listener-2.log
Please make sure that all the executables in this command exist and have
executable permission. This is often caused by a bad launch-prefix.
The traceback for the exception was written to the log file
[ INFO] [1598893286.274250713]: hello world 0
[talker-1] killing on exit
[listener-2] killing on exit
Here are the contents of my launch file my.launch:
<launch>
<env name="ROSCONSOLE_CONFIG_FILE"
value="$(find beginner_tutorials)/config/config.conf"/>
<arg name = "frequency" default = "10" />
<node pkg = "beginner_tutorials"
type = "talker"
name = "talker"
output = "screen"
args="$(arg frequency)"/>
<node pkg = "beginner_tutorials"
type = "listener"
name = "listener"
output = "screen"
launch-prefix = "gnome-terminal -e"/>
</launch>
I can see that inside the devel folders, the binaries are located as below:
joesan#joesan-InfinityBook-S-14-v5:~/Projects/ros-projects/catkin_ws/devel/lib$ cd beginner_tutorials/
drwxrwxr-x joesan joesan 4 KB Mon Aug 31 18:44:39 2020  .
drwxrwxr-x joesan joesan 4 KB Mon Aug 31 18:44:37 2020  ..
.rwxrwxr-x joesan joesan 327.3 KB Mon Aug 31 18:44:39 2020  listener
.rwxrwxr-x joesan joesan 190.1 KB Mon Aug 31 18:44:39 2020  talker

cleanup / organise the /config/initializers folder for new rails 4 project

Migrating from a rails 3 project and found that I have to many initialisers for my taste,
trying to clean out the config folder and minimise the use of initialisers or better organise them.
Currently I have:
...
-rw-r--r-- 1 Me staff 81 Jun 22 14:54 simple_navigation.rb
-rw-r--r-- 1 Me staff 1535 Jun 22 14:54 simple_navigation_overrule.rb
-rw-r--r-- 1 Me staff 27 Jun 22 14:54 will_paginate.rb
-rw-r--r-- 1 Me staff 514 Sep 10 23:12 wrap_parameters.rb
Are there ways to clean this up a bit or use subfolders to organise this better? I feel there are several initialisers im not sure still needed like the fix_ssl.rb one and some other initialisers that only have a 1 line.
Preferrable I would like to clean this up more
It looks like you can create whatever subdirectories you need.
From the guide for using initializer files:
You can use subfolders to organize your initializers if you like,
because Rails will look into the whole file hierarchy from the
initializers folder on down.

grails emacs mode - "Cannot open load file" "project-mode"

I am trying to use emacs for grails development. Tried on grails-emacs-mode
There are emacs and emacs23 on my ubuntu 12.04.
prayag#prayag:~$ ls -l /usr/share/emacs[tab][tab]
emacs/ emacs23/
As the grails-emacs-mode suggests, I copied grails-mode.el and primary.org files to my emacs23/site-list
prayag#prayag:~$ ls -l /usr/share/emacs23/site-lisp/
total 32
-rw-r--r-- 1 root root 3013 Nov 17 00:39 debian-startup.elc
drwxr-xr-x 2 root root 4096 Nov 17 00:39 dictionaries-common
-rw-r--r-- 1 root root 18205 Feb 14 01:11 grails-mode.el
-rw-r--r-- 1 root root 0 Feb 14 01:11 primary.org
-rw-r--r-- 1 root root 106 Sep 22 01:16 subdirs.el
Then, created init.el inside .emacs.d as there exists no .emacs file in home directory. The init.el conatains
(require 'grails-mode)
(setq grails-mode t)
(setq project-mode t)
(add-to-list 'auto-mode-alist '("\.gsp$" . nxml-mode)) ; Use whatever mode you want for views.
(project-load-all) ; Loads all saved projects. Recommended, but not required.
now, opening emacs23 doesn't show any grails in the menubar.
I also tried
M-x
load-file .emacs.d/init.el
which throws
Warning (initialization): An error occurred while loading `/home/prayag/.emacs.d/init.el':
File error: Cannot open load file, project-mode
To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file. Start Emacs with
the `--debug-init' option to view a complete error backtrace.
On starting emacs23 --debug-init, following error is thrown.
Debugger entered--Lisp error: (file-error "Cannot open load file" "project-mode")
require(project-mode)
eval-buffer(#<buffer *load*<2>> nil "/usr/share/emacs/23.3/site-lisp/grails-mode.el" nil t) ; Reading at buffer position 422
load-with-code-conversion("/usr/share/emacs/23.3/site-lisp/grails-mode.el" "/usr/share/emacs/23.3/site-lisp/grails-mode.el" nil t)
require(grails-mode)
eval-buffer(#<buffer *load*> nil "/home/prayag/.emacs.d/init.el" nil t) ; Reading at buffer position 23
load-with-code-conversion("/home/prayag/.emacs.d/init.el" "/home/prayag/.emacs.d/init.el" t t)
load("/home/prayag/.emacs.d/init" t t)
#[nil "\205\264
grails-mode requires project-mode as mentioned on the emacs-grails-mode page. So, you'll also need to install project-mode.
Also grab the remaining groovy packages(all but grails-mode) from here.
emacs-grails-mode-ext is a modest contribution to grails-mode allowing you to run Grails commands directly from emacs. For a given project(project-mode), you can run Grails commands such as create-domain-class, create-service, etc.
I also use the function ido-find-file-in-tag-files from here, I bind it to C-x C-M-f .
Simple guide with emacs-grails-mode:
Create a project from the command line or eshell -> grails create-app yourapp
Using dired, go to your Grails project folder
M-x project-new -> to create a new project(project-mode)
M-x project-save -> Save the project
M-x project-load-and-select -> Your project-name as argument
There's also a Grails menu if you use the menubar
You could also use my current emacs setup here, if you have emacs24 installed. I believe that it's available for Ubuntu 12.04, but I'm not sure. I usually build emacs from source on OSX or I use emacs-snapshot in Ubuntu.
Hope this helps.
I don't know Grail-mode at all. I've just clicked your link, and they state that project-mode is a dependency:
Dependencies:
project-mode is the only dependency.
As a consequence you will also have to install it. Link to the Emacs project code.
I am hoping for you this project does not have additional dependencies...
As a side note: later, try to install the last emacs (v24) which embeds a very convenient way to deal with package installation and dealing with packages dependencies. I've just check it out, it is present on an alternative (but very know) repository: Marmalade-repo.org.

Resources