OldGuy
OldGuy

Reputation: 109

WildFly 10 with PostgreSQL 9.4 datasource Error deploying application

I have lots of experience with Tomcat and Oracle or MySQL. This is my first experience with WildFly and PostgreSQL. It took a while to get WildFly set up to properly add a datasource for my PostgreSQL database.

But that is now in and I can successfully test the connection on the WildFly admin panel. Now when I attempt to deploy and start my EAR it fails with a module not found on "org.postgresql:main".

It appears that the problem is with the datasource. Could there be a jar file missing? Hopefully someone can guide me through this.

I have WildFly v10.0.0.Final and PostgreSQL v9.4.

In my WildFly installation I have created directories under modules for the PostgreSQL files. The structure is modules/org/postgres/main I have a module.xml file and the referenced jar file in that directory.

In module.xml contains:

<?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>

In standalone.xml I have the following code for the datasource.

            <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>

and

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

In persistence.xml contains

<?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>

When I deploy the EAR file and then attempt to start WildFly I get the following:

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

I have been searching for a couple days now on this error. Nothing comes back that makes sense. I hope someone can give me a few leads.

* NOTE *

I would expand on my explanation just a bit. This is not a new application. It has been under development for several months by another developer who I have joined. The problem is he uses IntelliJ for his IDE where all my experience is with Eclipse. So I am trying to set up Eclipse as my development environment.

We have compared all the installation and deployment controls and can't find any specific differences. Yet it works fine on his machine. I have tried running WildFly inside Eclipse and externally on the desktop and get the same error every time.

For a long time I couldn't get the datasource to connect to PostgreSQL (using the WildFly admin panel) but now I get a good connection. I would think if that works my configuration of the data source is good. It should not be necessary to change the way the datasource is created as long as WildFly and PostgreSQL are talking.

I am using Standalone.xml because, according to the documentation, that is the default configuration file. If you want to use standalone-full you have to override the start command, which I haven't done. And it appears to me the only real difference between standalone and standalone-full is that full has IIOS, which this application does not use.

I know the error you see in Java based application isn't necessarily the root cause so I am willing to try just about anything. I just want to understand what I am doing and gain an understanding of why.

***** SOLUTION *****

We finally discovered and fixed this problem. We had a conflict between the persistence.xml file and the standalone.xml file. So we removed the persistence.xml file and put everything in the standalone.xml the problem went away. We are in a situation where one group started this new development and had just gotten a start on the coding and the project was transferred to our group. The way that it is configured with Maven and the way Hibernate is set up we just didn't find this for a long time. I appreciate everyone's interest and your comments!!!!

Upvotes: 3

Views: 9229

Answers (3)

Pipo
Pipo

Reputation: 5073

You could see some extended documentation about this case here

  • With /tmp/postgresql-42.2.2.jar or replace its location
  • replacing: <yourPwd>, <yourUsrName>, <yourDbName>, <dbHost>, <yourDeploymentNameWarOrJarFileName>

you should be able to do the followings as mentioned above:

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/<yourDeploymentNameWarOrJarFileName> --name=<yourDbName> --connection-url=jdbc:postgresql://<dbHost>:5432/<yourDbName> --driver-name=postgres --user-name="<yourUsrName>" --password="<yourPwd>"

Upvotes: 0

stdunbar
stdunbar

Reputation: 17435

I'd really encourage you to consider using the jboss-cli program to do this. I like using that as it is easy to create a reproducable environment and, should the layout of the file ever change, you are likely to be a bit more insulated.

Some things I've done are below. Note that the jboss-cli program is in the Wildfly home in the "bin" directory. I've added that to my O/S command line path.

So, with a running Wildfly, you can first remove the datasource you are using:

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

And, for completeness, remove the PostgreSQL driver:

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

And the module:

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

Now, add the module:

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

and the driver:

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)'

and, finally, the datasource:

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})"

In the last statement, the ${} variables will need to be set to what your environment requires. Notice that this also sets the JNDI name - I keep them the same but that is not a requirement.

Once you've run this you'll need to stop and restart Wildfly.

In this way you can have a scriptable setup. When you upgrade at least the 10.x series should be the same though I've used the same scripts since Wildfly 8.

Upvotes: 3

Bibek Shakya
Bibek Shakya

Reputation: 1273

I have been working with Wildfly10 with posgresql-9.3, defining datasources directly in standalone-full.xml file have worked for me. So I hope this help you.

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

Do this in your standalone-full.xml which is under standalone>configuration

in that file inside <datasources> add this

 <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>

this is my persistence.xml file

 <?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>

When you add datasources through standalone-full.xml you dont need to create module.xml to present postgres. You just simply edit standalone-full.xml inside <drivers> add this

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

Upvotes: 3

Related Questions