10 Replies Latest reply: May 15, 2012 11:08 PM by Tony Kaska RSS

    Problems to get the Seam 3 examples working with AS 7 and PostgreSQL backend

    Tony Kaska Newbie

      I am trying to run the Seam 3 examples in AS 7 and PostgreSQL backend. Specifically I am trying to get the IDMCONSOLE example and then Seambooking example to run with PostgreSQL backend instead of the default H2. But I am not able to.

       

      I have successfully created the PostgreSQL data source. (Thanks to this discussion group)

       

      Now I try to use this data source and the updated the persistence.xml as follows. But I do not see any updates to my PostgreSQL database. I think <property name="hibernate.hbm2ddl.auto" value="update"/> from persistence.xml is working as I am able preserve new users added to the database. But I think it is happening in the default H2 database than PostgreSQL. I will appreciate any help. Thank you.

       

      <?xml version="1.0" encoding="UTF-8"?>

      <persistence xmlns="http://java.sun.com/xml/ns/persistence"

                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                   xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"

                   version="2.0">

          <persistence-unit name="idmconsoleDatabase">

              <jta-data-source>java:/PostgresDS</jta-data-source>

              <properties>

                  <!-- Properties for Hibernate (default provider for JBoss AS) -->

                      <property name="hibernate.hbm2ddl.auto" value="update"/>

                      <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>

                      <property name="hibernate.show_sql" value="false"/>

                      <property name="hibernate.format_sql" value="false"/>

                      <property name="hibernate.use_sql_comments" value="false"/>

              </properties>

          </persistence-unit>

      </persistence>

        • 1. Re: Problems to get the Seam 3 examples working with AS 7 and PostgreSQL backend
          Scott Marlow Master

          Try enabling TRACE logging for org.jboss.as.jpa and org.hibernate (follow instructions here).  The log output will be in as7/standalone/log/server.log (you can restart the AS7 app server after configuring the logging settings).  The trace output will give you a better idea of what is occurring when you deploy and use the demo app.

           

          If that doesn't help, try switching to the latest AS7 build (download from here).

           

          If that doesn't help, write back with more details here.  Include any error exceptions that show up in the AS7 console and the datasource definition (without the password).

          • 2. Re: Problems to get the Seam 3 examples working with AS 7 and PostgreSQL backend
            Tony Kaska Newbie

            Thank you for the quick response. I tried turning on the log. I have enclosed the extract of the log file as attachement here. But I see the interesting portion of the log. I am not referring to ExampleDS in my persistence.xml at all. It shows up in the log. I do not know how. Any insight will help. Meanwhile I will try to download the latest AS 7 build and try and let you know more. Thank you again.

             

            22:04:07,325 TRACE [org.jboss.as.jpa] (MSC service thread 1-7) PersistenceUnitMetadataImpl(version=2.0) [

                      name: idmconsoleDatabase

                      jtaDataSource: java:jboss/datasources/ExampleDS

                      nonJtaDataSource: null

                      transactionType: JTA

                      provider: org.hibernate.ejb.HibernatePersistence

                      classes[

                      ]

                      packages[

                      ]

                      mappingFiles[

                      ]

                      jarFiles[

                      ]

                      validation-mode: AUTO

                      shared-cache-mode: UNSPECIFIED

                      properties[

                                hibernate.dialect: org.hibernate.dialect.HSQLDialect

                                hibernate.hbm2ddl.auto: create-drop

                      ]]

            • 3. Re: Problems to get the Seam 3 examples working with AS 7 and PostgreSQL backend
              Tony Kaska Newbie

              There are WARs using ExampleDS datasource. Should idmconsole be forced use same datasource?

              • 4. Re: Problems to get the Seam 3 examples working with AS 7 and PostgreSQL backend
                Tony Kaska Newbie

                I tried the lattest build as suggested by Scott. First of all I could not even build. Please see the errors below. Let me know how I can try this better. Thank you.

                 

                [INFO] Scanning for projects...

                [WARNING]

                [WARNING] Some problems were encountered while building the effective model for

                org.jboss.seam.security:seam-security-example-idmconsole:war:3.2.0-SNAPSHOT

                [WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-fail

                safe-plugin is missing. @ line 287, column 29

                [WARNING]

                [WARNING] It is highly recommended to fix these problems because they threaten t

                he stability of your build.

                [WARNING]

                [WARNING] For this reason, future Maven versions might no longer support buildin

                g such malformed projects.

                [WARNING]

                [INFO]

                [INFO] ------------------------------------------------------------------------

                [INFO] Building Seam Security Identity Management Console Example 3.2.0-SNAPSHOT

                 

                 

                [INFO] ------------------------------------------------------------------------

                [INFO]

                [INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ seam-security-exampl

                e-idmconsole ---

                [INFO] Deleting C:\Users\tk\seam3\examples\idmconsole\target

                [INFO]

                [INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ seam-secur

                ity-example-idmconsole ---

                [debug] execute contextualize

                [INFO] Using 'UTF-8' encoding to copy filtered resources.

                [INFO] Copying 1 resource

                [INFO]

                [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ seam-security

                -example-idmconsole ---

                [INFO] Compiling 22 source files to C:\Users\tk\seam3\examples\idmconsole\

                target\classes

                [INFO]

                [INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ se

                am-security-example-idmconsole ---

                [debug] execute contextualize

                [INFO] Using 'UTF-8' encoding to copy filtered resources.

                [INFO] skip non existing resourceDirectory C:\Users\tk\seam3\examples\idmc

                onsole\src\test\resources

                [INFO]

                [INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ seam-

                security-example-idmconsole ---

                [INFO] Compiling 1 source file to C:\Users\tk\seam3\examples\idmconsole\ta

                rget\test-classes

                [INFO]

                [INFO] --- maven-surefire-plugin:2.9:test (default-test) @ seam-security-example

                -idmconsole ---

                [INFO] Tests are skipped.

                [INFO]

                [INFO] --- maven-war-plugin:2.1.1:war (default-war) @ seam-security-example-idmc

                onsole ---

                [INFO] Packaging webapp

                [INFO] Assembling webapp [seam-security-example-idmconsole] in [C:\Users\aananda

                n\seam3\examples\idmconsole\target\security-idmconsole]

                [INFO] Processing war project

                [INFO] Copying webapp webResources [C:\Users\tk\seam3\examples\idmconsole\

                src/main/resources-jbossas7] to [C:\Users\tk\seam3\examples\idmconsole\tar

                get\security-idmconsole]

                [INFO] Copying webapp resources [C:\Users\tk\seam3\examples\idmconsole\src

                \main\webapp]

                [INFO] Webapp assembled in [307 msecs]

                [INFO] Building war: C:\Users\tk\seam3\examples\idmconsole\target\security

                -idmconsole.war

                [WARNING] Warning: selected war files include a WEB-INF/web.xml which will be ig

                nored

                (webxml attribute is missing from war task, or ignoreWebxml attribute is specifi

                ed as 'true')

                [INFO]

                [INFO] --- maven-failsafe-plugin:2.12:integration-test (integration-test) @ seam

                -security-example-idmconsole ---

                [INFO] Failsafe report directory: C:\Users\tk\seam3\examples\idmconsole\ta

                rget\failsafe-reports

                 

                 

                -------------------------------------------------------

                T E S T S

                -------------------------------------------------------

                Running org.jboss.seam.security.examples.idmconsole.ftest.IdmConsoleTest

                log4j:WARN No appenders could be found for logger (org.jboss.logging).

                log4j:WARN Please initialize the log4j system properly.

                log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more in

                fo.

                Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.926 sec <<< FA

                ILURE!

                 

                 

                Results :

                 

                 

                Tests in error:

                  org.jboss.seam.security.examples.idmconsole.ftest.IdmConsoleTest: Unable to st

                art Selenium Server

                 

                 

                Tests run: 1, Failures: 0, Errors: 1, Skipped: 0

                 

                 

                [INFO]

                [INFO] >>> maven-source-plugin:2.1.2:jar (attach-sources) @ seam-security-exampl

                e-idmconsole >>>

                [INFO]

                [INFO] <<< maven-source-plugin:2.1.2:jar (attach-sources) @ seam-security-exampl

                e-idmconsole <<<

                [INFO]

                [INFO] --- maven-source-plugin:2.1.2:jar (attach-sources) @ seam-security-exampl

                e-idmconsole ---

                [INFO] Building jar: C:\Users\tk\seam3\examples\idmconsole\target\security

                -idmconsole-sources.jar

                [INFO]

                [INFO] --- maven-failsafe-plugin:2.12:verify (verify) @ seam-security-example-id

                mconsole ---

                [INFO] Failsafe report directory: C:\Users\tk\seam3\examples\idmconsole\ta

                rget\failsafe-reports

                [INFO] ------------------------------------------------------------------------

                [INFO] BUILD FAILURE

                [INFO] ------------------------------------------------------------------------

                [INFO] Total time: 8.801s

                [INFO] Finished at: Sun May 06 15:58:51 CDT 2012

                [INFO] Final Memory: 26M/66M

                [INFO] ------------------------------------------------------------------------

                [ERROR] Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:2.

                12:verify (verify) on project seam-security-example-idmconsole: There are test f

                ailures.

                [ERROR]

                [ERROR] Please refer to C:\Users\tk\seam3\examples\idmconsole\target\fails

                afe-reports for the individual test results.

                [ERROR] -> [Help 1]

                [ERROR]

                [ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit

                ch.

                [ERROR] Re-run Maven using the -X switch to enable full debug logging.

                [ERROR]

                [ERROR] For more information about the errors and possible solutions, please rea

                d the following articles:

                [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureExc

                eption

                • 5. Re: Problems to get the Seam 3 examples working with AS 7 and PostgreSQL backend
                  jaikiran pai Master

                  Tony Kaska wrote:

                   

                  I tried the lattest build as suggested by Scott. First of all I could not even build. Please see the errors below. Let me know how I can try this better. Thank you.

                   

                  Actually you don't have to build it yourself. Follow the link that Scott pointed you to and just download the already build latest binary and just use it like you would use a released JBoss AS version.

                  • 6. Re: Problems to get the Seam 3 examples working with AS 7 and PostgreSQL backend
                    Tony Kaska Newbie

                    TThank you. I am not building the application server. I am using the application server from the link pointed by Scott. I was trying to rebuild the IDMCONSOLE application. That is the only way I know I could get the application loaded in the server. That is when I get this build error. I have known to have the war files in deployment directory to get them running the application server. But the seam3 examples are magically running from somewhere. I have not figured out that yet. If you can point that out I will really appreciate it. I see there are entrees of the IDMCONSOLE.WAR mentioned in the standalone.xml deployment section. I do not understand anything further. The reason I am rebuilding the IDMCONSOLE sample again is so that I can load it to the new application server I downloaded from Scotts link. I do not know how to move the war file from the older server installation to the new server and get it running. Hope I am making it clear. Thank you again.

                    • 7. Re: Problems to get the Seam 3 examples working with AS 7 and PostgreSQL backend
                      Scott Marlow Master

                      Try finding the idmconsole.war file (it should be in a subfolder under the idmconsole source folder that you are building from).  You can copy it from there to the as7/standalone/deployments folder. 

                       

                      In addition, verify that the contents of the idmconsole.war are what you are expecting.  Do something like:

                      1. mkdir \FOO
                      2. copy IDMCONSOLE.WAR \FOO
                      3. cd \FOO
                      4. jar xf IDMCONSOLE.WAR

                       

                      The above will extract the contents of IDMCONSOLE.WAR in your \FOO folder (I assume your using Windows since you used upper case).  Then you can look at the persistence.xml and see if its what you expected.  If not, my first guess is that maybe you didn't change the persistence.xml source (instead you changed the one that gets built by maven).

                      • 8. Re: Problems to get the Seam 3 examples working with AS 7 and PostgreSQL backend
                        Tony Kaska Newbie

                        Scott, Thank you for the quick followup. But I was out with a customer all day who was 3 hours away. So I could get to it just now.

                         

                        If I take the current build and try that I am able to get this working. However I could not get this working with 7.1.1

                         

                        Should we assume this was a bug in 7.1.1 and subsequently resolved in 7.1.2 snapshot?

                         

                        I also tried to create a persistence using Forge. I faced the same problem in 7.1.1. So I strongly feel PostgreSQL connectivity is a problem with 7.1.1.

                         

                        Also I am wondering when is 7.1.2 planned to be official. Please advise. Thank you.

                        • 9. Re: Problems to get the Seam 3 examples working with AS 7 and PostgreSQL backend
                          Tony Kaska Newbie

                          Please ignore this issue as an user error. I am a SQL Server guy predominantly with experience in Microsoft stack. New to PostgreSQL and JBoss. I did not realize PostgreSQL table names are case sensitive. Once I fixed it 7.1.1 also works.

                          • 10. Re: Problems to get the Seam 3 examples working with AS 7 and PostgreSQL backend
                            Tony Kaska Newbie

                            Scott,

                             

                            I am sorry again. Actually 7.1.1 final is not working with PostgreSQL backend.  I think I did not test properly in 7.1.1. I am able to consistently reproduce PostgreSQL backend not working. If I move the same VAR to the current build which I downloaded last week it works. So 7.1.1 has connectivity problems with PostgreSQL. Please let me know if you want to me test anything more or suggestions for next step. I am counting on JBoss AS 7 for my next big thing. I need a version that works well with PostgreSQL. Please let me know. Thank you.

                             

                            Tony