I am developing a web service to allow uploading from client to server. I was able to get wsdl file at http://localhost:9999/UploadWebservice?wsdl
. Here is its content
<?xml version="1.0" encoding="UTF-8"?>
<!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.6 in JDK 6. -->
<!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.6 in JDK 6. -->
<definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://ws/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://ws/" name="ImageServerImplService">
<types></types>
<message name="upload">
<part name="arg0" type="xsd:string"></part>
<part name="arg1" type="xsd:base64Binary"></part>
</message>
<message name="uploadResponse">
<part name="return" type="xsd:string"></part>
</message>
<portType name="ImageServer">
<operation name="upload" parameterOrder="arg0 arg1">
<input message="tns:upload"></input>
<output message="tns:uploadResponse"></output>
</operation>
</portType>
<binding name="ImageServerImplPortBinding" type="tns:ImageServer">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc"></soap:binding>
<operation name="upload">
<soap:operation soapAction=""></soap:operation>
<input>
<soap:body use="literal" namespace="http://ws/"></soap:body>
</input>
<output>
<soap:body use="literal" namespace="http://ws/"></soap:body>
</output>
</operation>
</binding>
<service name="ImageServerImplService">
<port name="ImageServerImplPort" binding="tns:ImageServerImplPortBinding">
<soap:address location="http://localhost:9999/UploadWebservice"></soap:address>
</port>
</service>
</definitions>
Now I am writing a client to consume the service. Here is the client
package ws;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.util.Map;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.soap.SOAPBinding;
import com.sun.xml.ws.developer.JAXWSProperties;
public class ClientTaiwan {
public static void main(String[] args) {
ImageServerImplService service = new ImageServerImplService();
ImageServer delegate = service.getImageServerImplPort();
// Enable MTOM
BindingProvider bp = (BindingProvider) delegate;
SOAPBinding binding = (SOAPBinding) bp.getBinding();
binding.setMTOMEnabled(true);
// Set chunk size
Map<String, Object> ctxt =
((BindingProvider)delegate).getRequestContext();
ctxt.put(JAXWSProperties.HTTP_CLIENT_STREAMING_CHUNK_SIZE, 8192);
byte[] b;
try {
RandomAccessFile f = new RandomAccessFile("c:\100MB.zip", "r");
b = new byte[(int) f.length()];
f.read(b);
f.close();
delegate.upload("c://Upload//100MB.zip", b);
} catch (IOException e) {
e.printStackTrace();
}
System.out.println("Done!");
}
}
I receive the following stack trace
Exception in thread "main" javax.xml.ws.WebServiceException: java.io.IOException: Error writing request body to server
at com.sun.xml.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:225)
at com.sun.xml.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:136)
at com.sun.xml.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:110)
at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:1063)
at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:979)
at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:950)
at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:825)
at com.sun.xml.ws.client.Stub.process(Stub.java:443)
at com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:174)
at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:119)
at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:102)
at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:154)
at com.sun.proxy.$Proxy33.upload(Unknown Source)
at ws.ClientTaiwan.main(ClientTaiwan.java:47)
Caused by: java.io.IOException: Error writing request body to server
at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.checkError(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.write(Unknown Source)
at com.sun.xml.ws.transport.http.client.HttpClientTransport$WSChunkedOuputStream.write(HttpClientTransport.java:365)
at javax.activation.DataHandler.writeTo(Unknown Source)
at com.sun.xml.ws.encoding.MtomCodec$ByteArrayBuffer.write(MtomCodec.java:229)
at com.sun.xml.ws.encoding.MtomCodec.encode(MtomCodec.java:185)
at com.sun.xml.ws.encoding.SOAPBindingCodec.encode(SOAPBindingCodec.java:242)
at com.sun.xml.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:214)
The line that causes the problem is delegate.upload("c://Upload//100MB.zip", b);
Why does a published service is still not visible for its client? How can I fix it?
If you have any concern about my coding style please let me know. Things are a little out of my control right now.
Best regards
Hi guys,
I’m starting to evaluate Modeshape 4.1.0-Final with Wildfly 8.2. My installation is completely default with no modification in any configuration file, except those mentioned in this guide [1]. I’m not an expert neither with Wildfly nor Modeshape, but I couldn’t find any reference to this error.
I’m just trying to upload a file with ~50Mb.
Assuming:
- a remote installation in a Centos 7 linux box
- java 1.8.0_20
- using CMIS with AtomPub
- the client code:
public void saveFile(String folderName, String originalName, byte[] fileContent){ Map properties = new HashMap(); properties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:unversioned-document"); properties.put(PropertyIds.NAME, originalName); InputStream fileStream = new ByteArrayInputStream(fileContent); String mimetype = // guessMimeType(fileContent); "application/zip"; ContentStream contentStream = new ContentStreamImpl( originalName, BigInteger.valueOf(fileContent.length), mimetype, fileStream); Folder folder = null; if( folderName == null ){ folder = this.client.getSession().getRootFolder(); } else { folder = (Folder) this.client.getSession().getObjectByPath(folderName); } Document newDoc = folder.createDocument( properties, contentStream, VersioningState.NONE); }
The error raised is the following:
org.apache.chemistry.opencmis.commons.exceptions.CmisConnectionException: Cannot access "http://192.168.10.79:8080/modeshape-cmis/atom/artifacts/children?id=ef2822b9-bc1f-42aa-891c-bd753da1c0a8&versioningState=none": Error writing request body to server at org.apache.chemistry.opencmis.client.bindings.spi.http.DefaultHttpInvoker.invoke(DefaultHttpInvoker.java:230) at org.apache.chemistry.opencmis.client.bindings.spi.http.DefaultHttpInvoker.invokePOST(DefaultHttpInvoker.java:65) at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.post(AbstractAtomPubService.java:646) at org.apache.chemistry.opencmis.client.bindings.spi.atompub.ObjectServiceImpl.createDocument(ObjectServiceImpl.java:121) at org.apache.chemistry.opencmis.client.runtime.SessionImpl.createDocument(SessionImpl.java:1043) at org.apache.chemistry.opencmis.client.runtime.FolderImpl.createDocument(FolderImpl.java:77) at org.apache.chemistry.opencmis.client.runtime.FolderImpl.createDocument(FolderImpl.java:451) at modeshapetest.cmis.PutFileFacade.save(PutFileFacade.java:102) at modeshapetest.cmis.PutFileFacade_save_IntegrationTest.putHugeFileOk(PutFileFacade_save_IntegrationTest.java:170) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222) at org.junit.runners.ParentRunner.run(ParentRunner.java:300) at org.junit.runner.JUnitCore.run(JUnitCore.java:157) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:211) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134) Caused by: com.ctc.wstx.exc.WstxIOException: Error writing request body to server at com.ctc.wstx.sw.BaseStreamWriter.writeCharacters(BaseStreamWriter.java:388) at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AtomEntryWriter.writeContent(AtomEntryWriter.java:244) at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AtomEntryWriter.write(AtomEntryWriter.java:181) at org.apache.chemistry.opencmis.client.bindings.spi.atompub.ObjectServiceImpl$1.write(ObjectServiceImpl.java:123) at org.apache.chemistry.opencmis.client.bindings.spi.http.DefaultHttpInvoker.invoke(DefaultHttpInvoker.java:196) ... 35 more Caused by: java.io.IOException: Error writing request body to server at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.checkError(HttpURLConnection.java:2840) at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.write(HttpURLConnection.java:2823) at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65) at java.io.BufferedOutputStream.write(BufferedOutputStream.java:109) at com.ctc.wstx.io.UTF8Writer.write(UTF8Writer.java:143) at com.ctc.wstx.sw.BufferingXmlWriter.writeRaw(BufferingXmlWriter.java:269) at com.ctc.wstx.sw.BufferingXmlWriter.writeCharacters(BufferingXmlWriter.java:568) at com.ctc.wstx.sw.BaseStreamWriter.writeCharacters(BaseStreamWriter.java:385) ... 39 more
For obvious reason, I will not attach the file that I’m trying to upload, but I’ve tried with different sizes and types and, apparently after 10Mb all failed.
Thank you for help.
Rafael
[1] http://www.mastertheboss.com/jboss-frameworks/modeshape/nosql-data-storage-with-modeshape-4
Содержание
- java.io.IOException: Error writing to server
- Comments
- java.io.IOException: Error writing to server #2654
- Comments
- The problem
- Error Details
- Environment
- Code To Reproduce Issue [ Good To Have ]
- IOException — Error Writing to Server
- Comments
- Universal plugin fails with java.io.IOException: Error writing to server #1045
- Comments
- Expected behaviour
- Actual behaviour
- Information
- Reproducible
- build.sbt
- Steps to reproduce it
java.io.IOException: Error writing to server
I get a «java.io.IOException: Error writing to server» error, its information is as follow:
java.io.IOException: Error writing to server
at sun.net.www.protocol.http.HttpURLConnection.writeRequests(HttpURLConn
ection.java:440)
at sun.net.www.protocol.http.HttpURLConnection.writeRequests(HttpURLConn
ection.java:452)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLCon
nection.java:1000)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:373
)
at com.google.gdata.client.http.HttpGDataRequest.checkResponse(HttpGData
Request.java:552)
at com.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataReques
t.java:532)
at com.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRe
quest.java:523)
at com.google.gdata.client.media.MediaService.insert(MediaService.java:2
50)
at sample.youtube.YouTubeWriteClient.uploadVideo(YouTubeWriteClient.java
:517)
at sample.youtube.YouTubeWriteClient.main(YouTubeWriteClient.java:787)
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»);
return;
>
if (mimeType == null)
<
System.out.println(«filepath is null»);
return;
>
File videoFile = new File(filepath);
if (!videoFile.exists()) <
System.out.println(«Sorry, that video doesn’t exist.»);
return;
>
VideoEntry newEntry = new VideoEntry();
YouTubeMediaGroup mg = newEntry.getOrCreateMediaGroup();
mg.addCategory(new MediaCategory(YouTubeNamespace.CATEGORY_SCHEME, «Tech»));
mg.setTitle(new MediaTitle());
mg.getTitle().setPlainTextContent(videoTitle);
mg.setKeywords(new MediaKeywords());
mg.getKeywords().addKeyword(«gdata-test»);
mg.setDescription(new MediaDescription());
mg.getDescription().setPlainTextContent(videoTitle);
MediaFileSource ms = new MediaFileSource(videoFile, mimeType);
newEntry.setMediaSource(ms);
try <
service.insert(new URL(VIDEO_UPLOAD_FEED), newEntry);
> catch (ServiceException se) <
System.out.println(«Sorry, your upload was invalid:»);
System.out.println(se.getResponseBody());
return;
>
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»);
System.out.println(java.util.Arrays.asList(sun.misc.Launcher.getBootstrapClassPath().getURLs()).toString());
if (help || username == null || password == null || developerKey == null) <
printUsage();
System.exit(1);
>
YouTubeService service = new YouTubeService(«ytapi-VideoNmae-JJJyoub-phe8fmmj-0″,//»gdataSample-YouTubeAuth-1»,
developerKey);
if (service == null)
<
System.out.println(«service == null»);
>
try <
service.setUserCredentials(username, password);
> catch (AuthenticationException e) <
System.out.println(«Invalid login credentials.»);
System.exit(1);
>
String host=»160.94.220.241″;
String port=»3128″;
System.setProperty(«http.proxySet», «true»);
System.setProperty(«http.proxyHost», host);
System.setProperty(«http.proxyport», port);
try <
// here get the exception.
uploadVideo(service,filepath,mimeType);
> catch (IOException e) <
// Communications error
System.err.println(
«There was a problem communicating with the service.»);
e.printStackTrace();
>
>
This is some of my codes, it is too long to upload all. If you find sth error, please show it to me!
thanks
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
Slug: First.mov
Cache-Control: no-cache
Pragma: no-cache
Host: uploads.gdata.youtube.com
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Proxy-Connection: keep-alive
Content-Length: 17543973
——=_Part_0_12985263.1217284632453
Content-Type: application/atom+xml
First.mov gdata-test First.mov Tech
——=_Part_0_12985263.1217284632453
Content-Type: video/quicktime
and the error message:
[Fiddler] Connection to uploads.gdata.youtube.com 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?
Источник
java.io.IOException: Error writing to server #2654
The problem
I am experiencing this error most of the time when I run the script (not all the time).
cause: browser.getAttribute() function
Error Details
java.io.IOException: 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:Userssunil.kumarDocumentsExec_Envnode_moduleswebdriveriobuildlibcommandsgetAttribute.js:43:55
java.net.ConnectException: 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:Userssunil.kumarDocumentsQA_Exec_Envnode_moduleswebdriveriobuildlibcommandsgetAttribute.js:43:55
Environment
- 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.
java.io.IOException: Error writing to server at sun.net.www.protocol.http.HttpURLConnection.writeRequests(HttpURLConnection.java:416) at sun.net.www.protocol.http.HttpURLConnection.writeRequests(HttpURLConnection.java:428) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:934) at java.net.URL.openStream(URL.java:1007) at ReadHtml1.openURL(ReadHtml1.java:54) at ReadHtml1. (ReadHtml1.java:25) at ReadHtml1.main(ReadHtml1.java:34)
some information to solve this issue is appreciated.
thanks,
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:934) at java.net.URL.openStream(URL.java:1007) at ReadHtml1.openURL(ReadHtml1.java:54) at ReadHtml1. (ReadHtml1.java:25) at ReadHtml1.main(ReadHtml1.java:34)
>
So what is the code at line 54
import java.awt.Container;
import java.io.BufferedReader;
import java.io.File;
import java.io.InputStreamReader;
import java.net.URL;
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»);
ReadHtml1()
<
checkURL= JOptionPane.showInputDialog(f,»Enter the URL»);
>
public static void main(String[] args) <
// TODO Auto-generated method stub
new ReadHtml1();
>
Источник
Universal plugin fails with java.io.IOException: Error writing to server #1045
Expected behaviour
sbt universal:publish should publish a zip file to the set repository
Actual behaviour
sbt universal:publish fails with a java.io.IOException: Error writing to server error
Information
- 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 )
MacOS - What package are you building (e.g. docker, rpm, . )
zip
Reproducible
To reproduce the issue, you must to use a private artifactory repository.
build.sbt
Steps to reproduce it
Just type sbt universal:publish and you’ll get
[error] (sub/universal:publish) java.io.IOException: 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:
Thanks for your report. I’ll take a look when I’m back from my vacation.
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!
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.
@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! 🙂
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).
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.
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.
I get the same problem with the rpm plugin. However, running publish beforehand doesn’t seem to make it work for me.
Do you also have a similar setup? A private repo that requires credentials?
Yes, I also have a private repo that requires credentials
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.
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?
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.
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.
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
The workaround using publish before universal:publish doesn’t work in Sbt 1.x.
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 😥
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).
Источник
I follow the instrutions on
https://developer.amazon.com/public/solutions/alexa/alexa-voice-service/docs/reference-implementation-guide When «Running the Client», everything works fine until I reach step 16, and there is no response from server. Log message as follow: Sending ‘POST’ request to URL :
https://access-alexa-na.amazon.com/v1/avs/speechrecognizer/recognize {«messageHeader»:{«deviceContext»:[{«name»:»playbackState», «namespace»:»AudioPlayer», «payload»:{«streamId»:»», «offsetInMilliseconds»:»0″, «playerActivity»:»IDLE»}}]}, «messageBody»:{«profile»:»doppler-scone», «locale»:»en-us», «format»:»audio/L16; rate=16000; channels=1″}} java.util.concurrent.ExecutionException: java.io.IOException: Error writing request body to server at java.util.concurrent.FutureTask.report(FutureTask.java:122) at java.util.concurrent.FutureTask.get(FutureTask.java:188) at javax.swing.SwingWorker.get(SwingWorker.java:602) at com.amazon.alexa.avs.AVSApp$1$1.done(AVSApp.java:83) at javax.swing.SwingWorker$5.run(SwingWorker.java:737) at javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.run(SwingWorker.java:832) at sun.swing.AccumulativeRunnable.run(AccumulativeRunnable.java:112) at javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.actionPerformed(SwingWorker.java:842) at javax.swing.Timer.fireActionPerformed(Timer.java:312) at javax.swing.Timer$DoPostEvent.run(Timer.java:244) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:312) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:738) at java.awt.EventQueue.access$300(EventQueue.java:103) at java.awt.EventQueue$3.run(EventQueue.java:699) at java.awt.EventQueue$3.run(EventQueue.java:697) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) at java.awt.EventQueue.dispatchEvent(EventQueue.java:708) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138) at java.awt.EventDispatchThread.run(EventDispatchThread.java:91) Caused by: java.io.IOException: Error writing request body to server at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.checkError(HttpURLConnection.java:3205) at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.write(HttpURLConnection.java:3188) at java.io.DataOutputStream.write(DataOutputStream.java:107) at com.amazon.alexa.avs.AudioCapture.captureAudio(AudioCapture.java:62) at com.amazon.alexa.avs.AVSController.startRecording(AVSController.java:62) at com.amazon.alexa.avs.AVSApp$1$1.doInBackground(AVSApp.java:76) at com.amazon.alexa.avs.AVSApp$1$1.doInBackground(AVSApp.java:73) at javax.swing.SwingWorker$1.call(SwingWorker.java:296) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at javax.swing.SwingWorker.run(SwingWorker.java:335) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745)
alexa voice service
I’m seeing a strange failure in the JBossWS-CXF WSTrustTestCase; the client is submitting a POST request and gets an error while writing the body to the server:
[…]
Caused by: com.ctc.wstx.exc.WstxIOException: Error writing request body to server
at com.ctc.wstx.sw.BaseNsStreamWriter.doWriteAttr(BaseNsStreamWriter.java:519)
at com.ctc.wstx.sw.BaseNsStreamWriter.writeAttribute(BaseNsStreamWriter.java:228)
at org.apache.cxf.staxutils.StaxUtils.writeStartElement(StaxUtils.java:776)
at org.apache.cxf.staxutils.StaxUtils.copy(StaxUtils.java:668)
at org.apache.cxf.staxutils.StaxUtils.copy(StaxUtils.java:656)
at org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor$SAAJOutEndingInterceptor.handleMessage(SAAJOutInterceptor.java:212)
at org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor$SAAJOutEndingInterceptor.handleMessage(SAAJOutInterceptor.java:172)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:530)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:463)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:366)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:319)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:133)
… 28 more
Caused by: java.io.IOException: Error writing request body to server
at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.checkError(HttpURLConnection.java:3191)
at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.write(HttpURLConnection.java:3174)
at org.apache.cxf.io.AbstractWrappedOutputStream.write(AbstractWrappedOutputStream.java:51)
at org.apache.cxf.io.AbstractThresholdOutputStream.write(AbstractThresholdOutputStream.java:69)
at com.ctc.wstx.io.UTF8Writer.write(UTF8Writer.java:143)
at com.ctc.wstx.sw.BufferingXmlWriter.flushBuffer(BufferingXmlWriter.java:1366)
at com.ctc.wstx.sw.BufferingXmlWriter.fastWriteRaw(BufferingXmlWriter.java:1412)
at com.ctc.wstx.sw.BufferingXmlWriter.writeAttribute(BufferingXmlWriter.java:865)
at com.ctc.wstx.sw.BaseNsStreamWriter.doWriteAttr(BaseNsStreamWriter.java:516)
… 41 more
I tried capturing the message exchange using WireShark and noticed and empty POST request as last message. I’m attaching the dump files.