Java io ioexception error writing to server Error writing to server

I get a « Error writing to server» error, its information is as follow: Error writing to server

Can anybody help me? What probably cause this exception? Could it be a network problem?


Thanks for your reply!
I use GOOGLE YOUTUBE API for uploading videos, here is some of my codes:

private static void uploadVideo(YouTubeService service, String filepath, String mimeType) throws IOException <
if (filepath == null)
System.out.println(«filepath is null»);

if (mimeType == null)
System.out.println(«filepath is null»);

File videoFile = new File(filepath);

if (!videoFile.exists()) <
System.out.println(«Sorry, that video doesn’t exist.»);

VideoEntry newEntry = new VideoEntry();

YouTubeMediaGroup mg = newEntry.getOrCreateMediaGroup();
mg.addCategory(new MediaCategory(YouTubeNamespace.CATEGORY_SCHEME, «Tech»));
mg.setTitle(new MediaTitle());
mg.setKeywords(new MediaKeywords());
mg.setDescription(new MediaDescription());
MediaFileSource ms = new MediaFileSource(videoFile, mimeType);

try <
service.insert(new URL(VIDEO_UPLOAD_FEED), newEntry);
> catch (ServiceException se) <
System.out.println(«Sorry, your upload was invalid:»);

System.out.println(«Video uploaded successfully!»);

public static void main(String[] args) <
SimpleCommandLineParser parser = new SimpleCommandLineParser(args);

String username = parser.getValue(«username», «user», «u»);
String password = parser.getValue(«password», «pass», «p»);
String developerKey = parser.getValue(«key», «k»);
String filepath = parser.getValue(«file», «f»);
String mimeType = parser.getValue(«type», «t»);
boolean help = parser.containsKey(«help», «h»);

if (help || username == null || password == null || developerKey == null) <

YouTubeService service = new YouTubeService(«ytapi-VideoNmae-JJJyoub-phe8fmmj-0″,//»gdataSample-YouTubeAuth-1»,

if (service == null)
System.out.println(«service == null»);

try <
service.setUserCredentials(username, password);
> catch (AuthenticationException e) <
System.out.println(«Invalid login credentials.»);

String host=»″;
String port=»3128″;
System.setProperty(«http.proxySet», «true»);
System.setProperty(«http.proxyHost», host);
System.setProperty(«http.proxyport», port);

try <
// here get the exception.
> catch (IOException e) <
// Communications error
«There was a problem communicating with the service.»);

This is some of my codes, it is too long to upload all. If you find sth error, please show it to me!

Edited by: jmailer on Jul 25, 2008 5:51 PM

Thanks for your time! But the video i upload is very samll, just about 5M.
Are there any methods or tools that i can use to find what happened between my pc and the server?

Thanks for your reply. I cann’t get the server log.

But i download MS’s fiddler, with which I find that when my pc connects to the server it returns
502. I check this result in HTTP Status Code Definitions and find it has the following meaning:
502 Bad Gateway
The server, while acting as a gateway or proxy, received an invalid response from the upstream
server it accessed in attempting to fulfill the request.

and the HTTP Header information i get with fiddler:

POST /feeds/api/users/default/uploads HTTP/1.1
Content-Type: multipart/related;boundary=»—-=_Part_0_12985263.1217284632453″
Authorization: GoogleLogin auth=AIwbFARkDO9lXZtGA4hlY82BrZiTxQDt1Hfmjjp6M2jaIIRsIUQL3p5gX3zSpX44TelCOlCcvDy7mqS6SI6OUyimVAUzMZkoxZbUDUl8VADz84jcpW9y-yTD3uSbXNA7Xj9EzXE_NXhaeCQVUYtr9M8LFEfMw1OuOA
User-Agent: ytapi-VideoNmae-JJJyoub-phe8fmmj-0 YouTube-Java/1.0 GData-Java/null(gzip)
X-GData-Key: key=AI39si4OAs3sm-bPpnvrHqWUCKQBHqThZw7Lvu67LXznNYmf93OmAUwBf2z7KC2qgjlXhL_5fJJaJBxV-4mf46CMF52_boiKwQ
X-GData-Client: ytapi-VideoNmae-JJJyoub-phe8fmmj-0
Accept-Encoding: gzip
GData-Version: 1.0
Cache-Control: no-cache
Pragma: no-cache
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Proxy-Connection: keep-alive
Content-Length: 17543973

Content-Type: application/atom+xml gdata-test Tech
Content-Type: video/quicktime

and the error message:

[Fiddler] Connection to failed.
Exception Text: A connection
attempt failed because the connected party did not properly respond after a period of time,
or established connection failed because connected host has failed to respond.

It seems that it was a network linker problem, but i can connect to the server with my IE
browser. Do you have any good idea?

Источник Error writing to server #2654


KumarSunil20 commented Mar 15, 2018 •

The problem

I am experiencing this error most of the time when I run the script (not all the time).
cause: browser.getAttribute() function

Читайте также:  System warning critical error

Error Details Error writing to server
[chrome #0-0] Error: An unknown server-side error occurred while processing the command.
[chrome #0-0] at elementIdAttribute(«0.31804148897353457-28», «class») — C:\Users\sunil.kumar\Documents\Exec_Env\node_modules\webdriverio\build\lib\commands\getAttribute.js:43:55 Connection refused: connect
[chrome #0-0] Error: An unknown server-side error occurred while processing the command.
[chrome #0-0] at elementIdAttribute(«0.022919823191283495-28», «class») — C:\Users\sunil.kumar\Documents\QA_Exec_Env\node_modules\webdriverio\build\lib\commands\getAttribute.js:43:55


  • WebdriverIO version: 4.12.0
  • Node.js version: 8.9.1
  • wdio testrunner
  • wdio testrunner, running synchronous (wdio-sync):
    *chromedriver: 2.36.0
    *selenium-standalone: 6.13.0
    *wdio: 1.0.3
    *wdio-chromedriver-service: 0.1.2
    *wdio-selenium-standalone-service: 0.0.10
    *Chrome — 65.0.3325.162
    *Window — 10

Code To Reproduce Issue [ Good To Have ]

import < CommandError >from ‘../utils/ErrorHandler’

let getAttribute = (selector, attributeName) => <
* parameter check
if (typeof attributeName !== ‘string’) <
throw new CommandError(‘number or type of arguments don’t agree with getAttribute command’)

export default getAttribute

Is there any solution to the problem stated

The text was updated successfully, but these errors were encountered:


IOException — Error Writing to Server

Hi, Am trying to open an URL through java code and read the contents of the html page.sometimes my code runs perfectly but sometimes when i try to open the url am getting the following error. Error writing to server at at at at at ReadHtml1.openURL( at ReadHtml1. ( at ReadHtml1.main(

some information to solve this issue is appreciated.

Comments at at ReadHtml1.openURL( at ReadHtml1. ( at ReadHtml1.main(

So what is the code at line 54

import java.awt.Container;
import java.util.Properties;

import javax.swing.JFrame;
import javax.swing.JOptionPane;

public class ReadHtml1 <

JFrame f=new JFrame(«Link Checker»);
Container contentPane = f.getContentPane();
String checkURL=»»;
File file1=new File(«URLReader.txt»);
checkURL= JOptionPane.showInputDialog(f,»Enter the URL»);

public static void main(String[] args) <
// TODO Auto-generated method stub
new ReadHtml1();

Источник Error writing request body to server #1248


lavr commented Jun 22, 2020 •

Agent successfully sends several events to APM Server after start.
After that it drops connections to intake/v2/events while in the middle of http request, so server can not get events.

Here is access logs from http balancer in front of apm server. — agent’s machine, rt is request time.
First request goes well, then almost all requests fails:

Here is cause of error 400 in access log:

Tomcat startup config:

Content of /srv/sp/conf/

Apache Tomcat/8.0.32
Ubuntu 16.04
Java(TM) SE Runtime Environment (build 1.8.0_151-b12)

Tried send events without balancer,directly to port 8200 — same error in agent logs, no events in apm server.

Need help how to fix it.

The text was updated successfully, but these errors were encountered:

felixbarny commented Jun 23, 2020

Hi and thanks for creating the issue.

I’m closing this for now as this issue seems more related to APM Server. We also kindly ask to post all questions and issues on the Discuss forum first. In addition to awesome, knowledgeable community contributors, core APM developers are on the forums every single day to help you out as well. So, your questions will reach a wider audience there, and if we confirm that there is a bug, then you can reopen this issue with the new information or open a new one.


Universal plugin fails with Error writing to server #1045


dotta commented Oct 17, 2017

Expected behaviour

sbt universal:publish should publish a zip file to the set repository

Actual behaviour

sbt universal:publish fails with a Error writing to server error

Читайте также:  System error code 1722 rpc сервер недоступен


  • What sbt-native-packager are you using
    1.2.2 (also tried with 1.2.1 and 1.2.0)
  • What sbt version
    0.13.16 (also tried 0.13.13)
  • What is your build system (e.g. Ubuntu, MacOS, Windows, Debian )
  • What package are you building (e.g. docker, rpm, . )


To reproduce the issue, you must to use a private artifactory repository.


Steps to reproduce it

Just type sbt universal:publish and you’ll get

[error] (sub/universal:publish) Error writing to server

Now remove JavaAppPackaging from the build file. Try again sbt universal:publish and this time it will work! From the outside, it looks like the JavaAppPackaging plugin is doing something with the credentials, but I haven’t been able yet to validate this hunch.

If you do need to use JavaAppPackaging , the only workaround I found to make it work is to do the following:

1 — type sbt and enter the interactive shell
2 — remove the JavaAppPackaging from the sbt subproject that’s failing
3 — type reload
4 — type universal:publish (this will publish a zip that is very likely not what you want to publish)
5 — add back JavaAppPackaging
6 — type reload
7 — type universal:publish (this time you are publishing the intended zip)

This is far from being an actual workaround, but it serves displaying some unintended (?) side-effects happening when removing/adding JavaAppPackaging .

The text was updated successfully, but these errors were encountered:

muuki88 commented Oct 17, 2017

Thanks for your report. I’ll take a look when I’m back from my vacation.

dotta commented Oct 18, 2017

Hey! I’m actually trying to understand what’s happening and find at least a proper workaround, if not actually fixing the underlying issue. This to me smells like «scoping problem». Let me know if you have some idea for things that could be responsible for this!

muuki88 commented Oct 18, 2017

Thanks for taking the time 😍

A good starting point would be to create a new test based on this one.

Most of these weird issues are related to scoping from my experience so far. I must admit that I haven’t touched the deploy plugins in anyway. They are still pretty old.

If you like we can have a short chat or hangout/Skype call if you like.

dotta commented Oct 19, 2017

@muuki88 Thanks for chiming in! The challenge with writing a test is that this particular problem reveals itself only when publishing to a private repository. And, for some reason I can’t yet understand, the credentials needed to publish seem to not be available when JavaAppPackaging is enabled together with UniversalDeployPlugin .

Let’s have a chat once you are back from holidays! 🙂

dotta commented Oct 27, 2017

Turns out that if I do a publish before calling universal:publish , then it all works fine. And this is actually a good enough workaround for the moment (at least for my current use case).

muuki88 commented Oct 27, 2017

Thanks for sharing ❤️

So you have something like this in your code?

Maybe we should add this in the the UniversalDeployPlugin as well. Not sure what
publish has as a side effect.

dotta commented Oct 27, 2017

I am using sbt-release and we have a +publish before a +universal:publish . But it should be effectively the same as what you wrote.

Not sure what publish has as a side effect.

asdcdow commented Nov 19, 2017

I get the same problem with the rpm plugin. However, running publish beforehand doesn’t seem to make it work for me.

muuki88 commented Nov 19, 2017

Do you also have a similar setup? A private repo that requires credentials?

Читайте также:  Network error trying to reconnect фейсит

asdcdow commented Nov 19, 2017

Yes, I also have a private repo that requires credentials

asdcdow commented Nov 20, 2017 •

Looking closer at this. I think I’m running in to 2 problems.

    The problem described in the story

I think the second problem is why the workaround is not working for me (I’m trying to upload a >50mb RPM).

I think the problem in this story is cause by the Authenticator not being set for any of the *:publish tasks. The reason this workaround works is because the JVM requires you to set a global Authenticator . So, once it is set by publish then it is set for all of the *:publish tasks as well.

muuki88 commented Nov 20, 2017

Thanks a lot for digging deeper into this ❤️

A global Authentiator . This would be a good explanation. I was thinking about the credentials object not being scoped correctly, e.g.

So they get picked up during rpm:publish . Is there any way to access this Authenticator instance?

asdcdow commented Nov 20, 2017

I’m not sure how you are supposed to access the authenticator. However, the way I was able to see what was happening was by putting a breakpoint in IvyAuthenticator.install . This gets called before all of the http requests.

muuki88 commented Nov 20, 2017

Thanks a lot for sharing. I’m not sure if I have time to debug this. You have already done a lot to shed light into this issue.

Not sure how we handle this from here on. It looks that it’s partially a problem in native-packager. If you find a workaround or configuration that fixes this, I’m more than happy to merge it.

asdcdow commented Nov 20, 2017

Due to my other issue, I ended up using sbt-aether-deploy. I was then able to get this working using roughly this stack overflow answer

dragos commented Mar 7, 2018

The workaround using publish before universal:publish doesn’t work in Sbt 1.x.

muuki88 commented Mar 7, 2018

Thanks for the update 😀

Do you have any time to debug this issues further? I fear I won’t even have the time for a minimal setup to do so 😥

dragos commented Mar 8, 2018 •

I spent already more than a day debugging, and I didn’t get anywhere close to a solution. The workaround is to disable Gigahorse ( updateOptions in ThisBuild := updateOptions.value.withGigahorse(false) ). A few related discussions:

The usual connection goes like this:

  • attempt to connect without credentials
  • fail ( 401 or 403 ) and retry with credentials

When publishing a SNAPSHOT version this always fails. When publishing a release, it works (NOT with Gigahorse though).

  • SNAPSHOTs fail because Sbt (or Ivy, whatever) attempts to do PUT without credentials, and this fails early (broken pipe) because the server, reasonably so, does not wait for the whole upload to finish in order to return a 401 . The client has no idea that the reason for the broken pipe is missing credentials, and doesn’t try again.
  • releases work because Sbt/Ivy first tries to see if the file exists (since you’re not allowed to overwrite releases on the server). This first request fails with a well-behaved 401 and Ivy retries with authentication.

Ultimately, I don’t think this is a native packager issue, but it arises here more often because uploads are larger (perhaps the server waits and returns 401 for PUT s of certain file types, like pom files, that are small enough).


Оцените статью