Jak skonfigurowa poma i persistence.xml aby pobrane dane byly zapisywane w lokalnej bazie mysql a nie domyslnej w Wildfly?
Pom.xml
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<failOnMissingWebXml>false</failOnMissingWebXml>
<version.mysql>5.1.37</version.mysql>
<!-- See https://docs.jboss.org/wildfly/plugins/maven/1.1.0.Alpha7/apidocs/org/wildfly/plugin/server/AddUser.html#set%28java.lang.String%29 -->
<wildfly.adminUsername>admin</wildfly.adminUsername>
<wildfly.adminPassword>Admin#70365</wildfly.adminPassword>
<wildfly.add-user>${wildfly.adminUsername}:${wildfly.adminPassword}:group:ManagementRealm:false</wildfly.add-user>
<jdbc.datasource>java:jboss/datasources/MySQLDS</jdbc.datasource>
<mysql.connection.url>jdbc:mysql://localhost:3306/shopping??useUnicode=yes&characterEncoding=UTF-8</mysql.connection.url>
<mysql.username>root</mysql.username>
<mysql.password>speed</mysql.password>
</properties>
.....
persistance.xml
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="ShoppingDB" >
<!--<jta-data-source>java:jboss/datasources/ExampleDS</jta-data-source>-->
<jta-data-source>java:jboss/datasources/MySQLDS</jta-data-source>
<properties>
<!--<property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>-->
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect"/>
<property name="hibernate.hbm2ddl.auto" value="create"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.format_sql" value="true"/>
</properties>
</persistence-unit>
</persistence>
błąd jaki dostaje:
[ERROR] Failed to execute goal org.wildfly.plugins:wildfly-maven-plugin:1.1.0.Alpha7:run (default-cli) on project jjdz-shopping: The server failed to start: Deployment failed: Operation failed: {"WFLYCTL0062: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"WFLYCTL0180: Services with missing/unavailable dependencies" => [
[ERROR] "jboss.persistenceunit."jjdz-shopping-1.0-SNAPSHOT.war#ShoppingDB" is missing [jboss.naming.context.java.jboss.datasources.MySQLDS]",
[ERROR] "jboss.persistenceunit."jjdz-shopping-1.0-SNAPSHOT.war#ShoppingDB".FIRST_PHASE is missing [jboss.naming.context.java.jboss.datasources.MySQLDS]"
[ERROR] ]}}}
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.