surpass_li 发表于 2010-07-16 16:16

Windows下开源opentaps的安装

安装环境

系统:WindowsXp(64位, 2G)

数据库:mysql5.5

Jdk:1.6

opentaps版本:1.4.0

IDE:eclipse3.4

一、opentaps简介

opentaps是一个基于ofbiz基础开发的完全开源的企业级应用系统。它包括了完整的ERP和CRM解决方案和内建的企业智能工具。



opentaps现在在国内应用面不象sugarcrm/vtigercrm这些企业应用那样普遍,我想很大程度是由于JavaEE应用的逻辑结构严谨与复杂度决定其不象PHP应用那样容易拆分按需阅读切入。了解一个JavaEE的应用需要先了解其构造的框图、分层结构、每层实现的技术方式以及采用的技术。对于OFBiz这样一个野心极大要囊括几乎所有企业应用层面的项目,想要掌握它就更难上加难了,也许我们可以选择简单开始,先从文档的中文化与由简入繁的练习中开始了解这个庞大的开源项目。



二、opentaps安装准备

1、安装JDK 1.5或以上版本,并在系统中设置好JAVA_HOME及相关PATH

2、安装MYSQL 5.0或以上版本

3、下载opentaps 最新版本

            http://sourceforge.net/projects/opentaps/files/



三、开始安装

1、通过mysql命令行来创建opentaps所需数据库,为了方便识别,我们这里就用ofbiz来做数据库吧。

mysql> create database ofbiz;

推荐一个2个mysql的客户端图形工具:Navicat、Toad for mysql 都比较好用



2、将下载的opentaps解压至你电脑的任意合法目录(没有特殊字符)。



3、编辑opentaps目录中的framework/entity/config/entityengine.xml文件,使其能正确连接到你的mysql数据库中。

3.1 将其中的<delegator name="default"...> 段中的"datasource-name"从原来的"local" 改为 "localmysql"

3.2 编辑<datasource name="localmysql"...> 段内容,修改"jdbc-uri"为"jdbc:mysql://127.0.0.1/opentaps?autoReconnect=true";修改"jdbc-username"/ "jdbc-password"为你的mysql连接用户名/密码,修改character- set="utf8",collate=" utf8_general_ci",示例如下:



      <delegator name="default" entity-model-reader="main" entity-group-reader="main" entity-eca-reader="main" distributed-cache-clear-enabled="false">

      <group-map group-name="org.ofbiz" datasource-name="localmysql"/>

    </delegator>



      <datasource name="localmysql"

            helper-class="org.ofbiz.entity.datasource.GenericHelperDAO"

            field-type-name="mysql"

            check-on-start="true"

            add-missing-on-start="true"

            check-pks-on-start="false"

            use-foreign-keys="true"

            join-style="ansi-no-parenthesis"

            alias-view-columns="false"

            drop-fk-use-foreign-key-keyword="true"

            table-type="InnoDB"

            character-set="utf8"

            collate="utf8_general_ci">

      <read-data reader-name="seed"/>

      <read-data reader-name="seed-initial"/>

      <read-data reader-name="demo"/>

      <read-data reader-name="ext"/>

      <inline-jdbc

                jdbc-driver="com.mysql.jdbc.Driver"

                jdbc-uri="jdbc:mysql://127.0.0.1/ofbiz?autoReconnect=true&amp;useOldAliasMetadataBehavior=true"

                jdbc-username="root"

                jdbc-password="root"

                isolation-level="ReadCommitted"

                pool-minsize="2"

                pool-maxsize="250"/>

      <!-- <jndi-jdbc jndi-server-name="localjndi" jndi-name="java:/MySqlDataSource" isolation-level="Serializable"/> -->

    </datasource>





4、进行系统初始化

开始-cmd-cd到opentaps根目录

ant run-install

系统开始安装,这个时候是编译+系统安装,我大约用了6分多钟,直到系统提示安装完成。 这个过程很重要,也会出现很多问题,见最后的【问题一览】





5、启动opentaps

双击运行opentaps目录下的startofbiz.bat命令即可,请注意控制台输入默认输出至log下的ofbiz.log中,所以无法从控制台中判断系统是否启动完成,一般需等待两到五分钟。也可以将输出改回至console。



6、访问opentaps

打开浏览器访问:http://localhost:8080/opentaps

点击你希望访问的功能特性,系统默认帐号为

admin/ofbiz,拥有所有权限。



【问题一览】

·问题1:第5步中可能会出现,OutOfMemory异常,可以修改一下ant.bat

       "%JAVA_HOME%\\bin\\java" -Xms256M -Xmx512M-XX:MaxPermSize=512m -XX:PermSize=256m-jar hot-deploy/opentaps-common/lib/ant/ant-launcher.jar %1 %2 %3 %4 %5 %6

·问题2:第5步中出现“Unable to rename old file”错误,这个错误是64位系统引起的,官方已经给出了解决方法。详见下面链接:

http://www.opentaps.org/docs/index.php/General_Installation_of_Opentaps#Build_Aspect_class_Errors

就是用下面这段代码替换build-aspects.xml中的Weave advice into target jars那段代码(注意不是替换xml中全部内容)
<!-- ================================================================== --> <!-- Weave advice into target jars --> <!-- ================================================================== --> <target name="weave" depends="detect-dependencies" if="processRequired"> <echo message=" =========== Start Building Aspect (Weave) ============="/> <java classname="org.codehaus.aspectwerkz.compiler.AspectWerkzC" fork="true"> <jvmarg value="-Daspectwerkz.definition.file=${aopConfig}"/> <jvmarg value="-Daspectwerkz.transform.filter=no"/> <!-- <jvmarg value="-Daspectwerkz.transform.verbose=true"/> --> <!-- <jvmarg value="-Daspectwerkz.transform.details=true"/> --> <arg value="-verify"/> <classpath refid="local.class.path" /> <classpath> <pathelement path="${build.dir}/classes/common"/> </classpath> <!-- below is the jars to post-process --> <arg value="${ofbiz.dir}/framework/entity/build/lib/ofbiz-entity.jar"/> </java> <java classname="org.codehaus.aspectwerkz.compiler.AspectWerkzC" fork="true"> <jvmarg value="-Daspectwerkz.definition.file=${aopConfig}"/> <jvmarg value="-Daspectwerkz.transform.filter=no"/> <!-- <jvmarg value="-Daspectwerkz.transform.verbose=true"/> --> <!-- <jvmarg value="-Daspectwerkz.transform.details=true"/> --> <arg value="-verify"/> <classpath refid="local.class.path" /> <classpath> <pathelement path="${build.dir}/classes/common"/> </classpath> <!-- below is the jars to post-process, if these jar not effect each other you can put them in same pos, else please seperate them into another task --> <arg value="${ofbiz.dir}/framework/common/build/lib/ofbiz-common.jar"/> </java> <java classname="org.codehaus.aspectwerkz.compiler.AspectWerkzC" fork="true"> <jvmarg value="-Daspectwerkz.definition.file=${aopConfig}"/> <jvmarg value="-Daspectwerkz.transform.filter=no"/> <!-- <jvmarg value="-Daspectwerkz.transform.verbose=true"/> --> <!-- <jvmarg value="-Daspectwerkz.transform.details=true"/> --> <arg value="-verify"/> <classpath refid="local.class.path" /> <classpath> <pathelement path="${build.dir}/classes/common"/> </classpath> <!-- below is the jars to post-process --> <arg value="${ofbiz.dir}/applications/order/build/lib/ofbiz-order.jar"/> </java> <jar jarfile="${lib.dir}/${name}.jar" update="true" basedir="${build.dir}/classes/common" includes="org/opentaps/aspect/secas/**" /> <!-- put aop.xml into target jar META-INF dir --> <mkdir dir="${build.dir}/classes/META-INF" /> <copy file="${aopConfig}" tofile="${build.dir}/classes/META-INF/aop.xml" overwrite="true"/> <!-- create new jar with aop.xml, then copy it to orign location, using these for avoid unable rename error on windows 64bit system--> <zip destfile="${lib.dir}/ofbiz-entity.jar"> <zipfileset src="${ofbiz.dir}/framework/entity/build/lib/ofbiz-entity.jar"/> <fileset dir="${build.dir}/classes/"> <include name="META-INF/aop.xml"/> </fileset> </zip> <delete file="${ofbiz.dir}/framework/entity/build/lib/ofbiz-entity.jar" failonerror="false"/> <move file="${lib.dir}/ofbiz-entity.jar" tofile="${ofbiz.dir}/framework/entity/build/lib/ofbiz-entity.jar"/> <zip destfile="${lib.dir}/ofbiz-common.jar"> <zipfileset src="${ofbiz.dir}/framework/common/build/lib/ofbiz-common.jar"/> <fileset dir="${build.dir}/classes/"> <include name="META-INF/aop.xml"/> </fileset> </zip> <delete file="${ofbiz.dir}/framework/common/build/lib/ofbiz-common.jar" failonerror="false"/> <move file="${lib.dir}/ofbiz-common.jar" tofile="${ofbiz.dir}/framework/common/build/lib/ofbiz-common.jar"/> <zip destfile="${lib.dir}/ofbiz-order.jar"> <zipfileset src="${ofbiz.dir}/applications/order/build/lib/ofbiz-order.jar"/> <fileset dir="${build.dir}/classes/"> <include name="META-INF/aop.xml"/> </fileset> </zip> <delete file="${ofbiz.dir}/applications/order/build/lib/ofbiz-order.jar" failonerror="false"/> <move file="${lib.dir}/ofbiz-order.jar" tofile="${ofbiz.dir}/applications/order/build/lib/ofbiz-order.jar"/> <echo message=" =========== Done Building Aspect (Weave) =============="/> </target>



·问题3:第5步中可能还会再次出现内存不足的问题,这个时候可以将build.xml中的memory设置小一点:

<project name="OFBiz Main Build" default="build" basedir=".">

    <property name="site.dir" value="../site"/>

    <property name="memory.initial.param" value="-Xms256M"/>

    <property name="memory.max.param" value="-Xmx512M"/>

    <property name="permmemory.max.param" value="-XX:MaxPermSize=512m"/>

surpass_li 发表于 2010-07-16 16:21

opentaps的内存吃得有点大,期待下一版会有所改观呀

蓝色虫 发表于 2010-07-17 10:36

汗一个

java程序占系统资源太大

surpass_li 发表于 2010-07-18 15:20

如果设计和优化好了应该不会非常大
页: [1]
查看完整版本: Windows下开源opentaps的安装