Hi, 2012/4/13 Leigh Anderson <leigh.ander...@betfair.com>: > 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 > <classLoaderClass>org.springframework.instrument.classloading.tomcat.Tomcat > InstrumentableClassLoader</classLoaderClass> 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 > =================================================================== > --- > 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 @@ > */ > private ClassRealm tomcatRealm; > > + /** > + * Class loader class to set. > + * > + * @parameter > + */ > + protected String classLoaderClass; > + > // > ---------------------------------------------------------------------- > // Mojo Implementation > // > ---------------------------------------------------------------------- > @@ -460,14 +462,19 @@ > { > context.setParentClassLoader( getTomcatClassLoader() ); > } > + final WebappLoader loader = createWebappLoader(); > > - context.setLoader( createWebappLoader() ); > + context.setLoader( loader ); > File contextFile = getContextFile(); > if ( contextFile != null ) > { > context.setConfigFile( getContextFile().toURI().toURL() ); > } > + if (classLoaderClass != null) { > + loader.setLoaderClass(classLoaderClass); > + } > > + > return context; > > } > > > > On 12/04/2012 13:14, "Olivier Lamy" <ol...@apache.org> 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/ru >>n-mojo.html#contextFile >> >>2012/4/12 Leigh Anderson <leigh.ander...@betfair.com>: >>> 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" <ol...@apache.org> 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 <ol...@apache.org>: >>>>> 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 <leigh.ander...@betfair.com>: >>>>>> 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" <ol...@apache.org> 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 <leigh.ander...@betfair.com>: >>>>>>>> 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: >>>>>>>> >>>>>>>> >>>>>>>> [INFO] >>>>>>>> >>>>>>>>-------------------------------------------------------------------- >>>>>>>>-- >>>>>>>>-- >>>>>>>> [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] >>>>>>>> [ERROR] >>>>>>>> [ERROR] To see the full stack trace of the errors, re-run >>>>>>>>Maven >>>>>>>>with the >>>>>>>> -e switch. >>>>>>>> [ERROR] Re-run Maven using the -X switch to enable full >>>>>>>>debug >>>>>>>>logging. >>>>>>>> >>>>>>>> I have also tried >>>>>>>> * 'mvn tomcat:run-war', which seems to get past this point, >>>>>>>>but >>>>>>>>then the >>>>>>>> application will not start because the 'additionalClasspathDir' >>>>>>>>property >>>>>>>> is not supported by the 'run-war' goal. >>>>>>>> * removing 'useSeparateTomcatClassLoader' which then 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 >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> <plugin> >>>>>>>> <groupId>org.apache.tomcat.maven</groupId> >>>>>>>> >>>>>>>><artifactId>tomcat7-maven-plugin</artifactId> >>>>>>>> <version>2.0-beta-1</version> >>>>>>>> <configuration> >>>>>>>> <systemProperties> >>>>>>>> >>>>>>>><log4j.defaultInitOverride>true</log4j.defaultInitOverride> >>>>>>>> <HOSTNAME>localhost</HOSTNAME> >>>>>>>> <port.http>9090</port.http> >>>>>>>> <port.https>8443</port.https> >>>>>>>> </systemProperties> >>>>>>>> <port>9090</port> >>>>>>>> <httpsPort>8443</httpsPort> >>>>>>>> <path>/</path> >>>>>>>> >>>>>>>><useTestClasspath>false</useTestClasspath> >>>>>>>> <additionalClasspathDirs> >>>>>>>> >>>>>>>> >>>>>>>><additionalClasspathDir>${project.basedir}/config</additionalClasspa >>>>>>>>th >>>>>>>>Dir >>>>>>>>> >>>>>>>> </additionalClasspathDirs> >>>>>>>> >>>>>>>> <useSeparateTomcatClassLoader>true</useSeparateTomcatClassLoader> >>>>>>>> </configuration> >>>>>>>> <dependencies> >>>>>>>> <dependency> >>>>>>>> >>>>>>>><groupId>org.springframework</groupId> >>>>>>>> >>>>>>>> >>>>>>>><artifactId>spring-instrument-tomcat</artifactId> >>>>>>>> <version>${spring.version}</version> >>>>>>>> </dependency> >>>>>>>> </dependencies> >>>>>>>> </plugin> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>>____________________________________________________________________ >>>>>>>>__ >>>>>>>>__ >>>>>>>> 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-unsubscr...@tomcat.apache.org >>>>>>>> For additional commands, e-mail: users-h...@tomcat.apache.org >>>>>>>> >>>>>>> >>>>>>>--------------------------------------------------------------------- >>>>>>>To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org >>>>>>>For additional commands, e-mail: users-h...@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-unsubscr...@tomcat.apache.org >>>>>> For additional commands, e-mail: users-h...@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-unsubscr...@tomcat.apache.org >>>>For additional commands, e-mail: users-h...@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-unsubscr...@tomcat.apache.org >>> For additional commands, e-mail: users-h...@tomcat.apache.org >>> >> >>--------------------------------------------------------------------- >>To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org >>For additional commands, e-mail: users-h...@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-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > -- Olivier Lamy Talend: http://coders.talend.com http://twitter.com/olamy | http://linkedin.com/in/olamy --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org