Important: It is strongly discouraged to run other applications on WildFly (WF) with LSPS since LSPS is using a customized Hibernate.
To set up WildFly 11.0.0 with LSPS, do the following:
<module xmlns="urn:jboss:module:1.0" name="com.whitestein.lsps.security">
<resources>
<resource-root path="lsps-security-jboss-${lsps.version}.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
<module name="org.picketbox" />
</dependencies>
</module>
Take a note of the module name since it is used later for security realm configuration.$WF_HOME/modules/com/mysql/main/module.xml
with following content: <module xmlns="urn:jboss:module:1.0" name="com.mysql">
<resources>
<resource-root path="mysql-connector-java-<VERSION>-bin.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
$WF_HOME/modules/com/microsoft/sqlserver/main/module.xml
with following content: <module xmlns="urn:jboss:module:1.0" name="com.microsoft.sqlserver">
<resources>
<resource-root path="sqljdbc4.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
Also consider adding the sendStringParametersAsUnicode=false
property. <module xmlns="urn:jboss:module:1.0" name="com.oracle.jdbc">
<resources>
<resource-root path="ojdbc6.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
<module xmlns="urn:jboss:module:1.0" name="com.ibm.db2">
<resources>
<resource-root path="jcc-11.5.0.0.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
Configure JMS in the server profile file (typically, $WF_HOME/standalone/configuration/standalone-full.xml):
<server name="default" persistence-enabled="true">
.LSPS will use the default JMS connection factory.
Configure your data source in the server profile file (typically, $WF_HOME/standalone/configuration/standalone-full.xml).
The data source must be an XA-datasource with the transaction isolation TRANSACTION_READ_COMMITTED and the JNDI name must be jdbc/LSPS_DS.
<xa-datasource jndi-name="java:/jdbc/LSPS_DS" pool-name="LSPS_DS" enabled="true" use-java-context="false"> <driver>mysqlxa</driver> <xa-datasource-property name="URL">jdbc:mysql://localhost:3306/lsps?useUnicode=true&characterEncoding=utf-8</xa-datasource-property> <security> <user-name>lsps</user-name> <password>lsps</password> </security> <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation> <xa-pool> <min-pool-size>10</min-pool-size> <max-pool-size>20</max-pool-size> <prefill>true</prefill> </xa-pool> </xa-datasource>
<xa-datasource jndi-name="java:/jdbc/LSPS_DS" pool-name="LSPS_DS" enabled="true" use-java-context="true"> <driver>mssqlxa</driver> <xa-datasource-property name="URL">jdbc:sqlserver://localhost;databaseName=lsps</xa-datasource-property> <security> <user-name>lsps</user-name> <password>lsps</password> </security> <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation> <xa-pool> <min-pool-size>10</min-pool-size> <max-pool-size>20</max-pool-size> <prefill>true</prefill> </xa-pool> <new-connection-sql>select 1</new-connection-sql> <validation> <check-valid-connection-sql>select 1</check-valid-connection-sql> </validation> </xa-datasource>
<xa-datasource jndi-name="java:/jdbc/LSPS_DS" pool-name="LSPS_DS" enabled="true" use-java-context="true"> <driver>db2xa</driver> <xa-datasource-property name="User">lsps</xa-datasource-property> <xa-datasource-property name="Password">lsps</xa-datasource-property> <xa-datasource-property name="DatabaseName">lsps</xa-datasource-property> <xa-datasource-property name="ServerName">localhost</xa-datasource-property> <xa-datasource-property name="PortNumber">5000</xa-datasource-property> <xa-datasource-property name="progressiveStreaming">2</xa-datasource-property> <xa-datasource-property name="progressiveLocators">2</xa-datasource-property> <xa-datasource-property name="fullyMaterializedLobData">true</xa-datasource-property> <xa-datasource-property name="fullyMaterializedInputStreams">true</xa-datasource-property> <xa-datasource-property name="downgradeHoldCursorsUnderXa">true</xa-datasource-property> <xa-datasource-property name="resultSetHoldabilityForCatalogQueries">1</xa-datasource-property> <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation> <security> <user-name>lsps</user-name> <password>lsps</password> </security> <xa-pool> <min-pool-size>10</min-pool-size> <max-pool-size>20</max-pool-size> <prefill>true</prefill> </xa-pool> </xa-datasource>
<drivers>
element, make sure to delete the h2 driver (driver with the name="h2"
attribute) and add <driver>
for your data source: <driver name="mysqlxa" module="com.mysql">
<xa-datasource-class>com.mysql.cj.jdbc.MysqlXADataSource</xa-datasource-class>
</driver>
<driver name="mssqlxa" module="com.microsoft.sqlserver">
<xa-datasource-class>com.microsoft.sqlserver.jdbc.SQLServerXADataSource</xa-datasource-class>
</driver>
<driver name="oraclexa" module="com.oracle.jdbc">
<xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
</driver>
<driver name="db2xa" module="com.ibm.db2">
<xa-datasource-class>com.ibm.db2.jcc.DB2XADataSource</xa-datasource-class>
</driver>
<local-cache name="passivation">
<locking isolation="REPEATABLE_READ" acquire-timeout="600000"/>
<transaction mode="BATCH"/>
<file-store passivation="true" purge="false"/>
</local-cache>
</cache-container>
<mail-session name="lspsmail" jndi-name="java:jboss/mail/LSPS_MAIL">
<smtp-server outbound-socket-binding-ref="mail-smtp"/>
</mail-session>
Set up the login module for the LSPS realm: add the following to the "security-domains" of the security subsystem tag in $WF_HOME/standalone/configuration/standalone-full.xml or the respective WildFly config referencing the security module from step 2:
<security-domain name="lspsRealm" cache-type="default">
<authentication>
<login-module code="com.whitestein.lsps.security.jboss.LSPSRealm" flag="required" module="com.whitestein.lsps.security">
<module-option name="dsJndiName" value="/jdbc/LSPS_DS"/>
</login-module>
</authentication>
</security-domain>
The attribute cache-type of the security-domain element turns on caching of user login data. As a side effect, changes to user credentials will not be used until after the cache is flushed; for example, if a user changes user's password through the web console but the user is already using PDS, they will be able to connect PDS to the server with the old credentials. You can turn the cache off by omitting the cache-type attribute of the security-domain element. The security domain definition will look as follows:
<security-domain name="lspsRealm">
<authentication>
<login-module code="com.whitestein.lsps.security.jboss.LSPSRealm" flag="required" module="com.whitestein.lsps.security">
<module-option name="dsJndiName" value="/jdbc/LSPS_DS"/>
</login-module>
</authentication>
</security-domain>
For additional module options, refer to the JavaDoc of the implementing class and super classes. You can also plug in your own authentication module.
Configure networking (optional).
By default WildFly binds to the local host. You can change the configuration in $WF_HOME/standalone/configuration/standalone-full.xml (or the WildFly config you use). For example, to bind WildFly to any IPv4 address use the following setting:
<interface name="management">
<any-address/>
</interface>
<interface name="public">
<any-address/>
</interface>
<interface name="unsecure">
<any-address/>
</interface>
Set up Java memory options:
JVM might require larger amount of memory depending on the uploaded and used LSPS modules.
JAVA_OPTS="$JAVA_OPTS -Djboss.server.default.config=standalone-full.xml"
JAVA_OPTS="$JAVA_OPTS -Dorg.eclipse.emf.ecore.EPackage.Registry.INSTANCE=org.eclipse.emf.ecore.impl.EPackageRegistryImpl"
Without this configuration property, the LSPS application will fail to run properly.JAVA_OPTS="-Dorg.apache.el.parser.COERCE_TO_ZERO=false $JAVA_OPTS"
LSPS needs the system property org.apache.el.parser.COERCE_TO_ZERO to be set to "false" (see https://jsp-spec-public.dev.java.net/issues/show_bug.cgi?id=183). Without the property, empty input in numeric fields in the web application is interpreted as 0. This interpretation causes some functionalities not to work.