Camel JPA - No Persistence provider for EntityManager named camel

2014-01-25 Thread Sebarry
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.


JpaConsumer - failed polling endpoint

2014-01-31 Thread Sebarry
Hi,

I'm getting the following error trying to poll a JPA entity Person. There's
no error in the code. Everything compiles ok with a mvn clean install and
the Person entity does exist in the
net.lr.tutorial.karaf.camel.jpa2jms.model package. I have installed all the
necessary features I believe and I know it's correctly connection to the
database because it's creating a sequence database for the primary key.

2014-01-30 21:33:59,848 | WARN  | jms.model.Person | JpaConsumer
 
| 125 - org.apache.camel.camel-core - 2.12.0 | Consumer
Consumer[jpa://net.lr.tutorial.karaf.camel.jpa2jms.model.Person?consumer.delay=3500]
failed polling endpoint:
Endpoint[jpa://net.lr.tutorial.karaf.camel.jpa2jms.model.Person?consumer.delay=3500].
Will try again at next poll. Caused by:
[org.apache.openjpa.persistence.ArgumentException - An error occurred while
parsing the query filter "select x from Person x". Error message: The name
"Person" is not a recognized entity or identifier. Perhaps you meant Person,
which is a close match. Known entity names: [Person]] 

org.apache.openjpa.persistence.ArgumentException: An error occurred while
parsing the query filter "select x from Person x". Error message: The name
"Person" is not a recognized entity or identifier. Perhaps you meant Person,
which is a close match. Known entity names: [Person] 

Any ideas?

Sean



--
View this message in context: 
http://camel.465427.n5.nabble.com/JpaConsumer-failed-polling-endpoint-tp5746645.html
Sent from the Camel - Users mailing list archive at Nabble.com.