openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Murali" <>
Subject Re: JNDI lookup in OpenJPA.
Date Thu, 17 May 2007 03:29:39 GMT
Hi Patrick Linskey,

We are not writing the OpenJPA code in EJB. Our Application is basically using Hibernate code
for persistence D/B operations. 
Since, Hibernate is having LGPL licensing terms we are trying to replace Hibernate with OpenJPA
which is not having any Licensing issues.

We are able to create EntityManagerFactory & EntityManager instances without going for
JNDI lookup operation.

We used the following approach:

EntityManagerFactory emFactory = Persistence.createEntityManagerFactory("puName",System.getProperties());
EntityManager session = emFactory.createEntityManager();

But we are facing problems while persisting the DTO object. Following the trace of the exception
that we have encountered:

2007-05-16 22:05:39,796 ERROR []
The Security Server failed to persist data into the repository database. Refer to server.log
for details.
<0.9.7-incubating nonfatal user error> org.apache.openjpa.persistence.ArgumentException:
Attempt to cast instance "[id->2;
name->test1; description->test1memberHosts->0policies->0]" to PersistenceCapable
failed.  Ensure that it has been enhanced.
FailedObject:[id->2; name->test1;
 at org.apache.openjpa.kernel.BrokerImpl.assertPersistenceCapable(
 at org.apache.openjpa.kernel.BrokerImpl.persist(
 at org.apache.openjpa.kernel.BrokerImpl.persist(
 at org.apache.openjpa.kernel.DelegatingBroker.persist(
 at org.apache.openjpa.persistence.EntityManagerImpl.persist(
 at com.receivables.server.mgmt.ConsoleManagement.createHostGroup(
 at org.apache.struts.action.RequestProcessor.processActionPerform(
 at org.apache.struts.action.RequestProcessor.process(
 at org.apache.struts.action.ActionServlet.process(
 at org.apache.struts.action.ActionServlet.doPost(
 at javax.servlet.http.HttpServlet.service(
 at javax.servlet.http.HttpServlet.service(
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(
 at com.receivables.server.mgmt.console.access.AuthorizationFilter.doFilter(
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(
 at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(
 at org.apache.catalina.core.StandardWrapperValve.invoke(
 at org.apache.catalina.core.StandardContextValve.invoke(
 at org.apache.catalina.core.StandardHostValve.invoke(
 at org.apache.catalina.valves.ErrorReportValve.invoke(
 at org.apache.catalina.core.StandardEngineValve.invoke(
 at org.apache.catalina.connector.CoyoteAdapter.service(
 at org.apache.coyote.http11.Http11Processor.process(
 at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(
 at org.apache.tomcat.util.threads.ThreadPool$
2007-05-16 22:22:38,672 INFO  [com.receivables.server.logger.LoggerUtil] Getting audit logger
from Logger Util

We are trying to understand the meaning of "Enhancing the DTO object to Persistence capabilities"
as observed in the trace of the exception.

Can you please help in this regard.

Thanks in advance.

Waiting for your response.

Murali Krishna Adiraju.

----- Original Message ----- 
From: "Patrick Linskey" <>
To: <>; "Murali" <>
Sent: Thursday, May 17, 2007 2:00 AM
Subject: Re: JNDI lookup in OpenJPA.

> Hi,
> Are you writing this in an EJB, or some other artifact type?
> -Patrick
> On 5/14/07, Murali <> wrote:
>> Hi,
>> I am new to OpenJPA technology.
>> I am having problems while performing JNDI lookup for the bean resources to get the
EntityManagerFactory instance.
>> 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.
>> Regards,
>> Murali Krishna Adiraju.
> -- 
> Patrick Linskey
> 202 669 5907
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message