Alfresco community 4.0 installation on Glassfish 3.1
April 19, 2010 12 Comments
PLEASE NOTE:
The following worked only on Alfresco 3.4d – We tried to get it to work on version 4.0 but it will not.
We have now resorted to using the Tomcat Bundled version of 3.4d as our server is 32bit linux.
Follow the below instructions if you still want, but be it on your own head
1. Get alfresco war files for deployment in existing application servers package file alfresco-community-4.0.a.zip from https://process.alfresco.com/ccdl/?file=release/community/build-3755/alfresco-community-4.0.a.zip
2. MySql setting
mysql>create database alfresco;
mysql>grant all privileges on alfresco.* to ‘YOUR_ALFRESCO_USERNAME’@’%’ identified by ‘YOUR_ALFRESCO_PASSWORD’;
mysql>grant all privileges on alfresco.* to ‘YOUR_ALFRESCO_USERNAME’@’localhost’ identified by ‘YOUR_ALFRESCO_PASSWORD’;
3. Create alfresco documents and index folder
mkdir /usr/local/alfresco
4.Unpack alfresco-community-4.0.a.zip
unzip alfresco-community-4.0.a.zip
5. Configure Alfresco before deploying to glassfish
5.1 alfresco-global.properties
Since alfresco 3.3, all the settings now based on alfresco-global.properties. This file can be found from the alfresco package file alfresco-community-4.0.a.zip. Copy this file from the unzip location to glassfish lib folder.
cd /alfresco-community-4.0.a/extensions/extension
cp alfresco-global.properties /usr/local/glassfish/domains/domain1/lib/classes/alfresco-global.properties
if Glassfish is installed at /usr/local/glassfish.
5.2 Modify alfresco-global.properties so alfresco can find database and index folder created before
Set alfresco folder
dir.root = /usr/local/alfresco
Set dababase username and password
db.username=YOUR_ALFRESCO_USERNAME
db.password=YOUR_ALFRESCO_PASSWORD
db.driver=org.gjt.mm.mysql.Driver
db.url=jdbc:mysql://localhost/alfresco
6. You need a ‘glassfish-web.xml’ for “useMyFaces” for alfresco. *ONLY needed if your using Glassfish 3.1 * – If using Glassfish 3.0 or below Skip to step 7/7.1 as that needs ‘sun-web.xml’.
7. sun-web.xml:
<?xml version=”1.0″ encoding=”UTF-8″?>
<!DOCTYPE sun-web-app PUBLIC “-//Sun Microsystems, Inc.//DTD Application Server 8.1 Servlet 2.4//EN” “http://www.sun.com/software/appserver/dtds/sun-web-app_2_4-1.dtd”>
<sun-web-app>
<class-loader delegate=”false”/>
<property name=”useMyFaces” value=”true”/>
</sun-web-app>
You can also get this file from http://blogs.sun.com/mandy/resource/sun-web.xml
7.1 Add sun-web.xml to alfresco.war
Go to the unpacked directory created from alfresco-community-4.0.a.zip, create a new directory named WEB-INF and put sun-web.xml on it.
cd /alfresco-community-4.0.a/
mkdir /WEB-INF/
cp /temp/sun-web.xml /WEB-INF/sun-web.xml
jar -uvf alfresco.war WEB-INF/*.xml
The alfresco.war should be edited.
8. Increase glassfish memory heap setting
Log in as administrator of glassfish from http://glassfishHost:4848/
Application Server->JVM Settings->JVM Options
Change -Xmx256m to -Xmx512m or more.
9. Deploy the new war file to glassfish.
Log in as administrator of glassshfish from http://glassfishHost:4848/ and deploy alfresco.war.
After a few minutes, alfreso can be visited by hppp://glassfishHost:8080/alfresco
10. Deploy share
Log in as administrator of glassshfish from http://glassfishHost:4848/ and deploy share.war from the unzip package.
There is a bug in share.war, so you will get the “No ‘login’ page type configured – but page auth required it.” error message if go to http://glassfishHost:8080/share.
Solution is download the latest spring-surf-core-configservice-1.0.0.CI-SNAPSHOT.jar from alfresco SVN
wget http://svn.alfresco.com/repos/alfresco-open-mirror/alfresco/HEAD/root/projects/3rd-party/src/spring-surf-core-configservice-1.0.0.CI-SNAPSHOT.jar
cp spring-surf-core-configservice-1.0.0.CI-SNAPSHOT.jar /usr/local/glassfish/domains/domain1/applications/j2ee-modules/share/WEB-INF/lib/
Restart glassfish, go to http://Glassfishhost:8080/share
Should work!
You can also add the spring-surf-core-configservice-1.0.0.CI-SNAPSHOT.jar to the share.war and deploy it.
Just a few small corrections.
The location to copy alfresco-global.properties is
/usr/local/glassfish/domains/domain1/lib/classes/alfresco-global.properties
if Glassfish is installed at /usr/local/glassfish.
I actually created a folder WEB-INF/classes/ in the alfresco directory that results from extracting the .tar.gz file and copied the properties file in there, then used “jar -uvf alfresco.war WEB-INF/*” (perform this setup after the following inclusion of sun-web.xml and it will add all the files at once).
The URL for the update Spring Surf Core Config Services is:
http://svn.alfresco.com/repos/alfresco-open-mirror/alfresco/HEAD/root/projects/3rd-party/lib/spring-surf/spring-surf-core-configservice-1.0.0.CI-SNAPSHOT.jar
I also recommend adding your modules to the alfresco.war file here. Get the alfresco module management jar (alfresco-mmt-3.3.jar) from the Sourceforge site http://sourceforge.net/projects/alfresco/files/
Thanks for this guide. It got me kick started and introduced me to things I never knew of before (since I am only new to J2EE, since the start of the year).
I have added the line “if Glassfish is installed at /usr/local/glassfish.” and corrected the “class” to “classes”
Thank you.
thanks a lot!!! I was looking for how install alfresco over glassfish, and this instruction are very goods. thanks.
Sean Ye:
Thanks for posting this page as I am attempting exactly that: installing the Alfresco War 3.3 CE under Glassfish.
Unfortunately, I have run into a problem that I cannot solve. After going through the steps outlined above, when I try to deploy the newly edited alfresco.war I get the following error:
“An error has occurred
Exception while preparing the app : java.lang.RuntimeException: JSP Compilation Error: org.apache.jasper.JasperException: file /opt/glassfishv3/glassfish/domains/domain1/applications/alfresco/jsp/parts/titlebar.jsp(26,114) PWC6228: #{…} not allowed in a template text body.
Any idea what needs to happen to remote this error?
Theo
A small update on this. I am using the GlassFish Administration Console to deploy Alfresco and I had turned on Precompile JSPs.
When I do not select that option, the above error goes away to be replaced with a more ominous: java.lang.NullPointerException
without any other commentary or stack trace.
Yet another attempt. This time I selected the only virtual server that was offered, and now get the following error:
Exception while loading the app: java.lang.Exception: java.lang.IllegalStateException: ContainerBase.addChild: start org.apache.catalina.LifecycleException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘RepoServerMgmt’ defined in class path resource [alfresco/core-services-context.xml]: Cannot resolve reference to bean ‘transactionService’ while setting bean property ‘transactionService’; nexted exception is org.springframework.beans.factory.BeanCreati….
Ok, after a day of trying I am giving up.
Hi Theo,
What is the version of your glassfish and Java?
My system:
Java 1.6_11
Glassfish 2.1
Cheers,
Sean
Sean:
Java 1.6.0-b09 (OpenJDK)
Glassfish V3 (build 74.2)
I think you should try glassfish2.
Pingback: Alfresco community 3.3 works on Glassfish v3.0 « Not so many…
Could you update it for Alfresco 4 and GlassFish 3.1? I’ve downloaded: https://process.alfresco.com/ccdl/?file=release/community/build-3755/alfresco-community-4.0.a.zip and it seems to be different from what you have.
Thanks.
Will do, I’ll take a look at it on Monday. We’re using glassfish 3.1 & Alfresco 3.4d, we just never got around to updating the post.