Cannot find the declaration of element 'persistence'

A common error when using EJB3 is

Cannot find the declaration of element 'persistence'

This is caused by a missing xml namespace attribute declaration in your persistence.xml file. To fix this error make sure your persistence tag has the following syntax:

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

instead of

<persistence>