JBAS010441: Failed to load module for driver [org.postgresql]

ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 31) JBAS014613: Operation ("add") failed - address: ([    
    ("subsystem" => "datasources"),     
    ("jdbc-driver" => "PostgresJDBCDriver") 
]) - failure description: "JBAS010441: Failed to load module for driver [org.postgresql]"

I am getting above error while running my server. I am using JBoss server.


I found the answer right here on StackOverflow: How to add PostgreSQL datasource to WildFly 9.0?

After reading from the above link I realized that I was missing the postgres directory. So then I created the directory: /postgres/main/ in here : $JBOSS_HOME/modules/org/postgres/main/ and created the module.xml file. Then copy and paste the postgres driver to the same directory. Restart JBoss and it should work properly.