Jboss 操作("add")失败
Jboss Operation("add") failed
我是 Jboss 的新人。我正在尝试使用 Jboss 启动 Spring 引导,但遇到了 postgres 驱动程序问题。当我启动服务器时弹出以下错误并崩溃。
> 13:00:47,681 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
("subsystem" => "datasources"),
("data-source" => "DigitalFarm_DS")
]) - failure description: {
"WFLYCTL0412: Required services that are not installed:" => ["jboss.jdbc-driver.postgresql"],
"WFLYCTL0180: Services with missing/unavailable dependencies" => [
"org.wildfly.data-source.DigitalFarm_DS is missing [jboss.jdbc-driver.postgresql]",
"jboss.driver-demander.java:jboss/datasources/DigitalFarmDS is missing [jboss.jdbc-driver.postgresql]"
]
}
13:00:47,682 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
("subsystem" => "datasources"),
("data-source" => "DigitalFarm_DS")
]) - failure description: {
"WFLYCTL0412: Required services that are not installed:" => [
"jboss.jdbc-driver.postgresql",
"jboss.jdbc-driver.postgresql"
],
还有我的独立文件
<datasources>
<datasource jndi-name="java:jboss/datasources/DigitalFarmDS" pool-name="DigitalFarm_DS" enabled="true" use-java-context="true" statistics-enabled="true">
<connection-url>jdbc:postgresql://localhost:5432/DigitalFarm</connection-url>
<driver>postgresql</driver>
<security>
<user-name>_db_username</user-name>
<password>_db_password_</password>
</security>
</datasource>
<datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true" statistics-enabled="${wildfly.datasources.statistics-enabled:${wildfly.statistics-enabled:false}}">
<connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
<driver>h2</driver>
<security>
<user-name>sa</user-name>
<password>sa</password>
</security>
</datasource>
<drivers>
<driver name="postgresql" module="org.postgresql">
<driver-class>org.postgresql.Driver</driver-class>
<xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
</driver>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
</drivers>
</datasources>
我正在为 wildfly 使用此依赖项
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-websocket</artifactId>
</exclusion>
</exclusions>
</dependency>
请帮助我。你遇到过这样的问题吗?
服务器在您的 class 路径中找不到“postgresql”的驱动程序 jar 的问题。
"WFLYCTL0180: Services with missing/unavailable dependencies" => [
"org.wildfly.data-source.DigitalFarm_DS is missing [jboss.jdbc-driver.postgresql]"
实际上,Jboss中的Datasource子系统默认在应用程序class路径中获取驱动程序class,通过驱动程序部分的模块名称加载。
在 Jboss 中,您可以通过两种方式加载模块:
首先:使用应用部署库
如果您使用 deploymen-scanner (JBOSS_APP//.<[=43),请将 Postgres 驱动程序 jar 添加到您的应用程序部署资源=]>) 结构如下:
app-deployment.war
|_WEB-INF
|_lib
|_postgresql-42.2.5.jar (example version)
二:外部模块
在您的 jboss 实例中创建一个与您的案例中的模块名称匹配的新模块,它应该是这样的:
modules
|_org
|_postgresql
|_main
|_postgresql-42.2.5.jar
|_module.xml
其中module.xml描述了这个新模块的资源(驱动jar文件),例子:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.7" name="org.postgresql">
<resources>
<resource-root path="postgresql-42.2.5.jar.jar"/>
</resources>
<dependencies>
<module name=""/>
...
</dependencies>
</module>
最后,您需要将模块添加到 jboss-deployment-structure.xml (app-deployment/WEB-INF/jboss-deployment-structure.xml) 以被视为外部依赖,同时部署应用程序,示例:
<?xml version='1.0' encoding='UTF-8'?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
<deployment>
<dependencies>
...
<module name="org.postgresql"/>
...
</dependencies>
</deployment>
</jboss-deployment-structure>
当需要外部管理驱动程序时使用此解决方案。
我是 Jboss 的新人。我正在尝试使用 Jboss 启动 Spring 引导,但遇到了 postgres 驱动程序问题。当我启动服务器时弹出以下错误并崩溃。
> 13:00:47,681 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
("subsystem" => "datasources"),
("data-source" => "DigitalFarm_DS")
]) - failure description: {
"WFLYCTL0412: Required services that are not installed:" => ["jboss.jdbc-driver.postgresql"],
"WFLYCTL0180: Services with missing/unavailable dependencies" => [
"org.wildfly.data-source.DigitalFarm_DS is missing [jboss.jdbc-driver.postgresql]",
"jboss.driver-demander.java:jboss/datasources/DigitalFarmDS is missing [jboss.jdbc-driver.postgresql]"
]
}
13:00:47,682 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
("subsystem" => "datasources"),
("data-source" => "DigitalFarm_DS")
]) - failure description: {
"WFLYCTL0412: Required services that are not installed:" => [
"jboss.jdbc-driver.postgresql",
"jboss.jdbc-driver.postgresql"
],
还有我的独立文件
<datasources>
<datasource jndi-name="java:jboss/datasources/DigitalFarmDS" pool-name="DigitalFarm_DS" enabled="true" use-java-context="true" statistics-enabled="true">
<connection-url>jdbc:postgresql://localhost:5432/DigitalFarm</connection-url>
<driver>postgresql</driver>
<security>
<user-name>_db_username</user-name>
<password>_db_password_</password>
</security>
</datasource>
<datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true" statistics-enabled="${wildfly.datasources.statistics-enabled:${wildfly.statistics-enabled:false}}">
<connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
<driver>h2</driver>
<security>
<user-name>sa</user-name>
<password>sa</password>
</security>
</datasource>
<drivers>
<driver name="postgresql" module="org.postgresql">
<driver-class>org.postgresql.Driver</driver-class>
<xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
</driver>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
</drivers>
</datasources>
我正在为 wildfly 使用此依赖项
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-websocket</artifactId>
</exclusion>
</exclusions>
</dependency>
请帮助我。你遇到过这样的问题吗?
服务器在您的 class 路径中找不到“postgresql”的驱动程序 jar 的问题。
"WFLYCTL0180: Services with missing/unavailable dependencies" => [
"org.wildfly.data-source.DigitalFarm_DS is missing [jboss.jdbc-driver.postgresql]"
实际上,Jboss中的Datasource子系统默认在应用程序class路径中获取驱动程序class,通过驱动程序部分的模块名称加载。 在 Jboss 中,您可以通过两种方式加载模块:
首先:使用应用部署库
如果您使用 deploymen-scanner (JBOSS_APP/
app-deployment.war
|_WEB-INF
|_lib
|_postgresql-42.2.5.jar (example version)
二:外部模块
在您的 jboss 实例中创建一个与您的案例中的模块名称匹配的新模块,它应该是这样的:
modules
|_org
|_postgresql
|_main
|_postgresql-42.2.5.jar
|_module.xml
其中module.xml描述了这个新模块的资源(驱动jar文件),例子:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.7" name="org.postgresql">
<resources>
<resource-root path="postgresql-42.2.5.jar.jar"/>
</resources>
<dependencies>
<module name=""/>
...
</dependencies>
</module>
最后,您需要将模块添加到 jboss-deployment-structure.xml (app-deployment/WEB-INF/jboss-deployment-structure.xml) 以被视为外部依赖,同时部署应用程序,示例:
<?xml version='1.0' encoding='UTF-8'?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
<deployment>
<dependencies>
...
<module name="org.postgresql"/>
...
</dependencies>
</deployment>
</jboss-deployment-structure>
当需要外部管理驱动程序时使用此解决方案。