openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Murali" <>
Subject JNDI lookup in OpenJPA.
Date Tue, 15 May 2007 05:01:06 GMT

I am new to OpenJPA technology.
I am having problems while performing JNDI lookup for the bean resources to get the EntityManagerFactory
I am trying to perform JNDI lookup operation to fetch the DataSource & EntityManagerFactory
instances to connect to the DataBase.
Following is the code snippet:
public static EntityManagerFactory  getOpenJPASessionFactory(String jndiSessionFactoryName)
 throws DaoException {  
    EntityManagerFactory emFactory = null;  
    try {
       Context ctx = new InitialContext();
       emFactory = (EntityManagerFactory) ctx.lookup(jndiSessionFactoryName);
    }catch (ClassCastException cce) {
       throw new DaoException(DaoConstants.OPENJPA_FACTORY_ERROR, cce);  
    } catch (NamingException ne) {
       throw new DaoException(DaoConstants.OPENJPA_FACTORY_ERROR, ne);  
    return emFactory; 
When i try to get the EntityManager Instance from Factory instance, it says "jndiSessionFactoryName"
is not bound, because of this i am not able to get the Datasource for performing the Database
Following are the environment details:
Application Server: Jboss-4.0.4.GA
Operating System with version: Redhat Linux 4, with kernel version Elsmp 
OpenJPA version: 0.9.7 
JDK version: Jdk 1.5.0_07
Database: IBM DB2  version 9.1

Is there any interoperability issue of OpenJPA with Jboss-4.0.4.GA?
Do we have to upgrade to any newer version of Jboss ?
Please help me in this regard. 
Thanks in advance.
Waiting for your response.
Murali Krishna Adiraju.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message