imixs / imixs-jsf-example

Imixs JEE Web Example Application
8 stars 9 forks source link

Deployment fails #49

Closed MatzeKiel closed 3 years ago

MatzeKiel commented 4 years ago

Hi, i was following the WildFly Deployment Guide and can not deploy the .war. I always get the following error:

"WFLYCTL0412: Required services that are not installed:" => ["jboss.naming.context.java.jdbc.workflow"], "WFLYCTL0180: Services with missing/unavailable dependencies" => ["jboss.persistenceunit.\"imixs-jsf-example.war#org.imixs.workflow.jpa\" is missing [jboss.naming.context.java.jdbc.workflow]"]

I even changed the standalone.xml by https://github.com/imixs/imixs-jsf-example/issues/10 to:

                <security-domain name="imixsrealm" cache-type="default">
                    <authentication>
                        <login-module code="UsersRoles" flag="required">
                            <module-option name="usersProperties" value="sampleapp-users.properties"/>
                            <module-option name="rolesProperties" value="sampleapp-roles.properties"/>
                        </login-module>
                        <login-module code="RoleMapping" flag="required">
                            <module-option name="rolesProperties" value="imixsrealm.properties"/>
                            <module-option name="replaceRole" value="false"/>
                        </login-module>
                    </authentication>
                </security-domain>
            </security-domains>

and all three files are located under wildfly\standalone\configuration. The error still occures.

What i made wrong?

rsoika commented 4 years ago

Hi, what you need to configure is the database resources. In your standalone.xml file there should be something like this:

        <datasources>
          .....

            <!-- imixs-workflow datasource -->
            <datasource jta="true" jndi-name="java:/jdbc/workflow" pool-name="workflow" enabled="true" use-ccm="true">
                <connection-url>${env.POSTGRES_CONNECTION}</connection-url>
                <driver-class>org.postgresql.Driver</driver-class>
                <driver>postgresql</driver>
                <security>
                  <user-name>${env.POSTGRES_USER}</user-name>
                  <password>${env.POSTGRES_PASSWORD}</password>
                </security>
                 <validation>
                    <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker"/>
                    <!-- any background-validation-millis > 0 will enable background validation. See https://jira.jboss.org/browse/JBAS-4088. -->
                    <background-validation-millis>60000</background-validation-millis>
                </validation>                
            </datasource>                
            <drivers>
         ......
                <driver name="postgresql" module="org.postgresql">
                    <driver-class>org.postgresql.Driver</driver-class>
                </driver>
            </drivers>
        </datasources>

And of course you need to provide a postgresql driver in this case. You can also use mysql or mariadb. But in any case you need a databasedriver connecting to your database.

You can take a look into the /src/docker/configuration/ folder there a preconfigured standalone.xml files for the different wildfly releases. If you can run docker this will be the easiest way to get started , because in this case you do not need to setup your own server.

See also this blog how to setup postgresql with wildfly.

MatzeKiel commented 4 years ago

Hi rsoika,

postgresql was setuped by your blog tutorial, but i think the "imixs-jsf-example.war" expected a database named only "workflow" and not "workflow-db". After i changed it the deploying process went on. But it stops now by:

354 ERROR [org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 2) WFLYCTL0348: Timeout after [300] seconds waiting for service container stability. Operation will roll back. Step that first updated the service container was 'deploy' at address '[("deployment" => "imixs-jsf-example.war")]' 361 ERROR [org.jboss.as.server] (DeploymentScanner-threads - 2) WFLYSRV0022: Deploy of deployment "imixs-jsf-example.war" was rolled back with no failure message 362 ERROR [org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 2) WFLYCTL0190: Step handler org.jboss.as.server.deployment.DeploymentHandlerUtil$1@3a2f7df3 for operation deploy at address [("deployment" => "imixs-jsf-example.war")] failed handling operation rollback -- java.util.concurrent.TimeoutException: java.util.concurrent.TimeoutException

The imixs-jsf-example.war.failed shows only: "WFLYCTL0063: Composite operation was rolled back"

What ist now the Problem? I followed your instructions: https://github.com/imixs/imixs-workflow/issues/277#issuecomment-309263808

rsoika commented 4 years ago

Yes of course the database names and jdbc names are up to your project and the naming must match in all layers:

  1. the database-pool config in the standalone.xml must match your postgresql setup
  2. the jdbc/pool-name must match your persistence.xml file

We don't make any assumptions in the imixs-workflow project to give the developer the full freedom in setup and configuration. But this makes the setup sometimes more 'interesting' ;-)

If you setup your wildfly server by yourself (not using the docker setup) then you can check your pool configuration first on the wildfly web console (http://localhost:9990). There you can select your pool config and you can make a 'ping'-test to check if wildfly is happy with your postgreSQL server.

The other issue is the setup of the database-module in wildfly. You can take a look into this blog.

At the end I recommend to use docker. With docker you get rid of all the manual setup and config stuff. Wouldn't that be an option for you?