如题,因为使用了多种框架,所以类库包很多,为了使目录结构清晰建立工程时将这些包分成许多目录分类存放,
比如...\myweb\web-inf\lib下又建立了许多子目录
...\myweb\web-inf\lib\struts\*.jar
...\myweb\web-inf\lib\hibernate\*.jar
...\myweb\web-inf\lib\spring\*.jar
在eclipse环境中使用没有问题,因为eclipse可以自定义库路径,但是运行web时tomcat就找不到这些类库了,因为
tomcat默认只寻找到web-inf\lib目录和自身的lib目录。
请问有什么办法可以让tomcat能找到我自定义的各个库路径?

解决方案 »

  1.   

    我设置了系统classpath没有用,但我觉得我设置的classpath没有问题。
      

  2.   

    试试,打开右下角tomcat图标,右键Configure Tomcat,
    选中Java选项,改动Java Classpath
      

  3.   

    恕我愚钝,没看明白,右下角的tomcat图标在哪里?
      

  4.   

    可以试着把项目发布到你本地的tomcat服务器上试试
      

  5.   

    tomcat/conf/catalina.properties 文件里面应该是配置架构包路径的地方shared.loader=${catalina.base}/shared/classes,${catalina.base}/shared/lib/*.jar,自己的架构包路径/*.jar试试行不行
      

  6.   

    不能改,这是 Servlet 规范所规定的!The contents of the WEB-INF directory are:• The /WEB-INF/web.xml deployment descriptor.
    • The /WEB-INF/classes/ directory for servlet and utility classes. The classes in
        this directory must be available to the application class loader.
    • The /WEB-INF/lib/*.jar area for Java ARchive files. These files contain servlets,
        beans, and other utility classes useful to the Web application. The Web application
        class loader must be able to load classes from any of these archive
        files.The Web application class loader must load classes from the WEB-INF/ classes
    directory first, and then from library JARs in the WEB-INF/lib directory. Also, any
    requests from the client to access the resources in WEB-INF/ directory must be
    returned with a SC_NOT_FOUND(404) response.Ref. Java Servlet Specification Version 2.5, SRV.9.5 Directory Structure, p.66.
      

  7.   

    我发现大叔很喜欢查XXXX规范。。!
      

  8.   

    你可以把你要用的jar包拷贝到Tomcat的lib目录下不就可以了
      

  9.   


    开始菜单,选择apache tomcat,之后运行 Configure Tomcat这个是tomcat的管理工具,运行后右下角就有了..
      

  10.   

    18楼的,我实在不知道你说的菜单在哪里。
    是eclipse还是tomcat的bin目录下的启动程序?(我的tomcat版本是6,eclipse是3.3 lomboz)
    无论哪个工具我也看不到您说的开始菜单和“apache tomcat,之后运行 Configure Tomcat”。
    麻烦您再给点提示好吗?谢谢。
      

  11.   

    我也很想知道这个答案,我也遇到同样的问题,我以为可以在web.xml下配置,有人解决了吗?