Configure GlassFish

Last modified by Eleni Cojocariu on 2026/10/28 16:57

Steps

Information

GlassFish is not an officially supported servlet container: these instructions are contributed by the community and receive no testing from the XWiki project.

To deploy XWiki on Eclipse GlassFish as your servlet container:

  1. Install Eclipse GlassFish 7 or later, and a supported Java runtime. GlassFish has to provide Jakarta Servlet 5.0 or later, since the XWiki web application is built against the jakarta namespace, and to run on one of the Java versions XWiki supports: GlassFish 5 and earlier fail the first condition, GlassFish 6 the second. The installation directory is referred to as GLASSFISH_HOME.
  2. Download the XWiki WAR file for the version you need.
  3. Extract the XWiki WAR file into a directory of your choice, referred to as XWIKI_HOME, outside the GlassFish installation. GlassFish deploys an extracted directory as it stands, and the steps below edit XWiki's configuration files in it.
  4. Configure a relational database, which XWiki connects to as soon as GlassFish deploys it.
  5. Create a directory to store XWiki's permanent data, then open XWIKI_HOME/WEB-INF/xwiki.properties and set its path:
    environment.permanentDirectory=/var/lib/xwiki/data
  6. Give Java the memory, the encoding and the module access that XWiki needs, by adding these elements to the <java-config> element of GLASSFISH_HOME/glassfish/domains/domain1/config/domain.xml while the domain is stopped:
    <jvm-options>-Xmx1024m</jvm-options>
    <jvm-options>-Dfile.encoding=UTF-8</jvm-options>
    <jvm-options>--add-opens=java.base/java.lang=ALL-UNNAMED</jvm-options>
    <jvm-options>--add-opens=java.base/java.io=ALL-UNNAMED</jvm-options>
    <jvm-options>--add-opens=java.base/java.util=ALL-UNNAMED</jvm-options>
    <jvm-options>--add-opens=java.base/java.util.concurrent=ALL-UNNAMED</jvm-options>
  7. Start the default domain:
    GLASSFISH_HOME/bin/asadmin start-domain
  8. Deploy XWIKI_HOME with /xwiki as its context root, which the rest of the documentation assumes:
    GLASSFISH_HOME/bin/asadmin deploy --contextroot xwiki --name xwiki XWIKI_HOME
  9. Open http://localhost:8080/xwiki/bin/view/Main/ in a browser. GlassFish deploys XWiki, which opens the Distribution Wizard so that you can install its flavor.

FAQ

Can I deploy XWiki from the GlassFish administration console?

Yes, at http://localhost:4848, logging in as admin, which the ZIP distribution ships without a password, then using "Applications" and "Deploy" with xwiki as the context root.

XWiki fails on a class that GlassFish also ships. What do I do?

The XWiki web application ships a WEB-INF/sun-web.xml file that makes its own libraries take precedence over the container's. GlassFish reads that file only for backward compatibility, so if the conflict persists, create WEB-INF/glassfish-web.xml holding the same <class-loader delegate="false"/> element inside a <glassfish-web-app> root.

Can GlassFish manage XWiki's database connections?

Yes, by declaring a data source as described in Declare an XWiki Data Source in GlassFish.

More

To find more about the current topic, you can search or use the table below and filter the columns to narrow your choices.

Related

Get Connected