Widlfy 10 custom DataSource

Answered

Hello everyone,


 


(Sorry that some of the formatting is off - I don't know how to fix this)


 


I want to deploy my project to Wildfly Application Server. I have made it work, however now I do want to use something different than the default H2 database. Therefore I have created a new data source in standalone.xml:


 


 <datasource jta="true" jndi-name="java:jboss/datasources/MySQLDS" pool-name="MySqlDS" enabled="true" use-ccm="true">
<connection-url>jdbc:mysql://localhost:3306/mysqlds</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<driver>mysql</driver>
<security>
<user-name>root</user-name>
</security>
<validation>
<valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker"/>
<background-validation>true</background-validation>
<exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter"/>
</validation>
</datasource>


 


 


 


Driver is also there: 


 


 


 


<driver name="mysql" module="com.mysql.driver">
<driver-class>com.mysql.jdbc.Driver</driver-class>
</driver>


 


 


 


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="primary">
<jta-data-source>java:jboss/datasources/MySQLDS</jta-data-source>
<properties>
<property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/>
<property name="hibernate.show_sql" value="false" />
</properties>
</persistence-unit>
</persistence>
Now when I click test connection in the Wildfly console the connection works.

However, whenever I run the server and deploy the project with IntelliJ I get this error:

[2016-06-01 06:09:08,304] Artifact software-engeneering-wildfly-archetype-ejb:ejb: Error during artifact deployment. See server log for details.
[2016-06-01 06:09:08,305] Artifact software-engeneering-wildfly-archetype-ejb:ejb: java.lang.Exception: {"WFLYCTL0180: Services with missing/unavailable dependencies" => ["jboss.persistenceunit.\"software-engeneering-wildfly-archetype-ejb.jar#primary\" is missing [jboss.naming.context.java.jboss.datasources.MySQLDS]","jboss.persistenceunit.\"software-engeneering-wildfly-archetype-ejb.jar#primary\".__FIRST_PHASE__ is missing [jboss.naming.context.java.jboss.datasources.MySQLDS]"]}

Any help is greatly apreciated.

Thanks a lot in advance,
Christian


1 comment
Comment actions Permalink

It looks more like an application problem rather than deployment problem. 

Please check whether it works if deployed without IDEA (by copying arifact into the application server deployments folder or via the web admin console)?

 

0

Please sign in to leave a comment.