BufferedReader - InputStreamHandler Error. please help. thanks

P

PythonAnimal

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!!
 
P

PythonAnimal

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)
 
J

John C. Bollinger

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.
 
P

PythonAnimal

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
 
J

John C. Bollinger

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.
 
P

PythonAnimal

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.
 
P

PythonAnimal

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.
 
J

John C. Bollinger

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.
 
J

John C. Bollinger

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.
 

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,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top