JBoss6_en - terasolunaorg/terasoluna-gfw GitHub Wiki
terasoluan-gfw | OS | Java | JBoss | RDBMS | Browser | Mail Server | Message Queue |
---|---|---|---|---|---|---|---|
5.4.2.RELEASE |
CentOS 7.4 |
OpenJDK 8u161 |
JBoss EAP 6.4.0 |
PostgreSQL 9.6.10 |
Firefox ESR 38 (38.8.0) |
Postfix 3.2.2 + Dovecot 2.3.1 |
ActiveMQ 5.15.3 |
When TERASOLUNA Server Framework for Java (5.x) is used in JBoss EAP(JBoss Enterprise Application Platform)6 environment, the following settings are required.
-
Creation and setting of
jboss-deployment-structure.xml
-
Setting of URI encoding
-
Setting of file upload (Commons FileUpload)
When JBoss’s server module conflicts with the library used in TERASOLUNA Server Framework for Java (5.x), the module on JBoss side will take precedence, so it may not work properly.
Therefore, it is necessary to create jboss-deployment-structure.xml
and exclude the module on JBoss side (partial reference).
Place jboss-deployment-structure.xml
under WEB-INF.
WEB-INF/jboss-deployment-structure.xml
<jboss-deployment-structure>
<deployment>
<exclusions>
<module name="javaee.api" /><!-- (1) -->
<module name="javax.faces.api" /><!-- (2) -->
<module name="org.hibernate.validator" /><!-- (3) -->
<module name="org.jboss.logging" /><!-- (4) -->
<module name="org.slf4j" /><!-- (5) -->
<module name="javax.inject.api" /> <!-- (6) -->
</exclusions>
<dependencies>
<module name="javax.annotation.api" /><!-- (7) -->
<module name="javax.jms.api" /><!-- (8) -->
</dependencies>
<exclude-subsystems>
<subsystem name="jpa" /><!-- (9) -->
</exclude-subsystems>
</deployment>
</jboss-deployment-structure>
Sr. No. | Explanation |
---|---|
(1) |
Since there is a conflict between Bean Validation and JPA version and an error occurs, exclude Java EE module. (This setting is required when using Bean Validation for input check or using JPA as O/R Mapper) |
(2) |
Since Bean Validation version conflicts and an error occurs, exclude JavaServer Faces module. It should be set as per (1). (This setting is required when using Bean Validation for input check) |
(3) |
Since Hibernate Validator does not work properly, exclude Hibernate Validator module. |
(4) |
Since JBoss Logging version conflicts and an error occurs, exclude JBoss Logging module. |
(5) |
Since application log is not output properly, exclude SLF4J module. |
(6) |
Since javax.inject.api version conflicts and an error occurs, exclude javax.inject.api module. (In 5.3.0.RELEASE, error does not occur even if it is not excluded) |
(7) |
Since injection does not work using |
(8) |
Since API class of JMS is required in class path, refer javax.jms.api module. (This setting is required when using JMS) [1] |
(9) |
Since JPA version conflicts and an error occurs, exclude JPS subsystem from operation. (This setting is required when using JPA as O/R Mapper) |
[1]
When specific class of Apache ActiveMQ is used in the application, the added ActiveMQ module should be referred by the method same as "javax.jms.api" module for using the mechanism of resource adapter of JBoss (Refer
Resource Adapters for the mechanism of resource adapter of JBoss).
There is a method to include jar file of ActiveMQ in war file however, operation verification is not performed by this method.
In JBoss environment, if multibyte characters are included in the request parameter, garbled characters appear.
In order to avoid this, the following URI encoding setting should be done.
-
Set default character codes using
org.apache.catalina.connector.URI_ENCODING
-
If character codes are set for each request, apply the same to the request using
org.apache.catalina.connector.USE_BODY_ENCODING_FOR_QUERY_STRING
Refer the following for how to set.
Use org.apache.catalina.connector.URI_ENCODING
to set default character codes in URI.
-
Setting example
{JBOSS_HOME}/standalone/configuration/standalone.xml
Add the following settings of <extensions>
tag
<!--omitted-->
</extensions>
<system-properties>
<property name="org.apache.catalina.connector.URI_ENCODING" value="UTF-8"/>
</system-properties>
"UTF-8" is applied in the above example.
When character codes are set to each request using ServletRequest#setCharacterEncoding(String)
in application, character codes of request are applied to URI request parameter using org.apache.catalina.connector.USE_BODY_ENCODING_FOR_QUERY_STRING
.
-
Setting example
request.setCharacterEncoding("Windows-31J");
{JBOSS_HOME}/standalone/configuration/standalone.xml
Add the folloing settings of <extensions>
tag
<!--omitted-->
</extensions>
<system-properties>
<property name="org.apache.catalina.connector.URI_ENCODING" value="UTF-8"/>
<property name="org.apache.catalina.connector.USE_BODY_ENCODING_FOR_QUERY_STRING" value="true"/>
</system-properties>
"Windows-31J" is applied in the above example.
When character codes are not set in request, "UTF-8" specified in org.apache.catalina.connector.URI_ENCODING
is applied.
When file upload function of Servlet 3.0 is used in JBoss, the multibyte characters of request parameter and file name may be garbled.
This problem can be avoided by using Commons FileUpload. Refer to the explanation of the following guideline for how to use.