随笔 - 6  文章 - 129  trackbacks - 0
<2024年3月>
252627282912
3456789
10111213141516
17181920212223
24252627282930
31123456

常用链接

留言簿(14)

随笔档案(6)

文章分类(467)

文章档案(423)

相册

收藏夹(18)

JAVA

搜索

  •  

积分与排名

  • 积分 - 814176
  • 排名 - 49

最新评论

阅读排行榜

评论排行榜

原文:http://wiki.openbravo.com/wiki/ERP/2.50/Development_Stack_Setup


Summary

This article explains in detail how to install and configure the whole stack required for a Openbravo ERP development environment, including:

  • PostgreSQL.
  • Oracle.
  • Sun JDK.
  • Apache Ant.
  • Apache Tomcat.

The whole guide is valid for all the hardware architectures the stack supports, such as x86 or x86_64. A minimum of 2GB or RAM is recommended for x86 and 3GB for x86_64.


Motivation

A development setup has different needs than a production environment. The main goal is to make the developer's life as easy as possible, while increasing the productivity.

Some of the components are configured in the same way as in a production system. In those cases a link to the production environment setup is provided.


Operating System

We recommend using Linux or another UNIX-alike flavor (*BSD, OS-X, OpenSolaris). The amount of useful development tools provided by these operating systems are vastly superior to the rest, at least regarding Openbravo ERP. Do not use Windows.

Create an unprivileged user for you in this operating system. And once the environment is configured, avoid using the root user for anything related to Openbravo ERP development. Specially, do not compile as root.

PostgreSQL

Follow the installation steps to install PostgreSQL, configure an admin (postgres) password, and setup the MD5 password authentication. 8.3.5 or higher is the recommended version. Additionally, make sure the postgresql-contrib modules is installed (UUID requires it). Once it is installed, and to make the database accessible from anywhere, so that external developers or yourself can access it easily with PgAdmin3, psql or any other development tool. Locate and edit the postgresql.conf file, and uncomment the following line, assigning this new value:

listen_addresses='*'

This makes the database be listening in all the interfaces available in your system and not only in localhost (default).

Locate and edit the pg_hba.conf file, and add this line at the end:

host    all         all         0.0.0.0/0          md5

Or if you want more security you can change the 0.0.0.0/0 with the concrete IP that you want to give access for example 1.2.3.4/32.

Just for safety purposes, this assumes you have a firewall in your local LAN preventing outsiders to access the database.

Image:Bulbgraph.png   As an example, in Ubuntu 10.04, these file are located in /etc/postgresql/8.4/main, assuming that you have installed PostgreSQL 8.4.x

Oracle

Do not use Oracle XE 10g. It's 4GB storage limitation makes it useless for heavy development in a few days, and it has a bug that happens usually when using Openbravo ERP. Therefore, the recommended version is Standard Edition 11g (>=11.1.0.6.0).

The number of open cursors should be 3000 at least. To verify this:

SELECT value FROM v$parameter WHERE name = 'open_cursors';

To increase it:

ALTER SYSTEM SET open_cursors = 3000 SCOPE=BOTH;

Make sure that the number of processes is 150 at least. To verify this:

SELECT value FROM v$parameter WHERE name = 'processes';

To increase it:

ALTER SYSTEM set processes=150 SCOPE=SPFILE;

And restart Oracle after doing this change.

Sun JDK

Follow the installation steps to set up the Sun JDK. Notice that version JDK 1.6 must be used for version >=2.50 developments.

The IBM JDK works well too, but almost all the developers use Sun's version. It is therefore the recommended one.

Apache Ant

Follow the installation steps to set up the Apache Ant. Since version 2.50 Ant needs its memory settings to be tweaked. Otherwise some basic tasks like a compilation are likely to fail. Assuming you are using Bash as your shell, append the following line to your ~/.bashrc file:

export ANT_OPTS="-Xmx1024M"

For 64bit machines:

export ANT_OPTS="-Xmx1024M -XX:MaxPermSize=128M"

See the Apache Tomcat section for an explanation of what these options mean.

Close your current shell session and open a new one to apply changes.

Apache Tomcat

Do not use the Tomcat version provided by your operating system's package manager. The packaged version of Tomcat is very unfriendly in terms of development due to web application deployment specifics. This especially applies to Linux distributions.

Instead, download the official distribution (version 6.0.x), and extract the files in your home directory. We recommend you to place it in ~/servers/tomcat.

Every Linux distribution and operating system packages Tomcat in a different way, with different security settings, permissions, memory setting and logging configuration. Some of these configurations are not development friendly. This is the reason of the recommendation to use the official distribution.

The default memory settings of Tomcat are not enough for a proper Openbravo ERP functioning. Thus append the following line to your ~/.bashrc

export CATALINA_OPTS="-Djava.awt.headless=true -Xms384M -Xmx512M -XX:MaxPermSize=256M"
  • -Djava.awt.headless: this setting controls running the environment with a headless implementation. In Openbravo ERP the client is always a web browser, so the JVM does not need to run any graphical window at all.
  • -Xms: this setting controls the initial size of the Java heap. Properly tuning this parameter reduces the overhead of garbage collection, improving server response time and throughput.
  • -Xmx: this setting controls the maximum size of the Java heap. Properly tuning this parameter reduces the overhead of garbage collection, improving server response time and throughput.
  • -XX:MaxPermSize: this setting controls the section of the heap reserved for the permanent generation, and holds all of the reflective data for the JVM.

These options are the same ones as for production environment, except for the -server option. This is useful only in production servers, because it makes the JVM to use the optimizing compiler instead of the standard one. And while this change increases significantly the performance of the server, it takes longer to warm up. And deployment speed is something that a developer appreciates.

In order to avoid the Unable to find a javac compiler; com.sun.tools.javac.Main is not on the classpath. Perhaps JAVA_HOME does not point to the JDK error when trying to compile the application from Tomcat using the Openbravo ERP web interface, add the tools.jar library to Tomcat's classpath:

cp $JAVA_HOME/lib/tools.jar ~/servers/tomcat/lib/

In order to avoid Tomcat from auto-reloading itself, comment the WatchedResource line in conf/context.xml:

<!-- <WatchedResource>WEB-INF/web.xml</WatchedResource> -->

Configure a username and password for the Tomcat Manager, by replacing the conf/tomcat-users.xml file with these contents:

<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="manager"/>
<role rolename="admin"/>
<user username="admin" password="admin" roles="admin,manager"/>
</tomcat-users>

Replace password="admin" with your own password.

Finally, to start and stop tomcat use the following commands:

cd ~/servers/tomcat/bin
./startup.sh
./shutdown.sh

Mercurial

Follow the Mercurial manual for Openbravo developers to install and configure it.



posted on 2010-12-31 08:31 Ke 阅读(765) 评论(0)  编辑  收藏 所属分类: Openbravo

只有注册用户登录后才能发表评论。


网站导航: