camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Camel JPA - No Persistence provider for EntityManager named camel
Date Sat, 25 Jan 2014 16:42:55 GMT
Hi

When you use jpa you need a persistence.xml file where you configure
your JPA provider and whatnot.

Google the internet about that.

The default persistent unit name is camel. But you can configure to
use another name if you like. See:
http://camel.apache.org/jpa



On Fri, Jan 24, 2014 at 4:30 PM, Sebarry <seanjamesbarry@yahoo.co.uk> wrote:
> Hi,
>
> I am trying to get the following code to work so I can consume from a JPA
> entity.
>
> String DATASOURCE_CONTEXT = "java:jboss/datasources/WikiDS";
>
>         Connection result = null;
>         DataSource datasource = null;
>
>         try {
>                 Context initialContext = new InitialContext();
>             datasource = (DataSource)initialContext.lookup(DATASOURCE_CONTEXT);
>
>             if (datasource == null) {
>                 System.out.println("Data source is null");
>             }
>             else {
>                 System.out.println("Data source is OK!!!");
>             }
>         }
>         catch(NamingException ex) {
>                 System.out.println("Naming exception is: " + ex.getMessage());
>         }
>
>         SimpleRegistry reg = new SimpleRegistry() ;
>         reg.put("myDataSource",datasource);
>
>         CamelContext context = new DefaultCamelContext(reg);
>
>         ConnectionFactory connectionFactory = new
> ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");
>         context.addComponent("test-jms",
> JmsComponent.jmsComponentAutoAcknowledge(connectionFactory));
>         context.addRoutes(new RouteBuilder() {
>             public void configure() {
>
> from("jpa://org.apache.camel.example.jmstofile?consumer.namedQuery=step1&consumeDelete=false").to("file://test");
>             }
>         });
>
>         ProducerTemplate template = context.createProducerTemplate();
>         context.start();
>
> Whatever I do I get the following exception.
>
> [ERROR] Failed to execute goal
> org.codehaus.mojo:exec-maven-plugin:1.1.1:java (default-cli) on project
> camel-example-jms-file: An exception occured while executing the Java class.
> null: InvocationTargetException: No Persistence provider for EntityManager
> named camel.
>
> Any ideas how to fix this?
>
> Regards,
>
> Sean
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-JPA-No-Persistence-provider-for-EntityManager-named-camel-tp5746449.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Make your Camel applications look hawt, try: http://hawt.io

Mime
View raw message