Friday, September 5, 2025

Windows Batch Script with Menu Choices

 

@ECHO OFF

:Menu

CLS

ECHO ----------------------------------------

ECHO   Application Development Environment

ECHO ----------------------------------------

ECHO 1. JDK 8.0.392 and Tomcat 9.0.37

ECHO 2. JRE 21.0.8 and Tomcat 9.0.108

ECHO 3. Exit

ECHO ----------------------------------------

SET /P CHOICE="Enter your choice (1-3): "


IF "%CHOICE%"=="1" GOTO Option1

IF "%CHOICE%"=="2" GOTO Option2

IF "%CHOICE%"=="3" GOTO :EOF

GOTO Menu


:Option1

SET DEV_HOME=C:/Users/DevApps

SET JAVA_HOME=%DEV_HOME%/zulu8.74.0.17-ca-jdk8.0.392-win_x64

SET CATALINA_HOME=%DEV_HOME%/ApacheTomcat9_CitizenPortal

@ECHO Open JDK 8.0.392 and Tomcat 9.0.37

GOTO Common


:Option2

SET DEV_HOME=C:/Users/DevApps

SET JAVA_HOME=%DEV_HOME%/zulu21.44.17-ca-jre21.0.8-win_x64

SET CATALINA_HOME=%DEV_HOME%/apache-tomcat-9.0.108

@ECHO Open JDK 21.0.8 and Tomcat 9.0.108

GOTO Common


:Common

REM SET JAVA_HOME=C:\Program Files (x86)\Java\jre1.8.0_191

SET CATALINA_BASE=%CATALINA_HOME%

SET PATH=%JAVA_HOME%/bin;%PATH%;%CATALINA_HOME%/bin;C:\Program Files\7-Zip


Monday, September 1, 2025

Mediawiki Installation and Setup

 

Downloads:

• Web Server: Apache VS17 binaries and modules download

• PHP: PHP Downloads

• Database: MySQL Download MySQL Community Server or MariaDB - Community Server

• MediaWiki: Download - MediaWiki


Installation:

• Unzip the files to the local folders


Configuration:

• Httpd: modify %HTTPD_HOME%/conf/httpd.conf

Set server Root:

Define SRVROOT "c:/DevApps/Apache24"

Set listen port:

Listen 8080

Enable(uncomment) SSL

LoadModule ssl_module modules/mod_ssl.so

Enable PHP

LoadModule php_module "C:/DevApps/php-8.4.11/php8apache2_4.dll"

AddHandler application/x-httpd-php .php

PHPIniDir "C:/DevApps/php-8.4.11"

• Enable extension in php.ini by removing ";" from the following lines

;extension_dir = "ext"

;extension=mysqli

;extension=curl

;extension=fileinfo

;extension=intl

;extension=mbstring

;extension=openssl

;extension=pdo_mysql


Database:

• Log in as root(admin account)

• Run the following statement to create initial DB:

CREATE DATABASE my_wiki;

CREATE USER 'wikiuser'@'localhost' IDENTIFIED BY 'database_password';

GRANT ALL PRIVILEGES ON my_wiki.* TO 'wikiuser'@'localhost' WITH GRANT OPTION;

Set up Wiki:

localhost:8080/mediawiki-1.44.0/index.php

• Set up MySQL, account etc

• Admin account creation

• Options: eg Authorized editors only

• Email, Skin etc

Download LocalSettings.php after the successful Wiki installation and copy it to %WIKI_HOME%

MySQL Installation

  • Download MySQL from www.mysql.com and configure thru the installation

• If you download .zip file, run %MYSQL_HOME%\bin\mysql_configurator.exe and configure the data folder, accounts, service etc.

○ Data Directory: C:\ProgramData\MySQL\data

○ Type and Networking: defaults - Development Computer, TCP/IP, Port 3306 etc

○ Root password and any user accounts

○ Windows Services (optional if running as standalone)

○ Server File Permission: defaults only to Administrators Group, you may need to manually add the users' access

○ Sample Database: skip

○ Apply Configuration - execute

• Start MySQL by running mysqld --defaults-file="C:/ProgramData/MySQL/data/my.ini" --console

• Stop MySQL by running mysqladmin -u root -p shutdown

• Connect to MySQL using mysql -u <userid> -p

• List existing databases: Show databases;

• Create a new database: CREATE DATABASE demodb;

• Switch to a database: USE <database name>;


Thursday, August 21, 2025

Installation and Configuration XWiki

This document describes the steps to install and configure XWiki as a knowledge base site. The production information can be found in https://www.xwiki.org/.

Application Server


• Unzip Tomcat 9
• Set up Tomcat 9 environment
○ SET JAVA_HOME=%ROOT%/jdk-21.0.2
○ SET CATALINA_HOME=%ROOT%/apache-tomcat-9.0.108
○ SET CATALINA_BASE=%CATALINA_HOME%
○ SET PATH=%PATH%;%JAVA_HOME%/bin;%CATALINA_HOME%/bin

Database


• For set up PostgresSQL, refer to Set up PostgresSQL database
• Start PostgresSQL: pg_ctl start
• Log in DB with postgres: psql -h localhost -U postgres
• Create Xwiki database: for v17, use LOCALE_PROVIDER = 'builtin' and LOCALE = 'C.UTF-8'
CREATE DATABASE xwiki
WITH OWNER = postgres
ENCODING = 'UNICODE'
LOCALE_PROVIDER = 'icu'
LOCALE = 'en_US.UTF-8'
TABLESPACE = pg_default
TEMPLATE = template0;
• Connect to DB and create a user and grant all permissions
\CONNECT xwiki;
CREATE USER xwiki PASSWORD '<password>' VALID UNTIL 'infinity';
GRANT ALL PRIVILEGES ON DATABASE xwiki TO xwiki;
ALTER DATABASE xwiki OWNER TO xwiki;
• Visit Download | pgJDBC to download JDBC library: postgresql-*.jar

Application Configuration

Download XWiki 16.10.10 - for production, download WAR Package for Servlet Container
• Unzip the .war file content into %CATALINA_HOME%\webapps\xwiki
• Review %CATALINA_HOME%\webapps\xwiki\WEB-INF\hibernate.cfg.xml with the DB connection URL mentioned in the DB installation above and update if needed
• Review %CATALINA_HOME%\webapps\xwiki\WEB-INF\xwiki.properties for the permanent directory set up mentioned in the Tomcat installation above and update if needed
• Copy the download postgrsql-*.jar into %CATALINA_HOME%\webapps\xwiki\WEB-INF\lib

Application Initialization

• Start Tomcat: catalina start
• Visit http://localhost:8080/xwiki/bin/view/Main/ first time to complete the application initialization

Troubleshooting

• Check Tomcat log files in %CATALINA_HOME%\logs
• Enable Tomcat admin user by add/uncomment the following in %CATALINA_HOME%\conf\tomcat-users.xml
  <role rolename="manager-gui"/>
          <user username="admin" password="<password>" roles="manager-gui"/>

References

Tuesday, January 28, 2025

 

Wildfly upgrade for Java Server Faces

 applications

Background

This document describes the basic changes for migrating JSF 2 applications from Wildfly v20 (JBOSS Enterprise Application Platform 7) to v30+ (or JBOSS EAP 8) – for version mapping between Wildfly and Jboss EAP, please refer to Appendix. The main changes in the later versions of Wildfly/Jboss EAP are package rename and deprecation. For example, the old javax.faces.* packages are renamed to jakarta.faces.*. This will need the Java library dependency changes and the reference updates in the application source code. Also some changes are required in the application configuration and web application deployment descriptors (eg web.xml).

Preparation

Download and install Wildfly 35, WildFly Downloads

Configure the application server supporting libraries if needed. Like the previous application server, ojdbc libraries may need to be copied to the application server, %JBOSS_HOME%\modules\system\layers\base.

Set up admin account (use %JBOSS_HOME%\bin\add-user.bat) for accessing the Wildfly/Jboss EAP admin console: http://localhost:9990

Basic Changes

Here are the general steps:
  • replace the library references in project configuration file (eg pom.xml in Apache Maven)

  • update the references in the source code based on the new libraries. If no new libraries to use, may need to consider to rewrite certain application functions.

  • compile and package the application and fix any compile errors

  • deploy the application package to the running application server and fix any deployment errors

  • test the application and fix the runtime errors

Maven project file, pom.xml

  • Update the library dependencies as the following. Find updated 3rd party library dependencies from Maven Repository: Search/Browse/Explore. For the new versions, look at what’s bundled with the wildfly. Eg in %JBOSS_HOME%\modules\system\layers\base\*

Name

Old Library (to be replaced)

New Library

jUnit

3.x

4.x

JAXB API

javax.xml.bind > jaxb-api

jakarta.xml.bind > jakarta.xml.bind-api

JSF API

com.sun.faces > jsf-api

jakarta.platform > jakarta.jakartaee-api
or jakarta.faces > jakarta.faces-api

JSF IMPL

com.sun.faces > jsf-api

CDI Support


jakarta.enterprise > jakarta.enterprise.cdi-api

Java Servlet

javax.servlet > javax.servlet-api

jakarta.servlet > jakarta.servlet-api

Expression Language

javax.el > javax.el-api

jakarta.el > jakarta.el-api

JSTL (taglib)

javax.servlet.jsp.jstl > jstl-api

jakarta.servlet.jsp.jstl > jakarta.servlet.jsp.jstl-api

JEE API

Javax > javaee-api

(upgrade the version only if needed)

JMS

(the libs with JEE API may not work)

jakarta.jms > jakarta.jms-api


RESTful WS API

javax.ws.rs > javax.ws.rs-api

jakarta.ws.rs > jakarta.ws.rs-api

OJDBC

com.oracle > ojdbc

(upgrade the version only if needed)

Hibernate

org.hibernate > hibernate-core

org.hibernate.orm > hibernate-core

Plugins update with new versions

org.apache.maven.plugins > maven-compiler-plugin

org.apache.maven.plugins > maven-resources-plugin

org.apache.maven.plugins > maven-war-plugin


Package reference rename in application source code

  • Change imports with the new package names from the above new libraries

The following list contains the new references:

import jakarta.annotation.PostConstruct;

import jakarta.el.ELResolver;

import jakarta.enterprise.context.ApplicationScoped;

import jakarta.enterprise.context.RequestScoped;

import jakarta.enterprise.context.SessionScoped;

import jakarta.enterprise.inject.Disposes;

import jakarta.enterprise.inject.Produces;

import jakarta.faces.application.FacesMessage;

import jakarta.faces.context.FacesContext;

import jakarta.faces.event.AjaxBehaviorEvent;

import jakarta.faces.event.PhaseEvent;

import jakarta.faces.event.PhaseId;

import jakarta.faces.event.PhaseListener;

import jakarta.faces.model.SelectItem;

import jakarta.inject.Inject;

import jakarta.inject.Named;

import jakarta.jms.BytesMessage;

import jakarta.jms.Queue;

import jakarta.jms.QueueConnection;

import jakarta.jms.QueueConnectionFactory;

import jakarta.jms.QueueSender;

import jakarta.jms.QueueSession;

import jakarta.persistence.CascadeType;

import jakarta.persistence.Column;

import jakarta.persistence.ElementCollection;

import jakarta.persistence.Entity;

import jakarta.persistence.EntityManager;

import jakarta.persistence.EntityManagerFactory;

import jakarta.persistence.EntityTransaction;

import jakarta.persistence.FetchType;

import jakarta.persistence.Id;

import jakarta.persistence.JoinColumn;

import jakarta.persistence.JoinTable;

import jakarta.persistence.ManyToMany;

import jakarta.persistence.MapKeyColumn;

import jakarta.persistence.NamedQueries;

import jakarta.persistence.NamedQuery;

import jakarta.persistence.OrderBy;

import jakarta.persistence.Table;

import jakarta.persistence.Transient;

import jakarta.servlet.http.HttpServletRequest;

import jakarta.servlet.http.HttpServletResponse;

import jakarta.servlet.http.HttpSession;

import jakarta.ws.rs.client.Client;

import jakarta.ws.rs.client.ClientBuilder;

import jakarta.ws.rs.client.Entity;

import jakarta.ws.rs.client.WebTarget;

import jakarta.ws.rs.Consumes;

import jakarta.ws.rs.core.Context;

import jakarta.ws.rs.core.MediaType;

import jakarta.ws.rs.core.Response;

import jakarta.ws.rs.core.UriInfo;

import jakarta.ws.rs.DELETE;

import jakarta.ws.rs.ext.ParamConverter;

import jakarta.ws.rs.ext.Provider;

import jakarta.ws.rs.GET;

import jakarta.ws.rs.HeaderParam;

import jakarta.ws.rs.Path;

import jakarta.ws.rs.PathParam;

import jakarta.ws.rs.POST;

import jakarta.ws.rs.Produces;

import jakarta.ws.rs.PUT;

import jakarta.ws.rs.QueryParam;

import jakarta.jms.BytesMessage;

import jakarta.jms.Queue;

import jakarta.jms.QueueConnection;

import jakarta.jms.QueueConnectionFactory;

import jakarta.jms.QueueSender;

import jakarta.jms.QueueSession;



  • Update WEB-INF\web.xml

find the old class types defined there and rename if available. For example of the following new names:

<servlet>

<servlet-name>Faces Servlet</servlet-name>

<servlet-class>jakarta.faces.webapp.FacesServlet</servlet-class>

<load-on-startup>1</load-on-startup>

</servlet>

<error-page>

<exception-type>jakarta.faces.application.ViewExpiredException</exception-type>

<location>/m_login.xhtml</location>

</error-page>

  • @NamedQuery with implicit ‘SELECT’ not allowed, so add “SELECT <object alias> ” before “FROM”

  • @Type(type = "yes_no") replaced by @Convert(converter = YesNoConverter.class). Note: when referring to it in NativeQueries, you may need to pass a true/false query parameter instead of hard-coded Y/N in the query.

  • @Singlton may need to be replaced with @ApplicationScoped because the @PostConstructed method in @Singlton may not be executed.

Potential Issues

Some old 3rd party libraries (eg Richfaces) may be out-of-support with using the old packages, and they will need to be replaced with the similar well-supported/updated libraries. For example, if the JSF applications are using Richfaces (UI components or AJAX), consider to replace with PrimeFaces for example. For possible Richfaces component replacements, refer to Appendix.


Appendix


Version Mapping between JBoss EAP and Wildfly

JBoss EAP Version

WildFly Version

8

28

7.4

23

7.3

18

7.2

14

7.1

11

7

10



Richfaces to Primefaces Migration References



RichFaces (change from)

PrimeFaces (change to)


Listener

a4j:actionListener

f:setPropertyActionListener

AJAX

a4j:ajax

p:ajax

Button

a4j:commandButton render

p:commandButton update=

Link

a4j:commandLink

p:commandLink

JS function

a4j:jsFunction

p:remoteCommand

Media output

a4j:mediaOutput

p:graphicImage, ...

Output area

a4j:outputPanel

div or p:tab or p:outputPanel

Parameter

a4j:param

f:param

Region

a4j:region

h:panelGroup or p:fragment

Repeat

a4j:repeat

p:repeat

Status

a4j:status

p:ajaxStatus

Accordion

rich:accordion

p:accordionPanel

Accord. item

rich:accordionItem

p:tab

Autocomplete

rich:autocomplete

p:autocomplete

Calendar

rich:calendar

p:calendar

Sub-table

rich:collapsibleSubTable

p:dataTable (nested)

Column

rich:column

p:column

Button

rich:commandButton

p:commandButton ajax="false"

Command link

rich:commandLink

p:commandLink ajax="false"

Control

rich:componentControl

JS function

Data grid

rich:dataGrid

p:dataGrid

Data scroll

rich:dataScroller

remove (use paginator)

Data table

rich:dataTable

p:dataTable

Sub-menu

rich:dropDownMenu

p:submenu

Editor

rich:editor

p:editor(p:textEditor in PF 6)

File upload

rich:fileUpload

p:fileUpload

Focus

rich:focus

p:focus

Google map

rich:gmap (RF3)

p:gmap

Hot key

rich:hotKey

p:hotkey

Spinner

rich:inputNumberSpinner

p:spinner

List

rich:list

p:dataList

Menu item

rich:menuItem

p:menuitem

Message

rich:message

p:message

Messages

rich:messages

p:messages

Panel

rich:panel

p:panel

Panel menu

rich:panelMenu

p:panelMenu or p:menu

Menu item

rich:panelMenuItem

p:menuitem

Pick list

rich:pickList

p:pickList

Popup

rich:popup

p:dialog

Select one

rich:select

p:selectOneMenu

Tab

rich:tab

p:tab

Menu bar

rich:toolbar

p:menubar or p:toolbar

Menu group

rich:toolbarGroup

remove

Tooltip

rich:tooltip

p:tooltip

Tree

rich:tree

p:tree

Tree node

rich:treeNode

p:treeNode

Label

h:outputLabel

p:outputLabel

Input text

h:inputText

p:inputText

Input secret

h:inputSecret

p:password

Message

h:message

p:message

Messages

h:messages

p:messages

Text area

h:inputTextarea

p:inputTextarea

Dropdown

h:selectOneListbox

p:selectOneMenu

Select one

h:selectOneMenu

p:selectOneMenu

Multi-select

h:selectManyListbox

p:selectManyMenu

Check box

h:selectBooleanCheckbox

p:selectBooleanCheckbox

Check boxes

h:selectManyCheckbox

p:selectManyCheckbox

Radio button

h:selectOneRadio

p:selectOneRadio

Button

h:commandButton

p:commandButton ajax="false

Regular link

h:commandLink

p:commandLink ajax="false"

Image link

h:commandLink

p:menuitem

Link

h:link

p:link

Column

h:column

p:column

Repeat

ui:repeat

p:repeat

Field set

fieldset

p:fieldset


References

Migration Guide 3.0: Hibernate ORM 5 to 6 migration · quarkusio/quarkus Wiki

Getting Started With Jakarta EE 10 - Jakarta CDI

Alternative of richfaces components in primefaces - Stack Overflow