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.

Reply via email to