BufferedReader - InputStreamHandler Error. please help. thanks

Discussion in 'Java' started by PythonAnimal@gmail.com, Nov 16, 2005.

  1. Guest

    Hello I am executing the following code. I seem to be getting this
    error
    java.lang.NoSuchMethodError:
    uploadequity3.EquityUpdater.loadFile(Ljava/io/BufferedReader;)Z

    but I am passing the following
    InputStream inpStream = fileUploaded.getInputStream();
    InputStreamReader inpStreamReader = new InputStreamReader(inpStream);
    BufferedReader bufRea = new BufferedReader(inpStreamReader);

    I pass this bufRea to a class.method(BufferedReader read)

    When I pass the bufferedReader to this method I get teh previous error.
    I was wondering, usually I pass a fileReader to a buffered reader but
    because I am using a FormFile I can not do this. This is a struts app.
    Am I passing the wrong stream. I see BufferedReader accepts a Reader,
    is passing an InputStreamReader OK?
    Thank-you!!
     
    , Nov 16, 2005
    #1
    1. Advertising

  2. Guest

    Re: BufferedReader - InputStreamHandler Error. please help. thanks

    Here is the full stack trace..
    java.lang.NoSuchMethodError:
    uploadequity3.EquityUpdater.loadFile(Ljava/io/BufferedReader;)Z
    uploadequity3.FileUploadAction.execute(FileUploadAction.java:41)
    org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
    org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
    org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
    org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
     
    , Nov 16, 2005
    #2
    1. Advertising

  3. Re: BufferedReader - InputStreamHandler Error. please help. thanks

    wrote:
    > Here is the full stack trace..
    > java.lang.NoSuchMethodError:
    > uploadequity3.EquityUpdater.loadFile(Ljava/io/BufferedReader;)Z
    > uploadequity3.FileUploadAction.execute(FileUploadAction.java:41)
    > org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
    > org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
    > org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
    > org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
    > javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
    > javax.servlet.http.HttpServlet.service(HttpServlet.java:856)


    From the API docs:
    ====
    public class NoSuchMethodError
    extends IncompatibleClassChangeError

    Thrown if an application tries to call a specified method of a class
    (either static or instance), and that class no longer has a definition
    of that method.

    Normally, this error is caught by the compiler; this error can only
    occur at run time if the definition of a class has incompatibly changed.
    ====

    So, have you modified uploadequity3.FileUploadAction or
    uploadequity3.EquityUpdater recently? You somehow have managed to get
    unmatched versions of these classes trying to work together.


    --
    John Bollinger
     
    John C. Bollinger, Nov 17, 2005
    #3
  4. Roedy Green Guest

    Roedy Green, Nov 17, 2005
    #4
  5. Guest

    Re: BufferedReader - InputStreamHandler Error. please help. thanks

    Hi Me again, I Rechecked everything, I actually removed all the class
    files and compiled everyting (javac *.java). In one of my classes I
    have a class loadFile(InputStream stream) - class compiles fine, But my
    other class can not find this class. I get
    javax.servlet.ServletException: Servlet execution threw an exception


    root cause

    java.lang.NoSuchMethodError:
    uploadequity3.EquityUpdater.loadFile(Ljava/io/InputStream;)Z
    uploadequity3.FileUploadAction.execute(FileUploadAction.java:42)
    org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
    org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
    org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
    org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

    Could it be because I am compiling one of hte classes on jbuilder,
    while the other on UNIX?? I copy the class file over to the UNIX box.
    Thanks in advance
     
    , Nov 17, 2005
    #5
  6. Re: BufferedReader - InputStreamHandler Error. please help. thanks

    wrote:
    > Hi Me again, I Rechecked everything, I actually removed all the class
    > files and compiled everyting (javac *.java). In one of my classes I
    > have a class loadFile(InputStream stream) - class compiles fine, But my
    > other class can not find this class. I get
    > javax.servlet.ServletException: Servlet execution threw an exception
    >
    >
    > root cause
    >
    > java.lang.NoSuchMethodError:
    > uploadequity3.EquityUpdater.loadFile(Ljava/io/InputStream;)Z
    > uploadequity3.FileUploadAction.execute(FileUploadAction.java:42)
    > org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
    > org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
    > org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
    > org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
    > javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
    > javax.servlet.http.HttpServlet.service(HttpServlet.java:856)


    This does not mean that one class cannot find another class. To the
    contrary, it means that one class finds the other just fine, but that
    the class that was found does not contain a method that is supposed to
    be there.

    > Could it be because I am compiling one of hte classes on jbuilder,
    > while the other on UNIX?? I copy the class file over to the UNIX box.


    See my previous response in this thread. This is not caused (directly)
    by compiling one class in jbuilder and the other via javac on a UNIX
    (tm) box. HOWEVER, it could very well be caused by compiling the two
    classes separately from incompatible sources. If you cannot compile
    them both in the same build, then at least ensure that the class for
    EquityUploader *that will be used in production* is in the compilation
    classpath for FileUploadAction, and that no other version is present.
    (Watch out for out-of-date classes lying around.) In the final extreme,
    make sure you are compiling from identical sources in both places; your
    version control system will help you there, presuming that you are using
    one.

    --
    John Bollinger
     
    John C. Bollinger, Nov 18, 2005
    #6
  7. Guest

    Re: BufferedReader - InputStreamHandler Error. please help. thanks

    Yes I actually moved all teh .java files over and when I do javac
    *.java the compilation works but if I do simple javac EquityU.java it
    does not work. I rm *.class and redid this still I keep getting an
    older class file. I am figuring out if it is looking in another
    directory but all the class files are stored in my
    WEB-INF/class/pakFolderName. Frustrating using javac *.java then
    seeing the class was not updated.
    Thanks again John. I appreciate it.
     
    , Nov 18, 2005
    #7
  8. Guest

    Re: BufferedReader - InputStreamHandler Error. please help. thanks

    I get this error.
    EquityUpdater.java:68: cannot resolve symbol
    for 2-3 different classes, yet the classes are all in the same package
    in the same directory. But when I do javac *.java everything compiles
    fine. This is quite frustrating Thanks.
     
    , Nov 18, 2005
    #8
  9. Re: BufferedReader - InputStreamHandler Error. please help. thanks

    wrote:
    > Yes I actually moved all teh .java files over and when I do javac
    > *.java the compilation works but if I do simple javac EquityU.java it
    > does not work. I rm *.class and redid this still I keep getting an
    > older class file. I am figuring out if it is looking in another
    > directory but all the class files are stored in my
    > WEB-INF/class/pakFolderName. Frustrating using javac *.java then
    > seeing the class was not updated.


    You mean WEB-INF/classes/pakFolderName, I suppose. Watch out for
    another copy of your classes in a jar in WEB-INF/lib, as those would
    also be in your webapp's class path. Also watch out for copies in other
    directories that your servlet container puts in your class path; these
    directories depend on the container, so check the documentation.

    --
    John Bollinger
     
    John C. Bollinger, Nov 19, 2005
    #9
  10. Re: BufferedReader - InputStreamHandler Error. please help. thanks

    wrote:
    > I get this error.
    > EquityUpdater.java:68: cannot resolve symbol
    > for 2-3 different classes, yet the classes are all in the same package
    > in the same directory. But when I do javac *.java everything compiles
    > fine. This is quite frustrating Thanks.


    That may indicate something screwy with your source code (misspelled
    package names, possibly combined with redundant source files, for
    instance) or it may indicate a problem with how you're using javac.
    Those are the most likely things that occur to me, anyway. I can't
    offer any particular resolution, however, because I don't have any real
    lead on a specific problem.

    --
    John Bollinger
     
    John C. Bollinger, Nov 19, 2005
    #10
    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. Peter Blatt
    Replies:
    0
    Views:
    312
    Peter Blatt
    Aug 11, 2003
  2. Robert
    Replies:
    0
    Views:
    3,088
    Robert
    Oct 5, 2003
  3. KK
    Replies:
    2
    Views:
    723
    Big Brian
    Oct 14, 2003
  4. gbattine
    Replies:
    0
    Views:
    1,162
    gbattine
    Jun 5, 2006
  5. shapper
    Replies:
    0
    Views:
    358
    shapper
    Dec 18, 2007
Loading...

Share This Page