Issue
Here is how my project structure looks:
When I right-click project and add a persistence unit, the percistence.xml is added in "Configuration Files". I Copied percistence.xml after getting this exception to "Web Pages/META-INF" and the same exception was thrown. I tried deleting percistence.xml from "Configuration Files" and the same exception was thrown also This is what the properties in my percistence.xml looks like:
<persistence-unit name="PU" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="javax.persistence.jdbc.url" value="jdbc:sqlserver://ramysazure.database.windows.net:1433;databaseName=SocialDB"/>
<property name="javax.persistence.jdbc.user" value="HI1033@ramysazure"/>
<property name="javax.persistence.jdbc.driver" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
<property name="javax.persistence.jdbc.password" value="******"/>
<property name="hibernate.cache.provider_class" value="org.hibernate.cache.NoCacheProvider"/>
</properties>
Solution
Move the META-INF
directory to your Source Packages
or even resources
. You will typically have the structure of src/main/java
for your sources, and the resources will be in src/main/resources
. That directory is for files that will be copied to the build destination and not processed.
Keep the WEB-INF
where it is, though.
Answered By - coladict