Alfresco community 4.0 installation on Glassfish 3.1

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”&gt;
<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.

18 comments

  1. Michael Alleblas

    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).

    • Sean Ye

      I have added the line “if Glassfish is installed at /usr/local/glassfish.” and corrected the “class” to “classes”
      Thank you.

  2. Carlos

    thanks a lot!!! I was looking for how install alfresco over glassfish, and this instruction are very goods. thanks.

  3. Theo

    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

  4. 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.

  5. Theo

    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.

  6. Pingback: Alfresco community 3.3 works on Glassfish v3.0 « Not so many…
    • Raymond Reid

      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.

      • Bill Milligan

        Ever get around to Alfie 4 on the Fish? I’m running fine on tomcat right now, but I’m curious if it’s worth the attempt to consolidate all my apps onto a single platform, and if it makes more sense to use the Fish than the Cat.

      • Raymond Reid

        We’ve now moved our Alfresco installation to Tomcat, as it just works without having to fiddle with things too much & it gets around the ‘Too many open files’ issue that we were having too often when running Alfresco on Glassfish.

      • Bill Milligan

        Thanks for the quick response. Yeah, this makes sense. A quick google shows that none of the other third-party apps I want to run want to run in my GF either. I suppose that makes it my ex-GF. Too bad, my own apps would run there just fine…

  7. Cobolus

    I tried to deploy alfresco 4.0d on glassfish 2.1 but I’m not able to connect to localhost:8080/alfresco. The only exception I see in the log is the following:

    [#|2012-07-18T16:53:35.070+0200|SEVERE|sun-appserver2.1|javax.enterprise.resource.webservices.jaxws.server.http|_ThreadID=10;_ThreadName=main;_RequestID=8a974e4f-e5d3-4392-a0f0-f18367208366;|WSSERVLET11: failed to parse runtime descriptor: exception during WSDL parsing: jndi:/server/alfresco/WEB-INF/wsdl/CMISWS-Service.wsdl
    com.sun.xml.ws.server.ServerRtException: exception during WSDL parsing: jndi:/server/alfresco/WEB-INF/wsdl/CMISWS-Service.wsdl
    at com.sun.xml.ws.server.EndpointFactory.getWSDLPort(EndpointFactory.java:535)
    at com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:175)
    at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:467)
    at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parseAdapters(DeploymentDescriptorParser.java:253)
    at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parse(DeploymentDescriptorParser.java:147)
    at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.contextInitialized(WSServletContextListener.java:108)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4655)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:5364)
    at com.sun.enterprise.web.WebModule.start(WebModule.java:345)
    at com.sun.enterprise.web.LifecycleStarter.doRun(LifecycleStarter.java:58)
    at com.sun.appserv.management.util.misc.RunnableBase.runSync(RunnableBase.java:304)
    at com.sun.appserv.management.util.misc.RunnableBase._submit(RunnableBase.java:176)
    at com.sun.appserv.management.util.misc.RunnableBase.submit(RunnableBase.java:192)
    at com.sun.enterprise.web.VirtualServer.startChildren(VirtualServer.java:1762)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1244)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:971)
    at com.sun.enterprise.web.LifecycleStarter.doRun(LifecycleStarter.java:58)
    at com.sun.appserv.management.util.misc.RunnableBase.runSync(RunnableBase.java:304)
    at com.sun.appserv.management.util.misc.RunnableBase._submit(RunnableBase.java:176)
    at com.sun.appserv.management.util.misc.RunnableBase.submit(RunnableBase.java:192)
    at com.sun.enterprise.web.EmbeddedWebContainer$WebEngine.startChildren(EmbeddedWebContainer.java:497)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1244)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:549)
    at org.apache.catalina.startup.Embedded.start(Embedded.java:945)
    at com.sun.enterprise.web.WebContainer.start(WebContainer.java:873)
    at com.sun.enterprise.web.PEWebContainer.startInstance(PEWebContainer.java:793)
    at com.sun.enterprise.web.PEWebContainerLifecycle.onStartup(PEWebContainerLifecycle.java:89)
    at com.sun.enterprise.server.ApplicationServer.onStartup(ApplicationServer.java:449)
    at com.sun.enterprise.server.ondemand.OnDemandServer.onStartup(OnDemandServer.java:134)
    at com.sun.enterprise.server.PEMain.run(PEMain.java:409)
    at com.sun.enterprise.server.PEMain.main(PEMain.java:336)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.sun.enterprise.server.PELaunch.main(PELaunch.java:415)
    Caused by: com.sun.xml.ws.util.ServiceConfigurationError: com.sun.xml.ws.api.wsdl.parser.WSDLParserExtension: Provider com.sun.xml.ws.policy.jaxws.PolicyWSDLParserExtension is specified in jar:file:/root/glassfish/lib/webservices-rt.jar!/META-INF/services/com.sun.xml.ws.api.wsdl.parser.WSDLParserExtensionbut could not be instantiated: java.lang.ClassCastException
    at com.sun.xml.ws.util.ServiceFinder.fail(ServiceFinder.java:233)
    at com.sun.xml.ws.util.ServiceFinder.access$300(ServiceFinder.java:141)
    at com.sun.xml.ws.util.ServiceFinder$LazyIterator.next(ServiceFinder.java:379)
    at com.sun.xml.ws.util.ServiceFinder.toArray(ServiceFinder.java:225)
    at com.sun.xml.ws.server.EndpointFactory.getWSDLPort(EndpointFactory.java:513)
    … 35 more
    Caused by: java.lang.ClassCastException
    at java.lang.Class.cast(Class.java:2990)
    at java.lang.Class.cast(Class.java:2990)
    at com.sun.xml.ws.util.ServiceFinder$LazyIterator.next(ServiceFinder.java:374)
    … 37 more
    |#]

    [#|2012-07-18T16:53:35.084+0200|SEVERE|sun-appserver2.1|javax.enterprise.system.container.web|_ThreadID=10;_ThreadName=main;_RequestID=8a974e4f-e5d3-4392-a0f0-f18367208366;|WebModule[/alfresco]PWC1275: Exception sending context initialized event to listener instance of class com.sun.xml.ws.transport.http.servlet.WSServletContextListener
    com.sun.xml.ws.transport.http.servlet.WSServletException: WSSERVLET11: failed to parse runtime descriptor: exception during WSDL parsing: jndi:/server/alfresco/WEB-INF/wsdl/CMISWS-Service.wsdl
    at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.contextInitialized(WSServletContextListener.java:118)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4655)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:5364)
    at com.sun.enterprise.web.WebModule.start(WebModule.java:345)
    at com.sun.enterprise.web.LifecycleStarter.doRun(LifecycleStarter.java:58)
    at com.sun.appserv.management.util.misc.RunnableBase.runSync(RunnableBase.java:304)
    at com.sun.appserv.management.util.misc.RunnableBase._submit(RunnableBase.java:176)
    at com.sun.appserv.management.util.misc.RunnableBase.submit(RunnableBase.java:192)
    at com.sun.enterprise.web.VirtualServer.startChildren(VirtualServer.java:1762)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1244)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:971)
    at com.sun.enterprise.web.LifecycleStarter.doRun(LifecycleStarter.java:58)
    at com.sun.appserv.management.util.misc.RunnableBase.runSync(RunnableBase.java:304)
    at com.sun.appserv.management.util.misc.RunnableBase._submit(RunnableBase.java:176)
    at com.sun.appserv.management.util.misc.RunnableBase.submit(RunnableBase.java:192)
    at com.sun.enterprise.web.EmbeddedWebContainer$WebEngine.startChildren(EmbeddedWebContainer.java:497)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1244)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:549)
    at org.apache.catalina.startup.Embedded.start(Embedded.java:945)
    at com.sun.enterprise.web.WebContainer.start(WebContainer.java:873)
    at com.sun.enterprise.web.PEWebContainer.startInstance(PEWebContainer.java:793)
    at com.sun.enterprise.web.PEWebContainerLifecycle.onStartup(PEWebContainerLifecycle.java:89)
    at com.sun.enterprise.server.ApplicationServer.onStartup(ApplicationServer.java:449)
    at com.sun.enterprise.server.ondemand.OnDemandServer.onStartup(OnDemandServer.java:134)
    at com.sun.enterprise.server.PEMain.run(PEMain.java:409)
    at com.sun.enterprise.server.PEMain.main(PEMain.java:336)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.sun.enterprise.server.PELaunch.main(PELaunch.java:415)
    Caused by: com.sun.xml.ws.server.ServerRtException: exception during WSDL parsing: jndi:/server/alfresco/WEB-INF/wsdl/CMISWS-Service.wsdl
    at com.sun.xml.ws.server.EndpointFactory.getWSDLPort(EndpointFactory.java:535)
    at com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:175)
    at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:467)
    at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parseAdapters(DeploymentDescriptorParser.java:253)
    at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parse(DeploymentDescriptorParser.java:147)
    at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.contextInitialized(WSServletContextListener.java:108)
    … 30 more
    Caused by: com.sun.xml.ws.util.ServiceConfigurationError: com.sun.xml.ws.api.wsdl.parser.WSDLParserExtension: Provider com.sun.xml.ws.policy.jaxws.PolicyWSDLParserExtension is specified in jar:file:/root/glassfish/lib/webservices-rt.jar!/META-INF/services/com.sun.xml.ws.api.wsdl.parser.WSDLParserExtensionbut could not be instantiated: java.lang.ClassCastException
    at com.sun.xml.ws.util.ServiceFinder.fail(ServiceFinder.java:233)
    at com.sun.xml.ws.util.ServiceFinder.access$300(ServiceFinder.java:141)
    at com.sun.xml.ws.util.ServiceFinder$LazyIterator.next(ServiceFinder.java:379)
    at com.sun.xml.ws.util.ServiceFinder.toArray(ServiceFinder.java:225)
    at com.sun.xml.ws.server.EndpointFactory.getWSDLPort(EndpointFactory.java:513)
    … 35 more
    Caused by: java.lang.ClassCastException
    at java.lang.Class.cast(Class.java:2990)
    at com.sun.xml.ws.util.ServiceFinder$LazyIterator.next(ServiceFinder.java:374)
    … 37 more
    |#]

    • Raymond Reid

      Have you followed the instructions to the letter, I’ve installed it many times and not seen your above error.

      I know this isn’t the answer that you want to hear, but we’ve now moved our Alfresco installation to Tomcat, as it just works without having to fiddle with things too much & it gets around the ‘Too many open files’ issue that we were having too often when running Alfresco on Glassfish.

      So if that is at all possible for your setup, I would urge you to go the way of Tomcat – New versions of Alfresco just didn’t work with Glassfish & I’m sure that you’ll be after the version with the latest features.

      Regards,
      Ray.

Leave a comment