jsp error: package does not exist [message #182908] |
Sun, 19 November 2006 02:09 |
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 13:37 |
Larry Isaacs Messages: 1354 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... ;)
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.02866 seconds