使用JdbcSQLException Jhipster应用程序启动失败该对象已关闭[90007-190]

时间:2016-01-20 21:49:44

标签: jhipster

我已经问了一个关于这个问题的问题。我在三个不同的数据库(H2,MYSQL,Postgre)和两个操作系统上尝试了这个。该应用程序的工作方式与没有自定义实体所以我可以追溯到我的实体文件。

我认为值得指出的是,我使用提供的生成器完成了所有实体生成。我还遵循建议的步骤(生成多对多的顺序等)。我真的不知道该做什么。

这是Log(Windows 10下的H2):

Caused by: org.h2.jdbc.JdbcSQLException: Das Objekt wurde bereits geschlossen
The object is already closed [90007-190]
    at org.h2.message.DbException.getJdbcSQLException(DbException.java:345) ~[h2-1.4.190.jar:1.4.190]
    at org.h2.message.DbException.get(DbException.java:179) ~[h2-1.4.190.jar:1.4.190]
    at org.h2.message.DbException.get(DbException.java:155) ~[h2-1.4.190.jar:1.4.190]
    at org.h2.message.DbException.get(DbException.java:144) ~[h2-1.4.190.jar:1.4.190]
    at org.h2.jdbc.JdbcConnection.checkClosed(JdbcConnection.java:1465) ~[h2-1.4.190.jar:1.4.190]
    at org.h2.jdbc.JdbcConnection.checkClosed(JdbcConnection.java:1443) ~[h2-1.4.190.jar:1.4.190]
    at org.h2.jdbc.JdbcConnection.setAutoCommit(JdbcConnection.java:427) ~[h2-1.4.190.jar:1.4.190]
    at com.zaxxer.hikari.proxy.ConnectionProxy.setAutoCommit(ConnectionProxy.java:334) ~[HikariCP-2.4.1.jar:na]
    at com.zaxxer.hikari.proxy.HikariConnectionProxy.setAutoCommit(HikariConnectionProxy.java) ~[HikariCP-2.4.1.jar:na]
    at liquibase.database.jvm.JdbcConnection.setAutoCommit(JdbcConnection.java:361) ~[liquibase-core-3.4.2.jar:na]
    ... 7 common frames omitted

2016-01-20 22:03:49.020 ERROR 6432 --- [  restartedMain] o.s.boot.SpringApplication               : Application startup failed

这是我的实体文件: Game.json

{
    "relationships": [
        {
            "relationshipId": 1,
            "relationshipName": "frame",
            "otherEntityName": "frame",
            "relationshipType": "one-to-many",
            "otherEntityRelationshipName": "game"
        },
        {
            "relationshipId": 2,
            "relationshipName": "lane",
            "otherEntityName": "lane",
            "relationshipType": "one-to-one",
            "ownerSide": false,
            "otherEntityRelationshipName": "game"
        },
        {
            "relationshipId": 3,
            "relationshipName": "player",
            "otherEntityName": "player",
            "relationshipType": "many-to-many",
            "ownerSide": false,
            "otherEntityRelationshipName": "game"
        }
    ],
    "fields": [
        {
            "fieldId": 1,
            "fieldName": "gameCount",
            "fieldType": "Integer"
        },
        {
            "fieldId": 2,
            "fieldName": "shotCount",
            "fieldType": "Integer"
        },
        {
            "fieldId": 3,
            "fieldName": "totalShotCount",
            "fieldType": "Integer"
        },
        {
            "fieldId": 4,
            "fieldName": "frameCount",
            "fieldType": "Integer"
        }
    ],
    "changelogDate": "20160120203457",
    "dto": "mapstruct",
    "service": "no",
    "pagination": "pager"
}

Lane.json

{
    "relationships": [
        {
            "relationshipId": 1,
            "relationshipName": "game",
            "otherEntityName": "game",
            "relationshipType": "one-to-one",
            "otherEntityField": "id",
            "ownerSide": true,
            "otherEntityRelationshipName": "lane"
        }
    ],
    "fields": [
        {
            "fieldId": 1,
            "fieldName": "activated",
            "fieldType": "Boolean"
        },
        {
            "fieldId": 2,
            "fieldName": "number",
            "fieldType": "Integer"
        }
    ],
    "changelogDate": "20160120203923",
    "dto": "mapstruct",
    "service": "no",
    "pagination": "no"
}


{
    "relationships": [
        {
            "relationshipId": 1,
            "relationshipName": "lane",
            "otherEntityName": "lane",
            "relationshipType": "one-to-many",
            "otherEntityRelationshipName": "player"
        },
        {
            "relationshipId": 2,
            "relationshipName": "game",
            "otherEntityName": "game",
            "relationshipType": "many-to-many",
            "otherEntityField": "id",
            "ownerSide": true
        },
        {
            "relationshipId": 3,
            "relationshipName": "shot",
            "otherEntityName": "shot",
            "relationshipType": "one-to-many",
            "otherEntityRelationshipName": "player"
        }
    ],
    "fields": [
        {
            "fieldId": 1,
            "fieldName": "name",
            "fieldType": "String"
        },
        {
            "fieldId": 2,
            "fieldName": "active",
            "fieldType": "Boolean"
        }
    ],
    "changelogDate": "20160120204127",
    "dto": "mapstruct",
    "service": "no",
    "pagination": "pagination"
}

Frame.json

{
    "relationships": [
        {
            "relationshipId": 1,
            "relationshipName": "frame",
            "otherEntityName": "frame",
            "relationshipType": "many-to-one",
            "otherEntityField": "id"
        },
        {
            "relationshipId": 2,
            "relationshipName": "player",
            "otherEntityName": "player",
            "relationshipType": "many-to-one",
            "otherEntityField": "id"
        }
    ],
    "fields": [
        {
            "fieldId": 1,
            "fieldName": "shotValue",
            "fieldType": "Integer"
        },
        {
            "fieldId": 2,
            "fieldName": "created",
            "fieldType": "LocalDate"
        },
        {
            "fieldId": 3,
            "fieldName": "shotOrder",
            "fieldType": "Integer"
        }
    ],
    "changelogDate": "20160120204549",
    "dto": "mapstruct",
    "service": "no",
    "pagination": "infinite-scroll"
}

Frame.json

{
    "relationships": [
        {
            "relationshipId": 1,
            "relationshipName": "game",
            "otherEntityName": "game",
            "relationshipType": "many-to-one",
            "otherEntityField": "id"
        },
        {
            "relationshipId": 2,
            "relationshipName": "shot",
            "otherEntityName": "shot",
            "relationshipType": "one-to-many",
            "otherEntityRelationshipName": "frame"
        },
        {
            "relationshipId": 3,
            "relationshipName": "player",
            "otherEntityName": "player",
            "relationshipType": "many-to-many",
            "otherEntityField": "id",
            "ownerSide": true
        }
    ],
    "fields": [
        {
            "fieldId": 1,
            "fieldName": "frameNumber",
            "fieldType": "Integer"
        }
    ],
    "changelogDate": "20160120204315",
    "dto": "mapstruct",
    "service": "no",
    "pagination": "infinite-scroll"
}

master.xml

<?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog
    xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd">

    <include file="classpath:config/liquibase/changelog/00000000000000_initial_schema.xml" relativeToChangelogFile="false"/>
    <include file="classpath:config/liquibase/changelog/20160120203457_added_entity_Game.xml" relativeToChangelogFile="false"/>
    <include file="classpath:config/liquibase/changelog/20160120203923_added_entity_Lane.xml" relativeToChangelogFile="false"/>
    <include file="classpath:config/liquibase/changelog/20160120204127_added_entity_Player.xml" relativeToChangelogFile="false"/>
    <include file="classpath:config/liquibase/changelog/20160120204315_added_entity_Frame.xml" relativeToChangelogFile="false"/>
    <include file="classpath:config/liquibase/changelog/20160120204549_added_entity_Shot.xml" relativeToChangelogFile="false"/>
    <!-- jhipster-needle-liquibase-add-changelog - JHipster will add liquibase changelogs here -->
</databaseChangeLog>

xxxx_initial_schema.xml

<?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog
    xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd">

    <include file="classpath:config/liquibase/changelog/00000000000000_initial_schema.xml" relativeToChangelogFile="false"/>
    <include file="classpath:config/liquibase/changelog/20160120203457_added_entity_Game.xml" relativeToChangelogFile="false"/>
    <include file="classpath:config/liquibase/changelog/20160120203923_added_entity_Lane.xml" relativeToChangelogFile="false"/>
    <include file="classpath:config/liquibase/changelog/20160120204127_added_entity_Player.xml" relativeToChangelogFile="false"/>
    <include file="classpath:config/liquibase/changelog/20160120204315_added_entity_Frame.xml" relativeToChangelogFile="false"/>
    <include file="classpath:config/liquibase/changelog/20160120204549_added_entity_Shot.xml" relativeToChangelogFile="false"/>
    <!-- jhipster-needle-liquibase-add-changelog - JHipster will add liquibase changelogs here -->
</databaseChangeLog>

xxxxx_added_entity_Game.xml

<?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog
    xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd">

    <property name="now" value="now()" dbms="mysql,h2"/>
    <property name="now" value="current_timestamp" dbms="postgresql"/>
    <property name="now" value="sysdate" dbms="oracle"/>

    <property name="autoIncrement" value="true" dbms="mysql,h2,postgresql,oracle"/>

    <property name="floatType" value="float4" dbms="postgresql, h2"/>
    <property name="floatType" value="float" dbms="mysql, oracle"/>

    <!--
        Added the entity Game.
    -->
    <changeSet id="20160120203457" author="jhipster">
        <createTable tableName="game">
            <column name="id" type="bigint" autoIncrement="${autoIncrement}">
                <constraints primaryKey="true" nullable="false"/>
            </column>
            <column name="game_count" type="integer"/>
            <column name="shot_count" type="integer"/>
            <column name="total_shot_count" type="integer"/>
            <column name="frame_count" type="integer"/>
        </createTable>

    </changeSet>
</databaseChangeLog>

xxxxx_added_entity_Lane.xml

<?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog
    xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd">

    <property name="now" value="now()" dbms="mysql,h2"/>
    <property name="now" value="current_timestamp" dbms="postgresql"/>
    <property name="now" value="sysdate" dbms="oracle"/>

    <property name="autoIncrement" value="true" dbms="mysql,h2,postgresql,oracle"/>

    <property name="floatType" value="float4" dbms="postgresql, h2"/>
    <property name="floatType" value="float" dbms="mysql, oracle"/>

    <!--
        Added the entity Lane.
    -->
    <changeSet id="20160120203923" author="jhipster">
        <createTable tableName="lane">
            <column name="id" type="bigint" autoIncrement="${autoIncrement}">
                <constraints primaryKey="true" nullable="false"/>
            </column>
            <column name="activated" type="bit"/>
            <column name="number" type="integer"/>
            <column name="game_id" type="bigint">
                <constraints unique="true"/>
            </column>
        </createTable>

        <addForeignKeyConstraint baseColumnNames="game_id"
                                 baseTableName="lane"
                                 constraintName="fk_lane_game_id"
                                 referencedColumnNames="id"
                                 referencedTableName="game"/>

    </changeSet>
</databaseChangeLog>

xxxxx_added_entity_Player.xml

<?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog
    xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd">

    <property name="now" value="now()" dbms="mysql,h2"/>
    <property name="now" value="current_timestamp" dbms="postgresql"/>
    <property name="now" value="sysdate" dbms="oracle"/>

    <property name="autoIncrement" value="true" dbms="mysql,h2,postgresql,oracle"/>

    <property name="floatType" value="float4" dbms="postgresql, h2"/>
    <property name="floatType" value="float" dbms="mysql, oracle"/>

    <!--
        Added the entity Player.
    -->
    <changeSet id="20160120204127" author="jhipster">
        <createTable tableName="player">
            <column name="id" type="bigint" autoIncrement="${autoIncrement}">
                <constraints primaryKey="true" nullable="false"/>
            </column>
            <column name="name" type="varchar(255)"/>
            <column name="active" type="bit"/>
        </createTable>

        <createTable tableName="player_game">
            <column name="games_id" type="bigint">
                <constraints nullable="false"/>
            </column>
            <column name="players_id" type="bigint">
                <constraints nullable="false"/>
            </column>
        </createTable>

        <addPrimaryKey columnNames="players_id, games_id" tableName="player_game"/>

        <addForeignKeyConstraint baseColumnNames="players_id"
                                 baseTableName="player_game"
                                 constraintName="fk_player_game_game_id"
                                 referencedColumnNames="id"
                                 referencedTableName="player"/>

        <addForeignKeyConstraint baseColumnNames="games_id"
                                 baseTableName="player_game"
                                 constraintName="fk_player_game_player_id"
                                 referencedColumnNames="id"
                                 referencedTableName="game"/>

    </changeSet>
</databaseChangeLog>

xxxxx_added_entity_Frame.xml

<?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog
    xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd">

    <property name="now" value="now()" dbms="mysql,h2"/>
    <property name="now" value="current_timestamp" dbms="postgresql"/>
    <property name="now" value="sysdate" dbms="oracle"/>

    <property name="autoIncrement" value="true" dbms="mysql,h2,postgresql,oracle"/>

    <property name="floatType" value="float4" dbms="postgresql, h2"/>
    <property name="floatType" value="float" dbms="mysql, oracle"/>

    <!--
        Added the entity Frame.
    -->
    <changeSet id="20160120204315" author="jhipster">
        <createTable tableName="frame">
            <column name="id" type="bigint" autoIncrement="${autoIncrement}">
                <constraints primaryKey="true" nullable="false"/>
            </column>
            <column name="frame_number" type="integer"/>
            <column name="game_id" type="bigint"/>
        </createTable>

        <addForeignKeyConstraint baseColumnNames="game_id"
                                 baseTableName="frame"
                                 constraintName="fk_frame_game_id"
                                 referencedColumnNames="id"
                                 referencedTableName="game"/>

        <createTable tableName="frame_player">
            <column name="players_id" type="bigint">
                <constraints nullable="false"/>
            </column>
            <column name="frames_id" type="bigint">
                <constraints nullable="false"/>
            </column>
        </createTable>

        <addPrimaryKey columnNames="frames_id, players_id" tableName="frame_player"/>

        <addForeignKeyConstraint baseColumnNames="frames_id"
                                 baseTableName="frame_player"
                                 constraintName="fk_frame_player_player_id"
                                 referencedColumnNames="id"
                                 referencedTableName="frame"/>

        <addForeignKeyConstraint baseColumnNames="players_id"
                                 baseTableName="frame_player"
                                 constraintName="fk_frame_player_frame_id"
                                 referencedColumnNames="id"
                                 referencedTableName="player"/>

    </changeSet>
</databaseChangeLog>

xxxxx_added_entity_Shot.xml

<?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog
    xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd">

    <property name="now" value="now()" dbms="mysql,h2"/>
    <property name="now" value="current_timestamp" dbms="postgresql"/>
    <property name="now" value="sysdate" dbms="oracle"/>

    <property name="autoIncrement" value="true" dbms="mysql,h2,postgresql,oracle"/>

    <property name="floatType" value="float4" dbms="postgresql, h2"/>
    <property name="floatType" value="float" dbms="mysql, oracle"/>

    <!--
        Added the entity Shot.
    -->
    <changeSet id="20160120204549" author="jhipster">
        <createTable tableName="shot">
            <column name="id" type="bigint" autoIncrement="${autoIncrement}">
                <constraints primaryKey="true" nullable="false"/>
            </column>
            <column name="shot_value" type="integer"/>
            <column name="created" type="date"/>
            <column name="shot_order" type="integer"/>
            <column name="frame_id" type="bigint"/>
            <column name="player_id" type="bigint"/>
        </createTable>

        <addForeignKeyConstraint baseColumnNames="frame_id"
                                 baseTableName="shot"
                                 constraintName="fk_shot_frame_id"
                                 referencedColumnNames="id"
                                 referencedTableName="frame"/>

        <addForeignKeyConstraint baseColumnNames="player_id"
                                 baseTableName="shot"
                                 constraintName="fk_shot_player_id"
                                 referencedColumnNames="id"
                                 referencedTableName="player"/>

    </changeSet>
</databaseChangeLog>

我们非常感谢帮助,因为我们希望在JHipster上构建我们的应用程序。

0 个答案:

没有答案