Tuesday, September 18, 2007

Setting Up a Virtual Frame Buffer (XVBF) to Support Open Office

Deploying Alfresco Community I may need to setup OpenOffice and how I discovered with surprise, OpenOffice insist to connect with X, and there was no X server to connect. So OpenOffice exits with error:

$ soffice "-accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager" -nologo -headless -nofirststartwizard &

soffice.bin X11 error: Can't open display:
Set DISPLAY environment variable, use -display option
or check permissions of your X-Server
(See "man X" resp. "man xhost" for details)

I think because it needs X as rendering engine. I installed Xvbf, that is a X server that can run on machines with no display hardware and no physical input devices. It emulates a dumb framebuffer using virtual memory.

To avoid this problem you have simply start Xvfb before OpenOffice and setup properly the DISPLAY environment variable. If you don't have Xvfb installed on your system you can add it with:

$ apt-get install xvfb

Then you can start it:

$ Xvfb :5 -screen 0 1600x1200x24 &

the Virtual Frame Buffer now is on display 5 screen 0, so you have to set the DISPLAY environment variable to:

$ export DISPLAY=:5.0

Finally now you can start Open Office as daemon.

Alfresco 2.1.0 WCM Community + Ubuntu Feisty + Oracle Express

This is an easy wiky to install Alfresco on Ubuntu with Oracle 10.2 XE and Tomcat 5.5.
This wiki assumes you are knowledgeable enough with Tomcat and Oracle and don't follow you in deep to install them both.
Download the file alfresco-community-tomcat-2.1.0.tar.gz and uncompress it in /opt/alfresco-community-tomcat-2.1.0. You will find a complete installation of Tomcat 5.5 in the tomcat directory.
Now customize the file alfresco.sh setting:
APPSERVER=/opt/alfresco-community-tomcat-2.1.0/tomcat
Under Oracle you have to create a new account (username: alfresco password:alfresco). Then grant connect and resource Rules.
Now you can setup the Oracle connection and to do this you need copy the Oracle JDBC drivers in alfresco/tomcat/common/lib/. Forget to put the JDBC drivers in the common/lib is one of most common problem in the Alfresco installation

Those files are custom-repository.properties and custom-hibernate-dialect.properties:
  1. custom-repository.properties
    • uncomment custom content and index data location and adjust as appropriate:
      #
      # Sample custom content and index data location
      #
      dir.root=/opt/alfresco-community-tomcat-2.1.0/alf_data
      dir.indexes=/opt/alfresco-community-tomcat-2.1.0/alf_data/lucene_indexes

    • uncomment the account info and adjust as appropriate:
      #
      # Sample database connection properties
      #
      db.username=alfresco
      db.password=alfresco
      db.pool.initial=10
      db.pool.max=100

    • uncomment the Oracle connection lines and adjust as appropriate (pay particular attention to the SID, in our case is XE)
      #
      # Oracle connection (requires ojdbc14_g.jar or equivalent jar in shared libraries location)
      #
      db.driver=oracle.jdbc.OracleDriver
      db.url=jdbc:oracle:thin:@localhost:1521:XE

    • comment out any other connection lines using #
  2. custom-hibernate-dialect.properties -
    • comment out any other dialect line using #
      #
      # Oracle dialect
      #
      hibernate.dialect=org.hibernate.dialect.Oracle9Dialect

  3. copy the Oracle JDBC drivers ojdbc14_g.jar in the tomcat common lib:

    • cp $ORACLE_HOME/jdbc/lib/ojdbc14_g.jar alfresco/tomcat/common/lib/

If you have an oracle client you could check the oracle connection with the following command:

$ sqlplus alfresco/alfresco@XE
SQL*Plus: Release 10.2.0.1.0 - Production on Mon Sep 17 22:47:32 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
SQL> quit
Disconnected from Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production

Customize the ./zstart_oo.sh and start OpenOffice like a daemon this will permit to document transformation.
Check if OpenOffice is started correctly looking for a process listening on port 8100
$ netstat -ntl | grep 8100
tcp 0 0 127.0.0.1:8100 0.0.0.0:* LISTEN
The JAVA_HOME variable must be set correctly to your Java5 (or higher) installation.
Now you can start alfresco running the script:
$ ./alfresco.sh start
check the alfresco.log to see what's happening. If you find some exceptions as shown in the following lines, don't worry, that happens because the user haven't the administrator rights:
01:39:48,474 ERROR [org.alfresco.smb.protocol.netbios] NetBIOSNameServer setup error:
java.net.BindException: Permission denied
at java.net.PlainDatagramSocketImpl.bind0(Native Method)
at java.net.PlainDatagramSocketImpl.bind(PlainDatagramSocketImpl.java:82)
at java.net.DatagramSocket.bind(DatagramSocket.java:368)
at java.net.DatagramSocket.(DatagramSocket.java:210)
at java.net.DatagramSocket.(DatagramSocket.java:261)
at java.net.DatagramSocket.(DatagramSocket.java:234)
at org.alfresco.filesys.netbios.server.NetBIOSNameServer.openSocket(NetBIOSNameServer.java:1085)
at org.alfresco.filesys.netbios.server.NetBIOSNameServer.run(NetBIOSNameServer.java:1611)
at java.lang.Thread.run(Thread.java:619)
01:39:48,557 ERROR [org.alfresco.ftp.protocol] FTP Socket error
java.net.BindException: Permission denied
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359)
at java.net.ServerSocket.bind(ServerSocket.java:319)
at java.net.ServerSocket.(ServerSocket.java:185)
at java.net.ServerSocket.(ServerSocket.java:141)
at org.alfresco.filesys.ftp.FTPNetworkServer.run(FTPNetworkServer.java:407)
at java.lang.Thread.run(Thread.java:619)

you can start the application with the following command and avoid the problem
$ sudo ./alfresco.sh start
look at alfresco.log to see if everything is going well and then check the http://localhost:8080/alfresco/faces/jsp/login.jsp with your browser.