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.

Sunday, September 16, 2007

Oracle XE 10.2.0.1.0 - Connectivity Problems

After to have experienced some connectivity problems with Oracle XE in the following lines some suggestion found looking around on the web:

Oracle XE has it's own forum - to register and discuss XE problems with XE experts use URL http://www.oracle.com/technology/xe/registration

A few things to think about when troubleshooting XE connectivity problems:

1) Listener must be up (first)
2) Database must be up
3) Listener must recognize database
4) Listener must be monitoring for APEX (Home page)
5) Port for Apex must be available (8080, the default, is also default for tomcat and others)
6) All Oracle admin stuff must be handled by a user in the right group (ORA_DBA group in Windows, DBA in Linux). The group must have been set up using a local administrator (administrator, root) that can update the registry, create groups, and write to the disk.

I'll walk thru the steps of getting it all running in Linux - assuming successful install. Listener and database are services so use control panel appropriately. I start with database and listener down and show the various outputs

oracle@fuzzy:~> lsnrctl status

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 16-MAR-2006 07:58:27
Copyright (c) 1991, 2005, Oracle. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_XE)))

TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 2: No such file or directory

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=fuzzy)(PORT=1521)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 111: Connection refused

Start the listener. Use control panel in Windows

oracle@fuzzy:~> lsnrctl start

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 16-MAR-2006 08:00:45

Copyright (c) 1991, 2005, Oracle. All rights reserved.

Starting /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/tnslsnr: please wait...


TNSLSNR for Linux: Version 10.2.0.1.0 - Production

System parameter file is /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/admin/listener.ora
Log messages written to /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC_FOR_XE)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=fuzzy.forbrichcomputing.ca)(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_XE)))

STATUS of the LISTENER

------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 16-MAR-2006 08:00:45
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Default Service XE

Listener Parameter File /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/admin/listener.ora
Listener Log File /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC_FOR_XE)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=fuzzy.forbrichcomputing.ca)(PORT=1521)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

Make sure the database is running. Idle instance is not good

oracle@fuzzy:~> sqlplus / as sysdba


SQL*Plus: Release 10.2.0.1.0 - Production on Thu Mar 16 08:02:59 2006

Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.

SQL> rem start the database. Use control panel in WIndows

SQL> startup
ORACLE instance started.
Total System Global Area 289406976 bytes
Fixed Size 1258488 bytes
Variable Size 92277768 bytes
Database Buffers 192937984 bytes
Redo Buffers 2932736 bytes
Database mounted.
Database opened.
SQL> exit
Disconnected from Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production

Check if listener knows about DB and APEX

oracle@fuzzy:~> lsnrctl status

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 16-MAR-2006 08:04:56
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_XE)))

STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production

Start Date 16-MAR-2006 08:00:45
Uptime 0 days 0 hr. 4 min. 10 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Default Service XE
Listener Parameter File /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/admin/listener.ora
Listener Log File /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC_FOR_XE)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=fuzzy.forbrichcomputing.ca)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=fuzzy.forbrichcomputing.ca)(PORT=8080))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "XE" has 1 instance(s).
Instance "XE", status READY, has 1 handler(s) for this service...
Service "XEXDB" has 1 instance(s).
Instance "XE", status READY, has 1 handler(s) for this service...
Service "XE_XPT" has 1 instance(s).
Instance "XE", status READY, has 1 handler(s) for this service...
The command completed successfully

Great; it has a handle for database (XE) and Apex (XEXDB) but Apex is on 8080, which conflicts with Tomcat.Move Apex

oracle@fuzzy:~> sqlplus system/oracle

SQL*Plus: Release 10.2.0.1.0 - Production on Thu Mar 16 08:06:37 2006
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production

SQL> exec dbms_xdb.sethttpport(8090);


PL/SQL procedure successfully completed.


SQL> select dbms_xdb.gethttpport() from dual;

DBMS_XDB.GETHTTPPORT()
----------------------
8090
SQL> exit

Disconnected from Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production

Check that Apex is on 8090

oracle@fuzzy:~> lsnrctl status

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 16-MAR-2006 08:08:52

Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_XE)))

STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 16-MAR-2006 08:00:45
Uptime 0 days 0 hr. 8 min. 6 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Default Service XE
Listener Parameter File /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/admin/listener.ora
Listener Log File /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC_FOR_XE)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=fuzzy.forbrichcomputing.ca)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=fuzzy.forbrichcomputing.ca)(PORT=8090))(Presentation=HTTP)(Session=RAW))

Services Summary...

Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "XE" has 1 instance(s).
Instance "XE", status READY, has 1 handler(s) for this service...
Service "XEXDB" has 1 instance(s).
Instance "XE", status READY, has 1 handler(s) for this service...
Service "XE_XPT" has 1 instance(s).
Instance "XE", status READY, has 1 handler(s) for this service...
The command completed successfully

now check http://localhost:8090/apex/ with a browser

If you cannot reach the remote server, there is a useful trick using a ssh tunnel:

ssh -L 8090:localhost:8090 user@IP_of_your_server

This can be done recursively and permit to reach the remote server as you are there :-)

Friday, September 14, 2007

Installing Alfresco 2.1.0 WCM + Ubuntu Linux + Oracle 10 Express Edition

Once have successfully installed and configured Oracle (to know how to install Oracle 10 Express look here) you can install a fresh copy of Alfresco version 2.1.0 (AlfrescoEnterprisePlusWCM-2.1.0-Linux-x86-Install.zip), the zip file provide two different installer:

AlfrescoEnterprise-2.1.0-Linux-x86-Install.bin

AlfrescoWCMEnterprise-2.1.0-Linux-x86-Install.bin

I started with AlfrescoEnterprise-2.1.0-Linux-x86-Install.bin.

The installation process it is quite easy to complete, accept the license agreement, choose the destination folder and resolve a question: do you want use the jdk and openoffice already locally installed or do you want download these necessaries components? we don't need anything. We can install both JDK and OpenOffice via apt-get and anyway, we'll see later, the only thing we need is to know where JDK and OpenOffice are. The path to setup properly the startup scripts.

After the install wizard choose to start the configuration wizard and you will be asked for:
  • Database Type - choose Oracle;
  • Content Store Location - the directory where Alfresco will store files and other stuff, leave the default if you don't have particular needs;
  • Index Location - another directory for the indexes, leave the default if you don't have particular needs;
  • OpenOffice Installation Directory - /usr/lib/openoffice (if you have openoffice installed through apt-get) anyway this parameters will never be used because the configuration wizard have some bugs.

Now I had to setup the database connection to Oracle. I didn't find any documentation in the setup to configure an Oracle connection but adjust the instruction write for MySql (README_mysql.txt), I hope, it will be quite easy, you have to create an account called alfresco using the Oracle 10 apex console (http://localhost:8090/apex/)

To setup the Oracle connection, you need to look 2 files from the $ALFRESCO_HOME/tomcat/shared/classes/alfresco/extension directory. Those files are custom-repository.properties and custom-hibernate-dialect.properties:
  1. custom-repository.properties
    • 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

copy the 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

Looking at the startup script I see the Alfresco 2.1.0 configuration wizard have a bug, the @@ALFRESCO_DIR@@ should be replaced in the admin scripts with the correct path. Anyway this did not happened, so I had to patch all the scripts present in the installation directory (Be sure to be in the correct directory before submit this!):

$ perl -i -p -e 's/\@\@ALFRESCO_DIR\@\@/\/home\/freedev\/apps\/servers\/alfresco-2.1.0/g' *.sh

So I hoped to have resolved all installation problems, but JDK and OpenOffice although were downloaded successfully, during the package decompression many binary files necessaries to the execution did not have the execution permission, so the installation... well, I think you understand. Fortunately install a new package (i.e. JDK) under Ubuntu it is really easy:

sudo apt-get install sun-java6-jdk

and remove everything related the gcj:

sudo apt-get remove gcj-4.1-base

Finally to fix the startup scripts we need to create two link one to configure the JAVA_HOME in the startup scripts and another to allow the script to find OpenOffice:

ln -s /usr/lib/jvm/java-6-sun-1.6.0.00/ alfresco/java

ln -s /usr/lib/openoffice/ openoffice.org2.1

now we can finally try to start Alfresco.

$ ./alfresco.sh start