首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Moqui 1.4.1 Postgresql配置

Moqui 1.4.1 Postgresql配置
EN

Stack Overflow用户
提问于 2015-01-23 18:03:23
回答 2查看 687关注 0票数 1

我试图让Moqui1.4.1发布并运行,但使用Postgres作为数据库平台。这是平台的细节。

  • Ubuntu 12.04
  • Postgres 9.4使用JDBC驱动程序PostgreSQL9.3-1102.jdbc41.jar(位于/运行时/lib中)。希望那是正确的地方)

首先,我在任何地方都找不到MoquiDefaultConf.xml,所以我假设这只适用于开发?

在运行时/conf下,我有MoquiDevConf.xml、MoquiDevTestConf.xml、MoquiProductionConf.xml、MoquiStagingConf.xml。在所有四项中,我都添加了以下实体-外观条目。

代码语言:javascript
复制
    <entity-facade crypt-pass="MoquiDefaultPassword:CHANGEME">
      <!--
        <datasource group-name="transactional" database-conf-name="postgresql" schema-name="">
        <inline-jdbc jdbc-uri="jdbc:postgresql://127.0.0.1:5432/MoquiDEFAULT?autoReconnect=true&amp;useUnicode=true&amp;characterEncoding=UTF-8" jdbc-username="moqui" jdbc-password="moqui" pool-minsize="2" pool-maxsize="50"/>
    </datasource>   
    -->

    <datasource group-name="transactional" database-conf-name="postgres" schema-name="public">
      <!--
            <inline-jdbc pool-minsize="5" pool-maxsize="50">
                <xa-properties user="moqui" password="moqui" serverName="localhost" portNumber="5432"
                               databaseName="MoquiDEFAULT"/>
            </inline-jdbc>
        -->

        <inline-jdbc jdbc-uri="jdbc:postgresql://127.0.0.1:5432/MoquiDEFAULT"
                    jdbc-username="moqui" jdbc-password="moqui"
                    pool-minsize="2" pool-maxsize="50"/>
        </datasource>
        </entity-facade>

 <!-- end snippet -->

问题是:

当我运行gradle load时,load目标

  1. 创建一堆我不理解的derby数据库,因为它现在是为Postgres配置的。
  2. enumeration_type枚举是在Postgres中创建的。

,然后进程被卡住了.

这是点的输出。

代码语言:javascript
复制
    > --- 12304 [main] INFO org.moqui.impl.entity.EntityDbMeta 
 Created table [ENUMERATION_TYPE] for entity [moqui.basic.EnumerationType]
    > --- 12788 [main] INFO org.moqui.impl.entity.EntityDbMeta 
 Created table [ENUMERATION] for entity [moqui.basic.Enumeration]
    > --- 611953 [-task-scheduler] WARN Bitronix.tm.BitronixTransaction 
 transaction timed out: a Bitronix Transaction with GTRID [3132372E302E312E3100000000002E270D00000001], status=MARKED_ROLLBACK, 1 resource(s) enlisted (started Thu Jan 01 02:50:24 SAST 1970)

所以Bitronix对某些事情不满意。

如果我终止加载并重新启动,那么它将创建下一个表geo,然后再次卡住,尽管这一次它没有显示Bitronix警告。

代码语言:javascript
复制
    > --- 12268    [main] INFO org.moqui.impl.entity.EntityDbMeta 
 Created table [GEO] for entity [moqui.basic.Geo]

帮助感激。

答复的附加信息

我下载是为了评估功能,所以我只想运行应用程序,而不是扩展它。正如您已经指出的,这个文件中只有预构建的WAR文件。但是,如果浏览WAR文件的内容,则不会发现MoquiDefaultConf.xml文件。实际上,整个WAR文件中唯一的XML文件是web.xml。

在发现这一点之后,在阅读了书中关于安装的章节之后,我搜索了MoquiDefaultConf.xml并在github上找到了这个文件。然后,我从其中复制了数据源元素,然后简单地将其粘贴到所有列出的Moqui*Conf.xml的实体外观中,以确保它最终选择了up....which,但遇到了停止问题。我尝试了两种内联jdbc选项:一次使用带有标记的选项,一次使用没有的选项。

抱歉的。我来自微软的背景,所以这对我来说有点陌生,但在我的辩护中,我在技术上能够像这样摸索着启动和运行OFBiz。

更新

好的。进步。

原来我在运行Postgres9.1而不是9.4 (Oops )。Linux noob),带有PostgreSQL9.3-1102.jdbc4.jar驱动程序。不确定这是否是导致暂停的原因,但我用PostgreSQL93-1102.jdbc41.jar驱动程序升级到Postgres 9.4,并且暂停仍在发生。

David,您正确地指出了缺失的启动添加缺失和运行时添加缺失属性。之所以会出现这种情况,是因为我最初尝试将数据源元素从OFBiz等效项中拼凑在一起,当我最终在网上找到MoquiDefaultConf.xml时,我只将内联jdbc元素复制到从OFBiz中使用的数据源元素中,而没有复制整个数据源元素。太傻了。无论如何,在只将数据源元素添加到MoquiDevConf.xml和"gradle load“之后,在Postgres中创建了91个表,从而构建完成了successfully....well。

名为MoquiDEFAULT的derby数据库是在db文件夹中的derby文件夹中创建的仍然。我可以确认webapp正在与Postgres对话,因为我在示例网格中创建了一个条目,它出现在Postgres中的示例表中。我对内部的了解还不够,无法知道查询是否在德比数据库中重复。

最后,在使用了消除过程之后,我确定构建使用的是MoquiDevConfig.xml,而不是MoquiProductionConf.xml。也就是说,当我只将数据源放在MoquiProductionConf.xml entity-facade元素中时,它没有效果,只在derby (well...over 100 .dat文件)中创建表,在Postgres中没有创建表。这是令人困惑的,因为MoquiInit.properties只引用过MoquiProductionConf.xml。我可以确认,使用MoquiDevConfig.xml生成的.dat文件比MoquiProductionConf.xml少20个。我对Gradle构建文件不太了解,不知道要更改什么。

MoquiDevConf.xml

代码语言:javascript
复制
<?xml version="1.0" encoding="UTF-8" ?>
代码语言:javascript
复制
<tools enable-elasticsearch="true" enable-camel="false"/>

<cache-list>
    <!-- Development Mode - don't use these for production, load testing, etc.
         Cleared by default every 20 seconds from when loaded into cache. -->
    <cache name="entity.definition" expire-time-idle="30"/>
    <!-- longer timeout since this basically looks through all files to check for new or moved entity defs -->
    <cache name="entity.location" expire-time-idle="300"/>
    <cache name="entity.data.feed.info" expire-time-idle="30"/>

    <cache name="service.location" expire-time-idle="5"/>
    <cache name="service.java.class" expire-time-idle="5"/>

    <cache name="kie.component.releaseId" expire-time-idle="5"/>

    <cache name="screen.location" expire-time-idle="5"/>
    <cache name="screen.template.mode" expire-time-idle="5"/>
    <cache name="screen.template.location" expire-time-idle="5"/>

    <cache name="resource.xml-actions.location" expire-time-idle="5"/>
    <cache name="resource.groovy.location" expire-time-idle="5"/>
    <!-- longer timeout because these are cached by the expression text itself, so changed text is a new entry -->
    <cache name="resource.groovy.expression" expire-time-idle="600"/>
    <cache name="resource.javascript.location" expire-time-idle="5"/>

    <cache name="resource.ftl.location" expire-time-idle="5"/>
    <cache name="resource.gstring.location" expire-time-idle="5"/>
    <cache name="resource.wiki.location" expire-time-idle="5"/>
    <cache name="resource.markdown.location" expire-time-idle="5"/>
    <cache name="resource.text.location" expire-time-idle="5"/>
    <cache name="resource.reference.location" expire-time-idle="5"/>

    <cache name="l10n.message" expire-time-idle="600"/>
</cache-list>

<server-stats stats-skip-condition="ec.web?.request?.pathInfo?.startsWith('/rpc') || ec.web?.request?.pathInfo?.startsWith('/status')">
    <!-- For development, track everything! It'll run slow through... -->
    <artifact-stats type="screen" persist-bin="true" persist-hit="true"/>
    <artifact-stats type="screen-content" persist-bin="true" persist-hit="true"/>
    <artifact-stats type="transition" persist-bin="true" persist-hit="true"/>
    <artifact-stats type="service" persist-bin="true" persist-hit="true"/>
    <artifact-stats type="service" sub-type="entity-auto" persist-bin="true" persist-hit="false"/>
    <artifact-stats type="service" sub-type="entity-implicit" persist-bin="true" persist-hit="false"/>
    <artifact-stats type="entity" persist-bin="true"/>
</server-stats>

<webapp-list>
    <webapp name="webroot" http-port="8080" https-enabled="false">
        <root-screen host=".*" location="component://webroot/screen/webroot.xml"/>
    </webapp>
</webapp-list>

<screen-facade boundary-comments="true">
    <!-- The default conf file has a macro location defined for html already, but this is an example of how to
        refer to a file to override the default macros. -->
    <screen-text-output type="html" mime-type="text/html"
                        macro-template-location="template/screen-macro/ScreenHtmlMacros.ftl"/>
</screen-facade>

<entity-facade crypt-pass="MoquiDefaultPassword:CHANGEME">
<datasource group-name="transactional" database-conf-name="postgres" schema-name="public" startup-add-missing="true" runtime-add-missing="false">
    <inline-jdbc pool-minsize="5" pool-maxsize="50">
    <xa-properties user="moqui" password="moqui" serverName="localhost" portNumber="5432"
              databaseName="MoquiDEFAULT"/>
    </inline-jdbc>
    <!-- <inline-jdbc jdbc-uri="jdbc:postgresql://127.0.0.1/MoquiDEFAULT"
        jdbc-username="moqui" jdbc-password="moqui" pool-minsize="2" pool-maxsize="50"/> -->
</datasource>
</entity-facade>

<repository-list>
    <!-- <repository name="main" location="http://localhost:8081/rmi" type="rmi" workspace="default"
                username="admin" password="admin"/> -->
</repository-list>
<component-list>
    <!-- This loads the tools component over top of the default one, which will result in a warning but works
        fine. Use something like this to refer to components in a JCR repository. -->
    <component name="tools" location="component/tools"/>
</component-list>

EN

回答 2

Stack Overflow用户

发布于 2015-01-23 22:21:44

如果下载了二进制版本,则MoquiDefaultConf.xml文件位于预构建的可执行war文件中,尽管您可以在源代码回购中看到它:

https://github.com/moqui/moqui/blob/master/framework/src/main/resources/MoquiDefaultConf.xml

在这里,您将看到Postgres的一个示例配置:

代码语言:javascript
复制
    <datasource group-name="transactional" database-conf-name="postgres" schema-name="public" startup-add-missing="true" runtime-add-missing="false">
        <inline-jdbc pool-minsize="5" pool-maxsize="50">
            <xa-properties user="moqui" password="moqui" serverName="localhost" portNumber="5432"
                           databaseName="MoquiDEFAULT"/>
        </inline-jdbc>
        <!-- <inline-jdbc jdbc-uri="jdbc:postgresql://127.0.0.1/MoquiDEFAULT"
                jdbc-username="moqui" jdbc-password="moqui" pool-minsize="2" pool-maxsize="50"/> -->
    </datasource>

特别要注意的是,数据源元素上的这两个属性是:startup add-缺失=“true”运行时-add-缺失=“false”。Postgres不支持动态创建表,因此必须在系统运行之前创建所有表,而不是默认模式,即只在需要时(在完成第一次写入时)创建表。

MoquiDefaultConf.xml文件还定义了"tenantcommon“实体组,并将其指向Derby:

代码语言:javascript
复制
    <datasource group-name="tenantcommon" database-conf-name="derby" schema-name="MOQUI">
        <inline-jdbc pool-minsize="2" pool-maxsize="10">
            <xa-properties databaseName="${moqui.runtime}/db/derby/MoquiDEFAULT" createDatabase="create"/>
        </inline-jdbc>
    </datasource>

要将这些实体也放入Postgres中,您需要向运行时使用的Moqui文件添加类似的定义。

票数 0
EN

Stack Overflow用户

发布于 2022-01-27 22:51:15

在MoquiDevConf.xml或MoquiProductionConf.xml中使用实体外观标记中的配置

代码语言:javascript
复制
<datasource group-name="transactional" database-conf-name="postgres" schema-name="public" startup-add-missing="true" runtime-add-missing="false">
        <inline-jdbc jdbc-uri="jdbc:postgresql://localhost/dbname" jdbc-username="postgres" jdbc-password="pass"/>
</datasource>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/28115977

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档