问题
Why can't the JSTL jars having tld files present in my web-inf/lib directory be read nicely by tomcat but not when i move to jBoss 5?
Is it a classloader issue?
I tried researching but there exists no clear answer. I read a huge classloader related article but not sure how that applies practically to my application.
Any help would be appreciated.
Thanks in advance Asif
回答1:
Tomcat is a simple JSP/Servlet container which ships with JSP and Servlet APIs only. JBoss is a more full fledged Java EE application server which ships with almost the entire Java EE API, including JSTL.
When you ship JSTL along with your own webapp, then chances are big that its API/impl version will conflict with the one which JBoss is already using. JBoss will load its own JSTL API (the jstl.jar
), but the webapp will load the JSTL impl (the standard.jar
). You should actually remove the JSTL JARs from your webapp and utilize the JBoss ones. In order to get JSTL to work for the same webapp on Tomcat as well, you could also add the JARs to Tomcat's own /lib
folder. This way every webapp deployed to Tomcat will be able to utilize JSTL without the need to include the JARs in /WEB-INF/lib
.
来源:https://stackoverflow.com/questions/7562890/basic-question-complicated-solution-tomcat-to-jboss