I'm trying to send a file with sftp using Spring Batch.
I find a great example/tutorial on this site https://blog.codecentric.de/en/2011/09/send-data-secure-with-sftp-and-spring-batch/ which I followed, though I am getting the "Could not send file per SFTP: ..." caught exception in the example in the link above in the SftpTasklet class. I believe my problem is that the int-sftp:outbound-channel-adapter in my application context is never getting called. The id associated with it sftpOutboundAdapter not referenced anywhere else on the page and I do not see how it gets called. I have found similar tutorials on other sites where it is also never explicitly called.
Basically, my question comes down to: how does the spring batch int-sftp:outbound-channel-adapter get called?
Thanks in advance
The tasklet sends a message (with a File payload) to outputChannel (sftpChannel.send(message);) which, in turn sends it to the outbound adapter.
Turn on DEBUG logging for org.springframework.integration to see the messasge flow.
Related
We have an application that uses asyncresponse and writes the data into a stream.
I upgraded to spring2 from 1.5.
And not sure if it could be releated but now with postman I get this error "Unexpected end of file".
Even in a java client , I get error "java.IO.EOFException: Unexpected end of zlib input stream".
But I get expected result in a curl command.
Now I suspect, this could be something either with user-agent or somewhere in spring2 or jersey , I need to set some properties to get rid of this.
There is no security , I excluded SecurityAutoConfiguration.java, in case somewhere it checks some user-agent.
Because of error I see in java client, I tried with server.compression.enabled=false (which is default anyway), but no luck.
I suppose I need to edit the question.
It seems there is some issue using StreamingOutput using spring2x. This is not streaming which I assumes results in all of above stated issues.
Any help is appreciated.
I'm trying to use the AMQPSource and I'm getting the error describe below, also imports are not working in EPL module. In advance, I test adding full package name to DistanceEvent (events.DistanceEvent and does not work).
To sending a message i'm using the publish Rabbitmq webadmin queue option with the next payload:
{"distance":33}
Could anyone help me?
The "IO-error deserializing object" is the reason you are not seeing data.
The "AMQPToObjectCollectorSerializable" expects the AMQP message to carry a valid JVM-serialized object however the "invalid header" means that the message content cannot be read by the JVM. Check the sender making sure it produces a AMQP message with a JVM-serialized object or may use replace "AMQPToObjectCollectorSerializable" with a deserializer that can understand your message. The code for "AMQPToObjectCollectorSerializable" can be found in Github if your are not sure how it deserializes.
I have problem with launching Google-Cast application similar to sample CastHelloText-chrome. I slightly modified example code for my specific purposes. The goal for creating this application is to send and show image data directly in Chromecast device.
Particularly the difference between official sample and my code is in message format and its content, sent by sender application. Sender application took png image coded by base64 and send through message bus with custom namespace. Receiver application get this message and use this as data source for html object <img>.
Error appears when I do this steps:
Reload sender page, checking console if any device found.
Send the form by just pushing enter on input box (text is ignored).
Now a popup from Chromecast extension shows. Next there are two scenarios:
3a) I confirm casting to device by choosing one from the list, then I get this error message in console:
onError: {"code":"channel_error","description":"Error: Timeout","details":null}
3b) I just click somewhere else, I get this error:
onError: {"code":"cancel","description":"User closed popup menu","details":null}
Both of errors are caused by calling function chrome.cast.requestSession in chromehellotext.html at line 161, but what's really wrong I don't know.
When I step sender script I realize that function sessionListener is never called. I know that something go wrong when code try to call chrome.cast.requestSession, where described error raises. So I need help if I missed about right way to use Google-Cast API or If this problem has something to do with networking issues.
Receiver application is registered on Google Cast SDK Developer Console and I'm testing on registered device with some serial number. I'm using Google Chrome in version 42.0.2300.2 canary (64-bit) and Chrome version 40.0.2214.111 (current stable I suppose). For testing I also tried to turn off Windows Firewall entirely but with no luck.
Edit:
There were some syntactic errors that caused error message described above.
It seems like you are trying to use the data/control channel to send an image; please don't do that; that channel is not meant to be used for large data communications; in fact it cannot send anything which approaches or exceeds 64k. If your goal is to send images from your local machine, you would need to run a local web server on your local machine and serve images through the web server.
For and easiest tutorial you can have a look to this tutorial.
It is well explained in this tutorial.
Chromecast Sender application
There is no need to maintain session by yourself.
just add button and enjoy casting
mCastManager.addMediaRouterButton(mediaRoutebtn);
I found a source of my problem. There was something wrong in receiver code - syntactic and runtime errors, so I must admit that my code wasn't functional. Now its working in terms of launching application and getting session.
Unfortunate thing is that the error message generated by Chromecast extension didn't match the actual error - at least it was a bit confusing when I didn't know what's really happening on receiver side without ability to debug the code.
I was unable to run typesafe activator in cloud9 :
The activator page loads OK but then I get the following error messages :
in the browser :
"Connection lost; you will need to reload the page or restart
Activator. It's also possible that Activator is open in another tab,
which causes this error."
in the cloud9 terminal :
"! #6j9pn9913 - Internal server error, for (GET)
[/home/stream?token=cba94...64394] -> play.api.Application$$anon$1:
Execution exception[[RuntimeException: Bad CSRF token for websocket]]"
Any help on how to solve this ?
Activator listens on 127.0.0.1 and is not even supposed to be listening on an external interface; it isn't completely clear to me why you can connect to it at all.
But however that connection works, it looks like the result is that the CSRF check fails. The CSRF check is checking that the query parameter there (?token=cba94...) matches a cookie that should have been set by the Activator page load. This demonstrates that the /home/stream request (to open the websocket) is coming from a page that has the cookie, i.e. from the same domain. Perhaps Activator doesn't know the domain you are loading the page from and therefore the cookie gets lost? Just a guess.
When the CSRF check fails that would then fail the websocket and cause the "Connection lost" error, though that error can also be caused by other things (such as proxies and antivirus software) that interfere with websockets.
You could possibly fix this, or take a step towards fixing this, by configuring the http.address system property to be picked up here: https://github.com/typesafehub/activator/blob/52012321b3a5a9f9dcf53582664e385d92763718/ui/app/activator/UIMain.scala#L130
You could also try setting application.defaultCookieDomain to the domain you are using (this is a Play config option and Activator's UI is a play app).
However:
you may well find other bugs in this scenario - it is not tested or supported
it is not at all secure unless you have some kind of authenticated proxy in front of it (there's no auth on the activator UI, and the UI has buttons to view and delete files, etc).
The activator shell command line is maybe a better option when you have your project build on a headless server, though I won't say running the UI is 100% impossible - you might be able to get it to work.
Using Spring 3.07
I have this upload form which is pretty much the basic spring example for such. Now it displays a message "No file selected" which is correct. However, I don't want this message. My users expect a message in a different language if at all. Does anybody know how I can get rid of this message?
This has nothing to do with Spring. That message is a browser message for input type file. Mock and scorn reigns down upon me.