tomcat启动加载类的顺序 博客分类: 技术天地 TomcatEXTJVMJSPServlet
程序员文章站
2024-03-24 10:50:58
...
今天在写一个用java发email的程序的一点总结:
在tomcat如果要使用mail session,必须保证activation.jar和mail.jar在同一个级别的classpath tomcat5默认是在${CATALINA_HOME}common/lib/下放了mail.jar,但是没有activation.jar,就这一点害的我今天忙了半天。
下面是tomcat启动加载类的顺序,记住在container环境下,类是有层次的,我今天就是把activation.jar 放在了WEB-INF/lib下,mail.jar在${CATALINA_HOME}common/lib/下,结果邮件怎么也发不出去。
Bootstrap: uses JVM classes & looks in $JAVA_HOME/jre/lib/ext | System: uses $CATALINA_HOME/bin/bootstrap.jar | and $JAVA_HOME/lib/tools.jar | Common: uses $CATALINA_HOME/common/lib / \ and $CATALINA_HOME/common/classes / \ and $CATALINA_HOME/common/endorsed / \ >> jsp and servlet API jars are here / +---------------------------------+ / | Catalina: uses $CATALINA_HOME/server/lib | and $CATALINA_HOME/server/classes | >> catalina.jar is here | Shared: uses $CATALINA_BASE/shared/lib / \ and $CATALINA_BASE/shared/classes / \ Webapp1 Webapp2 ... <--- **GREEDY** CLASSLOADERS