NetBeans Forums
| View previous topic :: View next topic |
| Author |
Message |
igillespie
Joined: 06 Feb 2009 Posts: 8
|
Posted: Fri Feb 06, 2009 6:36 pm Post subject: Persistence Error in Netbeans "Building a Java Desktop Database Application" Tut |
|
|
When doing the following two tutorials using NetBeans 6.5 and TopLink in a Windows Vista environment...
http://www.netbeans.org/kb/docs/java/gui-db.html
http://www.netbeans.org/kb/docs/java/gui-db-custom.html
...I get the following errors immediately at run time:
| Code: | Feb 6, 2009 12:33:15 PM org.jdesktop.application.Application$1 run
SEVERE: Application class carsapp.CarsApp failed to launch
javax.persistence.PersistenceException: No Persistence provider for EntityManager named car_databasePU: Provider named oracle.toplink.essentials.PersistenceProvider threw unexpected exception at create EntityManagerFactory:
oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException
Local Exception Stack:
Exception [TOPLINK-30005] (Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007))): oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while searching for persistence archives with ClassLoader: sun.misc.Launcher$AppClassLoader@11b86e7
Internal Exception: java.lang.IllegalArgumentException: URI has an authority component
... |
These are pretty basic tutorials, so I'm a little confused was to why either would throw an error.
I found MANY other users/developers complaining of the same error; however, the only cogent explanations of the solution that I could find suggested two fixes, neither of which seem to work.
First, several solutions noted that the persistence.xml file must be located in the META-INF directory of one's project folder. This is already done; the file was created and placed there by NetBeans.
Second, several other solutions note that META-INF and/or the appropriate TopLink "jar" file(s) have to "be in my CLASSPATH". I'm not entirely sure what this means.
Do these files/folders need to be specified in the CLASSPATH environment variable under the "System" menu in the Windows Control Panel, in the "Project Properties" NetBeans, or some place else? Do I actually need to specify the full path to each "jar" or folder, or will sub-folders and/or files be automatically scanned?
I've already tried various different combinations, but nothing seems to work.
Furthermore, in the project level "Properties" of my NetBeans project, under the node "Libraries", TopLink is already included under the "compile-time" libraries and I've also tried including the META-INF folder there but still not luck.
Please Help! This is getting incredibly frustrating for a first tutorial with NetBeans.
|
|
| Back to top |
|
 |
Grover Blue Posted via mailing list.
|
Posted: Fri Feb 06, 2009 7:10 pm Post subject: Persistence Error in Netbeans "Building a Java Desktop Database Application" Tut |
|
|
You need to add a persistence unit to your class. Right click on the
project and add a new one. Name it car_databasePU
On 2/6/09, igillespie <address-removed> wrote:
| Quote: | When doing the following two tutorials using NetBeans 6.5 and TopLink in a
Windows Vista environment...
http://www.netbeans.org/kb/docs/java/gui-db.html
http://www.netbeans.org/kb/docs/java/gui-db-custom.html
...I get the following errors immediately at run time:
Code:
Feb 6, 2009 12:33:15 PM org.jdesktop.application.Application$1 run
SEVERE: Application class carsapp.CarsApp failed to launch
javax.persistence.PersistenceException: No Persistence provider for
EntityManager named car_databasePU: Provider named
oracle.toplink.essentials.PersistenceProvider threw unexpected exception at
create EntityManagerFactory:
oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException
Local Exception Stack:
Exception [TOPLINK-30005] (Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs
(12/06/2007))):
oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while searching for
persistence archives with ClassLoader:
sun.misc.Launcher$AppClassLoader@11b86e7
Internal Exception: java.lang.IllegalArgumentException: URI has an authority
component
...
These are pretty basic tutorials, so I'm a little confused was to why either
would throw an error.
I found MANY other users/developers complaining of the same error; however,
the only cogent explanations of the solution that I could find suggested two
fixes, neither of which seem to work.
First, several solutions noted that the persistence.xml file must be located
in the META-INF directory of one's project folder. This is already done; the
file was created and placed there by NetBeans.
Second, several other solutions note that META-INF and/or the appropriate
TopLink "jar" file(s) have to "be in my CLASSPATH". I'm not entirely sure
what this means.
Do these files/folders need to be specified in the CLASSPATH environment
variable under the "System" menu in the Windows Control Panel, in the
"Project Properties" NetBeans, or some place else? Do I actually need to
specify the full path to each "jar" or folder, or will sub-folders and/or
files be automatically scanned?
I've already tried various different combinations, but nothing seems to
work.
Furthermore, in the project level "Properties" of my NetBeans project, under
the node "Libraries", TopLink is already included under the "compile-time"
libraries and I've also tried including the META-INF folder there but still
not luck.
Please Help! This is getting incredibly frustrating for a first tutorial
with NetBeans.
|
--
Sent from my mobile device
"If the American people ever allow private banks to control the issue
of their currency, first by inflation, then by deflation, the
banks...will deprive the people of all property until their children
wake-up homeless on the continent their fathers conquered... The
issuing power should be taken from the banks and restored to the
people, to whom it properly belongs." -- Thomas Jefferson
"Government big enough to supply everything...is big enough to take
everything you have. The course of history shows that as a government
grows, liberty decreases" --- Thomas Jefferson
www.CampaignForLiberty.org
|
|
| Back to top |
|
 |
igillespie
Joined: 06 Feb 2009 Posts: 8
|
Posted: Fri Feb 06, 2009 7:32 pm Post subject: |
|
|
It doesn't say that one needs to do that in the tutorial, but I've just tried it. Here's what happens.
I right-click on my project in the NetBeans "Projects" windows and select "New" | "Other...". Then, in the "New File" window, I select "Persistence" from the "Categories" menu and then "Persistence Unit" from the "File Types" window. I then click next.
On the next screen I type in car_databasePU as the "Persistence Unit Name" and then the "Finish" button at the bottom of the wondow is greyed out and I get a warning message just above that says "the name of the persistence unit must be unique".
This is a little odd since there's no persistence unit file in the existing project (as generated by NetBeans as part of the tutorial), but--in addition to car_databasePU being mentioned twice in the persistence.xml file--there is a line in another file--CarsView.properties--with the line "entityManager.persistenceUnit=car_databasePU". I don't really know what this means given that this is all part of the code generated automatically by NetBeans, but I hope it helps.
In any event, I doubt this is the problem as one doesn't have to create a perisistence unit file as part of the tutorial. All of that seems to be handled automatically.
|
|
| Back to top |
|
 |
giorgio42
Joined: 15 Aug 2008 Posts: 120
|
Posted: Fri Feb 06, 2009 9:48 pm Post subject: Persistence Error in Netbeans "Building a Java Desktop Database Application" Tut |
|
|
I don't know exactly what is going on inside Toplink here, but from the exception I assume that it searches the list of jars in the class path for persistence archives. During this process it runs into a path that violates the URI specification. You can easily evoke this exception by passing an URI similar to "file://foo/bar/baz.txt" to File(URI uri).
This may be a bug in Toplink, but you could at least check your class path (*not* the environment variable) for unorthodox looking entries?
Georg
2009/2/6 Grover Blue <address-removed ([email]address-removed[/email])>
| Quote: | You need to add a persistence unit to your class. Right click on the
project and add a new one. Name it car_databasePU
On 2/6/09, igillespie <address-removed ([email]address-removed[/email])> wrote:
| Quote: | When doing the following two tutorials using NetBeans 6.5 and TopLink in a
Windows Vista environment...
http://www.netbeans.org/kb/docs/java/gui-db.html
http://www.netbeans.org/kb/docs/java/gui-db-custom.html
...I get the following errors immediately at run time:
Code:
Feb 6, 2009 12:33:15 PM org.jdesktop.application.Application$1 run
SEVERE: Application class carsapp.CarsApp failed to launch
javax.persistence.PersistenceException: No Persistence provider for
EntityManager named car_databasePU: Provider named
oracle.toplink.essentials.PersistenceProvider threw unexpected exception at
create EntityManagerFactory:
oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException
Local Exception Stack:
Exception [TOPLINK-30005] (Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs
(12/06/2007))):
oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while searching for
persistence archives with ClassLoader:
sun.misc.Launcher$AppClassLoader@11b86e7
Internal Exception: java.lang.IllegalArgumentException: URI has an authority
component
...
These are pretty basic tutorials, so I'm a little confused was to why either
would throw an error.
I found MANY other users/developers complaining of the same error; however,
the only cogent explanations of the solution that I could find suggested two
fixes, neither of which seem to work.
First, several solutions noted that the persistence.xml file must be located
in the META-INF directory of one's project folder. This is already done; the
file was created and placed there by NetBeans.
Second, several other solutions note that META-INF and/or the appropriate
TopLink "jar" file(s) have to "be in my CLASSPATH". I'm not entirely sure
what this means.
Do these files/folders need to be specified in the CLASSPATH environment
variable under the "System" menu in the Windows Control Panel, in the
"Project Properties" NetBeans, or some place else? Do I actually need to
specify the full path to each "jar" or folder, or will sub-folders and/or
files be automatically scanned?
I've already tried various different combinations, but nothing seems to
work.
Furthermore, in the project level "Properties" of my NetBeans project, under
the node "Libraries", TopLink is already included under the "compile-time"
libraries and I've also tried including the META-INF folder there but still
not luck.
Please Help! This is getting incredibly frustrating for a first tutorial
with NetBeans.
|
--
Sent from my mobile device
"If the American people ever allow private banks to control the issue
of their currency, first by inflation, then by deflation, the
banks...will deprive the people of all property until their children
wake-up homeless on the continent their fathers conquered... The
issuing power should be taken from the banks and restored to the
people, to whom it properly belongs." -- Thomas Jefferson
"Government big enough to supply everything...is big enough to take
everything you have. The course of history shows that as a government
grows, liberty decreases" --- Thomas Jefferson
www.CampaignForLiberty.org
|
|
|
| Back to top |
|
 |
pointer2null
Joined: 11 Feb 2009 Posts: 13
|
Posted: Wed Feb 11, 2009 12:22 pm Post subject: |
|
|
there seems to be a lot of bug in the whole database/binding setup with netbeans. I've been trying for two days to get an embedded database working with no luck at all. I have managed to get the simplist tutorial to work, but if you try and add anything exciting like an auto increment primary key or an embedded database you run into problems.
you say your error is that the persistance manager needs a unique name, but there is not Pm in the project - I think this sounds like *yet* another netbeans bug - try closing netbeans and delete the build and dist folders from the project then restart netbeans. I had a similar case where an entity bean in the project had member values that didn't exist even though I had deleted the old one and made a new one - netbeans seemed not to have updated.
If you find the solution please post it as I'm sure we're not the only people having problems with this.
|
|
| Back to top |
|
 |
igillespie
Joined: 06 Feb 2009 Posts: 8
|
Posted: Wed Feb 11, 2009 3:02 pm Post subject: |
|
|
I've solved this the problem.
It looks like NetBeans/the compiler/the JVM could not find the persistence.xml file because it was stored on a network drive under the new Vista setup at my office.
I don't know why this would be a problem, but most people where I work don't do any kind of development/technical work so the privileges under the new Vista regime are very restrictive and it doesn't entirely surprise me that they would cause headaches.
Chalk another one up for Microsoft!
|
|
| Back to top |
|
 |
Melongo Annabel Posted via mailing list.
|
Posted: Wed Feb 11, 2009 5:58 pm Post subject: Persistence Error in Netbeans "Building a Java Desktop Database Application" Tut |
|
|
Please file this issue at: http://www.netbeans.org/community/issues.html
Thanks.
From: pointer2null <address-removed>
To: address-removed
Sent: Wednesday, February 11, 2009 6:22:40 AM
Subject: [nbusers] Persistence Error in Netbeans "Building a Java Desktop Database Application" Tut
there seems to be a lot of bug in the whole database/binding setup with netbeans. I've been trying for two days to get an embedded database working with no luck at all. I have managed to get the simplist tutorial to work, but if you try and add anything exciting like an auto increment primary key or an embedded database you run into problems.
you say your error is that the persistance manager needs a unique name, but there is not Pm in the project - I think this sounds like *yet* another netbeans bug - try closing netbeans and delete the build and dist folders from the project then restart netbeans. I had a similar case where an entity bean in the project had member values that didn't exist even though I had deleted the old one and made a new one - netbeans seemed not to have updated.
If you find the solution please post it as I'm sure we're not the only people having problems with this.
|
|
| Back to top |
|
 |
thompsonwd40 Posted via mailing list.
|
Posted: Wed Feb 11, 2009 7:01 pm Post subject: Persistence Error in Netbeans "Building a Java Desktop Database Application" Tut |
|
|
If you use Oracle, you need to set up an autoincrement trigger, I will post the solution if this applies to you.
Best,
David
----- Original Message -----
From: "Melongo Annabel" <address-removed>
To: address-removed
Sent: Wednesday, February 11, 2009 10:58:31 AM GMT -07:00 US/Canada Mountain
Subject: Re: [nbusers] Persistence Error in Netbeans "Building a Java Desktop Database Application" Tut
Please file this issue at: http://www.netbeans.org/community/issues.html
Thanks.
From: pointer2null <address-removed>
To: address-removed
Sent: Wednesday, February 11, 2009 6:22:40 AM
Subject: [nbusers] Persistence Error in Netbeans "Building a Java Desktop Database Application" Tut
there seems to be a lot of bug in the whole database/binding setup with netbeans. I've been trying for two days to get an embedded database working with no luck at all. I have managed to get the simplist tutorial to work, but if you try and add anything exciting like an auto increment primary key or an embedded database you run into problems.
you say your error is that the persistance manager needs a unique name, but there is not Pm in the project - I think this sounds like *yet* another netbeans bug - try closing netbeans and delete the build and dist folders from the project then restart netbeans. I had a similar case where an entity bean in the project had member values that didn't exist even though I had deleted the old one and made a new one - netbeans seemed not to have updated.
If you find the solution please post it as I'm sure we're not the only people having problems with this.
|
|
| Back to top |
|
 |
JLNavas
Joined: 18 Feb 2009 Posts: 1
|
Posted: Wed Feb 18, 2009 7:31 pm Post subject: |
|
|
Hi, I have the same problem, my pc runs Vista. I think that I´ve worked it out just changing the project directory.
I started again, but this time creating the project in a simple directory ("c:\testproject") and all has run Ok.
|
|
| Back to top |
|
 |
hantsy
Joined: 27 Aug 2008 Posts: 39
|
Posted: Thu Feb 19, 2009 2:16 am Post subject: Persistence Error in Netbeans "Building a Java Desktop Database Application" Tut |
|
|
JLNavas wrote:
| Quote: | [Laughing]
Hi, I have the same problem, my pc runs Vista. I think that I´ve worked it out just changing the project directory.
I started again, but this time creating the project in a simple directory ("c:\testproject") and all has run Ok.
| I have the same problem.
My development environment:
Fedora 10(i386)
Sun JDK update 12(32bit)
NetBeans 6.5
--
Hantsy Bai
Guangzhou, China
http://hantsy.blogspot.com
|
|
| Back to top |
|
 |
Manfred Riem Posted via mailing list.
|
Posted: Thu Feb 19, 2009 2:31 am Post subject: Persistence Error in Netbeans "Building a Java Desktop Database Application" Tut |
|
|
This is a probably bug in the persistence provider (are you using TopLink
Essentials)?
| Quote: | -----Original Message-----
From: Hantsy Bai [mailto:address-removed]
Sent: Wednesday, February 18, 2009 7:25 PM
To: address-removed
Subject: Re: [nbusers] Persistence Error in Netbeans "Building a Java
Desktop Database Application" Tut
JLNavas wrote:
| Quote: | [Laughing]
Hi, I have the same problem, my pc runs Vista. I think that I$BO<(Bve
| worked it out just changing the project directory.
| Quote: |
I started again, but this time creating the project in a simple
| directory ("c:\testproject") and all has run Ok.
I have the same problem.
My development environment:
Fedora 10(i386)
Sun JDK update 12(32bit)
NetBeans 6.5
--
Hantsy Bai
Guangzhou, China
http://hantsy.blogspot.com
|
|
|
| Back to top |
|
 |
fuddy
Joined: 29 May 2009 Posts: 1
|
Posted: Fri May 29, 2009 5:38 pm Post subject: A solution that works for me. |
|
|
I also had this same problem.
However, I have found a solution that works for me.
Mine is a Derby ( also known as JavaDB for some strange reason ) database.
My problem was in the definition of the "Database Location" in the JAVADB properties.
While Netbeans was perfectly happy with the way I had set it up, in that it allowed me to access the database using NetBeans itself, the application did not build - it gave the oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException and related errors.
So, I shut the database connection and server down
Created a new directory ( D:\Java\Databases )
Moved my database's directory into that new one.
Amended the "Database Location" in JAVADB Properties to D:\Java\Databases
Restarted the server, connected to the database, dropped and rebuilt the Database GUI
All worked fine.
Note sure if this will help all, but it might help some.
|
|
| Back to top |
|
 |
alexgr
Joined: 28 Jul 2009 Posts: 1
|
Posted: Tue Jul 28, 2009 6:03 pm Post subject: |
|
|
I had this problem too. After a couple of brain aneurysms, I figured out that the problem was that the Project Location folder path included non-latin characters.
I use windows in greek, which means that the default NetBeans Project Location is "C:\Documents and Settings\User\Τα έγγραφά μου\NetBeansProjects". Changing the location to something that includes only Latin characters solved the problem...
From what I see this is a bug supposedly resolved, but apparently it is not, as I used the very latest versions of all programs involved.
|
|
| Back to top |
|
 |
rdg_software
Joined: 06 Jan 2012 Posts: 2
|
Posted: Sat Feb 16, 2013 7:38 pm Post subject: persistence unit error |
|
|
I got the same problem. Two days of work but no result.
Tried Hibernate, Eclipselink but the same problem happen.
The EntityManager can't find the persistence library unit or the persistence.xml file. I don't know.
|
|
| Back to top |
|
 |
Edson Richter Posted via mailing list.
|
Posted: Wed Feb 20, 2013 11:51 am Post subject: Persistence Error in Netbeans "Building a Java Desktop Database Application" Tut |
|
|
Em 16/02/2013 17:38, rdg_software escreveu:
| Quote: | | Quote: | I got the same problem. Two days of work but no result.
Tried Hibernate, Eclipselink but the same problem happen.
The EntityManager can't find the persistence library unit or the persistence.xml file. I don't know.
| | Generally speakink, persistence.xml should be in META-INF folder of your class path.
Same apply for Web Apps.
In case of web apps, you will find the following structure:
This means that "META-INF/persistence.xml" should be at root of classpath (sibling your first bit of package - in my case, "br").
If you put your persistence.xml aside with your package, EntityManager should be able to find it.
Regards,
Edson
| Description: |
|
| Filesize: |
5.2 KB |
| Viewed: |
868 Time(s) |

|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|