Hi Kevin,

Thanks for taking interest despite this being a Websphere question. Here is
the information that might help:

1. Yes am using the EJB3 featurepack. My server is at version 6.1.0.17 with
EJB and Webservices FP installed.
2. The code snippet Persistence.createEntityManager() works on stand-alone
even with the jar tags(but fails in the container).
3. I am using the openJPA shipped with Websphere.

Having given you the above it looks from your answer that I have erred by
not stating my question properly. The issue is, I don't know what name is
used to bind the factory and the manager. So the issue is not that I'm not
able to lookup but that I don't know the JNDI name to look up and so haven't
even tried it. Somehow, I did not find any documentation on the Websphere
sites or google. 

Also on similar lines, I would like to see some documentation on how to
override the default openJPA shipped with WAS because I want to be able to
use the latest version but the one being picked up by the classloader is
always the 1.0 version.

Thanks in advance.



Kevin Sutter wrote:
> 
> Hi devu213,
> Just to clarify...  Are you using the EJB3 Feature Pack on top of
> WebSphere
> v6.1.  Are you using the version of OpenJPA that ships with the Feature
> Pack, or something newer?  It sounds like you are using container-managed
> persistence (ie. the injection support), so it sounds like you are using
> the
> EJB3 Feature Pack.  But, I just want to make sure.
> 
> With the EJB3 Feature Pack, the JNDI lookup of an EntityManager should
> work
> as well as the injection support.  You mention that you are getting a SAX
> parser error with your persistence.xml file.  Do you get any parsing
> errors
> when running OpenJPA standalone?  Or, is all of your testing within a
> container?  Can you provide more details on the specific parsing errors
> you
> are getting?
> 
> You should also be able to use application-managed persistence within the
> Container.
> 
> Off the top of my head, I'm not aware of any problems with what you are
> attempting.  Unfortunately, I can't highlight anything you're doing
> incorrectly.  If you can provide some additional details, maybe we can
> help
> get you running.
> 
> FYI...  Just a reminder.  This forum is for questions and issues specific
> to
> OpenJPA.  Since some of us are intimate with WebSphere, we attempt to help
> with related WebSphere questions.  In this particular case, it sounds like
> you might be hitting a problem with the EJB Container within WebSphere. 
> We
> can help with the triage of this case, but we won't be able to resolve the
> problem with OpenJPA (if it turns out to be a problem with the Container).
> 
> Thanks,
> Kevin
> 
> On Wed, Jan 7, 2009 at 2:40 AM, devu213 <[email protected]> wrote:
> 
>>
>> Hi,
>>
>> I need to lookup an entitymanager using JNDI on websphere 6.1. My
>> persistence.xml is configured to use JPA. Although I use injection (which
>> works) in almost all cases, I have a case where I would like the use of
>> entitymanager in a POJO and therefore would like to get it from JNDI
>> directly.
>>
>> The case is I have a cache which should be initialized with values from
>> the
>> database the first time it is accessed. The cache class is a POJO class.
>>
>> I don't seem to find any documentation regarding this. Is this a
>> websphere
>> limitation ? Also, currently this class is trying to create a factory of
>> its
>> own within the container using
>> Persistence.createEntityManagerFactory(unitname) but that fails as for
>> some
>> reason a SAX exception is thrown during parsing Persistence.xml file at
>> the
>> point where it tries to load the jar files containing the various entity
>> classes.
>>
>> So my second question is, is there some sort of restriction on the use of
>> Persistence.createEntityManager() inside the container?
>>
>> Have uploaded the class as well as the persistence.xml file.
>> http://n2.nabble.com/file/n2121433/ParamValuesCache.java
>> ParamValuesCache.java  http://n2.nabble.com/file/n2121433/persistence.xml
>> persistence.xml
>> --
>> View this message in context:
>> http://n2.nabble.com/Entitymanager-lookup-using-JNDI-on-webshpere-tp2121433p2121433.html
>> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: 
http://n2.nabble.com/Entitymanager-lookup-using-JNDI-on-webshpere-tp2121433p2137356.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Reply via email to