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

Posted

技术标签:

【中文标题】带有 PostgreSQL 9.4 数据源的 WildFly 10 部署应用程序时出错【英文标题】:WildFly 10 with PostgreSQL 9.4 datasource Error deploying application 【发布时间】:2016-08-19 17:01:36 【问题描述】:

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

但是现在,我可以在 WildFly 管理面板上成功测试连接。现在,当我尝试部署和启动我的 EAR 时,它会失败并显示 a module not found on "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

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

* 注意 *

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

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

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

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

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

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

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

【问题讨论】:

您好像在某个地方打错了字。未找到的模块是org.postgresql。其他所有内容都引用org.postgres。在您的standalone.xml 中搜索org.postgresql 并查看是否在任何地方找到它。 我确实看到了。有时由于当时发生的事情太多,很难确定是什么解决了问题。我已经更改了几件事,包括下面的答案 1,所以我不确定是什么修复了它。我是这个项目的新手,很多材料和说明存在冲突,有时甚至是完全错误的。感谢您为我找到了。 【参考方案1】:

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

我在模块下为 PostgreSQL 文件创建了目录。结构为modules/org/postgres/main

standalone-full.xml 下的standalone&gt;configuration 中执行此操作

&lt;datasources&gt; 内的那个文件中添加这个

 <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。您只需在 &lt;drivers&gt; 中编辑 standalone-full.xml 添加此

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

【讨论】:

如果我知道我早就知道了。这个网站很棒,但是关于分数和正确答案的副线内容并不直观。因为我没有自我,也不太在乎声誉,所以我倾向于忽略这些事情。我寻求帮助,并在力所能及的地方提供帮助,而不计分。我忘记了有些人对他们来说这是一件非常非常重要的事情。我会考虑标记这个,以便你得到你的认可。【参考方案2】:

我真的鼓励您考虑使用 jboss-cli 程序来执行此操作。我喜欢使用它,因为它很容易创建可重现的环境,并且如果文件的布局发生变化,您可能会更加绝缘。

我做过的一些事情如下。请注意,jboss-cli 程序位于“bin”目录下的 Wildfly 主目录中。我已将其添加到我的 O/S 命令行路径中。

因此,通过 running Wildfly,您可以先删除正在使用的数据源:

jboss-cli.sh --connect --command="/subsystem=datasources/data-source=yourDataSource/:remove"

并且,为了完整起见,删除 PostgreSQL 驱动程序:

jboss-cli.sh --connect --command="/subsystem=datasources/jdbc-driver=postgres:remove"

还有模块:

jboss-cli.sh --connect --command="module remove --name=org.postgres"

现在,添加模块:

jboss-cli.sh --connect --command="module add --name=org.postgres --resources=<location of the pgsql jar> --dependencies=javax.api,javax.transaction.api"

和司机:

jboss-cli.sh --connect --command='/subsystem=datasources/jdbc-driver=postgres:add(driver-name="postgres",driver-module-name="org.postgres",driver-class-name=org.postgresql.Driver)'

最后是数据源:

jboss-cli.sh --command="/subsystem=datasources/data-source=yourDataSource/:add(connection-url=jdbc:postgresql://$db.host:5432/$db.name,driver-name=postgres,jndi-name=java:/jdbc/yourDataSource,password=$db.password,user-name=$db.username)"

在最后一条语句中,需要将 $ 变量设置为您的环境需要的值。请注意,这也设置了 JNDI 名称 - 我将它们保持不变,但这不是必需的。

运行此程序后,您需要停止并重新启动 Wildfly。

通过这种方式,您可以进行可编写脚本的设置。当您升级时,至少 10.x 系列应该是相同的,尽管我从 Wildfly 8 开始使用相同的脚本。

【讨论】:

已经有一段时间没有回答这个问题了。但我想对这个回应发表评论。我们大多数人为某人工作。我们通常不会决定如何设计或部署事物。所以我们没有灵活性来改变配置或部署的方式。我们必须设置standalone.xml 文件并使用该配置部署Wildfly。也许其他人可以从您的建议中受益。但对我来说这是一种浪费。 对我来说似乎很复杂,您能否提供更多有关在命令行中替换什么的详细信息?谢谢 @PhilippeGachoud - 哪些领域是挑战? Wildfly docs 也包含更多细节。 找不到dataSource= 名称!我应该用什么代替它?我有一个`Unrecognized variable 用户名和密码字段必须介于 " 对我来说 user-name="username"【参考方案3】:

你可以看到一些关于这个案例的扩展文档here

使用/tmp/postgresql-42.2.2.jar 或替换其位置 替换:&lt;yourPwd&gt;&lt;yourUsrName&gt;&lt;yourDbName&gt;&lt;dbHost&gt;&lt;yourDeploymentNameWarOrJarFileName&gt;

您应该能够按照上面的说明进行以下操作:

cd wildfly-13.0.0.Final/bin

./jboss-cli.sh --connect controller=127.0.0.1

module add --name=org.postgresql --resources=/tmp/postgresql-42.2.2.jar --dependencies=javax.api,javax.transaction.api

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

data-source add --jndi-name=java:jboss/datasources/&lt;yourDeploymentNameWarOrJarFileName&gt; --name=&lt;yourDbName&gt; --connection-url=jdbc:postgresql://&lt;dbHost&gt;:5432/&lt;yourDbName&gt; --driver-name=postgres --user-name="&lt;yourUsrName&gt;" --password="&lt;yourPwd&gt;"

【讨论】:

以上是关于带有 PostgreSQL 9.4 数据源的 WildFly 10 部署应用程序时出错的主要内容,如果未能解决你的问题,请参考以下文章

Postgresql 9.4:索引在模式搜索中不起作用

记一次在线安装postgresql-9.4的问题

匹配两个数组列 postgresql-9.4-

Postgresql 9.4 - 转换为 JSONB 时输入语法无效

插入复合类型数组给出错误 postgresql 9.4--

具有 postgresql 9.4 和 JSON 字段支持的 Peewee 连接池