I use maven and it ends up in target/test-classes/META-INF when I junit test. 

> Date: Wed, 7 Jul 2010 01:42:04 -0500
> From: d...@plektos.com
> To: stripes-users@lists.sourceforge.net
> Subject: Re: [Stripes-users] Stripersist.getEntityManager() -->       
> NullPointerException
> 
> hi aaron,
> 
> thank you for your help.
> 
> 1) my persistence.xml ends up in the project root at:
> 
> target/classes/META-INF/persistence.xml
> 
> this appears to be correct to me. please correct me if
> i am wrong.
> 
> 2) i implemented the calls that you suggested in the
> junit setUpClass() and tearDownClass() methods.
> 
> it appears that Stripersist is successfully instantiated.
> however, the call "stirpersist.init(url)" fails with the
> following exception:
> 
> javax.persistence.PersistenceException: No Persistence provider for
> EntityManager named...
> 
> i believe that the URL is correctly formed. it points to
> the persistence.xml file in target/classes/META-INF.
> 
> thank you again for your help,
> lev
> 
> On Wed, Jul 7, 2010 at 12:56 AM, Aaron Porter <aa...@mongus.com> wrote:
> > Lev,
> > The META-INF directory that contains persistence.xml needs to end up at
> > /WEB-INF/classes/META-INF. It looks like the way you've set it up it
> > would be at /WEB-INF/classes/resources/META-INF. What I was proposing
> > was to create a new source folder called resources. In Eclipse you do
> > that by clicking File->New->Source Folder and enter resources as the
> > folder name.
> >
> > I'm guessing that even if you do have the persistence.xml file in the
> > correct location you'll get an error about trying to use Stripersist
> > without the Interceptor part of it because you're trying to test with
> > JUnit without a servlet container. It can be done but you'll need to
> > call some methods in Stripersist yourself. Create a new instance of
> > Stripersist and call init(new URL("path/to/persistence.xml")). Call
> > requestInit() to initialize for the current thread then call
> > requestComplete() to clean up when you're done.
> >
> > Aaron
> >
> >
> > On 07/06/2010 10:25 PM, Lev wrote:
> >> hi,
> >>
> >> i moved persistence.xml to src/resources/META-INF.
> >>
> >> however, the original problem persists -- i receive a
> >> NullPointerException on the call:
> >>
> >> Stripersist.getEntityManager();
> >>
> >> further information: i'm getting this exception when
> >> executing a Junit test of a DAO class -- i'm not
> >> executing web code (action beans, etc). would that
> >> contribute to the problem?
> >>
> >> any suggestions welcomed.
> >>
> >> thank you,
> >> lev
> >>
> >>
> >> On Tue, Jul 6, 2010 at 11:59 AM, Aaron Porter<aa...@mongus.com>  wrote:
> >>
> >>> Oops! Thanks for catching that Marcus!
> >>>
> >>> Aaron
> >>>
> >>> On 07/06/2010 09:09 AM, M.C.S. wrote:
> >>>
> >>>> Hi,
> >>>>
> >>>> Aaron Porter wrote:
> >>>>
> >>>>
> >>>>> If you're using Eclipse I recommend creating a source directory named
> >>>>> resources and then creating a subdirectory named WEB-INF and placing
> >>>>> persistence.xml in there.
> >>>>>
> >>>>>
> >>>>>
> >>>> Surely just a typo, but it surely should be named META-INF. I really
> >>>> hate these standard folder names :-)
> >>>>
> >>>> Best wishes
> >>>> Marcus
> >>>>
> >>>> ------------------------------------------------------------------------------
> >>>> This SF.net email is sponsored by Sprint
> >>>> What will you do first with EVO, the first 4G phone?
> >>>> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> >>>> _______________________________________________
> >>>> Stripes-users mailing list
> >>>> Stripes-users@lists.sourceforge.net
> >>>> https://lists.sourceforge.net/lists/listinfo/stripes-users
> >>>>
> >>>>
> >>>>
> >>>
> >>> ------------------------------------------------------------------------------
> >>> This SF.net email is sponsored by Sprint
> >>> What will you do first with EVO, the first 4G phone?
> >>> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> >>> _______________________________________________
> >>> Stripes-users mailing list
> >>> Stripes-users@lists.sourceforge.net
> >>> https://lists.sourceforge.net/lists/listinfo/stripes-users
> >>>
> >>>
> >> ------------------------------------------------------------------------------
> >> This SF.net email is sponsored by Sprint
> >> What will you do first with EVO, the first 4G phone?
> >> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> >> _______________________________________________
> >> Stripes-users mailing list
> >> Stripes-users@lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/stripes-users
> >>
> >>
> >
> >
> > ------------------------------------------------------------------------------
> > This SF.net email is sponsored by Sprint
> > What will you do first with EVO, the first 4G phone?
> > Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> > _______________________________________________
> > Stripes-users mailing list
> > Stripes-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/stripes-users
> >
> 
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> _______________________________________________
> Stripes-users mailing list
> Stripes-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/stripes-users
                                          
_________________________________________________________________
Dela fler filer med nya Hotmail (upp till 10 GB i ett mejl). Klicka här!
http://explore.live.com/windows-live-hotmail
------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to