JBoss 7上的JDBC Postgresql驱动程序

时间:2013-02-14 11:35:13

标签: jdbc jboss7.x postgresql-9.2

根据How to connect Jboss-as-7.1.1 with Postgresql中的说明将Postgresql JDBC部署到JBoss 7.1.1 Final模块中。

  1. 创建路径$ JBOSS_HOME / modules / org / postgresql / main
  2. 在$ 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. 进入同一目录下的postgresql-9.2-1002.jdbc4.jar

  4. 通过运行$ JBOSS_HOME / bin / jboss-cli --connect打开jboss-cli并运行命令:

    /subsystem=datasources/jdbc-driver=postgresql-driver:add(driver-name=postgresql-driver, driver-class-name=org.postgresql.Driver, driver-module-name=org.postgresql)
    
  5. 收到此错误后:

        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 个答案:

答案 0 :(得分:0)

尝试定义要添加驱动程序的配置文件。此命令在完整配置文件中附加新驱动程序:

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