<!--StartFragment -->
一个小项目移到服务器上,发现以前的项目出错了,访问一个很简单的jsp也会报错,说无法编译,报的错误就是:Only a type can be imported. com.xxx.xxx.XXX resolves to a package,意思就是说你jsp页面上引用的那个类不存在,可是测试的时候却正常,其实这样JSP已经是访问到的了,只是找不到类,我想应该是路径有问题,是的,因为放在服务器中,为了方便管理,服务器管理员建多了个子目录,而tomcat的context没有改变,每一个子文件夹都会被tomcat当作一个独立的虚拟应用的,所以每个子文件夹下的jsp页面访问的时候,都会在它的同一层找WEB-INF里面的class,这样当然找不到了,只有刚巧放在根目录下的jsp文件能访问。
解决办法:
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Context path="/MyLab2/MyLab" docBase="D:\\Program Files\\Apache Software Foundation\\Tomcat 5.5\\webapps\\MyLab2\\MyLab" reloadable="true">
</Context>
</Host>
只要加多这个context就可以了,其中path为访问路径,docBase为项目文件根目录所在。这样应用的文件路径通过docBase来指定,这样就不会再产生找不到class的问题了。
分享到:
相关推荐
不导入mail.jar会发生 An error occurred at line: 6 in the generated java file Only a type can be imported. javax.mail.Session resolves to a package
在使用Eclipse或MyEclipse等集成开发环境(IDE)时,可能会遇到“Some projects cannot be imported because they already exist in the workspace”的问题。这个错误提示表明,你试图导入的项目与当前工作空间...
A complete application or a class can be easily imported into Code Warehouse. Code stored in Code Warehouse can be searched by keywords, authors, dates, names of code units (application, class, or ...
Firstly, the data collected from the pendulum experiment, such as the angle of oscillation and corresponding time intervals, can be imported into MATLAB using built-in functions. Once the data is ...
and one of the feature of OOP in java is that, we can assign a subclass object or variable to the variable of the superclass type. Log files Log files keeps a records of internet protocol addresses...
+ New database engine for storing CD information (old databases can be imported) + Metadata plugin support, for now there is a freedb plugin included. This will be released as open source freeware ...
Source images can be imported into DjVuer directly from a TWAIN scanner, or loaded from common file formats such as JPEG files and Windows bitmap files. These images can then be converted and saved as...
A large number of Hypothesis events will be generated while only one Recognition and EndStream events will be associated with a particular recognition attempt. The sample provides a standard file ...
It can trace all the calls made by a process to the imported functions from a DLL. StraceNT can be very useful in debugging and analyzing the internal working of a program. StraceNT uses IAT patching...
It can trace all the calls made by a process to the imported functions from a DLL. StraceNT can be very useful in debugging and analyzing the internal working of a program. StraceNT uses IAT patching...
在IT行业中,函数钩子(Hook)是一种技术,允许开发者拦截和处理系统或应用程序中的特定事件,例如函数调用。标题“一个类来挂钩你的应用所调用的任何导入函数”指的是创建了一个类,该类能够监控并控制应用程序中...
In addition to this qualitative analysis, a quantitative analysis (using Rietveld refinement) can be performed as well. You can easily setup and run Rietveld refinements from within Match!, with the ...
Resource type: Unitypackage, can be imported and used immediately Content: Including shaders, materials, and sample scenes It is possible to autonomously mirror and flip graphics horizontally or ...
can be re-used. To perform a clean compilation from source files for all partitions, both the db and incremental_db folder should be removed. The imported_partitions sub-folder contains the last ...
This is a free tool provided for the Android mobile platform by Comwired.com to ...Everything should be included to be easily imported into the Eclipse IDE and has been developed to build on
This is a piece of VBA Macro code can be imported into MS Excel, successfully running on Excel 2010.
A new tool called Board Manager is provided to add ability to configure easily a Board description that can be then imported by the Workbench. The ST Motor Profiler tool is removed from the X-CUBE-...
Vuforia Engine can be easily imported into Unity by downloading and double-clicking the .unitypackage below.Vuforia Engine is the most widely used platform for AR development, with support for the ...
Linestyles can be imported from Bentley® MicroStation® .dgn files into .dwg files. For more details, see Working with DGN Linestyles. Strikethrough text Multi-line text now supports strikethrough ...
Developed interactive documents can be stored in a compact executable EXE-files (for example, the volume of the original CAD model 50 MB, * .exe file 3DVia Composer - the result of converting this ...