Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Dali » No persistence.xml file found in project?
No persistence.xml file found in project? [message #668658] Fri, 06 May 2011 11:45 Go to next message
Karsten Wutzke is currently offline Karsten Wutzke
Messages: 112
Registered: July 2009
Senior Member
Hello,

I had a regular JavaSE project. I converted it to a faceted project and added the Utility and JPA facets. Then a META-INF directory was created under src along with a persistence.xml.

This file of course was just a stub, so I deleted it because Eclipse complained that the entity classes weren't in persistence.xml. I then created a new persistence.xml that was/is *linked* to a file in the project's dir. Since then I get the error: "No persistence.xml file found in project"

I've found this http://wap.ecw.de/archives/1380 but I don't really know what to put where in my case.

Here's my current org.eclipse.wst.common.component:

<?xml version="1.0" encoding="UTF-8"?>
<project-modules id="moduleCoreId" project-version="1.5.0">
    <wb-module deploy-name="Test Geoareas Non-PK">
        <wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/>
        <property name="context-root" value="Test_Geoareas_Hibernate_JPA2_IdClass"/>
        <property name="java-output-path" value="/Test Geoareas Hibernate JPA2 IdClass/bin"/>
    </wb-module>
</project-modules>


Does anyone know how to repair this (what to do exactly)?

Karsten
Re: No persistence.xml file found in project? [message #669318 is a reply to message #668658] Mon, 09 May 2011 17:29 Go to previous messageGo to next message
Paul Fullbright is currently offline Paul Fullbright
Messages: 200
Registered: July 2009
Senior Member
A couple questions spring to mind:

Is this a web project? You have a deploy path of "/WEB-INF/classes" but are using the utility facet. Seems you should either have a web facet or use a different deploy path. Dali uses this information to determine source paths for deploy locations. Ergo, in your case, a source location for a deploy path of "META-INF/persistence.xml" would return no location, because there is no mapping to account for it.

Is this a maven project? I ask only because of the link you provided, which seems to describe a problem known for maven projects. https://bugs.eclipse.org/bugs/show_bug.cgi?id=251323



Re: No persistence.xml file found in project? [message #669420 is a reply to message #669318] Tue, 10 May 2011 05:50 Go to previous messageGo to next message
Karsten Wutzke is currently offline Karsten Wutzke
Messages: 112
Registered: July 2009
Senior Member
It's neither a web project nor a Maven project. As I wrote it used to be a regular JavaSE project to which I added JPA support manually by using the Utility Module and JPA facets. So, I'm using the following project facets: Java, JavaScript, JPA, Utility Module.

Adding the latter two resulted in Eclipse adding the META-INF dir under src, with a persistence.xml stub. I then deleted this one to link to my real one. Shortly thereafter (I can't reconstruct exactly when) the error appeared.

The XML shown is just what is currently in the file org.eclipse.wst.common.component which I didn't change manually at all.

The other linked resource (the German blog post) was just to add at least something I had tried, it doesn't necessarily apply.

So, is there a way to fix this? Is this a bug in Dali or some other plugin/component?

Karsten
Re: No persistence.xml file found in project? [message #670278 is a reply to message #669420] Fri, 13 May 2011 06:58 Go to previous messageGo to next message
Karsten Wutzke is currently offline Karsten Wutzke
Messages: 112
Registered: July 2009
Senior Member
?

Is this a bug? Converting a regular JavaSE project to Utility Module + JPA faceted => this bug?

Karsten
Re: No persistence.xml file found in project? [message #671056 is a reply to message #670278] Mon, 16 May 2011 12:01 Go to previous messageGo to next message
Paul Fullbright is currently offline Paul Fullbright
Messages: 200
Registered: July 2009
Senior Member
It *shouldn't* be. No.


But that .component file is just wrong. It should have the line:

<wb-resource deploy-path="/" source-path="/src"/>

instead of what you have. What you have is the deploy path for a web project, not an EE/SE project. The above is what I get when I convert a java project to a utility project. Those path mappings can be configured via the "Deployment Assembly" node on the project properties, so you shouldn't have to redo the conversion.


As to the potential second issue. When you say you link to your real persistence.xml, do you mean that you've created a "link" in the META-INF directory to another file elsewhere? If so, I don't believe there should be any problems with that either, as long as the deploy path is mapped to the right source location. you don't *have* to map the deploy location of "/" to "/src" if you don't want to (you could map "/META-INF" to "/artifacts" for instance), but we must be able to resolve a deploy location of "/META-INF/persistence.xml" to some actual source file. (In web projects, we look for "/WEB-INF/classes/META-INF/persistence.xml".)

(Also, apologies. Looks like preferences to get notifications for forum posts might have been reset.)

icon14.gif  Re: No persistence.xml file found in project? [message #671261 is a reply to message #671056] Tue, 17 May 2011 06:07 Go to previous message
Karsten Wutzke is currently offline Karsten Wutzke
Messages: 112
Registered: July 2009
Senior Member
Paul, thanks for replying.

That line of code you postes fixed all but one project of mine. I have no idea where the
        <wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/>

lines came from. I didn't edit anything manually and I can't remember having fiddled with the deployment assembly as the projects affected are only JavaSE test programs run from a shell. Strange!

As for the linking to persistence.xml it now also works as expected.

Consider this issue solved... Smile

Many thanks
Karsten

[Updated on: Tue, 17 May 2011 06:08]

Report message to a moderator

Previous Topic:JPA Tools -> Entity from Tables
Next Topic:Error: Dali not correctly validating @EmbeddedId ID classes
Goto Forum:
  


Current Time: Thu Jul 31 16:00:38 EDT 2014

Powered by FUDForum. Page generated in 0.02082 seconds