• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Spring Tomcat Instrument loader

 
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there any other way around to avoid using this jar file directly in the lib folder of tomcat? I have a tomcat instance that has a couple of other deployments that do not depend on Spring. How do I make those projects co-exist. Can I add this file as a dependency to my project's pom file? I remember doing that once, but then tomcat was not able to find this file and failed during startup. Well, I already tried that and got the following error:

 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If I use the Spring-Tomcat instrument jar file in the tomcat lib folder of tomcat deployment which is meant to be used only by one of the applications that will be deployed to this tomcat. I tried adding the jar file to my web applications lib folder but that did not help. I get the same error message as above during tomcat startup. Where else could I try putting this jar file? By any means, I want to avoid using it in the tomcat's lib folder.
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it a wise idea to add a custom location for class loader look up in catalina.properties file? I'm going to give it a try. But fully not convinced this to be a good idea. I would be happy if I have it in my application WEB-INF directory as this jar file is just local to this application and not to tomcat as such. If any of you have any other ideas, please post them here.
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Would it be a good idea to add a context.xml inside the META-INF folder of my web app and in this context.xml, I specify the tomcat spring class loader?
 
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please see the reference documentation on this:

http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/aop.html#aop-aj-ltw-environments

Are you adding the below to you web application context file?



If you read the link I gave you there is a section that that provides another link stating:

For efficiency, the embedded per-web-app configuration style is recommended because it will impact only applications that use the custom class loader and does not require any changes to the server configuration. See the Tomcat 6.0.x documentation for more details about available context locations.

 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Should the context.xml should be located in the META-INF folder of the web-app? Correct me if I got this wrong. But what I initially wanted is justified by your statement above. I do not want to use this custom class loader for the entire tomcat server but rather just for this one particular web application. I would give it a try and post the results here. I hope I could get rid of the Class Not Found exception.
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I just understood the whole story behind class loading in tomcat. I was under the impression that if I copy the spring instrument class loader jar file in the lib folder of tomcat, then it will be the default class loader for all the applications that are deployed to this tomcat server. But I guess I'm wrong in my understanding. Apart from copying the file to tomcat's lib folder, I have to explicitly specify in the context.xml of my web application to use this class loader as the default. So far so good. But what happened was, even without the context.xml file, the tomcat used the spring instrument class loader as its default. Why is this? Any idea?
reply
    Bookmark Topic Watch Topic
  • New Topic