Deployment 是否可以在Wildfly中将数据源部署描述符与驱动程序模块一起使用?
我无法使用“*-ds.xml”部署描述符配置数据源,数据库驱动程序作为模块安装。 只有将数据库驱动程序直接部署为jar时,datasource*-ds.xml文件才有效。 我认为,如果选择将驱动程序作为模块安装,则必须直接在standalone.xml中配置数据源。Deployment 是否可以在Wildfly中将数据源部署描述符与驱动程序模块一起使用?,deployment,datasource,wildfly,Deployment,Datasource,Wildfly,我无法使用“*-ds.xml”部署描述符配置数据源,数据库驱动程序作为模块安装。 只有将数据库驱动程序直接部署为jar时,datasource*-ds.xml文件才有效。 我认为,如果选择将驱动程序作为模块安装,则必须直接在standalone.xml中配置数据源。 我想要解决方案驱动程序模块+部署描述符。要使您的模块对应用程序可见,您需要将模块导入应用程序。应用程序的WEB-INF中需要jboss-deployment-structure.xml,如下所示: <?xml version=
我想要解决方案驱动程序模块+部署描述符。要使您的模块对应用程序可见,您需要将模块导入应用程序。应用程序的WEB-INF中需要jboss-deployment-structure.xml,如下所示:
<?xml version="1.0"?>
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="org.postgresql" services="export">
<imports>
<include path="META-INF**"/>
<include path="org**"/>
<!-- assuming package of the driver is org.something -->
</imports>
</module>
</dependencies>
</deployment>
</jboss-deployment-structure>
之后,模块和驱动程序应该对您的应用程序以及您的*-ds.xml可见
这是在*-ds.xml中表示希望使用模块驱动程序的方式:
<driver name="postgresql" module="org.postgresql">
<xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
</driver>
org.postgresql.xa.PGXADataSource
(示例使用postgresql配置,因为您似乎正在使用该配置)
编辑:将以下内容作为postgresql-ds.xml进行测试:
<datasources xmlns="http://www.jboss.org/ironjacamar/schema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.jboss.org/ironjacamar/schema http://docs.jboss.org/ironjacamar/schema/datasources_1_1.xsd">
<datasource jndi-name="java:jboss/datasources/PostgeSQLDB " pool-name="PostgreSQLPool">
<connection-url>jdbc:postgresql://localhost:5432/example
</connection-url>
<driver>postgres</driver>
<pool>
<max-pool-size>30</max-pool-size>
</pool>
<security>
<user-name>postgresql</user-name>
<password>postgresql</password>
</security>
</datasource>
<drivers>
<driver name="postgresql" module="org.postgresql">
<xa-datasource-class>org.postgresql.xa.PGXADataSource
</xa-datasource-class>
</driver>
</drivers>
</datasources>
jdbc:postgresql://localhost:5432/example
博士后
30
postgresql
postgresql
org.postgresql.xa.PGXADataSource
然而,对于Wildfly 10,它给出了以下信息:
20:17:22,895 WARN [org.jboss.as.connector] (MSC service thread 1-2) WFLYJCA0091: -ds.xml file deployments are deprecated. Support
may be removed in a future version.
20:17:23,058 WARN [org.jboss.as.connector.deployer.dsdeployer] (MSC service thread 1-1) WFLYJCA0012: <drivers/> in standalone -ds
.xml deployments aren't supported: Ignoring my-spring-app.war
20:17:22895警告[org.jboss.as.connector](MSC服务线程1-2)WFLYJCA0091:-ds.xml文件部署不推荐使用。支持
可能在将来的版本中删除。
20:17:23058警告[org.jboss.as.connector.deployer.dsdeployer](MSC服务线程1-1)WFLYJCA0012:独立-ds
.xml部署不受支持:忽略my-spring-app.war
我还在Wildfly 8.1上进行了测试,其中的消息是相同的。因此,似乎不支持在-ds.xml中部署数据源配置,您需要在standalone.xml中创建它,并引用其中的模块。似乎证实了这一点
链接还指出,您可以使用.ear/.war描述符定义数据源,这可能更适合您的用例。我使用.war文件和web.xml创建了一个示例,位于和。可以说,它甚至比-ds.xml更好,因为它是一个标准。多亏了eis,我将jboss部署描述符放在ear归档文件的META-INF文件夹中,它才得以工作:-) 无论如何,现在我必须将驱动程序直接放在standalone.xml文件中:
<driver name="postgresql-9_2-1002_jdbc4_jar" module="org.postgresql">
<driver-class>org.postgresql.Driver</driver-class>
</driver>
org.postgresql.Driver
通过jar部署,我可以直接将其放入*-ds.xml文件中。我认为这是可能的。我不会放弃。您是否已将db驱动程序模块导入应用程序?导入是什么意思?我刚刚将module.xml和jar文件放在modules/org/postgresql/main文件夹中。到目前为止,我只能让module+standalone.xml或deployment描述符+jar部署工作。但不是模块+部署描述符查看我的更新-不幸的是,这似乎不可能。但是有一种替代方案可能更适合您。尽管日志消息说“已弃用”,但在*-ds.xml文件中使用datasource+驱动程序的解决方案仅在wildfly 8.X中有效。对于JBoss7,它不起作用。我无法让它与xa数据源类一起工作。如果有,我会调查更多time@LauraLiparulo我的主要观点不是关于不推荐的消息,而是关于下一条消息。它说定义驱动程序所需的部分不受支持。但是,您应该能够使用.ear/war描述符获得类似的功能。使用Wildfly 10.0.0.Final,我只在standalone.xml中获得带有驱动程序的WFLYJCA0091警告,在*-ds.xml中获得数据源。目前,我不会使用web.xml来解决这个问题,因为我的数据源有很多配置标签,它可以与wildfly 8.2.1和wildfly 10.0.X一起使用。有一段时间我们应该在这家公司了解:-)@Eis谢谢你是的,在standalone.xml中有驱动程序,它也应该工作。不支持的是*-ds.xml中的驱动程序。好的,很高兴能帮上忙:)