tomcat没有检测到我的课程

时间:2013-04-23 02:36:41

标签: jsp tomcat tomcat7

我上课了

:~/apache-tomcat-7.0.39/webapps/ROOT/WEB-INF/classes/myclasses$ ls
myLog.class  myLog.java
:~/apache-tomcat-7.0.39/webapps/ROOT/WEB-INF/classes/myclasses$ cat myLog.java
import java.io.*;

public class myLog
{
    private static PrintWriter log = null;
    public myLog(String logpath) throws IOException
    {
        log = new PrintWriter(new FileWriter(logpath, true));
        log.println("Logging started\n");
    }
    p

我试着从我的jsp中访问相同内容,如下所示

<%@ page language = "java" %>
<%@ page import = "myclasses.*" %>
<html>
  <head>
    <title></title>
  </head>
  <body>
  <%
    myLog log = (myLog)application.getAttribute("logfile");
    try
    {
      if (log == null)
      {
        log = new myLog("new.log");

我正面临一个现在发现异常的课程。我重新启动了tomcat。 java.lang.NoClassDefFoundError:myLog

有人可以告诉我为什么,请..

0 个答案:

没有答案