• 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

An application talking to a Servlet... problem!

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

Spec..:
currently i have an Java application trying to send a String data to a Servlet that must receive and save it as a file in the server side. The problem is there occurs an Server 500 error..



Can anyone figure why this comes... My application code is as follows:
 
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
It could be this line:

When doing a URLConnection you should NEVER close a stream until the response has been read. Use flush() to make sure the request is sent. The reason being that close() causes the socket to be closed.
Bill
 
Vanchi Nathan
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello William,

Thanks for the response....very

My servlet is a simple one and it works when i invoke by a browser...(codes below):

...the problem is with the code in the following java application...(codes below):

The error i get is as follows:


I don't know why the application is not served by the doGet method instead it tell "Unknown Source"...

pl. help...
 
Vanchi Nathan
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Correction please..What i stated..

I don't know why the application is not served by the doGet method instead it tell "Unknown Source"...


actually not with doGet method but by doPostmethod..
 
reply
    Bookmark Topic Watch Topic
  • New Topic