WSO2IS IDP Proxy unable to obtain access token for mobile app - mobile

I have been testing WSO2 Identity Server IDP Proxy for android(http://wso2.com/library/articles/2014/07/sso-for-native-mobile-applications-with-wso2-identity-server/). I manage to setup the IDP Proxy App and test without problem. However, when I did setup the sample app given (azone and eBuy), I have encounter some error which I couldn't understand why the token is returning NULL whenever I login to those sample apps. Below are the error log:
09-10 11:04:55.020: D/dalvikvm(19024): GC_FOR_ALLOC freed 83K, 12%
free 9589K/10856K, paused 22ms, total 22ms 09-10 11:04:55.020:
I/dalvikvm-heap(19024): Grow heap (frag case) to 11.990MB for
1544896-byte allocation 09-10 11:04:55.045: D/dalvikvm(19024):
GC_FOR_ALLOC freed <1K, 11% free 11098K/12368K, paused 23ms, total
23ms 09-10 11:04:55.195: D/dalvikvm(19024): GC_FOR_ALLOC freed 2K, 10%
free 12516K/13788K, paused 15ms, total 15ms 09-10 11:04:55.310:
D/libEGL(19024): loaded /system/lib/egl/libEGL_mali.so 09-10
11:04:55.315: D/libEGL(19024): loaded
/system/lib/egl/libGLESv1_CM_mali.so 09-10 11:04:55.320:
D/libEGL(19024): loaded /system/lib/egl/libGLESv2_mali.so 09-10
11:04:55.325: E/(19024): Device driver API match 09-10 11:04:55.325:
E/(19024): Device driver API version: 23 09-10 11:04:55.325:
E/(19024): User space API version: 23 09-10 11:04:55.325: E/(19024):
mali: REVISION=Linux-r3p2-01rel3 BUILD_DATE=Wed Oct 9 21:05:57 KST
2013 09-10 11:04:55.395: D/OpenGLRenderer(19024): Enabling debug mode
0 09-10 11:05:09.585: D/IdentityProxyActivity(19024): starting IDP
Proxy App 09-10 11:05:10.220: W/IInputConnectionWrapper(19024):
showStatusIcon on inactive InputConnection 09-10 11:05:21.770:
D/IdentityProxyActivity(19024): starting IdentityProxyActivity
onActivityResult 09-10 11:05:21.775: D/AccessTokenHandler(19024):
d3b276fc3665350818f18f521f7ae4 09-10 11:05:21.790:
D/ServerUtilities(19024): Posting '{grant_type=authorization_code,
redirect_uri=http://wso2.com, scope=openid,
code=d3b276fc3665350818f18f521f7ae4}' to
https://172.18.64.178:9443/oauth2/token 09-10 11:05:21.795:
D/ServerUtilities(19024): Posting
'grant_type=authorization_code&redirect_uri=http://wso2.com&scope=openid&code=d3b276fc3665350818f18f521f7ae4' to https://172.18.64.178:9443/oauth2/token 09-10 11:05:22.150:
D/AccessTokenHandler(19024): {"error":"Internal Server
Error","error_description":"Internal Server Error"} 09-10
11:05:22.150: D/AccessTokenHandler(19024): Internal Server Error 09-10
11:05:22.150: D/AccessTokenHandler(19024): Internal Server Error 09-10
11:05:22.150: D/AndroidRuntime(19024): Shutting down VM 09-10
11:05:22.150: W/dalvikvm(19024): threadid=1: thread exiting with
uncaught exception (group=0x41c38700) 09-10 11:05:22.155:
E/AndroidRuntime(19024): FATAL EXCEPTION: main 09-10 11:05:22.155:
E/AndroidRuntime(19024): java.lang.NullPointerException 09-10
11:05:22.155: E/AndroidRuntime(19024): at
org.wso2.mobile.idp.proxy.IdentityProxy.receiveAccessToken(IdentityProxy.java:60)
09-10 11:05:22.155: E/AndroidRuntime(19024): at
org.wso2.mobile.idp.proxy.handlers.AccessTokenHandler$NetworkCallTask.onPostExecute(AccessTokenHandler.java:132)
09-10 11:05:22.155: E/AndroidRuntime(19024): at
org.wso2.mobile.idp.proxy.handlers.AccessTokenHandler$NetworkCallTask.onPostExecute(AccessTokenHandler.java:65)
09-10 11:05:22.155: E/AndroidRuntime(19024): at
android.os.AsyncTask.finish(AsyncTask.java:631) 09-10 11:05:22.155:
E/AndroidRuntime(19024): at
android.os.AsyncTask.access$600(AsyncTask.java:177) 09-10
11:05:22.155: E/AndroidRuntime(19024): at
android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644)
09-10 11:05:22.155: E/AndroidRuntime(19024): at
android.os.Handler.dispatchMessage(Handler.java:99) 09-10
11:05:22.155: E/AndroidRuntime(19024): at
android.os.Looper.loop(Looper.java:176) 09-10 11:05:22.155:
E/AndroidRuntime(19024): at
android.app.ActivityThread.main(ActivityThread.java:5419) 09-10
11:05:22.155: E/AndroidRuntime(19024): at
java.lang.reflect.Method.invokeNative(Native Method) 09-10
11:05:22.155: E/AndroidRuntime(19024): at
java.lang.reflect.Method.invoke(Method.java:525) 09-10 11:05:22.155:
E/AndroidRuntime(19024): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
09-10 11:05:22.155: E/AndroidRuntime(19024): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862) 09-10
11:05:22.155: E/AndroidRuntime(19024): at
dalvik.system.NativeStart.main(Native Method)
Also, when testing the sdample app(eBuy), aside the above error show in Logcat, there is no error shows in the Identity Server wso2carbon.log.

Gayan, I have finally solve the mystery of this issue. when I curl the way you mentioned, I notice a different type of error. It was show "error":"invalid_request","error_description":"Missing parameters: redirect_uri". After doing some checking on the OauthConstants.java between the proxy app and the sample apps (azone & eBuy). I notice that there is some error in code for the sample apps given. One of the variable was declared as REDIRECT_URL instead of CALL_BACK_URL in OauthConstants.java for the sample apps. Once I change to CALL_BACK_URL as required by the SDK. Everything works.

Did you put correct values for client id ,secret in OauthCostants.java
While analyzing your logs I have seen that you have successfully completed first step in the authorization code grant type and second step (token request) was failed due to some reason.
Could you see any exception logged in Identity Server back end ?
Any connectivity issue to https://172.18.64.178:9443/oauth2/token ?
Try with http://172.18.64.178:9763/oauth2/token ?

Related

Sending any Android build shows build error server response code 401

I see an error server returned http response code 401 whenever I try to send Android build for any project. I have even tried to send an unchanged version of the KitchenSink demo. I'm assuming I am missing an update of some kind. Below is the message on the output console:
You sent an android build without submitting a keystore. Notice that you will receive a build that is inappropriate for distribution (although it could be used for debugging purposes). For further details read http://www.codenameone.com/signing.html
Your build size is: 680kb
Sending build request to the server, notice that the build might take a while to complete!
Sending build to account: my#email.com
java.io.IOException: Server returned HTTP response code: 401 for URL: https://cloud.codenameone.com/appsec/7.0/build/upload
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1876)
at sun.net.www.protocol.http.HttpURLConnection.access$200(HttpURLConnection.java:91)
at sun.net.www.protocol.http.HttpURLConnection$9.run(HttpURLConnection.java:1466)
at sun.net.www.protocol.http.HttpURLConnection$9.run(HttpURLConnection.java:1464)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessController.doPrivilegedWithCombiner(AccessController.java:782)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1463)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
at com.codename1.build.client.BuildProcess.sendS3Build(BuildProcess.java:469)
at com.codename1.build.client.BuildProcess.sendRequestToServer(BuildProcess.java:500)
at com.codename1.build.client.CodeNameOneBuildTask.execute(CodeNameOneBuildTask.java:529)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
at sun.reflect.GeneratedMethodAccessor83.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
at org.apache.tools.ant.Project.executeTarget(Project.java:1376)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:286)
at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:555)
at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)
C:\Users\jn\Documents\NetBeansProjects\KitchenSink\build.xml:343: Error in server build process
BUILD FAILED (total time: 6 seconds)
Any help would be greatly appreciated

AWS Redshift failed connect [Error setting/closing connection: Connection timed out]

Overview
I learn to migrate an Amazon RDS for Oracle Database to Amazon Redshift referring this tutorial https://docs.aws.amazon.com/dms/latest/sbs/CHAP_RDSOracle2Redshift.html
Trouble
I had a trouble the below question.
I would like migrate Oralce DB to Amazon Redshift with AWS SCT
I managed to get out of trouble with the help of people. However, I had a new trouble.
I try to connect to Amazon Redshift with AWS SCT. AWS Redshift failed to connect.
images
I saw the log file. An error was recorded in the log.
2020-12-31 20:56:16.358 [ 78] LOADER ERROR Connection to 'jdbc:redshift://oracletoredshiftdwusingdms-redshiftcluster-1dll5wg4tqddk.cnxpo3loreqp.us-east-1.redshift.amazonaws.com:5439/test' wasn't established. ERROR: code: 500150; message: [Amazon](500150) Error setting/closing connection: Connection timed out: connect.
2020-12-31 20:56:16.358 [ 78] LOADER ERROR Error chain:
[Amazon](500150) Error setting/closing connection: Connection timed out: connect.
------------------------------
java.sql.SQLException: [Amazon](500150) Error setting/closing connection: Connection timed out: connect.
at com.amazon.redshift.client.PGClient.connect(Unknown Source)
at com.amazon.redshift.client.PGClient.<init>(Unknown Source)
at com.amazon.redshift.core.PGJDBCConnection.connect(Unknown Source)
at com.amazon.jdbc.common.BaseConnectionFactory.doConnect(Unknown Source)
at com.amazon.jdbc.common.AbstractDriver.connect(Unknown Source)
at com.amazon.sct.dbloader.JdbcDriverAdapter.connect(JdbcDriverAdapter.java:30)
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:677)
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:189)
at com.amazon.sct.dbloader.DbLoaderDataSource.testConnection(DbLoaderDataSource.java:109)
at com.amazon.sct.dbloader.SqlLoaderEngine.testConnection(SqlLoaderEngine.java:1706)
at com.amazon.sct.dbloader.DbLoader.checkConnection(DbLoader.java:706)
at com.amazon.sct.dbloader.DbLoader.connect(DbLoader.java:406)
at com.amazon.sct.dbloader.DbLoaderContainer.checkAccessibility(DbLoaderContainer.java:30)
at com.amazon.sct.task.TestConnectionTask.call(TestConnectionTask.java:40)
at com.amazon.sct.task.TestConnectionTask.call(TestConnectionTask.java:18)
at javafx.concurrent.Task$TaskCallable.call(Task.java:1425)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
Caused by: com.amazon.support.exceptions.GeneralException: [Amazon](500150) Error setting/closing connection: Connection timed out: connect.
... 17 more
Caused by: java.net.ConnectException: Connection timed out: connect
at java.base/sun.nio.ch.Net.connect0(Native Method)
at java.base/sun.nio.ch.Net.connect(Net.java:476)
at java.base/sun.nio.ch.Net.connect(Net.java:468)
at java.base/sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:694)
at java.base/sun.nio.ch.SocketAdaptor.connect(SocketAdaptor.java:100)
at com.amazon.redshift.client.PGClient.connect(Unknown Source)
at com.amazon.redshift.client.PGClient.<init>(Unknown Source)
at com.amazon.redshift.core.PGJDBCConnection.connect(Unknown Source)
at com.amazon.jdbc.common.BaseConnectionFactory.doConnect(Unknown Source)
at com.amazon.jdbc.common.AbstractDriver.connect(Unknown Source)
at com.amazon.sct.dbloader.JdbcDriverAdapter.connect(JdbcDriverAdapter.java:30)
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:677)
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:189)
at com.amazon.sct.dbloader.DbLoaderDataSource.testConnection(DbLoaderDataSource.java:109)
at com.amazon.sct.dbloader.SqlLoaderEngine.testConnection(SqlLoaderEngine.java:1706)
at com.amazon.sct.dbloader.DbLoader.checkConnection(DbLoader.java:706)
at com.amazon.sct.dbloader.DbLoader.connect(DbLoader.java:406)
at com.amazon.sct.dbloader.DbLoaderContainer.checkAccessibility(DbLoaderContainer.java:30)
at com.amazon.sct.task.TestConnectionTask.call(TestConnectionTask.java:40)
at com.amazon.sct.task.TestConnectionTask.call(TestConnectionTask.java:18)
at javafx.concurrent.Task$TaskCallable.call(Task.java:1425)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.lang.Thread.run(Thread.java:834)
2020-12-31 20:56:16.359 [ 78] GENERAL INFO Test connecting to Amazon Redshift database finished in 0:00:21.113 sec with memory consumption of 516.25 MB (497.79 MB .. 516.25 MB).
2020-12-31 20:56:16.359 [ 78] GENERAL INFO Test connecting to Amazon Redshift database statistics:
GENERAL: 0:00:21.113 sec
2020-12-31 20:56:16.365 [ 19] GENERAL ERROR com.amazon.sct.dbloader.DbLoaderHandledException: Connection wasn't established. Check connection properties.
java.util.concurrent.ExecutionException: com.amazon.sct.dbloader.DbLoaderHandledException: Connection wasn't established. Check connection properties.
at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
at com.amazon.sct.task.launcher.CommonTaskLauncher.lambda$run$0(CommonTaskLauncher.java:39)
at com.sun.javafx.binding.ExpressionHelper$Generic.fireValueChangedEvent(ExpressionHelper.java:360)
at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:80)
at javafx.beans.property.ObjectPropertyBase.fireValueChangedEvent(ObjectPropertyBase.java:106)
at javafx.beans.property.ObjectPropertyBase.markInvalid(ObjectPropertyBase.java:113)
at javafx.beans.property.ObjectPropertyBase.set(ObjectPropertyBase.java:147)
at javafx.concurrent.Task.setState(Task.java:698)
at javafx.concurrent.Task$TaskCallable.lambda$call$2(Task.java:1455)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
at com.sun.glass.ui.win.WinApplication._enterNestedEventLoopImpl(Native Method)
at com.sun.glass.ui.win.WinApplication._enterNestedEventLoop(WinApplication.java:201)
at com.sun.glass.ui.Application.enterNestedEventLoop(Application.java:509)
at com.sun.glass.ui.EventLoop.enter(EventLoop.java:107)
at com.sun.javafx.tk.quantum.QuantumToolkit.enterNestedEventLoop(QuantumToolkit.java:635)
at javafx.stage.Stage.showAndWait(Stage.java:465)
at javafx.scene.control.HeavyweightDialog.showAndWait(HeavyweightDialog.java:162)
at javafx.scene.control.Dialog.showAndWait(Dialog.java:346)
at com.amazon.sct.handler.CreateConnectionHandler.createConnection(CreateConnectionHandler.java:51)
at com.amazon.sct.viewmodel.AppViewModel.createConnection(AppViewModel.java:1406)
at com.amazon.sct.viewmodel.AppViewModel.createTargetConnection(AppViewModel.java:774)
at com.amazon.sct.view.AppView.loadTarget(AppView.java:348)
at com.amazon.sct.view.AppView.lambda$initConnectionMenusBindings$27(AppView.java:1077)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
at javafx.event.Event.fireEvent(Event.java:198)
at javafx.scene.Scene$MouseHandler.process(Scene.java:3862)
at javafx.scene.Scene.processMouseEvent(Scene.java:1849)
at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2590)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:409)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:299)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(GlassViewEventHandler.java:447)
at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:412)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:446)
at com.sun.glass.ui.View.handleMouseEvent(View.java:556)
at com.sun.glass.ui.View.notifyMouse(View.java:942)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: com.amazon.sct.dbloader.DbLoaderHandledException: Connection wasn't established. Check connection properties.
at com.amazon.sct.dbloader.DbLoader.checkConnection(DbLoader.java:721)
at com.amazon.sct.dbloader.DbLoader.connect(DbLoader.java:406)
at com.amazon.sct.dbloader.DbLoaderContainer.checkAccessibility(DbLoaderContainer.java:30)
at com.amazon.sct.task.TestConnectionTask.call(TestConnectionTask.java:40)
at com.amazon.sct.task.TestConnectionTask.call(TestConnectionTask.java:18)
at javafx.concurrent.Task$TaskCallable.call(Task.java:1425)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
... 1 more
What I try
[Amazon](500150) Error setting/closing connection: Connection timed out: connect.
I think the above error is similar to the issues.
So, I launched the Security Groups console and add [Rule: Type=Redshift, Source=MyIP].
I saved it and I try to connect again.
Unfortunately, AWS Redshift failed to connect with same error.
I have no idea to do next time.
What I should do?
To troubleshoot this issue, you can use following steps;
(1) To troubleshoot faster, instead of your java application, you can use ping command to check network reachability from your host/machine/laptop/desktop.
(2) If step one is successful, then try following commands on your host/machine/laptop/desktop using Windows command prompt or Windows PowerShell or Any Linux shell/command line tool;
nc -vz -w 3 "${DB_HOST}" "${DB_PORT}"
OR
telnet "${DB_HOST}" "${DB_PORT}"
(3) If commands from step (1) or (2) are failing with "Connection timed out" error, then
(3.1) Use VPC Reachability Analyzer : Create and analyze path with Source type Network Interfaces and Source as Network Interface Id of the machine where you application is deployed. Furthermore, select Destination type as Network Interfaces and Destination as network Interface Id of the AWS Red Shift. Put Destination port as 5439, keep Protocol as TCP.
Note: It takes few minutes for completion of this path analysis.
OR
(3.2) If you have enabled VPC Flow Logs, then you can trace vpc flow logs to check, which AWS resource is rejecting the network traffic. For VPC flow logs information please refer this document from AWS.

Strange Runtime Exception

I recently deleted my Netbeans Cache folder (/appdata/local/netbeans/cache/) and my codenameone apps that make use of the native google maps plugin have been acting up. I get a runtime exception at startup. Below is the stacktrace.
I have removed cn1 plugin from NB, downloaded new copy of the native maps cn1lib, cleaned and built and i still get the same error... please help.
[EDT] 0:0:4,404 - Exception: java.lang.NoClassDefFoundError - Could not initialize class com.codename1.impl.javase.StubLocationManager
at com.codename1.impl.javase.JavaSEPort.getLocationManager(JavaSEPort.java:8945)
at com.codename1.ui.Display.getLocationManager(Display.java:3573)
at com.labafrique.creporter.MyApplication.writeLocation(MyApplication.java:2544)
at com.labafrique.creporter.MyApplication.lambda$null$0(MyApplication.java:151)
at com.codename1.ui.Display.processSerialCalls(Display.java:1298)
at com.codename1.ui.Display.edtLoopImpl(Display.java:1242)
at com.codename1.ui.Display.mainEDTLoop(Display.java:1130)
at com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:120)
at com.codename1.impl.CodenameOneThread.run(CodenameOneThread.java:176)
Caused by: java.lang.IllegalStateException: Toolkit not initialized
at com.sun.javafx.application.PlatformImpl.runLater(PlatformImpl.java:273)
at com.sun.javafx.application.PlatformImpl.runLater(PlatformImpl.java:268)
at javafx.application.Platform.runLater(Platform.java:83)
at com.codename1.impl.javase.LocationSimulation.unitActionPerformed(LocationSimulation.java:609)
at com.codename1.impl.javase.LocationSimulation.access$1900(LocationSimulation.java:40)
at com.codename1.impl.javase.LocationSimulation$20.actionPerformed(LocationSimulation.java:446)
at javax.swing.JComboBox.fireActionEvent(JComboBox.java:1258)
at javax.swing.JComboBox.setSelectedItem(JComboBox.java:586)
at javax.swing.JComboBox.setSelectedIndex(JComboBox.java:622)
at com.codename1.impl.javase.LocationSimulation.setMeasUnit(LocationSimulation.java:729)
at com.codename1.impl.javase.StubLocationManager.<init>(StubLocationManager.java:78)
at com.codename1.impl.javase.StubLocationManager.<clinit>(StubLocationManager.java:58)
... 9 more
com.codename1.io.websocket.WebSocket$WebSocketException: Exception occurred while trying to connect.
at com.codename1.io.websocket.WebSocket.connect(WebSocket.java:416)
at com.codename1.io.websocket.WebSocket.access$400(WebSocket.java:39)
at com.codename1.io.websocket.WebSocket$4.run(WebSocket.java:393)
at com.codename1.impl.CodenameOneThread.run(CodenameOneThread.java:176)
Caused by: java.lang.RuntimeException: com.neovisionaries.ws.client.WebSocketException: Failed to connect to 'localhost:9494': Connection refused: connect
at com.codename1.io.websocket.WebSocketNativeImplImpl.connect(Unknown Source)
at com.codename1.io.websocket.WebSocket.connect(WebSocket.java:405)
... 3 more
Caused by: com.neovisionaries.ws.client.WebSocketException: Failed to connect to 'localhost:9494': Connection refused: connect
at com.neovisionaries.ws.client.SocketConnector.doConnect(Unknown Source)
at com.neovisionaries.ws.client.SocketConnector.connect(Unknown Source)
at com.neovisionaries.ws.client.WebSocket.connect(Unknown Source)
... 5 more
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
... 8 more
java.lang.NoClassDefFoundError: Could not initialize class com.codename1.impl.javase.StubLocationManager
at com.codename1.impl.javase.JavaSEPort.getLocationManager(JavaSEPort.java:8945)
at com.codename1.ui.Display.getLocationManager(Display.java:3573)
at com.labafrique.creporter.MyApplication.writeLocation(MyApplication.java:2544)
at com.labafrique.creporter.MyApplication.lambda$null$0(MyApplication.java:151)
at com.codename1.ui.Display.processSerialCalls(Display.java:1298)
at com.codename1.ui.Display.edtLoopImpl(Display.java:1242)
at com.codename1.ui.Display.mainEDTLoop(Display.java:1130)
at com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:120)
at com.codename1.impl.CodenameOneThread.run(CodenameOneThread.java:176)
java.lang.NoClassDefFoundError: Could not initialize class com.codename1.impl.javase.StubLocationManager
This started happening to one other user I'm aware of (but not to everyone surprisingly) as a result of the change to remove the maps in location manager. We had to remove them as Google became far too strict with maps key generation strategies.
We have a fix for this and will post it later on today or tomorrow morning.

java.io.IOException: Unable to unwrap data, invalid status

I am working on a SPA using spring(REST backend & security) and angularjs. Everything going ok but when I run it on my local I do see an error no Idea why this is happening.
2016-10-24 10:43:29.028 DEBUG 8040 --- [io-8443-exec-10] o.apache.coyote.http11.Http11Processor : Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper#1a572ed1:org.apache.tomcat.util.net.SecureNioChannel#1b7d9385:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:8443 remote=/0:0:0:0:0:0:0:1:53170]], Status in: [OPEN_READ], State out: [OPEN]
10:43:29.028 [https-jsse-nio-8443-exec-10] DEBUG o.a.coyote.http11.Http11Processor - Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper#1a572ed1:org.apache.tomcat.util.net.SecureNioChannel#1b7d9385:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:8443 remote=/0:0:0:0:0:0:0:1:53170]], Status in: [OPEN_READ], State out: [OPEN]
2016-10-24 10:43:31.949 DEBUG 8040 --- [nio-8443-exec-7] o.apache.coyote.http11.Http11Processor : Error parsing HTTP request header
java.io.IOException: Unable to unwrap data, invalid status [CLOSED]
at org.apache.tomcat.util.net.SecureNioChannel.read(SecureNioChannel.java:590)
at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.fillReadBuffer(NioEndpoint.java:1200)
at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.read(NioEndpoint.java:1149)
at org.apache.coyote.http11.Http11InputBuffer.fill(Http11InputBuffer.java:742)
at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:404)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:667)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:802)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1410)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
10:43:31.949 [https-jsse-nio-8443-exec-7] DEBUG o.a.coyote.http11.Http11Processor - Error parsing HTTP request header
java.io.IOException: Unable to unwrap data, invalid status [CLOSED]
at org.apache.tomcat.util.net.SecureNioChannel.read(SecureNioChannel.java:590)
at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.fillReadBuffer(NioEndpoint.java:1200)
at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.read(NioEndpoint.java:1149)
at org.apache.coyote.http11.Http11InputBuffer.fill(Http11InputBuffer.java:742)
at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:404)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:667)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:802)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1410)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
If anyone can give me a starting point I can do more research.
We had the same issue.
It turned out that on the server side an external event was forcefully closing the connection at some point during the call, which was causing this error.
I was facing same issue with creating wss(secured) webscoket api using tomcat's jsr-356 and deploying over aws ec2 and referring via domain from cloudflare.
To fix the issue I made 2 changes:
- changed cloudflare proxied mode to DNS only in A record.
- Bought new certificate and started using that from tomcat instead of cloudflare's origin CA certificate.
For detailed steps check this:
https://techxperiment.blogspot.com/2020/06/aws-ec2-tomcat-jsr-356-secure.html

Unable to adjust socket timeout when using org.apache.httpcomponents with App Engine

I was testing the following piece of code on the local dev server with an input url that was responding slowly.
final HttpGet getMethod = getHttpGet(apiUrl);
RequestConfig config = RequestConfig.custom()
.setSocketTimeout(60 * 1000)
.setConnectTimeout(60 * 1000)
.setConnectionRequestTimeout(60 * 1000)
.build();
getMethod.setConfig(config);
httpClient = HttpClients.createDefault();
proxyResponse = httpClient.execute(getMethod);
if (proxyResponse.getStatusLine().getStatusCode() == HTTP_OK) {
/* ... */
}
Though the socket timeouts are set at 60 seconds, after 6 seconds we see that org.apache.http.impl.execchain.RetryExec is retrying. And after 4 retries the request fails with an exception. It looks like the timeout information is being ignored.
INFO: Pre-render service making request:
Apr 15, 2014 4:49:01 PM com.github.greengerong.PreRenderSEOFilter dump
INFO: GET http://api.ajaxsnapshots.com/makeSnapshot?url=http%3A%2F%2Fkarmademo.dyndns.dk%3A8080%2F HTTP/1.1
...
Apr 15, 2014 4:49:07 PM org.apache.http.impl.execchain.RetryExec execute
INFO: I/O exception (java.net.SocketException) caught when processing request: Socket operation timed out: The API call remote_socket.Receive() took too long to respond and was cancelled.
Apr 15, 2014 4:49:07 PM org.apache.http.impl.execchain.RetryExec execute
INFO: Retrying request
...
Apr 15, 2014 4:49:12 PM org.apache.http.impl.execchain.RetryExec execute
INFO: I/O exception (java.net.SocketException) caught when processing request: Socket operation timed out: The API call remote_socket.Receive() took too long to respond and was cancelled.
Apr 15, 2014 4:49:12 PM org.apache.http.impl.execchain.RetryExec execute
INFO: Retrying request
...
Apr 15, 2014 4:49:17 PM org.apache.http.impl.execchain.RetryExec execute
INFO: I/O exception (java.net.SocketException) caught when processing request: Socket operation timed out: The API call remote_socket.Receive() took too long to respond and was cancelled.
Apr 15, 2014 4:49:17 PM org.apache.http.impl.execchain.RetryExec execute
INFO: Retrying request
...
Apr 15, 2014 4:49:22 PM com.github.greengerong.PreRenderSEOFilter doFilter
WARNING: Prerender service error
java.net.SocketException: Socket operation timed out: The API call remote_socket.Receive() took too long to respond and was cancelled.
at com.google.appengine.api.socket.SocketApiHelper.makeSyncCall(SocketApiHelper.java:73)
at com.google.appengine.api.socket.AppEngineSocketImpl.receive(AppEngineSocketImpl.java:710)
at com.google.appengine.api.socket.AppEngineSocketInputStream.read(AppEngineSocketInputStream.java:35)
at org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInputBufferImpl.java:136)
at org.apache.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInputBufferImpl.java:152)
at org.apache.http.impl.io.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:270)
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:140)
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:57)
at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:260)
at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:161)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.google.appengine.tools.development.agent.runtime.Runtime.invoke(Runtime.java:115)
at org.apache.http.impl.conn.CPoolProxy.invoke(CPoolProxy.java:138)
at com.sun.proxy.$Proxy49.receiveResponseHeader(Unknown Source)
at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:271)
at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:123)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:253)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:194)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:85)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:108)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:186)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:106)
at com.github.greengerong.PreRenderSEOFilter.proxyPrerenderedPageResponse(PreRenderSEOFilter.java:132)
at com.github.greengerong.PreRenderSEOFilter.doFilter(PreRenderSEOFilter.java:84)
I switched to using HttpURLConnection and I was able to successfully control the read timeout.
URL url = new URL(apiUrl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setReadTimeout(60 * 1000);
if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) {
/* ... */
}
Not sure why with the org.apache api I can not adjust the timeout. Just thought I'd post in case anyone knew and, more importantly, to make sure people were aware of the workaround.
Version information:
org.apache.httpcomponents - 4.3.1
app engine sdk - 1.9.0

Resources