Unable to connect to IBM Mobile first 7.1 server from remote machine - ibm-mobilefirst

Am trying to build a simple mobile first 7.1 application deployed on the windows server (Liberty profile). Am using the below code in the main.js file
WL.Client.connect({
onSuccess: function () {
console.log("Connected to MFP");
WL.Client.checkForDirectUpdate();
},
onFailure: function (f) {
console.log("Failed to connect to MFP, not sure what to do now.", f);
}
});
It is giving me the below error in client side.
Failed to connect to MFP, not sure what to do now.
class {status: 404, errorCode: "UNEXPECTED_ERROR", errorMsg: "The
server was unable to process the request from the application. Please
try again later.", invocationContext: undefined}
Note : The same setup works fine in mobile first server deployed in eclipse.
Steps I tried:
checked wlclient.properties which has correct values
tried to call the remote machine mfpconsole url from mobile and its works fine.
enabled trace logs logging
traceSpecification="com.ibm.puremeap.*=all:com.ibm.worklight.*=all:com.worklight.*=all"
but its logging any exception.

Related

KTOR Server StatusPages status() not working

I'm creating a website using KTOR v2.0.0 and I'm trying to set up StatusPages for the 404 & 500 error codes.
Locally this works as expected using the embedded server running the application through Intellij.
When I package the application to a WAR file and run it on a remote server the status() part doesn't seem to get triggered at all but the exception does.
install(StatusPages) {
println("StatusPages installed")
exception<Throwable> { call, cause ->
println("StatusPages exception triggered")
}
status(HttpStatusCode.NotFound) { call, status ->
println("Page not found!")
}
status(HttpStatusCode.Found) { call, status ->
println("Page WAS found!")
}
}
The exception works fine but neither of the status() calls work remotely, even though they work fine locally.
I'm using Jetty9 to call the WAR files and I'm using NGINX as a proxy from a domain name to the Jetty9 port. Is there something I'm missing in the process/setup for it to not work?
Any suggestions would be appreciated.

Unable to connect with openfire using react-native-xmpp

I have a react-native Chat application which I am running on my android phone using USB debugging and I am using OPENFIRE as a chat server. For connecting with Openfire I am using library 'react-native-xmpp'. Below is the code for connection with OPENFIRE using react-native-xmpp --
import XMPP from 'react-native-xmpp';
var JID = 'admin#192.168.4.246';
XMPP.on('error', (message) => console.log('ERROR:' + message));
XMPP.on('loginError', (message) => console.log('LOGIN ERROR:' + message));
XMPP.on('login', (message) => console.log('LOGGED!'));
XMPP.on('connect', (message) => console.log('CONNECTED!'));
XMPP.connect('ramvallabh#192.168.4.246', 'root','RNXMPP.PLAIN','192.168.4.246',5222);
XMPP.message('Hello world!' , JID);
XMPP.disconnect();
The IP I used here is my local IP address.
I am trying to connect to port 5222 as a PLAIN connection. But I am getting an error saying
SSL/TLS required by the client but not or no longer supported by
server.
I checked the OPENFIRE configuration at port 5222. I disabled the encryption and enabled the encryption but not getting any difference in either case. I also tried to connect to port 5223 then the error says
javax.net.ssl.SSLHandshakeException:
java.security.cert.CertPathValidatorException: Trust anchor for
certification path not found.
I not uploaded much of code because I think the error either lies in the library or some networking concept that I don't understand.
Does anybody have any idea what may be going wrong here or any other better way to do it?
You are facing this error because in the java code of raect-native-xmpp, security mode is enabled by default. If you want to use PLAIN text authentication than you must turn this off.
Example: Suppose you react-native app name is TestApp then go to the following directory:
TestApp/node_modules/react-native-xmpp/android/src/main/java/rnxmpp/service
and go to Line 76 and replace with the below line:
Before:
.setSecurityMode(ConnectionConfiguration.SecurityMode.required);
After:
.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled);

Failed to construct 'RTCPeerConnection': Unsatisfiable constraint IceTransports

I trying to setup RestComm Web SDK demo application on my local system, I just want to create an application for audio/video, chat, IVR, etc(RestComm provide me perfect solution for my needs). Now I have setup RestComm Web SDK on my local system and whenever I an trying to sip call, It throws WebRTCommClient:call(): catched exception:NotSupportedError: Failed to construct 'RTCPeerConnection': Unsatisfiable constraint IceTransports on browser console.
My webRTC confrigration is as below:
// setup WebRTClient
wrtcConfiguration = {
communicationMode: WebRTCommClient.prototype.SIP,
sip: {
sipUserAgent: 'TelScale RestComm Web Client 1.0.0 BETA4',
sipRegisterMode: register,
sipOutboundProxy: parameters['registrar'],
sipDomain: parameters['domain'],
sipDisplayName: parameters['username'],
sipUserName: parameters['username'],
sipLogin: parameters['username'],
sipPassword: parameters['password'],
},
RTCPeerConnection: {
iceServers: undefined,
stunServer: 'stun.l.google.com:19302',
turnServer: undefined,
turnLogin: undefined,
turnPassword: undefined,
}
};
While I can use olympus without any issue in Chrome Browser. I am stuck with this exception, any suggestions would be highly appreciated.
I think the problem here is that the version of Webrtcomm library inside the demo application you are using is outdated and doesn't include a fix for latest Chrome version. So please replace samples/hello-world/scripts/WebRTComm.js within your repository, with:
https://github.com/RestComm/webrtcomm/blob/master/build/WebRTComm.js
That should fix your issue.
Best regards,
Antonis Tsakiridis

Mobilefirst 7.1 adapter call fails from a Mobile Web Application

Im working in a mobilefirst 7.1 web mobile app and a liberty server, my app works fine in my development server, but when ive deployed the same application pointing to my remoter server (with ip not a domain), but the app gives me a 403 error. my adapters has a
securityTest="wl_unprotected"
if ive run my adapter as a rest service from his url directly it runs ok.
Client log
Request [/worklight/apps/services/api/TestConexion/mobilewebapp/query]
worklight.js:5349 Application details header: {"applicationDetails":{"platformVersion":"7.1.0.0","nativeVersion":""}}WL.Logger.__log # worklight.js:5349
http://xxx.xxx.xx.xx:xxxx/worklight/apps/services/api/TestConexion/mobilewebapp/query Failed to load resource: the server responded with a status of 403 (Forbidden)
server log:
[11/4/15 11:41:16:877 ART] 0000006e com.ibm.ws.webcontainer.extension W SRVE0190E: File not found: /201509231601/login/nls/redirection.js
More Logs
Cannot find application environment, application=TestConexion, version=null, environment=mobilewebapp
Error code: 1, error description: INTERNAL_ERROR, error message: FWLSE0062E: An internal error occurred during browser request. [project worklight]Cannot find application environment, application=TestConexion, version=null, environment=mobilewebapp, User Identity {wl_directUpdateRealm=null, SubscribeServlet=null, wl_authenticityRealm=null, AuthRealm=null, wl_remoteDisableRealm=null, SampleAppRealm=null, wl_antiXSRFRealm=null, wl_deviceAutoProvisioningRealm=null, wl_deviceNoProvisioningRealm=null, FarmalinkRealm=null, WASLTPARealm=null, wl_anonymousUserRealm=null}. [project worklight]
and an error of independent mode:
FWLSE0373W: Deployment of application 'TestConexion': The server is running in session independent mode, which the environment 'mobilewebapp' does not support.
Any thoughts?
To me, this:
Deployment of application 'TestConexion': The server is running in session independent mode, which the environment 'mobilewebapp' does not support.
Tells me that you are working on Token based sessions not HTTP sessions. IF you go to your worklight.properties you can make the changes there to run with HTTP sessions.
worklight.properties is located under server>conf. The properties are:
mfp.session.independent=false
mfp.attrStore.type=HttpSession

Worklight - connection on startup fails

using Worklight server v6.1 i'm trying to develop a simple app that connects to the production server at startup. To get this i do:
in initOptions.js file i set connectOnStartup to true
in wlCommonInit method of <my-app>.js file i call :
WL.Client.connect({
onSuccess: connected,
onFailure: failure
});
where connected and failure are two callback to two simple functions that load some data in a listview. When i trie it on a production or development environment i get a spot over my app's layout stating it's loading as you can see in the pic below(even if the application loaded data correctly):
i notice that after installing and running it on an iOS or Android device i don't have this strange behaviour, but on Windows8 devices i do have.
i set to false connectOnStartup and left only the call to WL.Client.connect.
Now the app doesn't get blocked anymore(i suppose becouse WL.Client.connect runs asynchronously while WL.Client.init does not but it's only my opinion).
i can't connect to the server yet, this is strange becouse(you can see in the pic) there is a listview filled with data returned by a sql adapter,
so it looks like the app can connect to the server for calling adapters but not for updates
You have already set connectOnStartup:true in initOption.js, this means that the app will try to connect to the Worklight Server on startup - basically it calls to connect, so why do you call WL.Client.connect in wlCommonInit() as well?
As for the onSuccess and onFailure, I think that in this what you may want is the following:
See the options for WL.Client.init.
There is an initOption that you can uncomment in initOptions.js:
onConnectionFailure
A failure-handling function invoked when connection to the Worklight
Server, performed on initialization by default, or if the
connectOnStartup flag is true, fails.
The "success" by default is wlCommonInit(), but you want something else then in initOptions.js you can also add onSuccess: something.
BTW, where did you see what you've done as a "best practice" by Worklight?