Alfresco - Instal·lació a GlassFish sobre OpenSuse

Procediment per a instal·lar Alfresco Labs 3.1 a OpenSuse 11.1

Requisits:

Ja es té instal·lat i configurat un servidor JEE Glassfish 2.1 (http://sites.google.com/site/pawneecity/glassfish-instal-lacio)

i un gestor de DB MySQL (en aquest cas a U:\xampp\mysql\)

a) Download - http://wiki.alfresco.com/wiki/Download_Labs

Labs 3.1 Final (Alfresco-Labs-3Stable-Linux-x86-Install) on OpenSuse 11.1 with Glassfish JEE server 2.1

http://wiki.alfresco.com/wiki/Labs_3_Final_download_files

Aquest article ha fet servir "Alfresco WAR files for deployment in existing application servers (.tar.gz)" [alfresco-labs-war-3Stable.tar.gz]

b) Segueix les intruccions de configuració http://wiki.alfresco.com/w/images/0/0b/Install_Configure_Alfresco_Lab3Stable.pdf

Verificar que s'ha configurat la variable d'entorn JAVA_HOME

>echo %JAVA_HOME%

U:\Program Files\Java\jdk1.6.0_13\

c) Extreure el contingut de l'arxiu descarregat

Entre d'altres, hi ha alfresco.war i share.war

d) Incloure descriptor específic a alfresco.war

A http://blogs.sun.com/mandy/entry/alfresco_on_glassfish_short_version indica que:

Glassfish has an undocumented property that when used in conjunction with the Classloader Delegate feature will allow MyFaces libraries to be loaded before the JSF libraries. You set both of these in the server specific deployment descriptor which is named sun-web.xml and which lives in the WEB-INF directory of the War file.

Així que creem un fitxer anomenat WEB-INF\sun-web.xml amb el contingut:

<?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>

i l'afegim al war així:

jar uvf alfresco.war WEB-INF/sun-web.xml

e) Preparatius

A aquest pas seguirem parcialment les indicacions a http://wiki.alfresco.com/wiki/Alfresco_on_Glassfish

>mysql -u root

mysql>create database alfresco;

mysql>grant all privileges on alfresco.* to 'alfresco'@'%' identified by 'alfresco';

mysql>grant all privileges on alfresco.* to 'alfresco'@'localhost' identified by 'alfresco';

A /opt/glassfish/domains/applications/lib/classes crear un subdirectori anomenat 'alfresco' (Nota: 'applications' és el domini de Glassfish on implementarem).

From the directory in which you unpacked the Alfresco bundle, copy the entire contents of the extensions directory to the directory you created earlier:

>sudo cp -r extensions/* /opt/glassfish/domains/applications/lib/classes/alfresco

note:You don't want to copy over the extensions directory itself, just it's contents (extension and messages directories).

Alfresco needs somewhere to keep all of it's documents and indexes. This is usually named alf_data, if you don't specify a path to alf_data or the path doesn't exist it will create one for you... somewhere. Let's not leave things to chance and create one and then configure Alfresco to find it:

${com.sun.aas.instanceRoot}/data/alfresco //Opció 1: Directori de dades relation al domini 'applications'

>sudo mkdir /var/lib/alfresco/alf_data //Opció 2: Directori de dades extern al domini de glassfish

Now change directory to the alfresco/extension directory you created with the copy that you did a couple of steps ago and modify the config files so that Alfresco can find alf_data and can find the database:

In custom-repository.properties do the following:

dir.root=U:\glassfish\domains\applications\data\alfresco (o "/var/lib/alfresco/alf_data")

db.username=alfresco

db.password=alfresco

# Derby connection

#

#db.driver=org.apache.derby.jdbc.EmbeddedDriver

#db.url=jdbc:derby:alf_data/derby_data/alfresco;create=true

# MySQL connection (This is default and requires mysql-connector-java-5.0.3-bin.jar, which ships with the Alfresco server)

#

db.driver=org.gjt.mm.mysql.Driver

db.url=jdbc:mysql://localhost/alfresco

In custom-hibernate-dialog.properties do:

# Derby dialect

#

#hibernate.dialect=org.hibernate.dialect.DerbyDialect

# MySQL dialect (default)

#

hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect

f) The URL used for the MySQL JDBC driver is just one of many mirrors. You might be better off going to http://dev.mysql.com/downloads/connector/j/5.1.html and choosing where to get it from. For Windows you'll need to go to the URL in a browser. Unpack this somewhere and copy mysql-connector-java-5.1.7-bin.jar to the GlassFish domain's lib directory.

> sudo cp mysql-connector-java-5.1.7-bin.jar /opt/glassfish/domains/applications/lib

g) Implementació d'alfresco.war i share.war

Accés a l'administració de Glassfish (domini 'applications') http://172.23.220.49:14848/

(per defecte->http://172.23.220.49:4848/ usuari i contrasenya per defecte són admin:adminadmin)

Clic Deploy Web Application (war)

En primer lloc s'ha implementat share.war

I després l'afresco.war modificat

h) Reiniciar glassfish i accedir a http://172.23.220.49:18080/alfresco

i) Sol·lucions d'errors

1) Si dóna l'error:

javax.faces.FacesException: java.net.ConnectException: Connection timed out

caused by:

java.net.ConnectException: Connection timed out

If your server machine is behind a proxy server you have to set some JAVA_OPTS from the glassfish admin console:

-Dhttp.proxyHost=yourproxyserver (localhost en aquest cas)

-Dhttp.proxyPort=yourproxyport (3128 en aquest cas)

restart glassfish

2) HTTP Status 503 (The requested service () is not currently available.)

Check logs at /opt/glassfish/domains/applications/logs/server.log

on 'applications' és el nom del domini en el que s'ha implementat Alfresco.

Solució: Com a mínim un cop es va solucionar així:

esborrar /opt/glassfish/domains/applications/logs/server.log

aturar glassfish

iniciar glassfish