Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
tutorial:dev:creating_a_development_environment [2019/07/23 15:13] – [Select IDE for frontend environment] fix link kotynekvtutorial:dev:creating_a_development_environment [2025/04/11 09:10] (current) – [Working-around IdM rebuild when developing backend module] fiserp
Line 1: Line 1:
 ====== Creating a development environment ====== ====== Creating a development environment ======
  
-This text is intended as a tutorial for CzechIdM developers with the goal to set up IDE, build CzechIdM in it and run the system. If you prefer quick glance at the code or need to start quickly, you can use [[tutorial:dev:quick_start_with_devstack|]]. +This text is intended as a tutorial for CzechIdM developers with the goal to set up IDE, build CzechIdM in it and run the system. If you prefer quick glance at the code or need to start quickly, you can use [[.:quick_start_with_devstack|]].
  
 ====== 1. Install Java and Maven ====== ====== 1. Install Java and Maven ======
Line 7: Line 7:
 First install JDK and Maven: First install JDK and Maven:
  
-Download Java 1.8 Oracle JDK (or OpenJDK), minor version **at least 101** (it's necessary due to the certificate of Nexus repository, which uses Let's encrypt and its support was added in version 101). The guide was tested for jdk1.8.0_131.+Download and install Java 11 OpenJDK (Java 21 OpenJDK for CzechIdM 13.1.0+).
  
 Install Maven from your system packages, at least version 3.1 is required. Install Maven from your system packages, at least version 3.1 is required.
 +
 <code bash> <code bash>
 yum install maven yum install maven
 mvn -v mvn -v
 +
 +
 </code> </code>
  
 Note: If you installed Java separately from your system libraries, you should set the correct Java home for Maven in the file ".mavenrc", which you will create in your home directory. You put there the full path to your JDK: Note: If you installed Java separately from your system libraries, you should set the correct Java home for Maven in the file ".mavenrc", which you will create in your home directory. You put there the full path to your JDK:
 <code> <code>
 +
 export JAVA_HOME=/path/to/installed/jdk/ export JAVA_HOME=/path/to/installed/jdk/
 +
 </code> </code>
 +
 This way Maven will always use this JDK. This way Maven will always use this JDK.
  
Line 27: Line 33:
 <code bash> <code bash>
 git clone https://github.com/bcvsolutions/CzechIdMng.git git clone https://github.com/bcvsolutions/CzechIdMng.git
 +
 +
 </code> </code>
  
-Check branch: +Check branch:
  
 <code bash> <code bash>
 git branch git branch
 +
 +
 </code> </code>
  
Line 39: Line 49:
 <code bash> <code bash>
 git checkout -b develop origin/develop git checkout -b develop origin/develop
 +
 +
 </code> </code>
  
Line 45: Line 57:
 <code bash> <code bash>
 git checkout -b personal/YourName/feature_or_bugfix-name_of_your_branch git checkout -b personal/YourName/feature_or_bugfix-name_of_your_branch
 +
 +
 </code> </code>
  
Line 51: Line 65:
 ====== 3. Install PostgreSQL ====== ====== 3. Install PostgreSQL ======
  
-CzechIdM in "dev" profile uses PostgreSQL as the repository. You have to install it at least in basic configuration:+CzechIdM in "dev" profile uses PostgreSQL as the repository. 
 + 
 +You have to folow one of these next steps. Choose one which fits you more. 
 + 
 +  - PostgreSQL to computer 3.1. 
 +  - Run docker image with postgres part 3.2. 
 + 
 +===== 3.1 Install PostgreSQL to computer =====
  
 Install necessary packages: Install necessary packages:
 +
 <code bash> <code bash>
 yum install postgresql postgresql-server postgresql-init yum install postgresql postgresql-server postgresql-init
 +
 +
 </code> </code>
  
 Fedora 25 packages: Fedora 25 packages:
 +
 <code bash> <code bash>
 dnf install postgresql-server postgresql-contrib dnf install postgresql-server postgresql-contrib
 +
 +
 +</code>
 +
 +Ubuntu 22.04 LTS packages:
 +
 +<code bash>
 +apt install postgresql postgresql-contrib
 +
 +
 </code> </code>
  
 First run of the service: First run of the service:
 +
 <code bash> <code bash>
 systemctl start postgresql.service systemctl start postgresql.service
 +
 +
 </code> </code>
  
-If the following error occurs: "Job for postgresql.service failed. See 'systemctl status postgresql.service' and 'journalctl -xn' for details." +If the following error occurs: "Job for postgresql.service failed. See 'systemctl status postgresql.service' and 'journalctl -xn' for details." Try initializing the PostgreSQL first and start the database again:
-Try initializing the PostgreSQL first and start the database again:+
  
 <code bash> <code bash>
 postgresql-setup --initdb --unit postgresql postgresql-setup --initdb --unit postgresql
 +
 +
 </code> </code>
  
 Set automatic start of the service when starting OS: Set automatic start of the service when starting OS:
 +
 <code bash> <code bash>
 systemctl enable postgresql.service systemctl enable postgresql.service
 +
 +
 </code> </code>
  
 Set the configuration file for the database to accept login and password (change METHOD from ident to md5) Set the configuration file for the database to accept login and password (change METHOD from ident to md5)
 +
 <code> <code>
 vim /var/lib/pgsql/data/pg_hba.conf vim /var/lib/pgsql/data/pg_hba.conf
 +
 +in Ubuntu it is:
 +vim /etc/postgresql/14/main/pg_hba.conf
 +
 +in Windows it is:
 +<Postgress Install Dir>/Data/pg_hba.conf
  
 # TYPE  DATABASE        USER            ADDRESS                 METHOD # TYPE  DATABASE        USER            ADDRESS                 METHOD
Line 92: Line 141:
 # IPv6 local connections: # IPv6 local connections:
 host         all                  all                ::1/128                     md5 host         all                  all                ::1/128                     md5
 +
 </code> </code>
  
 Restart the service to load the changes: Restart the service to load the changes:
 +
 <code> <code>
 systemctl restart postgresql.service systemctl restart postgresql.service
 +
 </code> </code>
  
-Create the database: +Create the database with name
-(Make sure you have installed and allowed en_US locale in your OS)+ 
 +  * Version 13 is for IdM 13 and develop (IdM 14) - bcv\_idm\_13 
 +  * Version 10 is for IdM 12 - 10 - bcv\_idm\_10 
 +  * Below version 10 - bcv\_idm\_storage 
 +  * (Make sure you have installed and allowed en_US locale in your OS)
  
 <code> <code>
 su postgres -c psql postgres su postgres -c psql postgres
 CREATE USER idmadmin PASSWORD 'idmadmin'; CREATE USER idmadmin PASSWORD 'idmadmin';
-CREATE DATABASE "bcv_idm_storage" WITH OWNER idmadmin ENCODING 'UTF8' LC_COLLATE = 'en_US.UTF-8' LC_CTYPE = 'en_US.UTF-8' template template0;+CREATE DATABASE "bcv_idm_13" WITH OWNER idmadmin ENCODING 'UTF8' LC_COLLATE = 'en_US.UTF-8' LC_CTYPE = 'en_US.UTF-8' template template0; 
 +CREATE DATABASE "bcv_idm_10" WITH OWNER idmadmin ENCODING 'UTF8' LC_COLLATE = 'en_US.UTF-8' LC_CTYPE = 'en_US.UTF-8' template template0; 
 </code> </code>
  
-====== 4Backend development environment ======+===== 3.2 Run postgreSQL in docker container =====
  
-The tutorial is different for each IDE. Select one and continue with a certain tutorial below:+Installation instructions for **Docker**  **only**  or **Docker desktop**  are here[[http://docs.docker.com/engine/install/|docker engine installation]].
  
-  * [[devel:documentation:quickstart:dev:ide:eclipse|Eclipse]] +After installation of docker. Use next command which will create postgres container with user and password which is used for development. 
-  * [[devel:documentation:quickstart:dev:ide:idea|IDEA]]+<code>
  
-In the IDE start the Tomcat server with CzechIdM deployed.+docker run --name postgresql -e POSTGRES_USER=idmadmin -e POSTGRES_PASSWORD=idmadmin -p 5432:5432 postgres:14.5
  
-In browser access [[http://localhost:8080/idm-backend/api/v1/status|http://localhost:8080/idm-backend/api/v1/status]] to check whether the backend is running. Following text should be displayed:+</code>
  
-> CzechIdM API is running +Connect to docker container and create the databases with names:
-+
-> If you can see this message, API is running+
  
 +  * Version 13 is for IdM 13 and develop (IdM 14) - bcv\_idm\_13
 +  * Version 10 is for IdM 12 - 10 - bcv\_idm\_10
 +  * Below version 10 - bcv\_idm\_storage
 +  * (Make sure you have installed and allowed en_US locale in your OS)
 +  * \l command will return list of databases make sure you have properly set owner of databases!
  
-====== 5. Frontend development environment ======+<code> 
 +docker exec -it postgresql /bin/bash 
 +psql -U idmadmin
  
-<note important>**BEWARE!!!** This tutorial may be obsoletePlease use this [[https://github.com/bcvsolutions/CzechIdMng/tree/develop/Realization/frontend|instructions]]</note>+CREATE DATABASE "bcv_idm_13" WITH OWNER idmadmin ENCODING 'UTF8' LC_COLLATE = 'en_US.UTF-8' LC_CTYPE = 'en_US.UTF-8' template template0; 
 +CREATE DATABASE "bcv_idm_10" WITH OWNER idmadmin ENCODING 'UTF8' LC_COLLATE = 'en_US.UTF-8' LC_CTYPE = 'en_US.UTF-8' template template0;
  
-In frontent project folder:+\l
  
-===== Install Node.js =====+</code>
  
-Node.js version 4.x.x or higher is required (npm version 3.6 or higher is required). Download and install Node.js by your OS. +After running command "\lyou should see this: 
-<note> Be sure to have these versions. When upgrading node by "nis also "npm" changed usually to lower version than needed. </note+<code
- +                                       List of databases 
-For linux (fedora): +         Name          |  Owner   | Encoding |  Collate     Ctype    |   Acces 
- +s privileges    
-<code bash> +-----------------------+----------+----------+------------+------------+-------- 
-dnf install nodejs+--------------- 
 + bcv_idm_10            | idmadmin | UTF8     | en_US.utf8 | en_US.utf8 |  
 + bcv_idm_13            | idmadmin | UTF8     | en_US.utf8 | en_US.utf8 | 
 </code> </code>
  
-Check nodejs version:+Database will be available on address: 
 + 
 +<code> 
 + postgresql://localhost:5432/postgres
  
-<code bash> 
-node -v 
 </code> </code>
  
-Check npm version:+====== 4. Backend development environment ======
  
-<code bash> +The tutorial is different for each IDE. Select one and continue with a certain tutorial below:
-npm -v +
-</code>+
  
-For update nodejs from 0.x versions:+  * [[:devel:documentation:quickstart:dev:ide:eclipse|]] 
 +  * [[:devel:documentation:quickstart:dev:ide:idea|]]
  
-  * [[https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora]] +In the IDE start the Tomcat server with CzechIdM deployed.
-  * [[http://tecadmin.net/upgrade-nodejs-via-npm/#]]+
  
-Install gulp as global+In browser access [[http://localhost:8080/idm-backend/api/v1/status|http://localhost:8080/idm-backend/api/v1/status]] to check whether the backend is running. Following text should be displayed:
  
-Gulp version 3.9.0 is required.+> CzechIdM API is running > > If you can see this message, API is running
  
-<code bash> +====== 5Frontend development environment ======
-npm install gulp@3.9.0 -g +
-</code>+
  
-Check gulp version:+<note important>**BEWARE!!!**  Please use these [[https://github.com/bcvsolutions/CzechIdMng/tree/develop/Realization/frontend|instructions]]</note>
  
-<code bash> +===== Select IDE for frontend environment =====
-gulp -v +
-</code>+
  
-===== Install the dependencies for application module =====+You can use any text editor or JavaScript IDE. We recommend to use ATOM
  
-First go to directory **czechidm-app**. It is basic application module keep dependencies on other sub-module. This module will start whole application.+  See [[:devel:documentation:quickstart:dev:ide:atom|ATOM tutorial]]
  
-<code bash> +====== 6. Run backend and frontend together ======
-cd czechidm-app +
-</code>+
  
-Run script modules-link defined in package.json. This script will create directory node_modules in parent directory and create symlink on him in czechidm-app. This prevents the problem with multiple copies of React (https://facebook.github.io/react/warnings/refs-must-have-owner.html). The goal is to have only one node_modules directory (for all ours modules) with React.+Assume running backend from the previous steps.
  
-<note important>IMPORTANT! Module-link script does not work on Windows. If are you Windows user, then you have to create symlink on node_modules (in parent directory) manually (use command 'mklink /D').</note>+In the project root folder:
  
-<code bash> +Start frontend
-npm run modules-link +
-</code>+
  
 <code bash> <code bash>
-npm run czechidm-modules-link +cd CzechIdM/Realization/frontend/czechidm-app 
-</code>+gulp
  
-Install basic dependencies for application module (will be common for all submodules ). 
  
-<code bash> 
-npm install 
 </code> </code>
  
-Install the dependencies for core module+A new browser window or tab will open with [[https://localhost:3000|https://localhost:3000]] automatically (this could take some time).
  
-Now we need to install mandatory core module. Go to core directory. You can use symlink in czechidm-modules.+The frontend is fully started after you see in following line in log:
  
 <code bash> <code bash>
-cd czechidm-modules/czechidm-core +[BS] 1 file changed (app.js)
-</code>+
  
-Install NPM dependencies. Most of dependency are installed within czechidm-core module. It is important for prevent problem with multiple copies of React. In this module is React present only in peer dependency. Peer dependency warnings are OK. 
  
-<code bash> 
-npm install 
 </code> </code>
  
-Go to app module.+After the application is running, log in:
  
-<code bash> +  * username: admin 
-cd ../../ +  * password: admin
-</code>+
  
-===== Install the dependencies for other sub modules =====+<note tip>If the app shows error with permission, log out</note> <note tip>To use CzechIdM in more windows or tabs for development purposes go to [[http://localhost:3001/|http://localhost:3001/]] to **BrowserSync**  administration and then go to **SyncOptions**  and disable everything except **CodeSync**</note>
  
-We can install other application modules. We will install optional example module czechidm-example.+Congratulations! Your CzechIdM development environment is ready to use.
  
-All application modules are in czechidm-modules directory (in czechidm-app). Go to him and create symlink on example module.+====== Common development errors & tips ======
  
-<code bash> +===== Tomcat server fails to start =====
-cd czechidm-modules +
-ln -s ../../czechidm-example +
-</code>+
  
-<note important>IMPORTANT! If are you Windows userthen you have to create symlink with command 'mklink /D' e.g. +If Tomcat server fails to starttry following:
-<code bash> +
-mklink /D d:\Projekty\BCV\CzechIdMng\Realization\frontend\czechidm-app\czechidm-modules\czechidm-acc d:\Projekty\BCV\CzechIdMng\Realization\frontend\czechidm-acc +
-</code> +
-</note>+
  
-Go to the example moduleYou can use symlink in czechidm-modules.+  * Increase the timeout for Tomcat server Start (see [[https://tomcat.apache.org/download-90.cgi|Install Tomcat]]) 
 +  * Check that PostgreSQL server is running.
  
 <code bash> <code bash>
-cd czechidm-example+systemctl status postgresql.service 
 + 
 </code> </code>
  
-Install NPM dependencies.+  * Check that PostgreSQL database exists and the user can connect: Use the credentials filled in ''idm-app/src/main/resources/application-dev.properties''  and try to connect to the PostgreSQL database written in the datasource URL. E.g. for this setup: 
 +<code> 
 + 
 +spring.datasource.url=jdbc:postgresql://localhost:5432/bcv_idm_storage 
 +spring.datasource.username=idmadmin 
 +spring.datasource.password=idmadmin
  
-<code bash> 
-npm install 
 </code> </code>
  
-Go to app module.+use the following command and type the password when asked for it.
  
 <code bash> <code bash>
-cd ../../+psql -h 127.0.0.1 -U idmadmin bcv_idm_storage 
 + 
 </code> </code>
  
-===== Install the dependencies for external module =====+  * Check that you can read from the tables of the database. As in the previous point, connect to the PostgreSQL database and try to select data from any of the IdM tables. If you have insufficient access rights, check the owner and grants for the schema "public". If the user idmadmin is not an owner, there must be GRANT on schema public to the user idmadmin or to "public"
 +  * Check the error message in the server output console.
  
-If you are developing a custom module (for example named as "czechidm-ext") that is not part of our product, you need to do the following:+==== Common error messages ====
  
-  * We have the product installed in the projects/CzechIdM/ folder. +''Initialization of bean failed; nested exception is org.flywaydb.core.api.FlywayException: Validate failed: Migration checksum mismatch for migration 7.07.004''  means that your database was already used for some other version of CzechIdM (you can check used Flyway versions in the tables idm\_schema\_version\_xxx)This can happen if you switch to some older development branch. The easiest solution for the **developer**  (you will lose all your prepared data in IdM!) is to drop the database (''DROP DATABASE bcv\_idm\_storage'') and create it again (see the part ''CREATE DATABASE''  of [[#install_postgresql|Install PostgreSQL]]). Or you can create a different database and set its name to the ''application-dev.properties''  temporarily.
-  * The czechidm-app module is in the projects/CzechIdM/Realization/frontend/czechidm-app/. +
-  For example, the externally developed module (frontend part) czechidm-ext is in the projects/ExternalModule/Realization/frontend/czechidm-ext/ folder.+
  
-First, we create the symlink to the "czechidm-ext" module:+''Initialization of bean failed; nested exception is org.flywaydb.core.api.FlywayException: Found more than one migration with version 7.07.004''  means literally that there is a duplicity in Flyway scripts versions. This has to be fixed by the authors of the scripts by renaming one of the script that use the same version. The log will tell you where to find the duplicity: 
 +<code> 
 + 
 +Offenders: 
 +-> ... idm-core-impl-7.7.0-SNAPSHOT.jar!/eu/bcvsolutions/idm/core/sql/postgresql/V7_07_004__automatic-role.sql (SQL) 
 +-> ... idm-core-impl-7.7.0-SNAPSHOT.jar!/eu/bcvsolutions/idm/core/sql/postgresql/V7_07_004__add-index-template-name.sql (SQL)
  
-<code bash> 
-cd projects/CzechIdM/Realization/frontend/czechidm-app/czechidm-modules 
-ln -s ../../../../../ExternalModule/Realization/frontend/czechidm-ext 
 </code> </code>
  
-Then we create a symlink from the external module to the product "node_modules". This prevents the problem with multiple copies of React (https://facebook.github.io/react/warnings/refs-must-have-owner.html). The goal is to have only one node_modules directory (for all modules) with React.+Just increase the version in the name of one of the scripts, clean & build the project again.
  
-<code bash> +=== Could not create Vfs.Dir from url ===
-cd ../../../../../ExternalModule/Realization/frontend/czechidm-ext +
-ln -s ../../../../CzechIdM/Realization/frontend/node_modules +
-</code>+
  
-===== Make all modules together =====+**This isn't error just warning**. You may don't interest about this warning. Warning is only when you start local development environment and you configuration for ic connectors path isn't correctly setup. Dont worry about this warning.
  
-After when we have installed all required modules, we have to copy them togetherIts means create symlinks from czechidm-modules to app node_modules.+<code> 
 +2019-07-18 10:01:20.436  WARN 31049 --- [ost-startStop-1] org.reflections.Reflections              : could not create Vfs.Dir from url. ignoring the exception and continuing 
 + 
 +org.reflections.ReflectionsException: could not create Vfs.Dir from url, no matching UrlType was found [file:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/libatk-wrapper.so] 
 +either use fromURL(final URL url, final List<UrlType> urlTypes) or use the static setDefaultURLTypes(final List<UrlType> urlTypes) or addDefaultURLTypes(UrlType urlType) with your specialized UrlType.
  
-<code bash> 
-cd ../czechidm-app 
-gulp makeModules 
 </code> </code>
  
-===== Test =====+===== Frontend build fails =====
  
-<code bash> +==== Out of memory ====
-gulp test +
-</code>+
  
-===== Select IDE for frontend environment =====+If your gulp build fails with the following error:
  
-You can use any text editor or JavaScript IDEWe recommend to use ATOM +<code> 
-  * See [[devel:documentation:quickstart:dev:ide:atom|ATOM tutorial]]+[INFO] [18:43:00] Starting 'browserify'..
 +[INFO] [18:45:30] Finished 'browserify' after 2.5 min 
 +[INFO] [18:45:30] Finished 'build' after 3.12 min 
 +[INFO] 
 +[INFO] <--- Last few GCs ---> 
 +[INFO] 
 +[INFO] 192087 msScavenge 1282.6 (1434.8) -> 1282.1 (1434.8) MB, 3.8 / 0 ms (+ 3.8 ms in 9 steps since last GC) [allocation failure]
 +[INFO] 192095 ms: Scavenge 1282.6 (1434.8) -> 1282.2 (1434.8) MB, 3.6 / 0 ms (+ 3.3 ms in 8 steps since last GC) [allocation failure]. 
 +[INFO] 192102 ms: Scavenge 1282.6 (1434.8) -> 1282.1 (1434.8) MB, 3.7 / 0 ms (+ 2.9 ms in 7 steps since last GC) [allocation failure]. 
 +[INFO] 
 +[INFO] 
 +[INFO] <--- JS stacktrace ---> 
 +[INFO] Cannot get stack trace in GC. 
 +[ERROR] FATAL ERROR: Scavenger: semi-space copy 
 +[ERROR] Allocation failed - process out of memory 
 +[ERROR] 1: node::Abort() [gulp]
  
-====== 6. Run backend and frontend together ======+</code>
  
-Assume running backend from the previous steps.+Try following:
  
-In the project root folder:+  * Go to ''Realization/frontend/czechidm-app/''  and delete ''node\_modules''. Then start the build again (''npm install''  etc.) 
 +  * If you build BE+FE of a project together, check the ''pom.xml''  of the app module - the configuration properties ''nodeVersion''  and ''npmVersion''. They should be the same as the product currently supports (check the [[https://github.com/bcvsolutions/CzechIdMng/blob/develop/Realization/backend/app/pom.xml|app module of the product]]): 
 +<code>
  
-Start frontend+                        <execution> 
 +                                <id>install node and npm</id> 
 +                                <goals> 
 +                                    <goal>install-node-and-npm</goal> 
 +                                </goals> 
 +                                <phase>generate-resources</phase> 
 +                                <configuration> 
 +                                    <nodeVersion>v10.15.3</nodeVersion> 
 +                                    <npmVersion>6.4.1</npmVersion> 
 +                                </configuration> 
 +                        </execution>
  
-<code bash> 
-cd CzechIdM/Realization/frontend/czechidm-app 
-gulp 
 </code> </code>
  
-A new browser window or tab will open with [[https://localhost:3000]] automatically (this could take some time).+  * try adding ''\–max\_old\_space\_size=4096''  to the ''gulp''  commandOr if you build BE+FE together by app module, try adding it in the pom.xml of the app:
  
-The frontend is fully started after you see in following line in log:+<code> 
 +                                                         <execution> 
 +                                                                <id>gulp build</id> 
 +                                                                <goals> 
 +                                                                        <goal>gulp</goal> 
 +                                                                </goals> 
 +                                                                <phase>generate-resources</phase> 
 +                                                                <configuration> 
 +                                                                        <arguments>build -p ${frontend.profile} -s ${frontend.stage} --max_old_space_size=4096</arguments> 
 +                                                                        <workingDirectory>../../frontend/czechidm-app</workingDirectory> 
 +                                                                        <installDirectory>target</installDirectory> 
 +                                                                </configuration> 
 +                                                        </execution>
  
-<code bash> 
-[BS] 1 file changed (app.js) 
 </code> </code>
  
-After the application is running, log in: +==== Wrong layout and NPM version ====
-  * username: admin +
-  * password: admin+
  
-<note tip>If the app shows error with permission, log out</note> +If your frontend looks like this: [[https://redmine.czechidm.com/issues/1752|https://redmine.czechidm.com/issues/1752]], check following:
-<note tip>To use CzechIdM in more windows or tabs for development purposes go to [[http://localhost:3001/]] to **BrowserSync** administration and then go to **SyncOptions** and disable everything except **CodeSync**</note>+
  
-Congratulations! Your CzechIdM development environment is ready to use.+  * there is package-lock.json file in the frontend app module and it looks like this: [[https://github.com/bcvsolutions/CzechIdMng/blob/develop/Realization/frontend/czechidm-app/package-lock.json|https://github.com/bcvsolutions/CzechIdMng/blob/develop/Realization/frontend/czechidm-app/package-lock.json]] 
 +  * NPM version which you use when building frontend (or FE+BE) is at least 6. 
 +<code>
  
 +npm -v
 +6.4.1
  
-====== Common development errors & tips ======+</code>
  
-===== Tomcat server fails to start =====+====== Developing on Appliance ======
  
-If Tomcat server fails to start, try following: +This section contains howtos and hacks for more effective development on IAM Appliance.
-  * Increase the timeout for Tomcat server Start (see [[devel:dev:quickstart:ide:eclipse#install_tomcat|Install Tomcat]]) +
-  * Check that PostgreSQL server is running. +
-<code bash> +
-systemctl status postgresql.service +
-</code> +
-  * Check that PostgreSQL database exists and the user can connect: Use the credentials filled in ''idm-app/src/main/resources/application-dev.properties'' and try to connect to the PostgreSQL database written in the datasource URL. E.g. for this setup: +
-<code> +
-spring.datasource.url=jdbc:postgresql://localhost:5432/bcv_idm_storage +
-spring.datasource.username=idmadmin +
-spring.datasource.password=idmadmin +
-</code> +
-use the following command and type the password when asked for it. +
-<code bash> +
-psql -h 127.0.0.1 -U idmadmin bcv_idm_storage +
-</code> +
-  * Check that you can read from the tables of the database. As in the previous point, connect to the PostgreSQL database and try to select data from any of the IdM tables. If you have insufficient access rights, check the owner and grants for the schema "public". If the user idmadmin is not an owner, there must be GRANT on schema public to the user idmadmin or to "public"+
-  * Check the error message in the server output console.+
  
-==== Common error messages ====+===== Working-around IdM rebuild when developing backend module =====
  
-''Initialization of bean failed; nested exception is org.flywaydb.core.api.FlywayException: Validate failed: Migration checksum mismatch for migration 7.07.004'' means that your database was already used for some other version of CzechIdM (you can check used Flyway versions in the tables idm\_schema\_version\_xxx). This can happen if you switch to some older development branch. The easiest solution for the **developer** (you will lose all your prepared data in IdM!) is to drop the database (''DROP DATABASE bcv\_idm\_storage'') and create it again (see the part ''CREATE DATABASE'' of [[#install_postgresql|Install PostgreSQL]])Or you can create a different database and set its name to the ''application-dev.properties'' temporarily.+When you are developing a backend module and need to debug it directly on the Appliance, each ''iam-czechidm'' service restart forces the application to relink... which can take significant amount of time. 
 +To speed things up you can, technically, edit the content of existing container without the need for relink.
  
-''Initialization of bean failed; nested exception is org.flywaydb.core.api.FlywayException: Found more than one migration with version 7.07.004'' means literally that there is a duplicity in Flyway scripts versionsThis has to be fixed by the authors of the scripts by renaming one of the script that use the same version. The log will tell you where to find the duplicity: +<note warning>This is really nonstandard hack and exercising special care is absolutely necessary.</note>
-<code> +
-Offenders: +
--> ... idm-core-impl-7.7.0-SNAPSHOT.jar!/eu/bcvsolutions/idm/core/sql/postgresql/V7_07_004__automatic-role.sql (SQL) +
--... idm-core-impl-7.7.0-SNAPSHOT.jar!/eu/bcvsolutions/idm/core/sql/postgresql/V7_07_004__add-index-template-name.sql (SQL) +
-</code> +
-Just increase the version in the name of one of the scripts, clean & build the project again.+
  
 +**Remarks**
 +  * If you are debugging a frontend module, this howto **will not work** because the frontend rebuild will be skipped.
 +  * If you forget to properly persist your changes (see steps below) you are creating rather nasty surprise for anybody who re-creates the ''czechidm'' docker container. And as the original container gets deleted in the process, you will have no way to find out what happenned. Always clean up after yourself.
  
-=== Could not create Vfs.Dir from url === +**Steps** 
-**This isn't error just warning**. You may don't interest about this warningWarning is only when you start local development environment and you configuration for ic connectors path isn't correctly setupDont worry about this warning.+  - (you start developing, add all your modules into proper folders in the appliance, restart the ''iam-czechidm'' service, let the build process finish) 
 +  - At this point, you have a basis of the application you are going to develop furtherYou can even have some custom frontend parts put in. 
 +  - Suppose you want to put another JAR into you application or replace one that is already here. (here we work with ''ssh-connector-1.0.1.jar'' as an example) 
 +    - Copy new / modified files directly into the container. <code>[root@appliance70 ~]# docker cp ssh-connector-1.0.1.jar czechidm:/opt/tomcat/current/webapps/idm/WEB-INF/lib/ 
 +Successfully copied 28.2kB to czechidm:/opt/tomcat/current/webapps/idm/WEB-INF/lib/</code> 
 +    - In case you need to delete something, remove it directly from the container. **This is the way you now have to handle conflicting libraries, by the way.**<code>[root@appliance70 ~]# docker exec czechidm ls -l /opt/tomcat/current/webapps/idm/WEB-INF/lib | grep ssh 
 +-rw-r--r--. 1 root root    26277 Apr 10 13:05 ssh-connector-1.0.1.jar
  
-<code> +[root@appliance70 ~]# docker exec czechidm rm -fv /opt/tomcat/current/webapps/idm/WEB-INF/lib/ssh-connector-1.0.1.jar 
-2019-07-18 10:01:20.436  WARN 31049 --- [ost-startStop-1] org.reflections.Reflections              : could not create Vfs.Dir from urlignoring the exception and continuing+removed '/opt/tomcat/current/webapps/idm/WEB-INF/lib/ssh-connector-1.0.1.jar'
  
-org.reflections.ReflectionsException: could not create Vfs.Dir from url, no matching UrlType was found [file:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/libatk-wrapper.so] +[root@appliance70 ~]# docker exec czechidm ls -l /opt/tomcat/current/webapps/idm/WEB-INF/lib | grep ssh 
-either use fromURL(final URL urlfinal List<UrlType> urlTypes) or use the static setDefaultURLTypes(final List<UrlTypeurlTypes) or addDefaultURLTypes(UrlType urlType) with your specialized UrlType. +(empty listing)</code> 
-</code>+    - Restart the IdM container<code> 
 +[root@appliance70 ~]# systemctl restart iam-czechidm</code> 
 +    - Let the IdM start as usualBecause you did not change anything in the appliance directories (under ''/data/volumes/czechidm/...'') the relink mechanism will not kick in. 
 +  Repeat the previous step as long as you need to develop / debug your backend module. 
 +  Persist the changes. 
 +    Once you are done working, you need to persist all changes you made. Gather all modules you were working on and put them into directories under ''/data/volumes/czechidm/...'' where they should be located. 
 +    - Stopdrop and start the IdM container. <code>[root@appliance70 ~]# systemctl stop iam-czechidm 
 +[root@appliance70 ~]# docker rm czechidm 
 +[root@appliance70 ~]# systemctl start iam-czechidm</code> 
 +    - Let the rebuild finish and wait for IdM to start. 
 +    - Test that changes you made are really there.
  • by kotynekv