Uploaded image for project: 'Application Server 7'
  1. Application Server 7
  2. AS7-2538

The jboss-javaee6-ear-webapp Maven archetype generates a project that can cause a database duplicate key conflict

    XMLWordPrintable

Details

    Description

      I created the the kitchensink-ear project using the jboss-javaee6-ear-webapp archetype.
      I built and deployed the application to a server where the kitchensink quickstart was already deployed.
      When I restarted my server, I got a JdbcSQLException:
      org.h2.jdbc.JdbcSQLException: Unique index or primary key violation:
      "PRIMARY_KEY_8 ON PUBLIC.MEMBER(ID)"; SQL statement:
      insert into Member (id, name, email, phone_number) values (0, 'John Smith',
      'john.smith@mailinator.com', '2125551212')
      Unfortunately there is no way to know if the kitchensink is also deployed to the server so it is easy to run into a conflict with the 'id' column.

      We need to make the following 2 changes to the archetype:

      1. We need to rename the table to avoid conflict. I checked in kitchensink-ear with the table renamed to "Registrant". This required renaming 5 files and changing all "member" references to "registrant". This can be found here: https://github.com/sgilda/quickstart

      2. We also need to change the index.xhtml message to say "You have successfully deployed a Java EE 6 Enterprise application on JBoss AS 7". This uses the EAR archetype so it is an Enterprise application and not just a web application.

      Attachments

        Activity

          People

            pmuiratbleepbleep Pete Muir (Inactive)
            sgilda_jira Sande Gilda (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: