Show last authors
1 {{box cssClass="floatinginfobox" title="**Contents**"}}
2 {{toc/}}
3 {{/box}}
4
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}}
8
9 {{error}}
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.
11 {{/error}}
12
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
15 * Start GlassFish instance using ##{{{$GLASSFISH_HOME/bin/asadmin start-domain}}}##
16 * Do you want to deploy from the web interface, or the commandline?
17 * Deploying from the web interface:
18 ** point your browser to ##{{{http://localhost:4848}}}##
19 ** log in as the default administrator user ##admin## with the default password ##adminadmin##
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)
22 * Deploy from the commandline:
23 ** ##{{{$GLASSFISH_HOME/bin/asadmin deploy --contextroot xwiki file.war}}}##
24 * enjoy XWiki from ##{{{http://localhost:8080/xwiki}}}##
25
26 If you need more help you can use the [[GlassFish documentation>>http://glassfish.java.net/docs/project.html]].
27
28 = Configuring a MySQL datasource in Glassfish =
29
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}}}##)
33 * Start or restart the Glassfish server: ##{{{bin/asadmin start-domain}}}## or ##{{{bin/asadmin restart-domain}}}##
34
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/]].
36
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]].
38
39 Quick and dirty is easy:
40
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.
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}}}##
45 * This should give you ##{{{Command create-jdbc-connection-pool executed successfully.}}}##
46 * Test the connection pool: ##{{{asadmin ping-connection-pool jdbc/xwikipool}}}##
47 * This should give you ##{{{Command ping-connection-pool executed successfully.}}}##
48 * If not, just execute ##{{{bin/asadmin delete-jdbc-connection-pool jdbc/xwikipool}}}## and start again :-)
49 * Create the JDBC resource: ##{{{asadmin --user=admin create-jdbc-resource --connectionpoolid jdbc/xwikipool jdbc/xwiki}}}##
50 * This should give you ##{{{Command create-jdbc-resource executed successfully.}}}##
51 * Test the JDBC resource: ##{{{asadmin --user admin list-jdbc-resources}}}##
52 * This should result in:
53 ##{{{jdbc/__TimerPool}}}##
54 ##{{{jdbc/__default}}}##
55 ##{{{jdbc/xwiki}}}##
56 ##{{{ }}}##
57 ##{{{Command list-jdbc-resources executed successfully.}}}##
58
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##.
60
61 Uncomment the default database section (simpy by moving the {{{"-->"}}} part a couple of lines down), and uncomment the MySQL part.
62
63 Done!
64
65 = Troubleshooting =
66
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:
69
70 {{code language="none"}}
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
73 {{/code}}
74
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.
76
77 These steps should solve the problem.

Get Connected