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 <devusm...@gmail.com> 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. > >