I migrate from jboss 7.1 to wildfly and i have some problems with my datasource.
10:04:37,900 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 49) JBAS017502: Undertow 1.0.0.Final starting
10:04:37,901 INFO [org.wildfly.extension.undertow] (MSC service thread 1-2) JBAS017502: Undertow 1.0.0.Final starting
10:04:37,903 INFO [org.jboss.as.webservices] (ServerService Thread Pool -- 50) JBAS015537: Activating WebServices Extension
10:04:37,904 INFO [org.jboss.as.security] (MSC service thread 1-3) JBAS013170: Current PicketBox version=4.0.20.Final
10:04:37,913 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 28) JBAS010404: Deploying non-JDBC-compliant driver class org.postgresql.Driver (version 9.0)
10:04:37,919 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-6) JBAS010417: Started Driver service with driver-name = postgresql
10:04:37,924 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 28) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
10:04:37,926 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-13) JBAS010417: Started Driver service with driver-name = h2
10:04:37,939 INFO [org.jboss.as.naming] (MSC service thread 1-9) JBAS011802: Starting Naming Service
10:04:37,939 INFO [org.jboss.as.mail.extension] (MSC service thread 1-10) JBAS015400: Bound mail session [java:jboss/mail/Default]
10:04:38,013 INFO [org.jboss.remoting] (MSC service thread 1-11) JBoss Remoting version 4.0.0.Final
10:04:38,023 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 49) JBAS017527: Creating file handler for path C:\bin\wildfly-8.0.0.Final/welcome-content
10:04:38,044 INFO [org.wildfly.extension.undertow] (MSC service thread 1-6) JBAS017525: Started server default-server.
10:04:38,061 INFO [org.wildfly.extension.undertow] (MSC service thread 1-14) JBAS017531: Host default-host starting
10:04:38,231 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-14) JBAS015012: Started FileSystemDeploymentService for directory C:\bin\wildfly-8.0.0.Final\standalone\deployments
10:04:38,398 INFO [org.wildfly.extension.undertow] (MSC service thread 1-11) JBAS017519: Undertow HTTP listener default listening on localhost/127.0.0.1:8080
10:04:38,530 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-3) JBAS010400: Bound data source [java:/jdbc/hq]
10:04:38,531 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-8) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
10:04:38,531 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-11) JBAS010400: Bound data source [java:/jdbc/dice]
10:04:38,641 INFO [org.jboss.ws.common.management] (MSC service thread 1-6) JBWS022052: Starting JBoss Web Services - Stack CXF Server 4.2.3.Final
When i look at my log i see that wildfly deployed my dice datasource and bound it to [java:/jdbc/dice]. It is referenced in my 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="dice">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>jdbc/dice</jta-data-source>
Now i want to check some datasource settings at startup to ensure isolation level and so on:
@Singleton
@Startup
public class ConfigService {
@Resource(name = "java:/jdbc/dice")
private DataSource dataSource;
In the startup method i just do things like:
Connection connection = dataSource.getConnection();
boolean autoCommit = connection.getAutoCommit();
int isolationLevel = connection.getTransactionIsolation();
At startup i always get:
10:04:56,948 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-15) MSC000001: Failed to start service jboss.deployment.unit."dice.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."dice.war".INSTALL: JBAS018733: Failed to process phase INSTALL of deployment "dice.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:166) [wildfly-server-8.0.0.Final.jar:8.0.0.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.0.Final.jar:1.2.0.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.0.Final.jar:1.2.0.Final]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_51]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_51]
at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]
Caused by: java.lang.IllegalArgumentException: JBAS011053: Incompatible conflicting binding at java:/jdbc/dice source: lookup (java:comp/DefaultDataSource)
at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.addJndiBinding(ModuleJndiBindingProcessor.java:243)
at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor$1.handle(ModuleJndiBindingProcessor.java:184)
at org.jboss.as.ee.component.ClassDescriptionTraversal.run(ClassDescriptionTraversal.java:54)
at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.processClassConfigurations(ModuleJndiBindingProcessor.java:152)
at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.deploy(ModuleJndiBindingProcessor.java:145)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:159) [wildfly-server-8.0.0.Final.jar:8.0.0.Final]
... 5 more
10:04:56,959 ERROR [org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 2) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "dice.war")]) - failure description: {
"JBAS014671: Failed services" => {"jboss.deployment.unit.\"dice.war\".INSTALL" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"dice.war\".INSTALL: JBAS018733: Failed to process phase INSTALL of deployment \"dice.war\"
Caused by: java.lang.IllegalArgumentException: JBAS011053: Incompatible conflicting binding at java:/jdbc/dice source: lookup (java:comp/DefaultDataSource)"},
"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.deployment.unit.\"dice.war\".weld.weldClassIntrospector is missing [jboss.deployment.unit.\"dice.war\".beanmanager]"]
}
10:04:57,112 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018559: Deployed "dice.war" (runtime-name : "dice.war")
10:04:57,113 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report
JBAS014775: New missing/unsatisfied dependencies:
service jboss.deployment.unit."dice.war".beanmanager (missing) dependents: [service jboss.deployment.unit."dice.war".weld.weldClassIntrospector]
JBAS014777: Services which failed to start: service jboss.deployment.unit."dice.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."dice.war".INSTALL: JBAS018733: Failed to process phase INSTALL of deployment "dice.war"
If i change the jndi name of the Datasource injection it works (eg. dice only), but i do not understand why. What am i doing wrong?
greetings, m
@Resource(lookup = "java:jboss/datasources/dice")
private DataSource dataSource;
I missused the @Resource annotation and used name instead of lookup. (switched the jndi name just for testing. in case you wonder)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With