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

Discussion in 'Java' started by Danijel, Aug 8, 2005.

  1. Danijel

    Danijel Guest

    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
    Danijel, Aug 8, 2005
    #1
    1. Advertising

  2. Danijel wrote:
    >
    > <%
    > 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
    --
    Unemployed English Java programmer
    http://jroller.com/page/tackline/
    Thomas Hawtin, Aug 8, 2005
    #2
    1. Advertising

  3. Danijel

    Danijel Guest

    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" <> wrote in message
    news:42f6a3cc$0$91529$...
    > Danijel wrote:
    > >
    > > <%
    > > 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
    > --
    > Unemployed English Java programmer
    > http://jroller.com/page/tackline/
    Danijel, Aug 8, 2005
    #3
  4. Danijel

    Roedy Green Guest

    On Mon, 8 Aug 2005 01:16:07 +0200, "Danijel" <>
    wrote or quoted :

    >
    >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,
    Roedy Green, Aug 14, 2005
    #4
  5. Danijel

    chncho

    Joined:
    Jul 24, 2012
    Messages:
    1
    I have the same problem, also.Have you solve your problem?
    chncho, Jul 24, 2012
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Howard
    Replies:
    2
    Views:
    366
    Michiel Salters
    Jul 4, 2003
  2. Rolf Magnus
    Replies:
    1
    Views:
    318
    ding feng
    Jul 4, 2003
  3. Mantorok Redgormor
    Replies:
    70
    Views:
    1,730
    Dan Pop
    Feb 17, 2004
  4. Su Zhang
    Replies:
    3
    Views:
    201
    Su Zhang
    Apr 18, 2011
  5. VK
    Replies:
    45
    Views:
    578
    Dr John Stockton
    Sep 12, 2006
Loading...

Share This Page