[ 
https://issues.apache.org/jira/browse/CAMEL-6798?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Alessandro Baldoni updated CAMEL-6798:
--------------------------------------

    Description: 
When using a JNDIRegistry in a Camel context to make a JPA EntityManagerFactory 
available to a JPAComponent (required when running Camel in a Java EE 
container), the JPAComponent is unable to find it due do this line:

            Map<String, EntityManagerFactory> map = 
getCamelContext().getRegistry().findByTypeWithName(EntityManagerFactory.class);

since the method findByTypeWithName in JNDIRegistry is unimplemented (returns a 
null map).
This forces to fallback to a SimpleRegistry or to a Spring registry, thus 
making impossible to use the JAVA EE container JNDI registry.

Proposted solution: At present, JNDI does not allow lookups based on a class.
My suggestion is to lookup the EntityManagerFactory by a standard name, such as 
when looking for the default persistence unit name (and eventually adding a 
property for the JPA URL in order to use a custom name).


  was:
The method findByTypeWithName in JNDIRegistry is unimplemented (returns a null 
map).
When using a JNDIRegistry in a Camel context to make a JPA EntityManagerFactory 
available to a JPAComponent (required when running Camel in a Java EE 
container), the JPAComponent is unable to find it due do this line:

            Map<String, EntityManagerFactory> map = 
getCamelContext().getRegistry().findByTypeWithName(EntityManagerFactory.class);

This forces to fallback to a SimpleRegistry or to a Spring registry, thus 
making impossible to use the JAVA EE container JNDI registry.

Proposted solution: At present, JNDI does not allow lookups based on a class.
My suggestion is to lookup the EntityManagerFactory by a standard name, such as 
when looking for the default persistence unit name (and eventually adding a 
property for the JPA URL in order to use a custom name).



> JPAComponent: unable to find EntityManagerFactory in JNDIRegistry
> -----------------------------------------------------------------
>
>                 Key: CAMEL-6798
>                 URL: https://issues.apache.org/jira/browse/CAMEL-6798
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core, camel-jpa
>    Affects Versions: 2.12.0, 2.12.1
>            Reporter: Alessandro Baldoni
>
> When using a JNDIRegistry in a Camel context to make a JPA 
> EntityManagerFactory available to a JPAComponent (required when running Camel 
> in a Java EE container), the JPAComponent is unable to find it due do this 
> line:
>             Map<String, EntityManagerFactory> map = 
> getCamelContext().getRegistry().findByTypeWithName(EntityManagerFactory.class);
> since the method findByTypeWithName in JNDIRegistry is unimplemented (returns 
> a null map).
> This forces to fallback to a SimpleRegistry or to a Spring registry, thus 
> making impossible to use the JAVA EE container JNDI registry.
> Proposted solution: At present, JNDI does not allow lookups based on a class.
> My suggestion is to lookup the EntityManagerFactory by a standard name, such 
> as when looking for the default persistence unit name (and eventually adding 
> a property for the JPA URL in order to use a custom name).



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to