Unable to compile class for JSP.package not found

Hello folks,

I was trying to build a simple web application using Eclipse IDE, tomcat 5.x server and ant to build and deploy the application.

I referenced the following tutorial:

http://www.onjava.com/pub/a/onjava/2003/01/08/tomcat4.html

I was able to create a war file, deploy it in tomcat. When i invoke a simple jsp it works fine. However if I try to import any source pkg into jsp it throws error. Below is stack trace.

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

Generated servlet error:

C:\tomcat\work\Catalina\localhost\aweb\org\apache\jsp\web\Home_jsp.java:6:

package com.ak.test does not exist

import com.ak.test.*;

^

1 error

org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)

org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:332)

org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:412)

org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)

org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)

org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)

org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)

org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)

org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)

javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1056)

org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:261)

org.apache.struts.action.RequestProcessor.internalModuleRelativeForward(RequestProcessor.java:994)

org.apache.struts.tiles.TilesRequestProcessor.internalModuleRelativeForward(TilesRequestProcessor.java:343)

org.apache.struts.action.RequestProcessor.processForward(RequestProcessor.java:553)

org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:211)

org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)

org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)

javax.servlet.http.HttpServlet.service(HttpServlet.java:689)

javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

Any clue what is the issue?

[2477 byte] By [get.it.donea] at [2007-11-27 3:29:26]
# 1

Additional Info:

Location of files

==================

My jsp file is located at:

C:\eclipse\workspace\aweb\web\Home.jsp

my class is located in:

C:\eclipse\workspace\aweb\WEB-INF\classes\com\ak\test

Webapplication Dir Structure:C:\eclipse\workspace:

aweb(webapplication name)

--+web

--+Home.jsp

--+src

+com.ak.test.MyJava.java

--+WEB-INF

+Classes

--+com.ak.test.MyJava.class

+lib

-struts.jar

+web.xml

+struts-config.xml

-aweb.war(build.xml creates war file as per WAR format)

Ant task which installs the webapplication in Tomcat:

<target name="install" description="Installs the Web Application" depends="package">

<echo message="Installing ${app.name} ..."/>

<install url="${manager.url}" username="${username}" password="${password}" path="/${app.name}"

config="file:${basedir}/war/META-INF/context.xml" war="file:${basedir}/${app.name}.war"/>

</target>

build.properties file

--

app.name=aweb

manager.url=http://localhost:8080/manager

tomcat.home=C:/tomcat

username=user

password=user

Contents of the jsp file

=======================

<%@ page import="com.ak.test.MyJava" %>

<html>

<head>

<title>Home Page</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

</head>

</body>

</html>

get.it.donea at 2007-7-12 8:32:22 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...