简体   繁体   English

运行OfBiz时出错-HTTP状态500 –内部服务器错误

[英]Error when Running OfBiz - HTTP Status 500 – Internal Server Error

I am having issues when I am running Ofbiz it is throwing this error: 我在运行Ofbiz时遇到问题,它将引发此错误:

HTTP Status 500 – Internal Server Error Type Exception Report HTTP状态500 –内部服务器错误类型异常报告

Message Could not get next sequenced ID for sequence name: Visit 消息无法获取序列名称的下一个序列ID:访问

Description The server encountered an unexpected condition that prevented it from fulfilling the request. 描述服务器遇到意外情况,阻止其满足请求。

Exception 例外

java.lang.IllegalArgumentException: Could not get next sequenced ID for sequence name: Visit
org.apache.ofbiz.entity.GenericDelegator.getNextSeqId(GenericDelegator.java:2239)
org.apache.ofbiz.entity.GenericDelegator.getNextSeqId(GenericDelegator.java:2227)
org.apache.ofbiz.entity.GenericEntity.setNextSeqId(GenericEntity.java:655)
org.apache.ofbiz.entity.GenericDelegator.createSetNextSeqId(GenericDelegator.java:764)
org.apache.ofbiz.webapp.stats.VisitHandler.getVisit(VisitHandler.java:187)
org.apache.ofbiz.webapp.stats.VisitHandler.getVisitId(VisitHandler.java:100)
org.apache.ofbiz.webapp.control.ControlServlet.doGet(ControlServlet.java:192)
javax.servlet.http.HttpServlet.service(HttpServlet.java:645)
javax.servlet.http.HttpServlet.service(HttpServlet.java:750)
org.apache.ofbiz.webapp.control.ContextFilter.doFilter(ContextFilter.java:191)
org.apache.ofbiz.webapp.control.ControlFilter.doFilter(ControlFilter.java:157)

Note The full stack trace of the root cause is available in the server logs. 注意在服务器日志中可以找到根本原因的完整堆栈跟踪。

Apache Tomcat/9.0.13 Apache Tomcat / 9.0.13

I have researched this error, and it appears to be related to either my delegator or the connection to the database, however I do not posses the skills to fix it. 我已经研究了此错误,它似乎与我的委托人或与数据库的连接有关,但是我不具备修复此错误的技能。 Can someone please help me? 有人可以帮帮我吗?

I have posted the contents of my entityengine.xml 我已经发布了我的entityengine.xml的内容

<group-map group-name="org.apache.ofbiz" datasource-name="localmysql"/>
    <group-map group-name="org.apache.ofbiz.olap" datasource-name="localmysqlolap"/>
    <group-map group-name="org.apache.ofbiz.tenant" datasource-name="localmysqltenant"/>
</delegator>
<!-- May be used when you create a service that manages many data for massive imports, this for performance reason or to escape functional cases -->
<delegator name="default-no-eca" entity-model-reader="main" entity-group-reader="main" entity-eca-reader="main" entity-eca-enabled="false" distributed-cache-clear-enabled="false">
    <group-map group-name="org.apache.ofbiz" datasource-name="localmysql"/>
    <group-map group-name="org.apache.ofbiz.olap" datasource-name="localmysqlolap"/>
    <group-map group-name="org.apache.ofbiz.tenant" datasource-name="localmysqltenant"/>
</delegator>

<!-- Be sure that your default delegator (or the one you use) uses the same datasource for test. You must run "gradlew loadAll" before running "gradlew testIntegration" -->
<delegator name="test" entity-model-reader="main" entity-group-reader="main" entity-eca-reader="main">
    <group-map group-name="org.apache.ofbiz" datasource-name="localmysql"/>
    <group-map group-name="org.apache.ofbiz.olap" datasource-name="localmysqlolap"/>
    <group-map group-name="org.apache.ofbiz.tenant" datasource-name="localmysqltenant"/>
</delegator>

<!-- need to at least define a name for each component to use -->
<entity-model-reader name="main"/>

<!-- need to at least define a name for each component to use -->
<entity-group-reader name="main"/>

<!-- need to at least define a name for each component to use -->
<entity-eca-reader name="main"/>

<!-- need to at least define a name for each component to use -->
<!-- defining:
    tenant       = OFBiz and External Tenant Data
    seed         = OFBiz and External Seed Data - to be maintained along with source and updated whenever a system deployment is updated
    seed-initial = OFBiz and External Seed Data - to be maintained along with source like other seed data, but only loaded initially and not updated when a system is updated except manually reviewing each line
    demo         = OFBiz Only Demo Data
    ext          = External General Data (custom)
    ext-test     = External Test Data (custom)
    ext-demo     = External Demo Data (custom)
-->
<entity-data-reader name="tenant"/>
<entity-data-reader name="seed"/>
<entity-data-reader name="seed-initial"/>
<entity-data-reader name="demo"/>
<entity-data-reader name="ext"/>
<entity-data-reader name="ext-test"/>
<entity-data-reader name="ext-demo"/>

<field-type name="hsql" loader="fieldfile" location="fieldtypehsql.xml"/>
<field-type name="derby" loader="fieldfile" location="fieldtypederby.xml"/>
<field-type name="daffodil" loader="fieldfile" location="fieldtypedaffodil.xml"/>
<field-type name="axion" loader="fieldfile" location="fieldtypeaxion.xml"/>
<field-type name="mysql" loader="fieldfile" location="fieldtypemysql.xml"/>
<field-type name="postgres" loader="fieldfile" location="fieldtypepostgres.xml"/>
<field-type name="oracle" loader="fieldfile" location="fieldtypeoracle.xml"/>
<field-type name="sapdb" loader="fieldfile" location="fieldtypesapdb.xml"/>
<field-type name="sybase" loader="fieldfile" location="fieldtypesybase.xml"/>
<field-type name="firebird" loader="fieldfile" location="fieldtypefirebird.xml"/>
<field-type name="mssql" loader="fieldfile" location="fieldtypemssql.xml"/>

<!--
For DAO/JDBC Helper: Tries:
  1. JNDI Datasource IF jdbc.jndi.name, context.provider, etc are specified
  2. Embedded (JOTM) if available (uses jdbc.driver, jdbc.uri, jdbc.username, jdbc.password, isolation.level)
  3. Direct to manually loaded JDBC driver (uses jdbc.driver, jdbc.uri, jdbc.username, jdbc.password)

Transaction Isolation Levels - (<helperName>.isolation.level) can be as follows:
 * None
 * ReadCommitted (Recommended)
 * ReadUncommitted
 * RepeatableRead
 * Serializable (NOT Recommended)
 * Not set uses database default
-->

<datasource name="localhsql"
        helper-class="org.apache.ofbiz.entity.datasource.GenericHelperDAO"
        field-type-name="hsql"
        check-on-start="true"
        add-missing-on-start="true"
        check-indices-on-start="true"
        use-foreign-keys="true"
        use-foreign-key-indices="true"
        use-fk-initially-deferred="false"
        join-style="ansi-no-parenthesis"
        alias-view-columns="true">
    <read-data reader-name="tenant"/>
    <read-data reader-name="seed"/>
    <read-data reader-name="seed-initial"/>
    <read-data reader-name="demo"/>
    <read-data reader-name="ext"/>
    <read-data reader-name="ext-test"/>
    <read-data reader-name="ext-demo"/>
    <inline-jdbc
            jdbc-driver="org.hsqldb.jdbcDriver"
            jdbc-uri="jdbc:hsqldb:runtime/data/hsqldb/ofbiz"
            jdbc-username="ofbiz"
            jdbc-password="ofbiz"
            isolation-level="ReadCommitted"
            pool-minsize="2"
            pool-maxsize="250"
            time-between-eviction-runs-millis="600000"/>
    <!-- <jndi-jdbc jndi-server-name="localjndi" jndi-name="java:/HsqlDataSource" isolation-level="ReadUncommitted"/> -->
    <!-- <jndi-jdbc jndi-server-name="default" jndi-name="comp/env/jdbc/xa/localhsql" isolation-level="ReadUncommitted"/> --> <!-- Orion Style JNDI name -->
    <!-- <jndi-jdbc jndi-server-name="localjndi" jndi-name="localhsqlDataSource"/> --> <!-- Weblogic Style JNDI name -->
</datasource>

//Data Sources //数据源

    <!-- Also consider:
mysql.conf
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8
[mysqld]
collation-server = utf8_unicode_ci
init-connect='SET NAMES utf8'
character-set-server = utf8

Mysql Version: > 5.6.4 (supports datetime milliseconds)
 -->
<datasource name="localmysql"
        helper-class="org.apache.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="tenant"/>
    <read-data reader-name="seed"/>
    <read-data reader-name="seed-initial"/>
    <read-data reader-name="demo"/>
    <read-data reader-name="ext"/>
    <read-data reader-name="ext-test"/>
    <read-data reader-name="ext-demo"/>
    <inline-jdbc
            jdbc-driver="com.mysql.jdbc.Driver"
            jdbc-uri="jdbc:mysql://127.0.0.1/ofbiz? 
autoReconnect=true&amp;characterEncoding=UTF-8"
            jdbc-username="ofbiz"
            jdbc-password="ofbiz"
            isolation-level="ReadCommitted"
            pool-minsize="2"
            pool-maxsize="250"
            time-between-eviction-runs-millis="600000"/><!-- Please note 
that at least one person has experienced a problem with this value with 
MySQL
            and had to set it to -1 in order to avoid this issue.
            For more look at http://markmail.org/thread/5sivpykv7xkl66px and 
http://commons.apache.org/dbcp/configuration.html-->
    <!-- <jndi-jdbc jndi-server-name="localjndi" jndi- 
name="java:/MySqlDataSource" isolation-level="Serializable"/> -->
</datasource>
<datasource name="localmysqlolap"
        helper-class="org.apache.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="tenant"/>
    <read-data reader-name="seed"/>
    <read-data reader-name="seed-initial"/>
    <read-data reader-name="demo"/>
    <read-data reader-name="ext"/>
    <read-data reader-name="ext-test"/>
    <read-data reader-name="ext-demo"/>
    <inline-jdbc
            jdbc-driver="com.mysql.jdbc.Driver"
            jdbc-uri="jdbc:mysql://127.0.0.1/ofbizolap? 
 autoReconnect=true&amp;characterEncoding=UTF-8"
            jdbc-username="ofbizolap"
            jdbc-password="ofbizolap"
            isolation-level="ReadCommitted"
            pool-minsize="2"
            pool-maxsize="250"
            time-between-eviction-runs-millis="600000"/><!-- Please note 
that at least one person has experienced a problem with this value with 
MySQL
            and had to set it to -1 in order to avoid this issue.
            For more look at http://markmail.org/thread/5sivpykv7xkl66px and 
http://commons.apache.org/dbcp/configuration.html-->
    <!-- <jndi-jdbc jndi-server-name="localjndi" jndi- 
name="java:/MySqlDataSource" isolation-level="Serializable"/> -->
</datasource>
<datasource name="localmysqltenant"
        helper-class="org.apache.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="tenant"/>
    <read-data reader-name="seed"/>
    <read-data reader-name="seed-initial"/>
    <read-data reader-name="demo"/>
    <read-data reader-name="ext"/>
    <read-data reader-name="ext-test"/>
    <read-data reader-name="ext-demo"/>
    <inline-jdbc
            jdbc-driver="com.mysql.jdbc.Driver"
            jdbc-uri="jdbc:mysql://127.0.0.1/ofbiztenant? 
 autoReconnect=true&amp;characterEncoding=UTF-8"
            jdbc-username="ofbiztenant"
            jdbc-password="ofbiztenant"
            isolation-level="ReadCommitted"
            pool-minsize="2"
            pool-maxsize="250"
            time-between-eviction-runs-millis="600000"/><!-- Please note 
that at least one person has experienced a problem with this value with 
MySQL
            and had to set it to -1 in order to avoid this issue.
            For more look at http://markmail.org/thread/5sivpykv7xkl66px and 
http://commons.apache.org/dbcp/configuration.html-->
    <!-- <jndi-jdbc jndi-server-name="localjndi" jndi- 
name="java:/MySqlDataSource" isolation-level="Serializable"/> -->
</datasource>

The cause here is easy to explain: you are auto-generating ids, which have already been taken. 原因很容易解释:您正在自动生成ID,这些ID已经被使用。 This causes a rollback of the entry and then a subsequent error is thrown. 这将导致该条目的回滚,然后引发后续错误。

Most likely you imported seed data with Ids larger 10000, which is where most auto-ids start and now a new entry will clash with the existing. 您最有可能导入了IDs大于10000的种子数据,这是大多数自动ID开始的位置,现在新条目将与现有ID冲突。

You can fix this by updating the nextseqId value (there is a table for it). 您可以通过更新nextseqId值(有一个表)来解决此问题。

For more infos on this topic, also feel free to join the Scipio ERP community , which happens to be a modern fork of the OFBiz project, 有关此主题的更多信息,请随时加入Scipio ERP社区 ,该社区恰好是OFBiz项目的一个现代分支,

Your first <delegator> opening tag is not seen in the code you have attached for entityengine.xml . 在您为entityengine.xml附加的代码中没有看到您的第一个<delegator>开头标记。 Assuming you are using MySQL DB, please check if the details provided such as DB name, username, password, etc provided in <datasource name="localmysql"> is correct. 假设您正在使用MySQL数据库,请检查<datasource name="localmysql">提供的数据库名称,用户名,密码等详细信息是否正确。 Also, please check if you are able to access your DB outside of Ofbiz. 另外,请检查您是否能够在Ofbiz之外访问数据库。 ie through a DB client like SQL Yog. 即通过像SQL Yog这样的数据库客户端。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 获取 HTTP 状态 500 ? 将 tomcat 7 升级到 8 时出现内部服务器错误 - Getting HTTP Status 500 ? Internal Server Error while upgrading tomcat 7 to 8 http put的AngularJS(500内部服务器错误) - AngularJS (500 Internal Server Error) for http put 问:$ http放500 :(内部服务器错误)? - Q:500 (Internal Server Error) at $http put? AJAX错误状态码500内部服务器错误 - AJAX error status code 500 internal server error 内部服务器错误500 - Internal Server Error 500 内部服务器错误(500) - Internal Server Error (500) GET http://localhost:3000/posts/timeline/(objId) 500 (Internal Server Error) - Uncaught (in promise) AxiosError {'Request failed with status code 500' - GET http://localhost:3000/posts/timeline/(objId) 500 (Internal Server Error) - Uncaught (in promise) AxiosError {'Request failed with status code 500' 加载资源失败:服务器响应状态为500(内部服务器错误 - Failed to load resource: the server responded with a status of 500 (Internal Server Error 使用Ajax时500内部服务器错误 - 500 internal server error when using ajax status: 500 Internal Server Error postman 在正文中输入数据时仅发布空大括号 - status : 500 Internal Server Error postman only posts empty curly brackets when enter the data on the body
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM