JDBC Postgresql driver on JBoss 7

2019-08-03 16:41发布

问题:

Deploying Postgresql JDBC into JBoss 7.1.1 Final as a module according to the instructions given in How to connect Jboss-as-7.1.1 with Postgresql .

  1. Created the path $JBOSS_HOME/modules/org/postgresql/main
  2. In $JBOSS_HOME/modules/org/postgresql/main/modules.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <module xmlns="urn:jboss:module:1.1" name="org.postgresql">
     <resources>
         <resource-root path="postgresql-9.2-1002.jdbc4.jar"/>
     </resources>
     <dependencies>
         <module name="javax.api"/>
         <module name="javax.transaction.api"/>
         <module name="javax.servlet.api" optional="true"/>
     </dependencies>
    </module>
    
  3. Into the same directory placed postgresql-9.2-1002.jdbc4.jar

  4. Opened jboss-cli by running $JBOSS_HOME/bin/jboss-cli --connect and ran the command:

    /subsystem=datasources/jdbc-driver=postgresql-driver:add(driver-name=postgresql-driver, driver-class-name=org.postgresql.Driver, driver-module-name=org.postgresql)
    

After it got this error:

    Failed to get the list of the operation properties: "JBAS010850: No
    handler for operation read-operation-description at address [
    ("subsystem" => "datasources"),
    ("jdbc-driver" => "postgresql-driver") ]"

回答1:

Try to define profile where you want to append a driver. This command appends a new driver in the full profile:

/profile=full/subsystem=datasources/jdbc-driver=postgresql-driver:add(driver-name=postgresql-driver, driver-class-name=org.postgresql.Driver, driver-module-name=org.postgresql)