• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

unexpected exception:please help

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi everyone,

i want to make a one way communication between applet and servlet.morever trying to send an array of string along the path stated and for that accomplishment i got stuck around the following code at client and server side.
when i run the code, having the following exception at server side




at client side(applet). dont confuse with jspURL, that is for servlet.



and this is at server side(servlet)



one more point for your sake of nailing my problem,

exception is being thrown at this line, and there is no any error at sun java console
please let me out of this headache

 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am going to take a highly scientific wild guess that your servlet side code tries to look at parameters before you start the attempt to read the object stream - this will position the input stream at EOF and cause an error.

Any attempt to look at request parameters causes the whole stream to be read.

Bill
 
John Mclain
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok i understand a bit, but its not enough to fix it.

so please tell, where should i make change in code at server side?

waiting for a quick reply.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by assantosh tripathi:
ok i understand a bit, but its not enough to fix it.


If that's the problem (and only you can tell us that) then, yes it is.


so please tell, where should i make change in code at server side?


Until you've confirmed that this is the problem nobody is going to be able to give you specific code changes to fix this.


waiting for a quick reply.


Please read this.
 
John Mclain
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Mr William wrote:

I am going to take a highly scientific wild guess that your servlet side code tries to look at parameters before you start the attempt to read the object stream - this will position the input stream at EOF and cause an error.



please let me clear a bit more, what exactly you want to say.


Any attempt to look at request parameters causes the whole stream to be read



but i think i am not attempting to read any request parameter before call to ObjectInputStream.

then why this exception is still thrown?
 
William Brogden
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the process by which the request ends up at the code you have listed? I am assuming you have a custom doGet method.

Apparently, after your applet sends the object, you execute

to immediately hit the servlet with another request!

What is supposed to happen there? What actually happens?

Bill
 
John Mclain
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks Mr William
to immediately hit the servlet with another request!





William wrote:
What is supposed to happen there? What actually happens?



actually i proposed to chek, wheather am getting the sent object at servlet side by runnig this by appletContext method.
ok,now i have removed this line indeed i am not getting any exception right now, but before this i was getting the exception(stated erliar).

now what i am intended to do is,
i have made an registrationform by using applets in jsp page. when user clicks the next button, he must get a feedback for data entered by him. this feedback should be displayed in another jsp page in same directory.

for this accomplishment planned to send all the data(entered in registration.jsp) to a servlet(in diffrent directory)and from servlet, after getting a requestDispatcher for feedback.jsp all the data should be available at feedback.jsp.

in next button's clicked event(on registration.jsp) i have written all the applet -servlet communication code along with


after sending the obect over output stream to servlet so that i would be able to open the feedback.jsp for feedback.

am i doing right?
 
John Mclain
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
but when i tried go along the way stated in my above post i am getting the null value at feedback.jsp

servlet side code


and at jsp side i am retrieving the data by this code



to check wheather i am doing right i have sent an array of string from applet to servlet of size three. but later i would send the actual data.
 
William Brogden
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


At what point have you made sure that reg_data[0] is not null?

Bill
 
reply
    Bookmark Topic Watch Topic
  • New Topic