`
WKsandy
  • 浏览: 149708 次
  • 性别: Icon_minigender_1
  • 来自: 常州
社区版块
存档分类
最新评论

Only a type can be imported

    博客分类:
  • java
阅读更多

TomExam_v2.1_UTF8访问jsp时报错:

org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: 8 in the generated java file
Only a type can be imported. com.tom.cache.ConfigCache resolves to a package

 

 

发现WEB-INF\classes下并没有类而是打tomexam.jar包放在了WEB-INF\lib下

 

解决办法:

在%CATALINA_HOME%\conf\server.xml的虚拟主机中通过Context子元素指定其Root Context所在位置:

 

<Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">
<Context path="/TomExam_v2.1_UTF8" docBase="D:\dev_tools\apache-tomcat-6.0.32\webapps\TomExam_v2.1_UTF8\WebRoot" reloadable="true" />
</Host>
 

只要加多个context就可以了,其中path为访问路径,docBase为项目文件根目录所在。这样应用的文件路径通过docBase来指定,这样就能在WEB-INF的lib载到包找到类了。

分享到:
评论

相关推荐

    javamail的jar包

    不导入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

    JSP Simple Examples

    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...

    语音识别系统C#实例

    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 ...

    BIND-LINUX64位包

    DNSKEY to be imported into the DNSKEY management framework. [RT #34698] Check that EDNS subnet client options are well formed. [RT #34718] "named" now preserves the capitalization of names when ...

    ImpREC 1.7c

    - Debug privilege is now managed and damaged PDB can be repaired (Thanks to EliCZ) - Renormalized exports (for Win9x/ME only) - Fixed a GPF when using the wheel mouse (or arrows keys) just after ...

    Clever Internet Suite (SRC) v9.1.0.0

    Starting from now, the components can be used by RAD Studio form designer in 64-bit projects. The basic socket components were replaced and improved. The class inheritance was changed. Please see the...

Global site tag (gtag.js) - Google Analytics