-
1. Re: Can't find persistence unit named in deployment
jewellgm Apr 13, 2018 10:01 AM (in response to skorejo)Do you have a datasource defined in your standalone.xml with a jndi-name of "java:/jdbc/mydb"?
Where is your persistence.xml bundled in relation to ClassAFacade?
It also looks like you have malformed XML. I see a "</provider>", but no opening tag.
-
2. Re: Can't find persistence unit named in deployment
skorejo Apr 13, 2018 10:14 AM (in response to jewellgm)Yes it is there in standalone-full.xml which is getting used in my case.
commondaoproject
|_Source packages
|_my.package.services
|_ ClassAFacade.java
|_Other sources
|_ resources
|_ META-INF
|_ cg91
|_ persistence.xml
I tried to place it directly under META-INF too, still did not work.
Sorry it was a typo, please see persistence.xml as below:
<xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2.0.xsd">
<persistence-unit name="war_PU" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>java:/jdbc/mydb</jta-data-source>
<class>my.package.entities.ClassA</class>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="eclipselink.logging.level" value="INFO"/>
</properties>
</persistence-unit>
</persistence>
-
3. Re: Can't find persistence unit named in deployment
jewellgm Apr 13, 2018 11:11 AM (in response to skorejo)Is your war file embedded within an ear file? Thanks for the directory tree, but I meant where are are those items from within your deployed application, and not the source tree.
For example:
app.ear
|_ app.war
|_ WEB-INF
|_ lib
|_ app.jar
|_ META-INF
|_ persistence.xml
or:
app.war
|_ WEB-INF
|_ lib
|_ app.jar
|_ classes
|_ META-INF
|_ persistence.xml
-
4. Re: Can't find persistence unit named in deployment
skorejo Apr 13, 2018 12:06 PM (in response to jewellgm)It is a war file. Please find the structure of deployment as following:
app.war
|_ WEB-INF
|_ lib
|_ dao.jar
|_ META-INF
|_ persistence.xml
|_ META-INF
-
5. Re: Can't find persistence unit named in deployment
jewellgm Apr 13, 2018 12:28 PM (in response to skorejo)I just noticed that your persistence provider is set to an eclipselink path. Wildfly uses hibernate rather than eclipselink. Try to change your provider to be "org.hibernate.jpa.HibernatePersistenceProvider". Of course, that property setting the log level would no longer be valid.
-
6. Re: Can't find persistence unit named in deployment
skorejo Apr 13, 2018 12:36 PM (in response to jewellgm)I changed that but it didnt resolve the error. I have noticed that on opening persistence.xml file no contents are displayed although the file size is of 1.6 kb.
-
7. Re: Can't find persistence unit named in deployment
mayerw01 Apr 14, 2018 4:58 AM (in response to skorejo)Which editor do you use inspecting your xml file? it shoult be a pure text editor (like notepad) that does not do any interpretation. You could also use an hex edtor to verify the contents.
Try to place your your datasource into the java:jboss context like:
<jta-data-source>java:jboss/datasources/mydb</jta-data-source>
-
8. Re: Can't find persistence unit named in deployment
skorejo Apr 14, 2018 8:58 AM (in response to mayerw01)Thanks for suggesting that. My datasource created is java:/datasources/mydb instead which is why I used the same in persistence.xml, please confirm if it does'nt seem fine?
-
9. Re: Can't find persistence unit named in deployment
mayerw01 Apr 16, 2018 5:06 AM (in response to skorejo)May be your persistence.xml file is corrupt. Did you try to inspect the file using an hex editor? You could also try to re create your file.