Show last authors
1 {{box cssClass="floatinginfobox" title="**Contents**"}}
2 {{toc/}}
3 {{/box}}
4
5 = WildFly 17.x =
6
7 The instructions are the same as for Wildly 14.x below.
8
9 = WildFly 14.x =
10
11 The instructions are the same as for Wildly 10.x below.
12
13 = WildFly 10.x =
14
15 The instructions are the same as for JBoss AS 7.x below.
16
17 Some documentation that can be useful:
18
19 * [[how WildFly 10.x Classloader works>>https://docs.jboss.org/author/display/WFLY10/Class+Loading+in+WildFly]]
20
21 == Troubleshooting ==
22
23 === Weld Deployment Error ===
24
25 WildFly does automatic implicit CDI deployment when it finds some CDI beans in JARs. We need to prevent this since XWiki doesn't use CDI and there can be some third-party deps we use that have some CDI annotations.
26
27 Note that we [[fixed this>>https://jira.xwiki.org/browse/XWIKI-13678]] by providing a ##META-INF/jboss-all.xml## file telling WildFly to not do CDI bean scanning in XWiki 8.3M2+. However [[we found a problem with it and removed it>>https://jira.xwiki.org/browse/XWIKI-15566]] in XWiki 10.8RC1+. In the end, it was found that [[this file was needed after all>>https://jira.xwiki.org/browse/XWIKI-16577]] and put back in XWiki 10.11.9/11.3.2/11.6RC1+...
28
29 If you're using a version of XWiki that doesn't provide this ##jboss-all.xml## then create one in the ##META-INF## directory inside the XWiki WAR, with the following content:
30
31 {{code language="xml"}}
32 <?xml version="1.0" encoding="UTF-8"?>
33
34 <!--
35 *
36 * See the NOTICE file distributed with this work for additional
37 * information regarding copyright ownership.
38 *
39 * This is free software; you can redistribute it and/or modify it
40 * under the terms of the GNU Lesser General Public License as
41 * published by the Free Software Foundation; either version 2.1 of
42 * the License, or (at your option) any later version.
43 *
44 * This software is distributed in the hope that it will be useful,
45 * but WITHOUT ANY WARRANTY; without even the implied warranty of
46 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
47 * Lesser General Public License for more details.
48 *
49 * You should have received a copy of the GNU Lesser General Public
50 * License along with this software; if not, write to the Free
51 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
52 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
53 *
54 -->
55
56 <!-- Required to tell WildFly to not do CDI bean parsing and try to do implicit deployment of them since XWiki doesn't
57 use CDI -->
58 <jboss xmlns="urn:jboss:1.0">
59 <weld xmlns="urn:jboss:weld:1.0" require-bean-descriptor="true"/>
60 </jboss>
61 {{/code}}
62
63 = JBoss AS 7.x =
64
65 * Download and install the [[JBoss Application Server>>http://www.jboss.org/jbossas/]]
66 * Deploy the XWiki WAR either by using the JBoss AS Admin (recommended) or by deploying on the filesystem. Read the [[JBoss AS documentation>>https://docs.jboss.org/author/display/AS71/Documentation]] to learn how to do this.
67 * If you have class loader issues read [[how JBoss AS7 Classloader works>>https://docs.jboss.org/author/display/AS71/Developer+Guide#DeveloperGuide-ClassloadinginJBossAS7]]
68
69 == Example using Standalone Deployment ==
70
71 * Copy the xwiki expanded WAR directory in ##JBOSSHOME/standalone/deployments/xwiki.war##
72 * Do a ##touch JBOSSHOME/standalone/deployments/xwiki.war.dodeploy##
73 * Start JBoss standalone: run ##./standalone.sh## from ##JBOSSHOME/bin/##
74
75 == Troubleshooting ==
76
77 === "More than the maximum number of request parameters" error ===
78
79 If you get the following error in the logs when trying to import a large XAR:
80
81 {{code}}
82 Servlet.service() for servlet action threw exception: java.lang.IllegalStateException: More than the maximum number of request parameters (GET plus POST) for a single request ([512]) were detected. Any parameters beyond this limit have been ignored. To change this limit, set the maxParameterCount attribute on the Connector.
83 {{/code}}
84
85 You'll need to [[configure Tomcat in JBoss to support more than 512 form fields>>https://community.jboss.org/thread/177942]].
86
87 = JBoss AS 4.0.x =
88
89 * Download and install the "JBoss Application Server". It's usually as simple as unzipping it in a directory. Let's call this directory ##$JBOSS_HOME##
90 * (optional) By default JBoss runs on port 8080. If you want to modify the port on which JBoss is running, edit ##$JBOSS_HOME/server/<mode>/deploy/jbossweb-tomcat55.sar/server.xml##. Search for ##8080## and replace it with the port value you wish to use. Similarly change the port in ##$JBOSS_HOME/server/<mode>/deploy/http-invoker.sar/META-INF/jboss-service.xml## to the value you like
91 * Copy and expand the XWiki WAR into a directory named ##xwiki.war/## (note that unlike most servlet containers JBoss wants the directory name to end with ##.war##) in ##$JBOSS_HOME/server/<server configuration>/deploy## where ##server configuration## is the JBoss configuration you're using
92 * Edit ##$JBOSS_HOME/server/<mode>/deploy/jbossweb-tomcat55.sar/server.xml## to set UTF-8 encoding:(((
93 {{code}}
94 <Connector port="8080" ... URIEncoding="UTF-8"/>
95 <Connector port="8009" ... URIEncoding="UTF-8"/>
96 {{/code}}
97 )))
98
99 == Classloading Isolation ==
100
101 The default JBoss behavior is that classes inside of the ##WEB-INF/classes## and ##WEB-INF/lib## directories of the WAR file are incorporated into the default shared class loader repository. This allows classes and resources to be shared between web applications. However this means that JARs provided by XWiki in ##WEB-INF/lib## will get mixed with JARs provided by JBoss and if both application provide the same JAR but in a different version, class incompatibilities will occur.
102
103 To solve this please read up on [[JBoss ClassLoading Configuration>>https://community.jboss.org/wiki/ClassLoadingConfiguration]] in order to configure JBoss not to use the unified class loader (set ##UseJBossWebLoader## to ##false## in ##META-INF/jboss-service.xml##).
104
105 Alternatively you may try to remove the clashing JARs from XWiki's ##WEB-INF/lib## hoping that the version provided by JBoss is compatible with XWiki's needs.
106
107 == Log4j Error ==
108
109 {{warning}}
110 It was reported that with XWiki 1.6 and JBoss 4.0.4, using these settings would generate an error with hibernate. Everything seems to work fine without these settings including classloading of log4j.
111 {{/warning}}
112
113 * Edit ##$JBOSS_HOME/server/<server configuration>/jbossweb-tomcat55.sar/META-INF/jboss-service.xml## file and replace:(((
114 {{code}}
115 <attribute name="Java2ClassLoadingCompliance">false</attribute>
116 <attribute name="UseJBossWebLoader">false</attribute>
117 {{/code}}
118 )))with:(((
119 {{code}}
120 <attribute name="Java2ClassLoadingCompliance">true</attribute>
121 <attribute name="UseJBossWebLoader">true</attribute>
122 {{/code}}
123 )))This is to avoid class loading issues for the Log4J library.
124
125 = Using a WildFly/JBoss DataSource =
126
127 == Tutorial for JBoss AS 7.1+ ==
128
129 * Create a JBoss Module for your database driver.
130 ** **HSQLDB**: create the directory ##[ROOT]/modules/org/hsqldb/main## and put the HSQLDB Driver JAR (e.g. ##hsqldb-2.2.9.jar##) in it and also create a ##module.xml## in it and write the following code inside:(((
131 {{code language='xml'}}
132 <?xml version="1.0" encoding="UTF-8"?>
133 <module xmlns="urn:jboss:module:1.0" name="org.hsqldb">
134 <resources>
135 <resource-root path="hsqldb-2.2.9.jar"/>
136 </resources>
137 <dependencies>
138 <module name="javax.api"/>
139 </dependencies>
140 </module>
141 {{/code}}
142 )))
143 ** **MySQL**: create the directory ##[ROOT]/modules/com/mysql/main## and put the MySQL Driver JAR (e.g. ##mysql-connector-java-5.1.48.jar##) in it and also create a ##module.xml## in it and write the following code inside:(((
144 {{code language='xml'}}
145 <?xml version="1.0" encoding="UTF-8"?>
146
147 <module xmlns="urn:jboss:module:1.1" name="com.mysql">
148 <resources>
149 <resource-root path="mysql-connector-java-5.1.48.jar"/>
150 </resources>
151 <dependencies>
152 <module name="javax.api"/>
153 <module name="javax.transaction.api"/>
154 <module name="javax.servlet.api" optional="true"/>
155 </dependencies>
156 </module>
157 {{/code}}
158 )))
159 * Edit the ##[ASROOT]/standalone/configuration/standalone.xml## file to add a new ##<datasource>## and a new ##<driver>## sections (adjust the properties as needed):
160 ** **MySQL**. Example:(((
161 {{code language='xml'}}
162 <datasources>
163 <datasource jta="true" jndi-name="java:jboss/datasources/XWikiDS" pool-name="XWikiDS" enabled="true" use-java-context="true" use-ccm="true">
164 <connection-url>jdbc:mysql://localhost:3306/xwiki?useSSL=false</connection-url>
165 <driver>mysql</driver>
166 <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
167 <pool>
168 <min-pool-size>10</min-pool-size>
169 <max-pool-size>100</max-pool-size>
170 <prefill>true</prefill>
171 </pool>
172 <security>
173 <user-name>xwiki</user-name>
174 <password>xwiki</password>
175 </security>
176 <statement>
177 <prepared-statement-cache-size>32</prepared-statement-cache-size>
178 <share-prepared-statements>true</share-prepared-statements>
179 </statement>
180 </datasource>
181 ...
182 <drivers>
183 <driver name="mysql" module="com.mysql">
184 <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
185 </driver>
186 ...
187 {{/code}}
188 )))
189 ** Note that it's also possible to create a data source file named ##-ds.xml## (e.g. ##hsqldb-ds.xml##) in ##[ASROOT]/standalone/deployments/## (you can also put it in your ##WEB-INF/## dir). Example of content for HSQLDB:(((
190 {{code}}
191 <?xml version="1.0" encoding="UTF-8"?>
192 <datasources xmlns="http://www.jboss.org/ironjacamar/schema">
193 <datasource jndi-name="java:jboss/datasources/XWikiDS" pool-name="XWikiDS" enabled="true" use-java-context="true">
194 <connection-url>jdbc:hsqldb:file:[path to your hsqldb db file, e.g. /tmp/xwiki-data/database/xwiki_db];shutdown=true</connection-url>
195 <driver>hsqldb</driver>
196 <security>
197 <user-name>sa</user-name>
198 <password></password>
199 </security>
200 </datasource>
201 </datasources>
202 {{/code}}
203
204 However it's not recommended because the deployment datasource feature should only be used in development environments, as the deployable datasources are considered as unmanaged datasource. Those are not recommended for production environments, because those can not be managed by the JBoss Management console or the management utilities like jboss-cli.sh. Hence such datasource cannot be managed like the managed dataSources which are configured inside the domain.xml or standalone*.xml files.
205 )))
206 * Modify XWiki's ##WEB-INF/hibernate.cfg.xml## file to tell Hibernate to use the defined DataSource rather than a direct JDBC connection:(((
207 {{code}}
208 <!-- This needs to be commented out since we're not going to use the DBCP connection pool (we're going to use the Data Source connection pool) -->
209 <!--property name="hibernate.connection.provider_class">com.xpn.xwiki.store.DBCPConnectionProvider</property-->
210 ...
211 <!-- Tells Hibernate to use the defined data source -->
212 <property name="connection.datasource">java:jboss/datasources/XWikiDS</property>
213
214 <!-- The following can be commented out since these are not needed as they are defined in the Data source definition -->
215 <!--
216 <property name="hibernate.connection.url">jdbc:hsqldb:file:${environment.permanentDirectory}/database/xwiki_db;shutdown=true</property>
217 <property name="hibernate.connection.username">sa</property>
218 <property name="hibernate.connection.password"></property>
219 <property name="hibernate.connection.driver_class">org.hsqldb.jdbcDriver</property>
220 -->
221 ...
222 {{/code}}
223 )))
224
225 == Tutorial for older versions ==
226
227 * Uncomment the ##resource-ref## section in XWiki's ##web.xml## file. You should have:(((
228 {{code}}
229 <resource-ref>
230 <description>DB Connection</description>
231 <res-ref-name>jdbc/XWikiDS</res-ref-name>
232 <res-type>javax.sql.DataSource</res-type>
233 <res-auth>Container</res-auth>
234 </resource-ref>
235 {{/code}}
236 )))
237 * Create the following ##jboss-web.xml## file in the deployed XWiki's ##WEB-INF/## directory:(((
238 {{code}}
239 <?xml version="1.0" encoding="ISO-8859-1"?>
240 <!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 2.3V2//EN" "http://www.jboss.org/j2ee/dtd/jboss-web_3_2.dtd">
241 <jboss-web>
242 <resource-ref>
243 <res-ref-name>jdbc/XWikiDS</res-ref-name>
244 <jndi-name>java:jboss/datasources/XWikiDS</jndi-name>
245 </resource-ref>
246 </jboss-web>
247 {{/code}}
248 )))
249 * Modify XWiki's ##WEB-INF/hibernate.cfg.xml## file to tell Hibernate to use the defined DataSource rather than a direct JDBC connection:(((
250 {{code}}
251 <!-- This needs to be commented out since we're not going to use XWiki's Data Source -->
252 <!--property name="hibernate.connection.provider_class">com.xpn.xwiki.store.DBCPConnectionProvider</property-->
253 ...
254 <!-- Tells Hibernate to use the defined data source -->
255 <property name="connection.datasource">java:jboss/datasources/XWikiDS</property>
256
257 <!-- The following can be commented out since these are not needed as they are defined in the Data source definition -->
258 <!--
259 <property name="hibernate.connection.url">jdbc:hsqldb:file:${environment.permanentDirectory}/database/xwiki_db;shutdown=true</property>
260 <property name="hibernate.connection.username">sa</property>
261 <property name="hibernate.connection.password"></property>
262 <property name="hibernate.connection.driver_class">org.hsqldb.jdbcDriver</property>
263 -->
264 ...
265 {{/code}}
266 )))
267
268 = Issues related to JBoss =
269
270 {{jira URL="https://jira.xwiki.org" source="jql"}}
271 labels = jboss
272 {{/jira}}

Get Connected