This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 155915 - Netbeans warns of invalid persistence.xml
Summary: Netbeans warns of invalid persistence.xml
Status: RESOLVED INCOMPLETE
Alias: None
Product: javaee
Classification: Unclassified
Component: Persistence (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Sergey Petrov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-22 02:48 UTC by _ gtzabari
Modified: 2009-09-30 01:20 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description _ gtzabari 2008-12-22 02:48:17 UTC
1) Create new persistence unit using the wizard
2) Persistence.xml will be created
3) Invoke the wizard a second time to create a new persistence unit
4) Wizard warns "The project has an invalid persistence.xml file" but won't explain what exactly is wrong.
5) persistence.xml node in Projects tab shows up like a normal XML file. There doesn't seem to be a way to bring up the
wizard to edit it.
Comment 1 _ gtzabari 2008-12-22 03:09:08 UTC
Seems to be caused by the removal of "source.root" in project.properties. As a workaround of
http://www.netbeans.org/issues/show_bug.cgi?id=151385 I removed this property and defined conf.dir using a direct path.
It isn't clear what "source.root" is supposed to be pointing to. I have the following path structure:

/sources
/conf
/netbeans-project-directory

Originally the following properties were set:

source.root=src
src.dir=${source.root}/java
conf.dir=${source.root}/conf

I redefined them to:

source.root (removed)
src.source.dir=${file.reference.Server-source}
conf.dir=../conf

Please advise me on what to do.
Comment 2 Dongmei Cao 2008-12-22 22:40:31 UTC
I can reproduce the problem if the conf.dir is outside the project and the persistence.xml.dir=${conf.dir}. But if I
have the persistence.xml.dir pointing to different directory, for example,
persistence.xml.dir=${src.source.dir}/META-INF, then it works. Can you try with the same change as I did and let me know
if it works? Thanks.
Comment 3 _ gtzabari 2008-12-23 18:22:43 UTC
Confirmed
Comment 4 Dongmei Cao 2008-12-23 21:26:50 UTC
Thanks for conforming. Since there is a workaround for it, it'll be looked into at some later time.
Comment 5 _ gtzabari 2008-12-24 20:00:03 UTC
dongmeic,

A few points:

1) When I wrote "confirmed" I simply checked that "persistence.xml.dir=${src.source.dir}/META-INF" worked. However, the
key point worth mentioning here is that for me ${src.source.dir} *is* outside the project directory. As such, I don't
think this confirms what you intended it to...

2) Why did you mark the issue as "resolved"? Shouldn't it remain open with target milestone set to "later"?

3) This issue is related to issue #151385
Comment 6 Dongmei Cao 2008-12-24 20:59:29 UTC
When I tried, the ${src.source.dir} can be outside or inside the project. The only time I see the problem is conf.dir is
outside the project and persistence.xml.dir is the conf.dir.

There is no "later" milestone. I can change it to "next"
Comment 7 Sergey Petrov 2009-07-23 12:06:29 UTC
what are steps before step "1) Create new persistence unit using the wizard"?
where it should be created, what should be changed in what kind of project etc?
Comment 8 _ gtzabari 2009-07-23 17:35:00 UTC
sergeyp,

To be honest I don't recall. I believe a vanilla Web Project using the wizard will do.
Comment 9 Martin Schovanek 2009-09-18 15:55:44 UTC
Removing the INCOMPLETE kw, please reevaluate.
Comment 10 Sergey Petrov 2009-09-28 12:59:49 UTC
looks like I need more details,
What is 'vanilla web project'?  should I just create this project and try new persistence unit or modify the project first?
Comment 11 _ gtzabari 2009-09-30 01:12:40 UTC
I tried creating a new Web project followed by two Persistence Units but the problem did not occur. Closing as WORKSFORME.
Comment 12 _ gtzabari 2009-09-30 01:20:29 UTC
Sorry, I am able to reproduce it now.

1) Create a new Web Project using the wizard
2) Close netbeans, edit project.properties
3) Remove "source.root"
4) Set conf.dir=../conf
5) Set src.dir=../source
6) Restart Netbeans
7) Create a new Persistence Unit using the wizard
8) Repeat step 7
9) Netbeans complains that "persistence.xml is invalid" as mentioned in the original report

Reproduced in build "nbms-and-javadoc-4007-on-090929"