0 Replies Latest reply on Sep 1, 2015 3:23 PM by magick93

    Attempt to add module - poor and misleading error messages

    magick93

      Hello

       

      I am trying to add the postgres driver to Wildfly 9.

       

      Here is my console output.

       

      [jboss@07138d81d831 bin]$ ./jboss-cli.sh --connect
      [standalone@localhost:9990 /] module add --name=org.postgresql --slot=main --resources=/opt/jboss/wildfly/postgresql-9.4-1201.jdbc41.jar --dependencies=javax.api,javax.transaction.api
      Module org.postgresql already exists at /opt/jboss/wildfly/modules/org/postgresql/main
      [standalone@localhost:9990 /] module add --name=org.postgresql --slot=main --resources=/opt/jboss/wildfly/postgresql-9.4-1201.jdbc41.jar --dependencies=javax.api,javax.transaction.api
      Module org.postgresql already exists at /opt/jboss/wildfly/modules/org/postgresql/main
      [standalone@localhost:9990 /] exit
      
      
      [jboss@07138d81d831 bin]$ cd ..
      [jboss@07138d81d831 wildfly]$ cd modules/
      [jboss@07138d81d831 modules]$ ls
      layers.conf  org  system
      [jboss@07138d81d831 modules]$ rm org
      rm: cannot remove 'org': Is a directory
      [jboss@07138d81d831 modules]$ rm org -r
      [jboss@07138d81d831 modules]$ ls
      layers.conf  system
      [jboss@07138d81d831 modules]$ cd ..
      [jboss@07138d81d831 wildfly]$ cd bin/
      [jboss@07138d81d831 bin]$ ./jboss-cli.sh
      You are disconnected at the moment. Type 'connect' to connect to the server or 'help' for the list of supported commands.
      [disconnected /] connect
      [standalone@localhost:9990 /] module add --name=org.postgresql --slot=main --resources=/opt/jboss/wildfly/postgresql-9.4-1201.jdbc41.jar --dependencies=javax.api,javax.transaction.api
      Failed to locate the file on the filesystem copying /opt/jboss/wildfly/postgresql-9.4-1201.jdbc41.jar to /opt/jboss/wildfly/modules/org/postgresql/main/postgresql-9.4-1201.jdbc41.jar: /opt/jboss/wildfly/postgresql-9.4-1201.jdbc41.jar (Permission denied)
      
      

      Permission denied? Strange. What user do I need to be? What permissions do I need?

      Do you fail to locate it, or is it a permissions issue????

      One of these is likely incorrect. See below where I list the directory contents - it looks like the path to the jar IS correct. So, an incorrect error message.

       

       

       

      Now - I run the exact same command again.

       

      [standalone@localhost:9990 /] module add --name=org.postgresql --slot=main --resources=/opt/jboss/wildfly/postgresql-9.4-1201.jdbc41.jar --dependencies=javax.api,javax.transaction.api
      Module org.postgresql already exists at /opt/jboss/wildfly/modules/org/postgresql/main
      
      

      So, did the previous attempt work after all? Well unfortunately no - Wildfly creates the directories in the module directory, but does not copy the driver, does not create the xml file. So another incorrect message.

       

      [standalone@localhost:9990 /] exit
      [jboss@07138d81d831 bin]$ cd /opt/jboss/wildfly/
      [jboss@07138d81d831 wildfly]$ ls
      LICENSE.txt  README.txt  appclient  bin  copyright.txt docs  domain  jboss-modules.jar  modules  postgresql-9.4-1201.jdbc41.jar  quickstarts  standalone  welcome-content
      [jboss@07138d81d831 wildfly]$ exit
      
      

       

       

      So, what is the correct - easy - way to add the postgres driver? And whats with the misleading error messages?

       

      Updates

       

      When I run:

      module add --name=org.postgres --resources=/opt/jboss/wildfly/psql-jdbc.jar --dependencies=javax.api,javax.transaction.api 

       

      I get the following:

       

      wf_1 | 19:19:32,536 ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 34) WFLYCTL0013: Operation ("add") failed - address: ([

      wf_1 |     ("subsystem" => "datasources"),

      wf_1 |     ("jdbc-driver" => "postgresql")

      wf_1 | ]) - failure description: "WFLYJCA0041: Failed to load module for driver [org.postgresql.jdbc]"

       

      Why is it failing to load? At this stage it is just trial and error. There is nothing useful in these error messages.