gpt4 book ai didi

java - 带有 PostgreSQL 9.4 数据源的 WildFly 10 部署应用程序时出错

转载 作者:塔克拉玛干 更新时间:2023-11-01 22:40:48 24 4
gpt4 key购买 nike

我在 Tomcat 和 Oracle 或 MySQL 方面拥有丰富的经验。这是我第一次使用 WildFlyPostgreSQL。设置 WildFly 以便为我的 PostgreSQL 数据库正确添加数据源需要一段时间。

但现在已经可以了,我可以在 WildFly 管理面板上成功测试连接。现在,当我尝试部署和启动我的 EAR 时,它失败了,并显示在“org.postgresql:main”上找不到模块

看来问题出在数据源上。会不会缺少 jar 文件?希望有人能指导我解决这个问题。

我有 WildFly v10.0.0.Final 和 PostgreSQL v9.4。

在我的 WildFly 安装中,我在模块下为 PostgreSQL 文件创建了目录。结构是 modules/org/postgres/main 我在该目录中有一个 module.xml 文件和引用的 jar 文件。

module.xml中包含:

<?xml version="1.0" ?>

<module xmlns="urn:jboss:module:1.1" name="org.postgres">

<resources>
<resource-root path="postgresql-9.4.1208.jre7.jar"/>
</resources>

<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>

standalone.xml 中,我有以下数据源代码。

            <xa-datasource jndi-name="java:jboss/datasources/GUN88_DS" pool-name="java:jboss/datasources/GUN88_DS" enabled="true">
<xa-datasource-property name="DatabaseName">gun88</xa-datasource-property>
<xa-datasource-property name="ServerName">localhost</xa-datasource-property>
<xa-datasource-property name="PortNumber">5432</xa-datasource-property>
<xa-datasource-property name="User">gunner</xa-datasource-property>
<xa-datasource-property name="Password">abcxyz</xa-datasource-property>
<xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
<driver>postgres</driver>
</xa-datasource>

                <driver name="postgres" module="org.postgres">
<xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
</driver>

persistence.xml中包含

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1"
xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence
http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="GUN88_DS">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<jta-data-source>java:jboss/datasources/GUN88_DS</jta-data-source>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
<property name="hibernate.show_sql" value="false" />
<property name="hibernate.cache.default_cache_concurrency_strategy"
value="nonstrict-read-write" />
<!-- property name="hibernate.cache.region.factory_class"
value="org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory" / -->
<property name="hibernate.max_fetch_depth" value="1" />
</properties>
</persistence-unit>
</persistence>

当我部署 EAR 文件然后尝试启动 WildFly 时,我得到以下信息:

2016-08-19 12:21:06,363 INFO  [org.jboss.modules] (main) JBoss Modules version 1.5.1.Final
2016-08-19 12:21:06,617 INFO [org.jboss.msc] (main) JBoss MSC version 1.2.6.Final
2016-08-19 12:21:06,701 INFO [org.jboss.as] (MSC service thread 1-8) WFLYSRV0049: WildFly Full 10.0.0.Final (WildFly Core 2.0.10.Final) starting
2016-08-19 12:21:06,703 DEBUG [org.jboss.as.config] (MSC service thread 1-8) Configured system properties:
awt.toolkit = sun.awt.windows.WToolkit
file.encoding = Cp1252
file.encoding.pkg = sun.io
file.separator = \
java.awt.graphicsenv = sun.awt.Win32GraphicsEnvironment
java.awt.printerjob = sun.awt.windows.WPrinterJob
java.class.path = C:\wildfly-10.0.0.Final\jboss-modules.jar
java.class.version = 52.0
java.endorsed.dirs = C:\Program Files\Java\jdk1.8.0_101\jre\lib\endorsed
java.ext.dirs = C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext;C:\Windows\Sun\Java\lib\ext
java.home = C:\Program Files\Java\jdk1.8.0_101\jre
java.io.tmpdir = C:\Users\gunner\AppData\Local\Temp\
java.library.path = C:\Program Files\Java\jdk1.8.0_101\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files (x86)\ActiveState Komodo Edit 10\;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Symantec.cloud\PlatformAgent\;C:\Program Files (x86)\Skype\Phone\;C:\Program Files\apache-maven-3.3.9/bin;.;;.
java.net.preferIPv4Stack = true
java.runtime.name = Java(TM) SE Runtime Environment
java.runtime.version = 1.8.0_101-b13
java.specification.name = Java Platform API Specification
java.specification.vendor = Oracle Corporation
java.specification.version = 1.8
java.util.logging.manager = org.jboss.logmanager.LogManager
java.vendor = Oracle Corporation
java.vendor.url = http://java.oracle.com/
java.vendor.url.bug = http://bugreport.sun.com/bugreport/
java.version = 1.8.0_101
java.vm.info = mixed mode
java.vm.name = Java HotSpot(TM) 64-Bit Server VM
java.vm.specification.name = Java Virtual Machine Specification
java.vm.specification.vendor = Oracle Corporation
java.vm.specification.version = 1.8
java.vm.vendor = Oracle Corporation
java.vm.version = 25.101-b13
javax.management.builder.initial = org.jboss.as.jmx.PluggableMBeanServerBuilder
javax.xml.datatype.DatatypeFactory = __redirected.__DatatypeFactory
javax.xml.parsers.DocumentBuilderFactory = __redirected.__DocumentBuilderFactory
javax.xml.parsers.SAXParserFactory = __redirected.__SAXParserFactory
javax.xml.stream.XMLEventFactory = __redirected.__XMLEventFactory
javax.xml.stream.XMLInputFactory = __redirected.__XMLInputFactory
javax.xml.stream.XMLOutputFactory = __redirected.__XMLOutputFactory
javax.xml.transform.TransformerFactory = __redirected.__TransformerFactory
javax.xml.validation.SchemaFactory:http://www.w3.org/2001/XMLSchema = __redirected.__SchemaFactory
javax.xml.xpath.XPathFactory:http://java.sun.com/jaxp/xpath/dom = __redirected.__XPathFactory
jboss.home.dir = C:\wildfly-10.0.0.Final
jboss.host.name = lex-gunner
jboss.modules.dir = C:\wildfly-10.0.0.Final\modules
jboss.modules.system.pkgs = org.jboss.byteman
jboss.node.name = lex-gunner
jboss.qualified.host.name = lex-gunner
jboss.server.base.dir = C:\wildfly-10.0.0.Final\standalone
jboss.server.config.dir = C:\wildfly-10.0.0.Final\standalone\configuration
jboss.server.data.dir = C:\wildfly-10.0.0.Final\standalone\data
jboss.server.deploy.dir = C:\wildfly-10.0.0.Final\standalone\data\content
jboss.server.log.dir = C:\wildfly-10.0.0.Final\standalone\log
jboss.server.name = lex-gunner
jboss.server.persist.config = true
jboss.server.temp.dir = C:\wildfly-10.0.0.Final\standalone\tmp
line.separator =

logging.configuration = file:C:\wildfly-10.0.0.Final\standalone\configuration/logging.properties
module.path = C:\wildfly-10.0.0.Final\modules
org.jboss.boot.log.file = C:\wildfly-10.0.0.Final\standalone\log\server.log
org.jboss.resolver.warning = true
org.xml.sax.driver = __redirected.__XMLReaderFactory
os.arch = amd64
os.name = Windows 7
os.version = 6.1
path.separator = ;
program.name = standalone.bat
sun.arch.data.model = 64
sun.boot.class.path = C:\Program Files\Java\jdk1.8.0_101\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\rt.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\sunrsasign.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_101\jre\classes
sun.boot.library.path = C:\Program Files\Java\jdk1.8.0_101\jre\bin
sun.cpu.endian = little
sun.cpu.isalist = amd64
sun.desktop = windows
sun.io.unicode.encoding = UnicodeLittle
sun.java.command = C:\wildfly-10.0.0.Final\jboss-modules.jar -mp C:\wildfly-10.0.0.Final\modules org.jboss.as.standalone -Djboss.home.dir=C:\wildfly-10.0.0.Final
sun.java.launcher = SUN_STANDARD
sun.jnu.encoding = Cp1252
sun.management.compiler = HotSpot 64-Bit Tiered Compilers
sun.os.patch.level = Service Pack 1
sun.stderr.encoding = cp437
sun.stdout.encoding = cp437
user.country = US
user.dir = C:\wildfly-10.0.0.Final\bin
user.home = C:\Users\gunner
user.language = en
user.name = gunner
user.script =
user.timezone = America/New_York
user.variant =
2016-08-19 12:21:06,704 DEBUG [org.jboss.as.config] (MSC service thread 1-8) VM Arguments: -Dprogram.name=standalone.bat -Xms64M -Xmx512M -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Dorg.jboss.boot.log.file=C:\wildfly-10.0.0.Final\standalone\log\server.log -Dlogging.configuration=file:C:\wildfly-10.0.0.Final\standalone\configuration/logging.properties
2016-08-19 12:21:08,504 INFO [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) WFLYDS0015: Re-attempting failed deployment gun88-ear-7.0.0.ear
2016-08-19 12:21:09,605 INFO [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) WFLYDS0004: Found gun88-ear-7.0.0.ear in deployment directory. To trigger deployment create a file called gun88-ear-7.0.0.ear.dodeploy
2016-08-19 12:21:09,627 INFO [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0039: Creating http management service using socket-binding (management-http)
2016-08-19 12:21:09,649 INFO [org.xnio] (MSC service thread 1-7) XNIO version 3.3.4.Final
2016-08-19 12:21:09,658 INFO [org.xnio.nio] (MSC service thread 1-7) XNIO NIO Implementation Version 3.3.4.Final
2016-08-19 12:21:09,695 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 38) WFLYCLINF0001: Activating Infinispan subsystem.
2016-08-19 12:21:09,725 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 33) WFLYJCA0004: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
2016-08-19 12:21:09,733 WARN [org.jboss.as.txn] (ServerService Thread Pool -- 54) WFLYTX0013: Node identifier property is set to the default value. Please make sure it is unique.
2016-08-19 12:21:09,750 INFO [org.jboss.as.security] (ServerService Thread Pool -- 53) WFLYSEC0002: Activating Security Subsystem
2016-08-19 12:21:09,761 INFO [org.jboss.as.naming] (ServerService Thread Pool -- 46) WFLYNAM0001: Activating Naming Subsystem
2016-08-19 12:21:09,775 INFO [org.wildfly.extension.io] (ServerService Thread Pool -- 37) WFLYIO001: Worker 'default' has auto-configured to 8 core threads with 64 task threads based on your 4 available processors
2016-08-19 12:21:09,787 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 33) WFLYJCA0005: Deploying non-JDBC-compliant driver class org.postgresql.Driver (version 9.4)
2016-08-19 12:21:09,821 INFO [org.jboss.as.security] (MSC service thread 1-5) WFLYSEC0001: Current PicketBox version=4.9.4.Final
2016-08-19 12:21:09,824 INFO [org.jboss.as.jsf] (ServerService Thread Pool -- 44) WFLYJSF0007: Activated the following JSF Implementations: [main]
2016-08-19 12:21:09,824 INFO [org.jboss.as.webservices] (ServerService Thread Pool -- 56) WFLYWS0002: Activating WebServices Extension
2016-08-19 12:21:09,861 INFO [org.wildfly.extension.undertow] (MSC service thread 1-4) WFLYUT0003: Undertow 1.3.15.Final starting
2016-08-19 12:21:09,863 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 55) WFLYUT0003: Undertow 1.3.15.Final starting
2016-08-19 12:21:09,888 INFO [org.jboss.as.connector] (MSC service thread 1-3) WFLYJCA0009: Starting JCA Subsystem (WildFly/IronJacamar 1.3.2.Final)
2016-08-19 12:21:09,902 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-5) WFLYJCA0018: Started Driver service with driver-name = postgres
2016-08-19 12:21:09,903 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-5) WFLYJCA0018: Started Driver service with driver-name = h2
2016-08-19 12:21:09,904 INFO [org.jboss.as.naming] (MSC service thread 1-5) WFLYNAM0003: Starting Naming Service
2016-08-19 12:21:09,916 INFO [org.jboss.as.mail.extension] (MSC service thread 1-5) WFLYMAIL0001: Bound mail session [java:jboss/mail/Default]
2016-08-19 12:21:10,086 INFO [org.jboss.as.ejb3] (MSC service thread 1-1) WFLYEJB0481: Strict pool slsb-strict-max-pool is using a max instance size of 64 (per class), which is derived from thread worker pool sizing.
2016-08-19 12:21:10,099 INFO [org.jboss.as.ejb3] (MSC service thread 1-5) WFLYEJB0482: Strict pool mdb-strict-max-pool is using a max instance size of 16 (per class), which is derived from the number of CPUs on this host.
2016-08-19 12:21:10,124 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 55) WFLYUT0014: Creating file handler for path 'C:\wildfly-10.0.0.Final/welcome-content' with options [directory-listing: 'false', follow-symlink: 'false', case-sensitive: 'true', safe-symlink-paths: '[]']
2016-08-19 12:21:10,899 INFO [org.jboss.remoting] (MSC service thread 1-7) JBoss Remoting version 4.0.18.Final
2016-08-19 12:21:10,910 INFO [org.wildfly.extension.undertow] (MSC service thread 1-6) WFLYUT0012: Started server default-server.
2016-08-19 12:21:10,917 INFO [org.wildfly.extension.undertow] (MSC service thread 1-1) WFLYUT0018: Host default-host starting
2016-08-19 12:21:11,000 INFO [org.wildfly.extension.undertow] (MSC service thread 1-6) WFLYUT0006: Undertow HTTP listener default listening on 127.0.0.1:8080
2016-08-19 12:21:11,237 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-3) WFLYDS0013: Started FileSystemDeploymentService for directory C:\wildfly-10.0.0.Final\standalone\deployments
2016-08-19 12:21:11,279 INFO [org.jboss.as.server.deployment] (MSC service thread 1-7) WFLYSRV0027: Starting deployment of "gun88-ear-7.0.0.ear" (runtime-name: "gun88-ear-7.0.0.ear")
2016-08-19 12:21:11,520 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-1) WFLYJCA0001: Bound data source [java:jboss/datasources/ExampleDS]
2016-08-19 12:21:11,535 WARN [org.jboss.as.connector.subsystems.datasources.AbstractDataSourceService$AS7DataSourceDeployer] (MSC service thread 1-4) IJ020016: Missing <recovery> element. XA recovery disabled for: java:jboss/datasources/GUN88_DS
2016-08-19 12:21:11,553 INFO [org.jboss.as.server.deployment] (MSC service thread 1-8) WFLYSRV0207: Starting subdeployment (runtime-name: "gun88-logfs.war")
2016-08-19 12:21:11,554 INFO [org.jboss.as.server.deployment] (MSC service thread 1-1) WFLYSRV0207: Starting subdeployment (runtime-name: "gun88-ui.war")
2016-08-19 12:21:11,558 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-4) WFLYJCA0001: Bound data source [java:jboss/datasources/GUN88_DS]
2016-08-19 12:21:11,716 INFO [org.infinispan.factories.GlobalComponentRegistry] (MSC service thread 1-7) ISPN000128: Infinispan version: Infinispan 'Mahou' 8.1.0.Final
2016-08-19 12:21:11,983 INFO [org.jboss.ws.common.management] (MSC service thread 1-5) JBWS022052: Starting JBossWS 5.1.3.Final (Apache CXF 3.1.4)
2016-08-19 12:21:13,840 WARN [org.jboss.as.server.deployment] (MSC service thread 1-4) WFLYSRV0059: Class Path entry jaxb-api.jar in /C:/wildfly-10.0.0.Final/standalone/deployments/gun88-ear-7.0.0.ear/gun88-logfs.war/WEB-INF/lib/jaxb-core-2.2.11.jar does not point to a valid jar for a Class-Path reference.
2016-08-19 12:21:13,846 WARN [org.jboss.as.server.deployment] (MSC service thread 1-4) WFLYSRV0059: Class Path entry jaxb-core.jar in /C:/wildfly-10.0.0.Final/standalone/deployments/gun88-ear-7.0.0.ear/gun88-logfs.war/WEB-INF/lib/jaxb-impl-2.2.11.jar does not point to a valid jar for a Class-Path reference.
2016-08-19 12:21:13,852 WARN [org.jboss.as.server.deployment] (MSC service thread 1-4) WFLYSRV0059: Class Path entry lib/snakeyaml-1.13.jar in /C:/wildfly-10.0.0.Final/standalone/deployments/gun88-ear-7.0.0.ear/gun88-logfs.war/WEB-INF/lib/liquibase-core-3.4.2.jar does not point to a valid jar for a Class-Path reference.
2016-08-19 12:21:14,304 INFO [org.jboss.as.jpa] (MSC service thread 1-4) WFLYJPA0002: Read persistence.xml for GUN88_DS
2016-08-19 12:21:14,355 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC000001: Failed to start service jboss.module.service."deployment.gun88-ear-7.0.0.ear".main: org.jboss.msc.service.StartException in service jboss.module.service."deployment.gun88-ear-7.0.0.ear".main: WFLYSRV0179: Failed to load module: deployment.gun88-ear-7.0.0.ear:main
at org.jboss.as.server.moduleservice.ModuleLoadService.start(ModuleLoadService.java:91)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.jboss.modules.ModuleNotFoundException: org.postgresql:main
at org.jboss.modules.Module.addPaths(Module.java:1092)
at org.jboss.modules.Module.link(Module.java:1448)
at org.jboss.modules.Module.relinkIfNecessary(Module.java:1476)
at org.jboss.modules.ModuleLoader.loadModule(ModuleLoader.java:225)
at org.jboss.as.server.moduleservice.ModuleLoadService.start(ModuleLoadService.java:68)
... 5 more

2016-08-19 12:21:16,239 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "gun88-ear-7.0.0.ear")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.module.service.\"deployment.gun88-ear-7.0.0.ear\".main" => "org.jboss.msc.service.StartException in service jboss.module.service.\"deployment.gun88-ear-7.0.0.ear\".main: WFLYSRV0179: Failed to load module: deployment.gun88-ear-7.0.0.ear:main
Caused by: org.jboss.modules.ModuleNotFoundException: org.postgresql:main"}}
2016-08-19 12:21:16,299 INFO [org.jboss.as.server] (ServerService Thread Pool -- 34) WFLYSRV0010: Deployed "gun88-ear-7.0.0.ear" (runtime-name : "gun88-ear-7.0.0.ear")
2016-08-19 12:21:16,309 INFO [org.jboss.as.controller] (Controller Boot Thread) WFLYCTL0183: Service status report
WFLYCTL0186: Services which failed to start: service jboss.module.service."deployment.gun88-ear-7.0.0.ear".main: org.jboss.msc.service.StartException in service jboss.module.service."deployment.gun88-ear-7.0.0.ear".main: WFLYSRV0179: Failed to load module: deployment.gun88-ear-7.0.0.ear:main

2016-08-19 12:21:16,494 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:9990/management
2016-08-19 12:21:16,495 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:9990
2016-08-19 12:21:16,495 ERROR [org.jboss.as] (Controller Boot Thread) WFLYSRV0026: WildFly Full 10.0.0.Final (WildFly Core 2.0.10.Final) started (with errors) in 10530ms - Started 314 of 604 services (4 services failed or missing dependencies, 378 services are lazy, passive or on-demand)
2016-08-19 12:21:16,546 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) WFLYSRV0208: Stopped subdeployment (runtime-name: gun88-ui.war) in 16ms
2016-08-19 12:21:16,597 INFO [org.jboss.as.server.deployment] (MSC service thread 1-8) WFLYSRV0208: Stopped subdeployment (runtime-name: gun88-logfs.war) in 68ms
2016-08-19 12:21:16,598 INFO [org.jboss.as.server.deployment] (MSC service thread 1-8) WFLYSRV0028: Stopped deployment gun88-ear-7.0.0.ear (runtime-name: gun88-ear-7.0.0.ear) in 70ms
2016-08-19 12:21:16,682 INFO [org.jboss.as.server] (DeploymentScanner-threads - 1) WFLYSRV0009: Undeployed "gun88-ear-7.0.0.ear" (runtime-name: "gun88-ear-7.0.0.ear")
2016-08-19 12:21:16,684 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 1) WFLYCTL0183: Service status report
WFLYCTL0184: New missing/unsatisfied dependencies:
service jboss.module.service."deployment.gun88-ear-7.0.0.ear".main (missing) dependents: [service jboss.deployment.unit."gun88-ear-7.0.0.ear".FIRST_MODULE_USE]
service jboss.module.service."deployment.gun88-ear-7.0.0.ear.gun88-logfs.war".main (missing) dependents: [service jboss.deployment.subunit."gun88-ear-7.0.0.ear"."gun88-logfs.war".FIRST_MODULE_USE]
service jboss.module.service."deployment.gun88-ear-7.0.0.ear.gun88-ui.war".main (missing) dependents: [service jboss.deployment.subunit."gun88-ear-7.0.0.ear"."gun88-ui.war".FIRST_MODULE_USE]
service jboss.module.spec.service."deployment.gun88-ear-7.0.0.ear.gun88-logfs.war".main (missing) dependents: [service jboss.deployment.unit."gun88-ear-7.0.0.ear".FIRST_MODULE_USE]
service jboss.module.spec.service."deployment.gun88-ear-7.0.0.ear.gun88-ui.war".main (missing) dependents: [service jboss.deployment.unit."gun88-ear-7.0.0.ear".FIRST_MODULE_USE]
WFLYCTL0186: Services which failed to start: service jboss.module.service."deployment.gun88-ear-7.0.0.ear".main

2016-08-19 12:21:21,350 INFO [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) WFLYDS0004: Found gun88-ear-7.0.0.ear in deployment directory. To trigger deployment create a file called gun88-ear-7.0.0.ear.dodeploy
2016-08-19 12:21:57,428 INFO [org.jboss.as.server] (Thread-2) WFLYSRV0220: Server shutdown has been requested.
2016-08-19 12:21:57,450 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-1) WFLYJCA0010: Unbound data source [java:jboss/datasources/ExampleDS]
2016-08-19 12:21:57,450 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-3) WFLYJCA0010: Unbound data source [java:jboss/datasources/GUN88_DS]
2016-08-19 12:21:57,464 INFO [org.wildfly.extension.undertow] (MSC service thread 1-2) WFLYUT0019: Host default-host stopping
2016-08-19 12:21:57,466 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-2) WFLYJCA0019: Stopped Driver service with driver-name = postgres
2016-08-19 12:21:57,482 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-5) WFLYJCA0019: Stopped Driver service with driver-name = h2
2016-08-19 12:21:57,499 INFO [org.wildfly.extension.undertow] (MSC service thread 1-1) WFLYUT0008: Undertow HTTP listener default suspending
2016-08-19 12:21:57,502 INFO [org.wildfly.extension.undertow] (MSC service thread 1-1) WFLYUT0007: Undertow HTTP listener default stopped, was bound to 127.0.0.1:8080
2016-08-19 12:21:57,505 INFO [org.wildfly.extension.undertow] (MSC service thread 1-1) WFLYUT0004: Undertow 1.3.15.Final stopping
2016-08-19 12:21:57,519 INFO [org.jboss.as] (MSC service thread 1-2) WFLYSRV0050: WildFly Full 10.0.0.Final (WildFly Core 2.0.10.Final) stopped in 85ms

我已经为这个错误搜索了几天。没有什么有意义的返回。我希望有人能给我一些线索。

* 注意 *

我会稍微扩展一下我的解释。这不是一个新的应用程序。我加入的另一位开发人员已经开发了几个月。问题是他将 IntelliJ 用于他的 IDE,而我的所有经验都来自 Eclipse。所以我正在尝试将 Eclipse 设置为我的开发环境。

我们已经比较了所有的安装和部署控制,没有发现任何具体差异。然而它在他的机器上运行良好。我尝试在 Eclipse 内部和桌面外部运行 WildFly,但每次都出现相同的错误。

很长一段时间我都无法将数据源连接到 PostgreSQL(使用 WildFly 管理面板),但现在我可以正常连接了。我想如果这可行,我的数据源配置就很好。只要 WildFly 和 PostgreSQL 对话,就没有必要改变数据源的创建方式。

我正在使用 Standalone.xml,因为根据文档,这是默认配置文件。如果你想使用 standalone-full,你必须覆盖启动命令,我还没有这样做。在我看来,standalone 和 standalone-full 之间唯一真正的区别是 full 有 IIOS,而这个应用程序没有使用它。

我知道您在基于 Java 的应用程序中看到的错误不一定是根本原因,所以我愿意尝试任何事情。我只想了解我在做什么并了解原因。

***** 解决方案 *****

我们终于发现并解决了这个问题。我们在 persistence.xml 文件和 standalone.xml 文件之间发生了冲突。所以我们删除了 persistence.xml 文件并将所有内容都放在 standalone.xml 中,问题就消失了。我们所处的情况是,一个小组开始了这项新开发,并且刚刚开始编码,并且该项目已转移到我们的小组。它使用 Maven 配置的方式和 Hibernate 的设置方式我们很长时间没有找到它。感谢大家的关注和评论!!!!

最佳答案

我一直在使用带有 posgresql-9.3 的 Wildfly10,直接在 standalone-full.xml 文件中定义数据源对我有用。所以我希望这对你有所帮助。

I have created directories under modules for the PostgreSQL files. The structure is modules/org/postgres/main

在您的 standalone-full.xml 中执行此操作在 standalone>configuration

在那个文件里面 <datasources>添加这个

 <datasource jndi-name="java:jboss/datasources/PAYROLL_DS" pool-name="PAYROLL_DS" enabled="true" use-java-context="true">
<connection-url>jdbc:postgresql://localhost:5432/payroll_db</connection-url>
<driver>postgresql</driver>
<security>
<user-name>test</user-name>
<password>test@123</password>
</security>
</datasource>

这是我的 persistence.xml文件

 <?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="PAYROLL_PU" transaction-type="JTA">
<jta-data-source>java:/jboss/datasources/PAYROLL_DS</jta-data-source>

<properties>
<property name="hibernate.hbm2ddl.auto" value="update"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.format_sql" value="false"/>
<property name="hibernate.case.use_query_cache" value="false"/>
<!-- 2nd level cache -->
</properties>
</persistence-unit>
</persistence>

当您通过 standalone-full.xml 添加数据源时你不需要创建 module.xml呈现postgres .您只需编辑 standalone-full.xml里面<drivers>添加这个

<driver name="postgresql" module="org.postgresql">
<xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
</driver>

关于java - 带有 PostgreSQL 9.4 数据源的 WildFly 10 部署应用程序时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39044338/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com