title: Log4j + OpenJPA = NoClassDefFoundError: javax/persistence/AttributeConverter
body: <p>I'm trying to get log4j (I would also be happy to use any logging api as log as it is jpa persistent) use jpa appender. </p>
  
  <p>My persistence.xml looks like this</p>
  
  <pre><code>&lt;persistence-unit name="persistenceUnit" transaction-type="RESOURCE_LOCAL"&gt;
      &lt;provider&gt;org.apache.openjpa.persistence.PersistenceProviderImpl&lt;/provider&gt;
      &lt;class&gt;org.apache.camel.processor.interceptor.jpa.JpaTraceEventMessage&lt;/class&gt;
      &lt;class&gt;org.apache.logging.log4j.core.appender.db.jpa.converter.ContextMapAttributeConverter&lt;/class&gt;
      &lt;class&gt;org.apache.logging.log4j.core.appender.db.jpa.converter.ContextMapJsonAttributeConverter&lt;/class&gt;
      &lt;class&gt;org.apache.logging.log4j.core.appender.db.jpa.converter.ContextStackAttributeConverter&lt;/class&gt;
      &lt;class&gt;org.apache.logging.log4j.core.appender.db.jpa.converter.ContextStackJsonAttributeConverter&lt;/class&gt;
      &lt;class&gt;org.apache.logging.log4j.core.appender.db.jpa.converter.MarkerAttributeConverter&lt;/class&gt;
      &lt;class&gt;org.apache.logging.log4j.core.appender.db.jpa.converter.MessageAttributeConverter&lt;/class&gt;
      &lt;class&gt;org.apache.logging.log4j.core.appender.db.jpa.converter.StackTraceElementAttributeConverter&lt;/class&gt;
      &lt;class&gt;org.apache.logging.log4j.core.appender.db.jpa.converter.ThrowableAttributeConverter&lt;/class&gt;
      &lt;class&gt;com.xxxxxx.lab.logging.ReportEntity&lt;/class&gt;
      &lt;properties&gt;
          &lt;property name="openjpa.jdbc.DBDictionary" value="org.apache.openjpa.jdbc.sql.HSQLDictionary"/&gt;
          &lt;!-- value="buildSchema" to runtime forward map the DDL SQL; value="validate" makes no changes to the database --&gt;
          &lt;property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema"/&gt;
          &lt;property name="openjpa.RuntimeUnenhancedClasses" value="supported"/&gt;
      &lt;/properties&gt;
  &lt;/persistence-unit&gt;
  </code></pre>
  
  <p>As per apidocs:</p>
  
  <blockquote>
    <p>Many of the return types of LogEvent methods (e.g., StackTraceElement,
    Message, Marker, Throwable, ThreadContext.ContextStack, and
    Map) will not be recognized by the JPA provider. In
    conjunction with @Convert, you can use the converters in the
    org.apache.logging.log4j.core.appender.db.jpa.converter package to
    convert these types to database columns.</p>
  </blockquote>
  
  <p>So I added all necessary classes, but it still throws:</p>
  
  <pre><code>java.lang.NoClassDefFoundError: javax/persistence/AttributeConverter
  </code></pre>