0

I am having issues when I am running Ofbiz it is throwing this error:

HTTP Status 500 – Internal Server Error Type Exception Report

Message Could not get next sequenced ID for sequence name: Visit

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

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

<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>
NickJ
  • 1
  • I dont know if it helps, but I also get this error when I run a ./gradlew cleanAll loadAll /root/.gradle/caches/modules-2/files-2.1/com.googlecode.concurrentlinkedhashmap/concurrentlinkedhashmap-lru/1.4.2/2eaf3d3c9746d526ff7e5b93931d482c3887e6ac/concurrentlinkedhashmap-lru-1.4.2.jar(com/googlecode/concurrentlinkedhashmap/ConcurrentLinkedHashMap.class): warning: Cannot find annotation method 'value()' in type 'GuardedBy' It then fails with the following error Process 'command '/usr/lib/jvm/java-8-openjdk-amd64/bin/java'' finished with non-zero exit value 1 – NickJ Jan 10 '19 at 11:10
  • You can also use Apache OFBiz user mailing list for such queries. https://ofbiz.apache.org/mailing-lists.html – Aditya Sharma Jan 11 '19 at 12:38
  • Which OFBiz version you are using? – Aditya Sharma Jan 11 '19 at 12:38

2 Answers2

0

The cause here is easy to explain: you are auto-generating ids, which have already been taken. 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.

You can fix this by updating the nextseqId value (there is a table for it).

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,

0

Your first <delegator> opening tag is not seen in the code you have attached for entityengine.xml. 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. Also, please check if you are able to access your DB outside of Ofbiz. ie through a DB client like SQL Yog.

Adorable
  • 5
  • 4