Java

Observe the Madness!

I decided to give OpenJPA another go now it’s all incubated and promises that running agents are the way of the past. Before I can really try any of that though I have a huge problem with my persistence.xml file not being parsed. I had this problem last time I tried OpenJPA and it took me ages to solve then as well.

I ended up looking at my own blog for any clues as to how I fixed it; I was infinitely recursing up my own arse. Anyway to help improve my Googling for a solution in future… If you are using OpenJPA and you get the following error:

cvc-elt.1: Cannot find the declaration of element 'persistence'.

Then replace the first persistence tag in the following way:


Not <persistence> but
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">

This simply defines what the Schema should be for the persistence unit. To understand why you’re doing this see this post. Note that the post is titled Dumb User Question but it’s really not, if you look at the example persistence file given in the documentation you would forgive anyone for making this mistake.

Standard

One thought on “Observe the Madness!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s