I'm trying to learn JavaEE 7 in detail and I have problems to get records from the database and display them on a JSF page.
I use WildFly 10.1.0 and Oracle XE11. I've created the following data source:
<datasource jndi-name="java:/supportApp" pool-name="OracleDS" enabled="true">
<connection-url>jdbc:oracle:thin:@localhost:1521:xe</connection-url>
<driver>oracle</driver>
<pool>
<min-pool-size>1</min-pool-size>
<max-pool-size>5</max-pool-size>
<prefill>true</prefill>
</pool>
<security>
<user-name>username</user-name>
<password>password</password>
</security>
</datasource>
The connection test in JBoss' admin interface is successful.
This is 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="SupportApp" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:/supportApp</jta-data-source>
<shared-cache-mode>NONE</shared-cache-mode>
<class>org.model.User</class>
</persistence-unit>
</persistence>
When I run WildFly via the standalone.bat
and deploy my application via mvn clean package wildfly:deploy
it works.
When I start the server in Eclipse and try to deploy my application with the same command it fails - since I added the JPA part. The error message I get is this:
14:48:40,768 INFO [org.jboss.as.jpa] (MSC service thread 1-1) WFLYJPA0002: Read persistence.xml for SupportApp
14:48:40,782 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 8) WFLYCTL0013: Operation ("full-replace-deployment") failed - address: ([]) - failure description: {
"WFLYCTL0412: Required services that are not installed:" => ["jboss.naming.context.java.supportApp"], "WFLYCTL0180: Services with missing/unavailable dependencies" => [ "jboss.persistenceunit.\"SupportAppEJB-0.0.1-SNAPSHOT.jar#SupportApp\" is missing [jboss.naming.context.java.supportApp]", "jboss.persistenceunit.\"SupportAppEJB-0.0.1-SNAPSHOT.jar#SupportApp\".__FIRST_PHASE__ is missing [jboss.naming.context.java.supportApp]" ]
}
It seems to be a problem with the persistence unit, but I don't uderstand what the problem is and how I can solve it. Any suggestions?
It figuered out that when eclipse asked me about the server runtime it installed a second wildfly application server. therefore my changes in the standalone.xml
of the manually installed one didn't take account in the server eclipse started. After changing the server runtime to the path where I manually installed wildfly and configured the datasource it works like a charm.