The method is undefined for the type - ERROR !!!

D

Danijel

Hi !

When I execute this code on localhost in jsp page everything works good.
Sever is Tomcat 5.5.9, class Film exists and it consists of static method
named isLookedByUser() that takes 2 parameters User and String.
Everything works perfect localy but...

<%
if (Film.isLookedByUser(user,sifraFilma){
do something ...
}
%>


When I upload on real server (also Tomcat 5.5.9 but working on Linux) I get
some stupid error that method is undefined for this class. That is simply
not true I checked that 100 times. Method exists on server also.

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

An error occurred at line: 31 in the jsp file: /proba.jsp
Generated servlet error:
The method isLookedByUser(User, String) is undefined for the type Film


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

org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:3
28)

org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:397)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:288)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)

org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:5
56)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:2
93)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


For almost 3 days I cant find solution. Can someone help me Please.
Locally everything works fine but on server doesn't.


Thank's in advanced !
Danijel
 
T

Thomas Hawtin

Danijel said:
<%
if (Film.isLookedByUser(user,sifraFilma){ ^)
do something ...
}
%>


When I upload on real server (also Tomcat 5.5.9 but working on Linux) I get
some stupid error that method is undefined for this class. That is simply
not true I checked that 100 times. Method exists on server also.

[...]
The method isLookedByUser(User, String) is undefined for the type Film

Can you do anything with the type Film from the JSP? Sometimes there can
be problems with not reloading classes, or they might not be in the
correct place. A short but complete example that demonstrate the problem
would be useful.

My guess is that Film is in the default package. JSPs are correctly
generated in a package of the JSP implementation's choosing. Film is
therefore in a different packages and isn't looked at. You can't even
import it with recent versions of javac (from 1.4ish?). You therefore
need to put Film in some package, and import it.

Tom Hawtin
 
D

Danijel

No Film class is working fine for other methods when uploaded to server.
Problem is this last method enterd.
Code works fine on local machine and package is checked 100 times. All my
classes are in same package.
That is why this problem drives me crazy.



Thomas Hawtin said:
Danijel said:
<%
if (Film.isLookedByUser(user,sifraFilma){ ^)
do something ...
}
%>


When I upload on real server (also Tomcat 5.5.9 but working on Linux) I get
some stupid error that method is undefined for this class. That is simply
not true I checked that 100 times. Method exists on server also.

[...]
The method isLookedByUser(User, String) is undefined for the type Film

Can you do anything with the type Film from the JSP? Sometimes there can
be problems with not reloading classes, or they might not be in the
correct place. A short but complete example that demonstrate the problem
would be useful.

My guess is that Film is in the default package. JSPs are correctly
generated in a package of the JSP implementation's choosing. Film is
therefore in a different packages and isn't looked at. You can't even
import it with recent versions of javac (from 1.4ish?). You therefore
need to put Film in some package, and import it.

Tom Hawtin
 
R

Roedy Green

When I upload on real server (also Tomcat 5.5.9 but working on Linux) I get
some stupid error that method is undefined for this class. That is simply
not true I checked that 100 times. Method exists on server also.

Is this the only class misbehaving?

What is different about it from the others that do work?

Try deleting generated java and class files to force them to be
regenerated.

Perhaps the problem is simply you spelled the class or method
different ways or with different caps. You have to be a fanatically
good or at least a consistent speller to make Java work.

Sometimes I cut and paste to ensure two complex names are absolutely
identical and discover that my eyes were ignoring a typo,
 
Joined
Jul 24, 2012
Messages
1
Reaction score
0
Hi !

When I execute this code on localhost in jsp page everything works good.
Sever is Tomcat 5.5.9, class Film exists and it consists of static method
named isLookedByUser() that takes 2 parameters User and String.
Everything works perfect localy but...

<%
if (Film.isLookedByUser(user,sifraFilma){
do something ...
}
%>


When I upload on real server (also Tomcat 5.5.9 but working on Linux) I get
some stupid error that method is undefined for this class. That is simply
not true I checked that 100 times. Method exists on server also.

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

An error occurred at line: 31 in the jsp file: /proba.jsp
Generated servlet error:
The method isLookedByUser(User, String) is undefined for the type Film


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

org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:3
28)

org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:397)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:288)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)

org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:5
56)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:2
93)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


For almost 3 days I cant find solution. Can someone help me Please.
Locally everything works fine but on server doesn't.


Thank's in advanced !
Danijel
I have the same problem, also.Have you solve your problem?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top