title: Getting error while creating JPA producer endpoint
body: <p>I am new to Camel. I am writing a camel route for following scenario</p>
  
  <ol>
  <li>Pick XML file from a location</li>
  <li>Validate the XML file against XSD</li>
  <li>Persist the XML data into DB</li>
  </ol>
  
  <p>And i wrote like this</p>
  
  <pre><code>public void configure() throws Exception {
             JaxbDataFormat jaxb = new JaxbDataFormat();
             JAXBContext ctx = JAXBContext.newInstance(Book.class);
             jaxb.setContext(ctx);
  
             from("file:data/source?noop=true").to("validator:books.xsd")
                                           .to("file:data/destination").split()
                                           .tokenizeXML("book").unmarshal(jaxb)
                                           .to("jpa:com.labs.Book");
  }
  </code></pre>
  
  <p>And My XML file is :</p>
  
  <pre><code>&lt;book&gt;
             &lt;author&gt;Kishore&lt;/author&gt;
             &lt;title&gt;The Second Book&lt;/title&gt;
             &lt;genre&gt;Fiction&lt;/genre&gt;
  &lt;/book&gt;
  </code></pre>
  
  <p>And my XSD is :</p>
  
  <pre><code>&lt;xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt;
    &lt;xs:element name="book"&gt;
      &lt;xs:complexType&gt;
        &lt;xs:sequence&gt;
          &lt;xs:element type="xs:string" name="author" nillable="false"/&gt;
          &lt;xs:element type="xs:string" name="title" nillable="false"/&gt;
          &lt;xs:element type="xs:string" name="genre" nillable="false" fixed="{Fiction,Bio}"/&gt;
        &lt;/xs:sequence&gt;
      &lt;/xs:complexType&gt;
    &lt;/xs:element&gt;
  &lt;/xs:schema&gt;
  </code></pre>
  
  <p>And i have JAXB model for the XML. And i have pesristence.xml file also. But i am getting an exception like below, when i am trying to execute my application</p>
  
  <pre><code>SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
  SLF4J: Defaulting to no-operation (NOP) logger implementation
  SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
  log4j:WARN No appenders could be found for logger (org.springframework.orm.jpa.LocalEntityManagerFactoryBean).
  log4j:WARN Please initialize the log4j system properly.
  log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
  1168  camel  WARN   [main] openjpa.Enhance - Unenhanced classes were detected even though the enhancer has ran. Ensure that the EntityManagerFactory is created prior to creating any Entities.    
  Exception in thread "main" org.apache.camel.FailedToCreateProducerException: Failed to create Producer for endpoint: Endpoint[jpa://com.labs.Book]. Reason: &lt;openjpa-2.3.0-r422266:1540826 nonfatal user error&gt; org.apache.openjpa.persistence.ArgumentException: This configuration disallows runtime optimization, but the following listed types were not enhanced at build time or at class load time with a javaagent: "
  com.labs.Book".
             at org.apache.camel.impl.ProducerCache.doGetProducer(ProducerCache.java:409)
             at org.apache.camel.impl.ProducerCache.acquireProducer(ProducerCache.java:123)
             at org.apache.camel.processor.SendProcessor.doStart(SendProcessor.java:202)
             at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
             at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:74)
             at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:59)
             at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:103)
             at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:89)
             at org.apache.camel.processor.DelegateAsyncProcessor.doStart(DelegateAsyncProcessor.java:79)
             at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
             at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:74)
             at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:59)
             at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:103)
             at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:89)
             at org.apache.camel.processor.RedeliveryErrorHandler.doStart(RedeliveryErrorHandler.java:1154)
             at org.apache.camel.support.ChildServiceSupport.start(ChildServiceSupport.java:41)
             at org.apache.camel.support.ChildServiceSupport.start(ChildServiceSupport.java:28)
             at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:74)
             at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:59)
             at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:103)
             at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:89)
             at org.apache.camel.processor.interceptor.DefaultChannel.doStart(DefaultChannel.java:153)
             at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
             at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:74)
             at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:59)
             at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:103)
             at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:61)
             at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:103)
             at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:89)
             at org.apache.camel.processor.MulticastProcessor.doStart(MulticastProcessor.java:993)
             at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
             at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:74)
             at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:59)
             at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:103)
             at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:61)
             at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:103)
             at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:89)
             at org.apache.camel.processor.MulticastProcessor.doStart(MulticastProcessor.java:993)
             at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
             at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:74)
             at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:59)
             at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:103)
             at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:89)
            at org.apache.camel.processor.DelegateAsyncProcessor.doStart(DelegateAsyncProcessor.java:79)
             at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
             at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:74)
             at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:59)
             at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:103)
             at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:89)
             at org.apache.camel.processor.RedeliveryErrorHandler.doStart(RedeliveryErrorHandler.java:1154)
             at org.apache.camel.support.ChildServiceSupport.start(ChildServiceSupport.java:41)
             at org.apache.camel.support.ChildServiceSupport.start(ChildServiceSupport.java:28)
             at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:74)
             at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:59)
             at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:103)
             at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:89)
             at org.apache.camel.processor.interceptor.DefaultChannel.doStart(DefaultChannel.java:153)
             at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
             at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:74)
             at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:59)
             at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:103)
             at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:61)
             at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:103)
             at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:89)
             at org.apache.camel.processor.MulticastProcessor.doStart(MulticastProcessor.java:993)
             at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
             at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:74)
             at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:59)
             at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:103)
             at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:89)
             at org.apache.camel.processor.DelegateAsyncProcessor.doStart(DelegateAsyncProcessor.java:79)
             at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
             at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:74)
             at org.apache.camel.impl.RouteService.startChildService(RouteService.java:334)
             at org.apache.camel.impl.RouteService.warmUp(RouteService.java:158)
             at org.apache.camel.impl.DefaultCamelContext.doWarmUpRoutes(DefaultCamelContext.java:2263)
             at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:2193)
             at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:1981)
             at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1851)
             at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1683)
             at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
             at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1651)
             at com.labs.App.main(App.java:36)
  Caused by: &lt;openjpa-2.3.0-r422266:1540826 nonfatal user error&gt; org.apache.openjpa.persistence.ArgumentException: This configuration disallows runtime optimization, but the following listed types were not enhanced at build time or at class load time with a javaagent: "
  com.labs.Book".
             at org.apache.openjpa.enhance.ManagedClassSubclasser.prepareUnenhancedClasses(ManagedClassSubclasser.java:115)
             at org.apache.openjpa.kernel.AbstractBrokerFactory.loadPersistentTypes(AbstractBrokerFactory.java:312)
             at org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java:236)
             at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:212)
             at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:155)
             at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:226)
             at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:153)
             at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:59)
             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
             at java.lang.reflect.Method.invoke(Method.java:606)
             at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.invokeProxyMethod(AbstractEntityManagerFactoryBean.java:376)
             at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean$ManagedEntityManagerFactoryInvocationHandler.invoke(AbstractEntityManagerFactoryBean.java:519)
             at com.sun.proxy.$Proxy20.createEntityManager(Unknown Source)
             at org.apache.camel.component.jpa.JpaEndpoint.createEntityManager(JpaEndpoint.java:284)
             at org.apache.camel.component.jpa.JpaProducer.&lt;init&gt;(JpaProducer.java:44)
             at org.apache.camel.component.jpa.JpaEndpoint.createProducer(JpaEndpoint.java:106)
             at org.apache.camel.impl.ProducerCache.doGetProducer(ProducerCache.java:405)
             ... 82 more
  </code></pre>
  
  <p>Thanks for your time and i appreciate your help. And if possible could you please refer some links to Camel JPA examples, where JPA Component is used as Producer.</p>