Tomcat 5.5.27

来源:互联网 发布:数据采集方法有哪些 编辑:程序博客网 时间:2024/05/01 03:19

      每个Java Web应用有唯一的Context,当Java Web应用运行时,Servlet容器为每一个Web应用创建唯一的ServletContext对象,它被用一个Web应用中所有的组件共享。

      We have chosen to make it an interface instead of a concrete class for an number of reasons. First of all, it makes writing unit tests for Controllers easier (as we'll see in the next chapter). Secondly, the use of interfaces means JDK proxying (a Java language feature) can be used to make the service transactional instead of CGLIB (a code generation library).

 

     

      异常:

      org.apache.jasper.JasperException: access denied (java.lang.RuntimePermission getClassLoader)

      java.security.AccessControlException: access denied (java.lang.RuntimePermission getClassLoader)
    

      关于这个问题的详细说明在   http://java.sun.com/developer/onlineTraining/Programming/JDCBook/appA.html
      解决办法修改 ${catalina.home}/config/catalina.policy 文件,添加代码

      grant codeBase "file:${catalina.home}/webapps/doom/-" {
              permission java.security.AllPermission;
      };

 

       其中 ${catalina.home}/webapps/doom 是web应用所在的目录。

 

 

       异常:

       java.lang.NoClassDefFoundError: javax/servlet/jsp/tagext/BodyTagSupport

       原因:jsp-api.jar 文件没有放到WEB-INF/lib/目录下。

       分析:tomcat的公共jar包目录下面有jsp 和 servlet,不需要将开发环境(Eclipse下面的jsp.jar或servler-api.jar放到个人的web应用的WEB-INF/lib目录下)

原创粉丝点击