Hide last authors
Vincent Massol 30.1 1 {{box cssClass="floatinginfobox" title="**Contents**"}}
2 {{toc/}}
3 {{/box}}
Vincent Massol 25.2 4
Vincent Massol 30.1 5 {{error}}
6 XWiki doesn't work on GlassFish versions 3.1.2 and 3.1.2.1 due to [[a bug>>https://java.net/jira/browse/GLASSFISH-18444]] which affects file uploads.
7 {{/error}}
Sergiu Dumitriu 27.1 8
Vincent Massol 31.1 9 {{error}}
Vincent Massol 32.1 10 We've had [[reports>>https://forum.xwiki.org/t/some-problem-to-install-xwiki-to-glassfish/3143]] that recent versions of GlassFish don't work out of the box to deploy XWiki. We're looking for some GlassFish expert who could update the instructions below to make XWiki deploy fine in GlassFish. Thx.
Vincent Massol 31.1 11 {{/error}}
12
Manuel Smeria 26.4 13 * Download the [[latest GlassFish>>http://glassfish.java.net/public/downloadsindex.html#top]]
14 * Download the exe for Windows or the shell script for Unix
Vincent Massol 3.2 15 * Start GlassFish instance using ##{{{$GLASSFISH_HOME/bin/asadmin start-domain}}}##
Silvia Macovei 14.2 16 * Do you want to deploy from the web interface, or the commandline?
JeroenBaten 2.1 17 * Deploying from the web interface:
Manuel Smeria 26.2 18 ** point your browser to ##{{{http://localhost:4848}}}##
19 ** log in as the default administrator user ##admin## with the default password ##adminadmin##
Vincent Massol 3.2 20 ** select ##Applications -> Web Applications -> Deploy## in the left tree
21 ** select the XWiki WAR archive to deploy and set the context root to ##xwiki## (anything else will make XWiki navigation break)
JeroenBaten 2.1 22 * Deploy from the commandline:
Vincent Massol 3.2 23 ** ##{{{$GLASSFISH_HOME/bin/asadmin deploy --contextroot xwiki file.war}}}##
JeroenBaten 15.1 24 * enjoy XWiki from ##{{{http://localhost:8080/xwiki}}}##
JeroenBaten 2.1 25
Manuel Smeria 26.2 26 If you need more help you can use the [[GlassFish documentation>>http://glassfish.java.net/docs/project.html]].
JeroenBaten 5.1 27
JeroenBaten 6.1 28 = Configuring a MySQL datasource in Glassfish =
JeroenBaten 5.1 29
Manuel Smeria 26.2 30 * Download the [[MySQL jdbc driver>>http://www.mysql.com/downloads/connector/j/]]
31 * Extract the contents of the file
32 * Copy the jar file to ##{{{GLASSFISH_HOME/glassfish/lib}}}## if you want it to be available to all Glassfish applications, or to the ##{{{WEB-INF/lib}}}## dir of the XWiki deployment dir if you only want it to be available locally (example: ##{{{GLASSFISH_HOME/glassfish/domains/domain1/applications/xwiki-enterprise-web-2.5-milestone-1/WEB-INF/lib}}}##)
JeroenBaten 6.1 33 * Start or restart the Glassfish server: ##{{{bin/asadmin start-domain}}}## or ##{{{bin/asadmin restart-domain}}}##
JeroenBaten 7.1 34
Manuel Smeria 26.2 35 If you want to use the web interface to define a datasource, you can read this tutorial on [[Creating and configuring a MySQL DataSource in GlassFish Application Server>>http://www.albeesonline.com/blog/2008/08/06/creating-and-configuring-a-mysql-datasource-in-glassfish-application-server/]].
JeroenBaten 7.1 36
Manuel Smeria 26.2 37 If you want to use the command line interface to define a datasource, you can read [[this tutorial>>http://weblogs.java.net/blog/felipegaucho/archive/2010/03/04/glassfish-v3-resources-administration-cli-tool-asadmin]].
JeroenBaten 7.1 38
39 Quick and dirty is easy:
Vincent Massol 30.1 40
Vincent Massol 30.3 41 * Create the connection pool: Assuming you followed the [[MySQL Installation steps>>platform:AdminGuide.InstallationMySQL]] you have a MySQL database called 'xwiki' accessible with a user named 'xwiki' having 'xwiki' as the password.
JeroenBaten 13.1 42 * ##{{{asadmin create-jdbc-connection-pool --datasourceclassname com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource}}}##
43 ##{{{ --restype javax.sql.ConnectionPoolDataSource --property "User=xwiki:Password=xwiki:URL=jdbc\\:mysql\\://localhost\\:3306/xwiki" }}}##
44 ##{{{jdbc/xwikipool}}}##
JeroenBaten 11.1 45 * This should give you ##{{{Command create-jdbc-connection-pool executed successfully.}}}##
JeroenBaten 9.1 46 * Test the connection pool: ##{{{asadmin ping-connection-pool jdbc/xwikipool}}}##
47 * This should give you ##{{{Command ping-connection-pool executed successfully.}}}##
JeroenBaten 16.1 48 * If not, just execute ##{{{bin/asadmin delete-jdbc-connection-pool jdbc/xwikipool}}}## and start again :-)
JeroenBaten 8.1 49 * Create the JDBC resource: ##{{{asadmin --user=admin create-jdbc-resource --connectionpoolid jdbc/xwikipool jdbc/xwiki}}}##
JeroenBaten 17.1 50 * This should give you ##{{{Command create-jdbc-resource executed successfully.}}}##
JeroenBaten 9.1 51 * Test the JDBC resource: ##{{{asadmin --user admin list-jdbc-resources}}}##
52 * This should result in:
53 ##{{{jdbc/__TimerPool}}}##
54 ##{{{jdbc/__default}}}##
JeroenBaten 19.1 55 ##{{{jdbc/xwiki}}}##
56 ##{{{ }}}##
JeroenBaten 9.1 57 ##{{{Command list-jdbc-resources executed successfully.}}}##
JeroenBaten 19.1 58
Manuel Smeria 26.2 59 Now the last thing you need to do is go into the directory ##{{{glassfish/domains/domain1/applications/xwiki-enterprise-web-2.5-milestone-1/WEB-INF}}}## and edit ##hibernate.cfg.xml##.
JeroenBaten 19.1 60
Manuel Smeria 26.2 61 Uncomment the default database section (simpy by moving the {{{"-->"}}} part a couple of lines down), and uncomment the MySQL part.
JeroenBaten 20.1 62
63 Done!
Vincent Massol 25.1 64
Vincent Massol 26.1 65 = Troubleshooting =
Vincent Massol 25.1 66
JeroenBaten 24.1 67 First thing you would normally do is import the default xar file to initialize the wiki and populate it with some nice pages.
68 However, it is very likely that you will see an error message like:
Vincent Massol 25.1 69
70 {{code language="none"}}
JeroenBaten 24.1 71 com.xpn.xwiki.XWikiException: Error number 0 in 11: Uncaught exception
72 Wrapped Exception: org.apache.commons.codec.binary.Base64.<init>(I[B)V
Vincent Massol 25.1 73 {{/code}}
JeroenBaten 20.1 74
Manuel Smeria 26.2 75 As explained in [[this email>>http://xwiki.markmail.org/search/?q=glassfish%20commons%20codec#query:glassfish%20commons%20codec+page:1+mid:dpg5gbkal6ysf3i5+state:results]] you should copy ##commons-codec-1.4.jar## from the ##xwiki/WEB-INF/lib## directory to the ##glassfishv3/glassfishmodules## and also delete ##commons-codec-repackaged.jar## from the ##glassfishv3/glassfish/modules## folder.
JeroenBaten 20.1 76
Manuel Smeria 26.2 77 These steps should solve the problem.

Get Connected