openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Murali" <murali.adir...@emagia.com>
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 [com.receivables.server.dao.host.hibernate.HostGroupDAOImpl]
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 "com.receivables.server.dao.host.HostGroupDTO@1ca61ca6[id->2;
name->test1; description->test1memberHosts->0policies->0]" to PersistenceCapable
failed.  Ensure that it has been enhanced.
FailedObject: com.receivables.server.dao.host.HostGroupDTO@1ca61ca6[id->2; name->test1;
description->test1memberHosts->0policies->0]
 at org.apache.openjpa.kernel.BrokerImpl.assertPersistenceCapable(BrokerImpl.java:4271)
 at org.apache.openjpa.kernel.BrokerImpl.persist(BrokerImpl.java:2373)
 at org.apache.openjpa.kernel.BrokerImpl.persist(BrokerImpl.java:2233)
 at org.apache.openjpa.kernel.DelegatingBroker.persist(DelegatingBroker.java:1010)
 at org.apache.openjpa.persistence.EntityManagerImpl.persist(EntityManagerImpl.java:541)
 at com.receivables.server.dao.host.hibernate.HostGroupDAOImpl.create(HostGroupDAOImpl.java:113)
 at com.receivables.server.host.HostGroupManager.createHostGroup(HostGroupManager.java:87)
 at com.receivables.server.mgmt.ConsoleManagement.createHostGroup(ConsoleManagement.java:243)
 at com.receivables.server.mgmt.console.host.HostGroupAddAction.execute(HostGroupAddAction.java:92)
 at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
 at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
 at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
 at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
 at com.receivables.server.mgmt.console.access.AuthorizationFilter.doFilter(AuthorizationFilter.java:70)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
 at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
 at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
 at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
 at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
 at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
 at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
 at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
 at java.lang.Thread.run(Thread.java:803)
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.

Regards,
Murali Krishna Adiraju.


----- Original Message ----- 
From: "Patrick Linskey" <plinskey@gmail.com>
To: <open-jpa-dev@incubator.apache.org>; "Murali" <murali.adiraju@emagia.com>
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 <murali.adiraju@emagia.com> 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
operations.
>>
>> Following are the environment details:
>>
>> Application Server: Jboss-4.0.4.GA
>> Operating System with version: Redhat Linux 4, with kernel version 2.6.9.42 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
>
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message