Google Data API Client Libraries with proxy - proxy

I use java and gdata API to manage my Calendar's data. But it works only if I have direct access to the Internet. In my case I have to use proxy. Is there any way to manage my Google calendar's data through the proxy?
I'v tried this way:
System.setProperty("http.proxyHost", "myproxy.mydomain.com");
System.setProperty("http.proxyPort", "3128");
URL feedUrl = new URL("http://www.google.com/calendar/feeds/....");
CalendarService myService = new CalendarService("exampleCo-exampleApp-1");
String encoded = new String(Base64.encodeBase64(new String("proxy_user:proxy_password").getBytes()));
String base64encodedCredentials = "Basic " + encoded;
myService.getRequestFactory().setPrivateHeader("Proxy-Authorization", base64encodedCredentials);
//!!! Exception in this line
myService.setUserCredentials("my_google_accaunt#gmail.com", "my_google_password");
Exception:
Exception in thread "main" com.google.gdata.util.AuthenticationException: Error connecting with login URI
at com.google.gdata.client.GoogleAuthTokenFactory.getAuthToken(GoogleAuthTokenFactory.java:549)
at com.google.gdata.client.GoogleAuthTokenFactory.setUserCredentials(GoogleAuthTokenFactory.java:397)
at com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:364)
at com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:319)
at com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:303)
at calendartest.CalendarTest.getCalendarEventsWithProxy(CalendarTest.java:145)
at calendartest.CalendarTest.main(CalendarTest.java:195)
Caused by: java.net.ConnectException: Connection timed out
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:391)
at java.net.Socket.connect(Socket.java:579)
Without proxy everything works.

You didn't say what language you're using but instructions for Java and .Net# are at:
https://developers.google.com/gdata/articles/proxy_setup
instructions for Python can be found at:
http://code.google.com/p/gdatacopier/wiki/ProxySupport (these should work for any app using the gdata-python-client)

Related

Unable to start activity ProxyBillingActivity, NullPointerException by getIntentSender()

We are using the latest Google Play billing client com.android.billingclient:billing:4.1.0 as described in https://developer.android.com/google/play/billing/integrate
Sometimes we get this non-reproducible exception in the crash logs, mostly Android 10 devices.
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.my.app/com.android.billingclient.api.ProxyBillingActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.IntentSender android.app.PendingIntent.getIntentSender()' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3654)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3806)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2267)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:8154)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.IntentSender android.app.PendingIntent.getIntentSender()' on a null object reference
at com.android.billingclient.api.ProxyBillingActivity.onCreate(com.android.billingclient:billing##4.1.0:12)
at android.app.Activity.performCreate(Activity.java:7963)
at android.app.Activity.performCreate(Activity.java:7952)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1307)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3629)
... 11 more
Any ideas how to fix/catch?

How to use Breakpoints in Axon Framework without having the event stream closed

I'm using the AXON Framework a multi-service java spring application.
Everytime i debugg my application and set a breakpoint (e.g. in an Eventhandler method) I recieve the folowing error after a few seconds:
org.axonframework.axonserver.connector.AxonServerException: The Event Stream has been closed, so no further events can be retrieved
at org.axonframework.axonserver.connector.event.axon.EventBuffer.peekNullable(EventBuffer.java:178) ~[axon-server-connector-4.5.2.jar:4.5.2]
at org.axonframework.axonserver.connector.event.axon.EventBuffer.hasNextAvailable(EventBuffer.java:144) ~[axon-server-connector-4.5.2.jar:4.5.2]
at org.axonframework.eventhandling.TrackingEventProcessor.processBatch(TrackingEventProcessor.java:385) ~[axon-messaging-4.5.2.jar:4.5.2]
at org.axonframework.eventhandling.TrackingEventProcessor.processingLoop(TrackingEventProcessor.java:292) ~[axon-messaging-4.5.2.jar:4.5.2]
at org.axonframework.eventhandling.TrackingEventProcessor$TrackingSegmentWorker.run(TrackingEventProcessor.java:1003) ~[axon-messaging-4.5.2.jar:4.5.2]
at org.axonframework.eventhandling.TrackingEventProcessor$WorkerLauncher.run(TrackingEventProcessor.java:1146) ~[axon-messaging-4.5.2.jar:4.5.2]
at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]
Caused by: io.grpc.StatusRuntimeException: CANCELLED: RST_STREAM closed stream. HTTP/2 error code: CANCEL
at io.grpc.Status.asRuntimeException(Status.java:535) ~[grpc-api-1.36.1.jar:1.36.1]
at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onClose(ClientCalls.java:478) ~[grpc-stub-1.36.1.jar:1.36.1]
at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:553) ~[grpc-core-1.36.1.jar:1.36.1]
at io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:68) ~[grpc-core-1.36.1.jar:1.36.1]
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:739) ~[grpc-core-1.36.1.jar:1.36.1]
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:718) ~[grpc-core-1.36.1.jar:1.36.1]
at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37) ~[grpc-core-1.36.1.jar:1.36.1]
at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123) ~[grpc-core-1.36.1.jar:1.36.1]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na]
... 1 common frames omitted
Is there any configuration trick, that allows me to use breakpoints without having the event stream closed?
After a lot of try and error I was able to solve this problem with the folowing entries in the AXON-Server's properties file (.../config/axonserver.properties)
axoniq.axonserver.keep-alive-time=0
axoniq.axonserver.keep-alive-timeout=604800000
axoniq.axonserver.min-keep-alive-time=604800000
Thes way the timeout only occures afer one week. This may cause problems in a production environment, but since I use a seperated axon server on my localhost machine for testing this is no problem for me.
This article helped figuring it out: https://docs.axoniq.io/reference-guide/axon-server/administration/admin-configuration/configuration

i want to send an email via tsend email component in talend

Hello i want to send an email via tsend email component in talend.i configured the component like this enter image description here
But its still gives me the error
Exception in component tSendMail_1 (EmailJob)
javax.mail.MessagingException: Exception reading response;
nested exception is:
java.net.SocketException: Connection reset
at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:1462)
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1260)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:370)
at javax.mail.Service.connect(Service.java:297)
at javax.mail.Service.connect(Service.java:156)
at javax.mail.Service.connect(Service.java:105)
at javax.mail.Transport.send0(Transport.java:168)
at javax.mail.Transport.send(Transport.java:98)
at local_project.emailjob_0_1.EmailJob.tSendMail_1Process(EmailJob.java:967)
at local_project.emailjob_0_1.EmailJob.tFileInputProperties_1Process(EmailJob.java:705)
at local_project.emailjob_0_1.EmailJob.runJobInTOS(EmailJob.java:1253)
at local_project.emailjob_0_1.EmailJob.main(EmailJob.java:1102)
Caused by: java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at sun.security.ssl.InputRecord.readFully(Unknown Source)
at sun.security.ssl.InputRecord.read(Unknown Source)
at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.readDataRecord(Unknown Source)
at sun.security.ssl.AppInputStream.read(Unknown Source)
at com.sun.mail.util.TraceInputStream.read(TraceInputStream.java:97)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at com.sun.mail.util.LineInputStream.readLine(LineInputStream.java:75)
at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:1440)
... 11 more
[statistics] disconnected
Job EmailJob terminé à 17:51 14/11/2018. [Code sortie=1]
The error you are facing Connection reset means basically, that the connection has been closed by the other end. There are many articles on this. You can read.
See
send-email-using-talend for creating jobs in Talend for sending email. This should help.
Looks like its connection closed problem. Please turn off 2-step verification and Allow less secure apps on your mail account and check again.

NativeScript Android Background Service

I am developing NativeScript android application. I am new to NativeScript. I want to run background service, which is checking service periodically and give notifications to user even though app not opened on device. I followed instructions from Nativescript site
https://www.nativescript.org/blog/using-android-background-services-in-nativescript
But when i call setupAlarm function, i received error can't instantiate class com.tns.notifications.NotificationIntentService; no empty constructor
please help me. i give full exception details below
The application crashed because of an uncaught exception. You can look at "stackTrace" or "nativeException" for more detailed information about the exception.
An uncaught Exception occurred on "main" thread.
java.lang.RuntimeException: Unable to instantiate service com.tns.notifications.NotificationIntentService: java.lang.InstantiationException: can't instantiate class com.tns.notifications.NotificationIntentService; no empty constructor
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2543)
at android.app.ActivityThread.access$1800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5001)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.InstantiationException: can't instantiate class com.tns.notifications.NotificationIntentService; no empty constructor
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1208)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2540)
... 10 more
To solve the no empty constructor issue, you can use nativescript-android-utils like this:
Install:
npm install nativescript-android-utils --save
In you code:
com.pip3r4o.android.app.IntentService.extend("com.mypackage.MyClass", {
onHandleIntent: function(){}
});
Now, com.mypackage.MyClass will have an empty constructor.
i found working nativescript android background service project from here
https://github.com/NativeScript/sample-android-background-services
The latest release of Nativescript allows you to use workers for multithreading applications. I believe it's what you should be using. In the tutorial you provided they also mention using web workers in the future.
What’s next
In the upcoming releases we will be rolling out support for the Web
Workers feature in NativeScript, allowing you to execute code in a
background thread, all through Angular/JavaScript.
Hope it helps.

beaconManager give me error when app back from background

I use altbeacon library in my app. Everything work Ok after start, but if i out from app she's in background i get notification on statusbar about beacons. When i click on this notification i get this error:
Process: pl.hekko.kesser.beacontest, PID: 29929
java.lang.RuntimeException: Unable to start activity ComponentInfo{pl.hekko.kesser.beacontest/pl.hekko.kesser.beacontest.MainActivity}: java.lang.UnsupportedOperationException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2202)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2252)
at android.app.ActivityThread.access$800(ActivityThread.java:139)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1200)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:606)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.UnsupportedOperationException
at java.util.Collections$UnmodifiableCollection.add(Collections.java:928)
at pl.hekko.kesser.beacontest.MainActivity.onCreate(MainActivity.java:83)
at android.app.Activity.performCreate(Activity.java:5275)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2166)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2252)
            at android.app.ActivityThread.access$800(ActivityThread.java:139)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1200)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
My MainActivity line 83:
beaconManager.getBeaconParsers().add(new BeaconParser().
setBeaconLayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24"));
I'm not sure this setBeaconLayout but seems to work fine generally.
Sometimes app doesn't start shows error, but second click on icon starts app. It seems that the same error cause this.
The problem is that you are only allowed to configure the list of active BeaconParsers once, when the library first starts up, so you get an error when you try to do it a second time. While it's easier to do this just once in the onCreate method of a custom Application, you can do this in the onCreate method of an Activity if you wrap it in an if statement like this:
// Only execute the code below if only the default BeaconParser is active
if (beaconManager.getBeaconParsers().size() == 1) {
// Put your BeaconParser setup code here
...
}

Resources