0

I have a little Java-project for my school. I use Eclipse Neon with JPA Diagram Editor and JavaFX. The problem -> when I set up the connection to the database, everything worked well (structure: project -> META-INF -> persistence.xml, generated through JPA). I didn't change the folder name or something in the persistence.xml, I only worked in the Main-class and added a new DAO-class. And now I get this error-message and don't understand why.

<?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="Kursverwaltung" transaction-type="RESOURCE_LOCAL">
<class>model.Course</class>
        <properties>
            <property name="javax.persistence.jdbc.url" value="jdbc:oracle:thin:@localhost:1521:xe"/>
            <property name="javax.persistence.jdbc.user" value="*right username*"/>
            <property name="javax.persistence.jdbc.password" value="*right password*"/>
            <property name="javax.persistence.jdbc.driver" value="oracle.jdbc.OracleDriver"/>
            <property name="hibernate.hbm2ddl.auto" value="create"/>
        </properties>
    </persistence-unit>
</persistence>

so how can the project don't find a file, which worked and I didn't changed a the folder or file name... or anything which could have something to do with the path? I only found answers that the path is wrong, but the structure was create through the JPA and worked, so I think that shouldn't be the problem.

Thanks for helping and sorry if the grammar is not so good.

1 Answers1

0

I came across this post while searching for clues as I had gotten the same error message. I thought this answer was helpful. It is easy to typo as things get more complicated.

But I'm pretty sure my situation was free of typos. I think another possible cause is that Eclipse just gets messed up sometimes, if one is doing things that are a little unusual that affect the file structure or build configuration.

Sometimes the best thing to do (after trying a Refresh, a Project clean and closing and restarting Eclipse) is to start fresh and build a new project.

I started a new project and everything worked fine. I compared the web.pom and persistence.xml and they were both identical to the failing project, except for the different project names. Maven libraries were the same. Classes were the same. Maybe I overlooked something, but if the error is something internal in Eclipse, starting fresh is probably the best.

Phil Freihofner
  • 7,645
  • 1
  • 20
  • 41