Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » jsp error: package does not exist
jsp error: package does not exist [message #182908] Sat, 18 November 2006 21:09 Go to next message
Eclipse User
Originally posted by: m.soderi.alice.it

I created the simplest possible dynamic project by doing the following:

1. CREATED A NEW DYNAMIC PROJECT
File -> New -> Project... -> Web -> Dynamic Web Project
I named the project "prova" and accepted all default settings.

2. CREATED A VERY SIMPLE CLASS
I created a class named ClasseDiProva in package it.soderi under dafault
source folder (/src). Class code follows:
package it.soderi;
public class Prova {
public String prova() { return "all right"; }
}

3. CREATED A VERY SIMPLE JSP
I created a jsp named index.jsp under default web content folder
(/WebContent). Jsp is an empty html page having
@page import "it.soderi.Prova"
at the top, and
out.print(new Prova().prova());
in tag body.

4. SPECIFIED IT WAS A TOMCAT PROJECT
In the project properties, I checked "Is a Tomcat project" leaving all other
values as default.

5. STARTED TOMCAT, VISITED JSP, OBTAINED ERROR
org.apache.jasper.JasperException: Unable to compile class for JSP

Generated servlet error:
C:\Programmi\eclipse\workspace\prova\work\org\apache\jsp\Web Content\index_jsp.java:6:
package it.soderi does not exist
import it.soderi.Prova;
^
An error occurred at line: 6 in the jsp file: /WebContent/index.jsp
Generated servlet error:
C:\Programmi\eclipse\workspace\prova\work\org\apache\jsp\Web Content\index_jsp.java:49:
cannot find symbol
symbol : class Prova
location: class org.apache.jsp.WebContent.index_jsp
out.print(new Prova().prova());
^
2 errors

NOTE
At compile time, everything's ok: code completion shows that package exists
and the class is in it with its method prova(). The problem is only at
runtime, when I get the specified error.
Eclipse version is 3.2.0, Tomcat version is 5.0 configured by default
server.xml, web development plugins should be the most updated.

Do you know any reason for that?
Thanks a lot... ;)
Re: jsp error: package does not exist [message #182954 is a reply to message #182908] Mon, 20 November 2006 08:37 Go to previous message
Larry Isaacs is currently offline Larry Isaacs
Messages: 1298
Registered: July 2009
Senior Member
I believe "Is a Tomcat project" is part of the Sysdeo Tomcat plug-in and
not part of Web Tools. I haven't played with the Sysdeo plug-in in
quite a while, but I don't believe it understands Web Tools flexible
project layout. Assuming you have defined a Tomcat server in Web Tools,
i.e. File -> New -> Other... -> Server -> Server, you can "run" the JSP
on that server by right-clicking on the JSP and executing Run As -> Run
On Server and working through the wizard.

Cheers,
Larry

Mirco Soderi wrote:
> I created the simplest possible dynamic project by doing the following:
>
> 1. CREATED A NEW DYNAMIC PROJECT
> File -> New -> Project... -> Web -> Dynamic Web Project
> I named the project "prova" and accepted all default settings.
>
> 2. CREATED A VERY SIMPLE CLASS
> I created a class named ClasseDiProva in package it.soderi under dafault
> source folder (/src). Class code follows:
> package it.soderi;
> public class Prova {
> public String prova() { return "all right"; }
> }
>
> 3. CREATED A VERY SIMPLE JSP
> I created a jsp named index.jsp under default web content folder
> (/WebContent). Jsp is an empty html page having
> @page import "it.soderi.Prova"
> at the top, and
> out.print(new Prova().prova());
> in tag body.
>
> 4. SPECIFIED IT WAS A TOMCAT PROJECT
> In the project properties, I checked "Is a Tomcat project" leaving all other
> values as default.
>
> 5. STARTED TOMCAT, VISITED JSP, OBTAINED ERROR
> org.apache.jasper.JasperException: Unable to compile class for JSP
>
> Generated servlet error:
> C:\Programmi\eclipse\workspace\prova\work\org\apache\jsp\Web Content\index_jsp.java:6:
> package it.soderi does not exist
> import it.soderi.Prova;
> ^
> An error occurred at line: 6 in the jsp file: /WebContent/index.jsp
> Generated servlet error:
> C:\Programmi\eclipse\workspace\prova\work\org\apache\jsp\Web Content\index_jsp.java:49:
> cannot find symbol
> symbol : class Prova
> location: class org.apache.jsp.WebContent.index_jsp
> out.print(new Prova().prova());
> ^
> 2 errors
>
> NOTE
> At compile time, everything's ok: code completion shows that package exists
> and the class is in it with its method prova(). The problem is only at
> runtime, when I get the specified error.
> Eclipse version is 3.2.0, Tomcat version is 5.0 configured by default
> server.xml, web development plugins should be the most updated.
>
> Do you know any reason for that?
> Thanks a lot... ;)
>
>
Previous Topic:WebTools 2.0M2 missing dependencies??
Next Topic:Announcing WTP 1.5.2
Goto Forum:
  


Current Time: Sat Jul 26 01:09:55 EDT 2014

Powered by FUDForum. Page generated in 0.33327 seconds