You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Sreyan Chakravarty <sr...@gmail.com> on 2015/08/07 21:24:25 UTC
Where to put context.xml in webapp archetype ?
I am using Maven for building a simple webapp that uses JDBC connection
pooling along with Hibernate.
I am using the Maven Webapp Archetype to build the project.
Where do I put context.xml and persistence.xml that I normally put under
META-INF in a normal dynamic web project.
RE: Where to put context.xml in webapp archetype ?
Posted by Martin Gainty <mg...@hotmail.com>.
if you have Spring you can put it anywhere you want
/** app context. */
private static org.springframework.context.support.ClassPathXmlApplicationContext.appContext;
YourClassName.appContext = new org.springframework.context.support.ClassPathXmlApplicationContext("conf/applicationContext.xml");
org.springframework.context.ApplicationContextcontext=(org.springframework.context.ApplicationContext) YourClassName.appContext;
*gruss*
Martin
______________________________________________
> Date: Sun, 30 Aug 2015 02:48:07 +0530
> Subject: Re: Where to put context.xml in webapp archetype ?
> From: sreyan.mailing@gmail.com
> To: users@maven.apache.org
>
> A little bit of update. You have to put context.xml in
>
> src/main/webapp/META-INF/context.xml
>
> not directly under the WEB-INF folder.
>
> On Sat, Aug 8, 2015 at 6:38 PM, jieryn <ji...@gmail.com> wrote:
>
> > I personally find this a bit weird, but it's because the JPA
> > persistence.xml needs to end up in
> > war!WEB-INF/classes/META-INF/persistence.xml whereas Tomcat will
> > expect to find context.xml in war!WEB-INF/context.xml. I suppose you
> > could put it in
> > src/main/webapp/WEB-INF/classes/META-INF/persistence.xml but then IDEs
> > will probably not find it easily/at all.
> >
> > Glad it works for you.
> >
> > On Sat, Aug 8, 2015 at 8:47 AM, Sreyan Chakravarty
> > <sr...@gmail.com> wrote:
> > > Thanks
> > >
> > > On Sat, Aug 8, 2015 at 4:05 PM, jieryn <ji...@gmail.com> wrote:
> > >
> > >> src/main/resources/META-INF/persistence.xml
> > >> src/main/webapp/WEB-INF/context.xml
> > >>
> > >> On Fri, Aug 7, 2015 at 3:24 PM, Sreyan Chakravarty
> > >> <sr...@gmail.com> wrote:
> > >> > I am using Maven for building a simple webapp that uses JDBC
> > connection
> > >> > pooling along with Hibernate.
> > >> >
> > >> > I am using the Maven Webapp Archetype to build the project.
> > >> >
> > >> > Where do I put context.xml and persistence.xml that I normally put
> > under
> > >> > META-INF in a normal dynamic web project.
> > >>
> > >> ---------------------------------------------------------------------
> > >> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > >> For additional commands, e-mail: users-help@maven.apache.org
> > >>
> > >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
Re: Where to put context.xml in webapp archetype ?
Posted by Sreyan Chakravarty <sr...@gmail.com>.
A little bit of update. You have to put context.xml in
src/main/webapp/META-INF/context.xml
not directly under the WEB-INF folder.
On Sat, Aug 8, 2015 at 6:38 PM, jieryn <ji...@gmail.com> wrote:
> I personally find this a bit weird, but it's because the JPA
> persistence.xml needs to end up in
> war!WEB-INF/classes/META-INF/persistence.xml whereas Tomcat will
> expect to find context.xml in war!WEB-INF/context.xml. I suppose you
> could put it in
> src/main/webapp/WEB-INF/classes/META-INF/persistence.xml but then IDEs
> will probably not find it easily/at all.
>
> Glad it works for you.
>
> On Sat, Aug 8, 2015 at 8:47 AM, Sreyan Chakravarty
> <sr...@gmail.com> wrote:
> > Thanks
> >
> > On Sat, Aug 8, 2015 at 4:05 PM, jieryn <ji...@gmail.com> wrote:
> >
> >> src/main/resources/META-INF/persistence.xml
> >> src/main/webapp/WEB-INF/context.xml
> >>
> >> On Fri, Aug 7, 2015 at 3:24 PM, Sreyan Chakravarty
> >> <sr...@gmail.com> wrote:
> >> > I am using Maven for building a simple webapp that uses JDBC
> connection
> >> > pooling along with Hibernate.
> >> >
> >> > I am using the Maven Webapp Archetype to build the project.
> >> >
> >> > Where do I put context.xml and persistence.xml that I normally put
> under
> >> > META-INF in a normal dynamic web project.
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >> For additional commands, e-mail: users-help@maven.apache.org
> >>
> >>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
Re: Where to put context.xml in webapp archetype ?
Posted by jieryn <ji...@gmail.com>.
I personally find this a bit weird, but it's because the JPA
persistence.xml needs to end up in
war!WEB-INF/classes/META-INF/persistence.xml whereas Tomcat will
expect to find context.xml in war!WEB-INF/context.xml. I suppose you
could put it in
src/main/webapp/WEB-INF/classes/META-INF/persistence.xml but then IDEs
will probably not find it easily/at all.
Glad it works for you.
On Sat, Aug 8, 2015 at 8:47 AM, Sreyan Chakravarty
<sr...@gmail.com> wrote:
> Thanks
>
> On Sat, Aug 8, 2015 at 4:05 PM, jieryn <ji...@gmail.com> wrote:
>
>> src/main/resources/META-INF/persistence.xml
>> src/main/webapp/WEB-INF/context.xml
>>
>> On Fri, Aug 7, 2015 at 3:24 PM, Sreyan Chakravarty
>> <sr...@gmail.com> wrote:
>> > I am using Maven for building a simple webapp that uses JDBC connection
>> > pooling along with Hibernate.
>> >
>> > I am using the Maven Webapp Archetype to build the project.
>> >
>> > Where do I put context.xml and persistence.xml that I normally put under
>> > META-INF in a normal dynamic web project.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Where to put context.xml in webapp archetype ?
Posted by Sreyan Chakravarty <sr...@gmail.com>.
Thanks
On Sat, Aug 8, 2015 at 4:05 PM, jieryn <ji...@gmail.com> wrote:
> src/main/resources/META-INF/persistence.xml
> src/main/webapp/WEB-INF/context.xml
>
> On Fri, Aug 7, 2015 at 3:24 PM, Sreyan Chakravarty
> <sr...@gmail.com> wrote:
> > I am using Maven for building a simple webapp that uses JDBC connection
> > pooling along with Hibernate.
> >
> > I am using the Maven Webapp Archetype to build the project.
> >
> > Where do I put context.xml and persistence.xml that I normally put under
> > META-INF in a normal dynamic web project.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
Re: Where to put context.xml in webapp archetype ?
Posted by jieryn <ji...@gmail.com>.
src/main/resources/META-INF/persistence.xml
src/main/webapp/WEB-INF/context.xml
On Fri, Aug 7, 2015 at 3:24 PM, Sreyan Chakravarty
<sr...@gmail.com> wrote:
> I am using Maven for building a simple webapp that uses JDBC connection
> pooling along with Hibernate.
>
> I am using the Maven Webapp Archetype to build the project.
>
> Where do I put context.xml and persistence.xml that I normally put under
> META-INF in a normal dynamic web project.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Where to put context.xml in webapp archetype ?
Posted by he...@free.fr.
there is one misconception: the project *is not built with* Maven Webapp Archetype, but it *was generated from* Maven Webapp Archetype
Once a project is generated from a Maven Archetype, it is a normal project, you can forget about its inception: the whole generated content is yours, to be maintained as if you wrote everything by hand
I don't precisely know what is generated by Maven Webapp Archetype, I suppose it uses maven-war-plugin [1]
Regards,
Hervé
[1] http://maven.apache.org/plugins/maven-war-plugin/usage.html
----- Mail original -----
De: "Sreyan Chakravarty" <sr...@gmail.com>
À: "Maven Users List" <us...@maven.apache.org>
Envoyé: Vendredi 7 Août 2015 21:24:25
Objet: Where to put context.xml in webapp archetype ?
I am using Maven for building a simple webapp that uses JDBC connection
pooling along with Hibernate.
I am using the Maven Webapp Archetype to build the project.
Where do I put context.xml and persistence.xml that I normally put under
META-INF in a normal dynamic web project.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org