Return-Path: X-Original-To: apmail-tomcat-users-archive@www.apache.org Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4D2AB9B64 for ; Fri, 13 Apr 2012 08:02:38 +0000 (UTC) Received: (qmail 59997 invoked by uid 500); 13 Apr 2012 08:02:34 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 59955 invoked by uid 500); 13 Apr 2012 08:02:34 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 59932 invoked by uid 99); 13 Apr 2012 08:02:34 -0000 Received: from minotaur.apache.org (HELO minotaur.apache.org) (140.211.11.9) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 13 Apr 2012 08:02:34 +0000 Received: from localhost (HELO mail-gx0-f173.google.com) (127.0.0.1) (smtp-auth username olamy, mechanism plain) by minotaur.apache.org (qpsmtpd/0.29) with ESMTP; Fri, 13 Apr 2012 08:02:33 +0000 Received: by ggnp2 with SMTP id p2so1852022ggn.18 for ; Fri, 13 Apr 2012 01:02:32 -0700 (PDT) Received: by 10.236.114.169 with SMTP id c29mr791670yhh.37.1334304152946; Fri, 13 Apr 2012 01:02:32 -0700 (PDT) MIME-Version: 1.0 Received: by 10.101.107.20 with HTTP; Fri, 13 Apr 2012 01:02:12 -0700 (PDT) In-Reply-To: References: From: Olivier Lamy Date: Fri, 13 Apr 2012 10:02:12 +0200 Message-ID: Subject: Re: Tomcat7-maven-plugin 2.0-beta1 and useSeparateTomcatClassloader fails with run goal To: Tomcat Users List Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi, 2012/4/13 Leigh Anderson : > Hi Olivier, > > It's actually the act of declaring a context.xml with a Loader element > that causes the application to fail. A new instance of WebAppLoader is > created, overriding the one carefully created by the plugin, without the > benefit of a properly configured class path. I've included a small patch > below which demonstrates my intent. Oh sure good catch. > > I'd added > org.springframework.instrument.classloading.tomcat.Tomc= at > InstrumentableClassLoader to the plugin configuration, > which was then picked up correctly and used by the WebAppLoader. Could you attach the patch to an issue ? > > Thanks, > Leigh > > Index: > tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7= /r > un/AbstractRunMojo.java > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- > tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7= /r > un/AbstractRunMojo.java (revision 1) > +++ > tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7= /r > un/AbstractRunMojo.java (revision ) > @@ -363,6 +357,15 @@ > =A0 =A0 =A0*/ > =A0 =A0 private ClassRealm tomcatRealm; > > + =A0 =A0/** > + =A0 =A0 * Class loader class to set. > + =A0 =A0 * > + =A0 =A0 * @parameter > + =A0 =A0 */ > + =A0 =A0protected String classLoaderClass; > + > =A0 =A0 // > ---------------------------------------------------------------------- > =A0 =A0 // Mojo Implementation > =A0 =A0 // > ---------------------------------------------------------------------- > @@ -460,14 +462,19 @@ > =A0 =A0 =A0 =A0 { > =A0 =A0 =A0 =A0 =A0 =A0 context.setParentClassLoader( getTomcatClassLoade= r() ); > =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 =A0final WebappLoader loader =3D createWebappLoader(); > > - =A0 =A0 =A0 =A0context.setLoader( createWebappLoader() ); > + =A0 =A0 =A0 =A0context.setLoader( loader ); > =A0 =A0 =A0 =A0 File contextFile =3D getContextFile(); > =A0 =A0 =A0 =A0 if ( contextFile !=3D null ) > =A0 =A0 =A0 =A0 { > =A0 =A0 =A0 =A0 =A0 =A0 context.setConfigFile( getContextFile().toURI().t= oURL() ); > =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 =A0if (classLoaderClass !=3D null) { > + =A0 =A0 =A0 =A0 =A0 =A0loader.setLoaderClass(classLoaderClass); > + =A0 =A0 =A0 =A0} > > + > =A0 =A0 =A0 =A0 return context; > > =A0 =A0 } > > > > On 12/04/2012 13:14, "Olivier Lamy" wrote: > >>The plugin has an option to setup context.xml to use see [1]. >>You can try to write an other context.xml only for using with the plugin = ? >> >>-- >>Olivier >> >>[1] >>http://tomcat.apache.org/maven-plugin-2.0-SNAPSHOT/tomcat7-maven-plugin/r= u >>n-mojo.html#contextFile >> >>2012/4/12 Leigh Anderson : >>> Hi Olivier, >>> >>> That's solved the problem, thanks. Unfortunately, declaring a custom >>>class >>> loader in a context.xml causes Tomcat to use that one, instead of the >>>one >>> set up with the correct class path by the plugin. I'll keep looking to >>>see >>> if I can find a way around this. >>> >>> Thanks for your prompt help with this. >>> Leigh >>> >>> On 12/04/2012 11:35, "Olivier Lamy" wrote: >>> >>>>Hello, >>>>Apologize for delay. >>>>That should be fixed now (I have deployed 2.0-SNAPSHOT). >>>>If you could try with your use case. >>>>Thanks, >>>>2012/4/8 Olivier Lamy : >>>>> Hello Leigh, >>>>> Thanks for creating issue. >>>>> Until now I tried to reproduce the issue but I failed. >>>>> I wonder if you could attach a build log using -e mvn flag. >>>>> >>>>> 2012/4/5 Leigh Anderson : >>>>>> Hi Olivier, >>>>>> >>>>>> I'm not able to run this with tomcat6 as it's a Servlet 3.0 project. >>>>>>I'll >>>>>> get the issue created -- should have some time next week to put >>>>>>together a >>>>>> sample project. >>>>>> >>>>>> >>>>>> Thanks, >>>>>> Leigh >>>>>> >>>>>> On 04/04/2012 11:36, "Olivier Lamy" wrote: >>>>>> >>>>>>>Hello, >>>>>>>Looks to be an issue (does that work with tomcat6:run ?) >>>>>>>Could you create an issue here: >>>>>>>https://issues.apache.org/jira/browse/MTOMCAT (if possible with a >>>>>>>small sample project to reproduce). >>>>>>> >>>>>>>Thanks >>>>>>>-- >>>>>>>Olivier Lamy >>>>>>>Talend: http://coders.talend.com >>>>>>>http://twitter.com/olamy | http://linkedin.com/in/olamy >>>>>>> >>>>>>>2012/4/3 Leigh Anderson : >>>>>>>> Hi All, >>>>>>>> >>>>>>>> I'm trying to start a web application with 'mvn tomcat7:run'. It >>>>>>>>seems >>>>>>>> that with the configuration below it fails with the following >>>>>>>>error: >>>>>>>> >>>>>>>> >>>>>>>> =A0 =A0 =A0 =A0[INFO] >>>>>>>> >>>>>>>>-------------------------------------------------------------------= - >>>>>>>>-- >>>>>>>>-- >>>>>>>> =A0 =A0 =A0 =A0[ERROR] Failed to execute goal >>>>>>>> org.apache.tomcat.maven:tomcat7-maven-plugin:2.0-beta-1:run >>>>>>>>(default-cli) >>>>>>>> on project mantis-test-web-app: No such archiver: 'jar'. -> [Help >>>>>>>>1] >>>>>>>> =A0 =A0 =A0 =A0[ERROR] >>>>>>>> =A0 =A0 =A0 =A0[ERROR] To see the full stack trace of the errors, = re-run >>>>>>>>Maven >>>>>>>>with the >>>>>>>> -e switch. >>>>>>>> =A0 =A0 =A0 =A0[ERROR] Re-run Maven using the -X switch to enable = full >>>>>>>>debug >>>>>>>>logging. >>>>>>>> >>>>>>>> I have also tried >>>>>>>> =A0 =A0 =A0 =A0* 'mvn tomcat:run-war', which seems to get past thi= s point, >>>>>>>>but >>>>>>>>then the >>>>>>>> application will not start because the 'additionalClasspathDir' >>>>>>>>property >>>>>>>> is not supported by the 'run-war' goal. >>>>>>>> =A0 =A0 =A0 =A0* removing 'useSeparateTomcatClassLoader' which the= n doesn't >>>>>>>>load the >>>>>>>> Spring instrumenting class loader required to use AspectJ LTW, >>>>>>>>specified >>>>>>>> in >>>>>>>> context.xml. I have confirmed that I get the same 'no such >>>>>>>>archiver' >>>>>>>>error >>>>>>>> if I remove the >>>>>>>> context.xml, so I don't believe this to be the cause. >>>>>>>> >>>>>>>> Is there something I've missed in the configuration? >>>>>>>> >>>>>>>> Cheers, >>>>>>>> Leigh >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 >>>>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0org.apache= .tomcat.maven >>>>>>>> >>>>>>>>tomcat7-maven-plugin >>>>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A02.0-beta-1= >>>>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 >>>>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 >>>>>>>> >>>>>>>>true >>>>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0localhost >>>>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A09090 >>>>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A08443 >>>>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 >>>>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A09090<= /port> >>>>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= 8443 >>>>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/ >>>>>>>> >>>>>>>>false >>>>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 >>>>>>>> >>>>>>>> >>>>>>>>${project.basedir}/config>>>>>>>th >>>>>>>>Dir >>>>>>>>> >>>>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 >>>>>>>> >>>>>>>> true >>>>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 >>>>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 >>>>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 >>>>>>>> >>>>>>>>org.springframework >>>>>>>> >>>>>>>> >>>>>>>>spring-instrument-tomcat >>>>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0${spring.version} >>>>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 >>>>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 >>>>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>>___________________________________________________________________= _ >>>>>>>>__ >>>>>>>>__ >>>>>>>> In order to protect our email recipients, Betfair Group use SkySca= n >>>>>>>>from >>>>>>>> MessageLabs to scan all Incoming and Outgoing mail for viruses. >>>>>>>> >>>>>>>> >>>>>>>>___________________________________________________________________= _ >>>>>>>>__ >>>>>>>>__ >>>>>>>> >>>>>>>> >>>>>>>>-------------------------------------------------------------------= - >>>>>>>>- >>>>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org >>>>>>>> For additional commands, e-mail: users-help@tomcat.apache.org >>>>>>>> >>>>>>> >>>>>>>--------------------------------------------------------------------= - >>>>>>>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org >>>>>>>For additional commands, e-mail: users-help@tomcat.apache.org >>>>>>> >>>>>> >>>>>> >>>>>> >>>>>>_____________________________________________________________________= _ >>>>>>__ >>>>>> In order to protect our email recipients, Betfair Group use SkyScan >>>>>>from >>>>>> MessageLabs to scan all Incoming and Outgoing mail for viruses. >>>>>> >>>>>> >>>>>>_____________________________________________________________________= _ >>>>>>__ >>>>>> >>>>>> --------------------------------------------------------------------= - >>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org >>>>>> For additional commands, e-mail: users-help@tomcat.apache.org >>>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> Olivier Lamy >>>>> Talend: http://coders.talend.com >>>>> http://twitter.com/olamy | http://linkedin.com/in/olamy >>>> >>>> >>>> >>>>-- >>>>Olivier Lamy >>>>Talend: http://coders.talend.com >>>>http://twitter.com/olamy | http://linkedin.com/in/olamy >>>> >>>>--------------------------------------------------------------------- >>>>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org >>>>For additional commands, e-mail: users-help@tomcat.apache.org >>>> >>> >>> >>> _______________________________________________________________________= _ >>> In order to protect our email recipients, Betfair Group use SkyScan fro= m >>> MessageLabs to scan all Incoming and Outgoing mail for viruses. >>> >>> _______________________________________________________________________= _ >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org >>> For additional commands, e-mail: users-help@tomcat.apache.org >>> >> >>--------------------------------------------------------------------- >>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org >>For additional commands, e-mail: users-help@tomcat.apache.org >> > > > ________________________________________________________________________ > In order to protect our email recipients, Betfair Group use SkyScan from > MessageLabs to scan all Incoming and Outgoing mail for viruses. > > ________________________________________________________________________ > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org > For additional commands, e-mail: users-help@tomcat.apache.org > --=20 Olivier Lamy Talend: http://coders.talend.com http://twitter.com/olamy | http://linkedin.com/in/olamy --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org