Could not Connect User to Service in Android Studio - java

I am using Android Studio 2.3. When I am attaching my Moto G4 to debug an application, it ends up with the following error in Android Monitor.
6333-7189/? I/XMPPConnection: Preparing to connect user 1576857969013772288 to service: on host: and port: 0
03-25 11:06:18.221 6333-7189/? E/XMPPConnectionManager: Failed to connect user '1576857969013772288' to host ' on port 0: XMPPError connecting to :0.: remote-server-error(502) XMPPError connecting to :0.
-- caused by: java.net.ConnectException: Connection refused
After this error, no further logs are captured even in verbose mode.

Check below Links:
https://stackoverflow.com/a/6876306/3992798
I am having a similar problem.
I have an application running on Websphere 7 Dev environment
http://appl.company.com/appl/home.action
And also on my localhost system
http://localhost/appl/home.action
I am trying to access a URL like below
http://appl.company.com/SiteContent/a.html from the above application
It works perfectly fine on my local system.
But on the development environment, on this particular line :-
String stream = (new java.net.URL(url)).openStream();
I am getting a "java.net.ConnectException: Connection refused" exception
On googling i figured, such problems are either due to one of the following
The port is wrong (cannot be this option, as same url running perfectly from local system)
Firewall is stopping it.

The Android SDK, do you config the path?
try to it what open a cmd window,input 'adb devices',see result waht display a device of you Moto

Related

How to resolve java.net.ConnectException: Connection refused

i am running my android application in device its not connecting to device.Its giving following error
[2016-10-24 19:41:00 - DeviceMonitor] Failed to start monitoring 127.0.0.1:5558
[2016-10-24 19:41:17 - Device] Error during Sync: Connection refused: connect
[2016-10-24 19:41:38 - Device] Error during Sync: Connection refused: connect
Try giving user permission to your manifest
<uses-permission android:name="android.permission.INTERNET" />
If you are sure that the server IP address and port number correct then my answer will not be so helpful.
Otherwise: - Especially if you are using different JVMs for the client android app and the java program(your server). This could happen probably because they are both referencing different localhosts.
Open command line and issue the command ipconfig you will get details about your network configurations. Instead of localhost Use the physical address of your computer(IPv4 address displayed on your terminal), it looks something like below.

Facing issue with ionic web-socket connection with java socket server

I am facing issue with websocket on Ionic
connection with "ionic serve" working perfect. but when i try with "ionic run android"(which is connected with WiFi) getting below given error.
"WebSocket connection to 'ws://192.168.1.7:8086/wsConn' failed: Error in connection establishment: net::ERR_CONNECTION_TIMED_OUT"
"192.168.1.7" is my server ip address.
I tested server running on window 10 and window server 2012 both.
tried with turning off server firewall also.
Can anyone help me on this ?

The application can't connect with a solr engine on a different computer

I run my Solr engine on Ubuntu 14.04 in VirtualBox. The guest operating system is connect to local network. It has this IP address: 192.168.10.102.
I'm trying to connect with Solr engine using my browser. I'm going to http://192.168.10.102:8983/solr/ and everything is works.
I wrote an application in Java (with SolrJ). I try to connect to the Solr engine and delete everything. The code looks like this:
server = new HttpSolrServer("http://192.168.10.102:8983/solr/");
server.deleteByQuery("*:*");
server.commit();
Sadly I get an exception:
[main] INFO org.apache.solr.client.solrj.impl.HttpClientUtil -
Creating new http client,
config:maxConnections=128&maxConnectionsPerHost=32&followRedirects=false
Exception in thread "main" org.apache.solr.common.SolrException:
Server at http://192.168.10.102:8983/solr returned non ok status:404,
message:Not Found at
org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:372)
at
org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:181)
at
org.apache.solr.client.solrj.request.AbstractUpdateRequest.process(AbstractUpdateRequest.java:117)
at
org.apache.solr.client.solrj.SolrServer.deleteByQuery(SolrServer.java:285)
at
org.apache.solr.client.solrj.SolrServer.deleteByQuery(SolrServer.java:271)
...
Everything is good when I comment deleteByQuery() and commit() functions.
How can I solve it?
You have to create any collection your url should look like http://192.168.10.102:8983/solr/collection1 and then you can try do something

Java Mission Control: Flight Recorder throws: javax.naming.ServiceUnavailableException

I am trying to profile a Java Spring application with the Oracle Java Mission control.
I have the JVM Connection configured as: localhost:7091
and I started the application with java -Dcom.sun.management.jmxremote.rmi.port=7091 -jar app.jar.
When I attempt to start the flight recorder I get an error message.
Failed to retrieve RMIServer stub: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: localhost; nested exception is:
java.net.ConnectException: Connection refused: connect]
Could not connect to a JVM at service:jmx:rmi:///jndi/rmi://localhost:7091/jmxrmi. Make sure one is running and that you are using the correct protocol in the Service URL.
Does anyone know what could be the reason for that error?
You could try to use auto discovery. Then the connection will show up automatically in JMC
-Dcom.sun.management.jmxremote.autodiscovery=true
You can also name the connection so you can identify it easily.
-Dcom.sun.management.jdp.name=App
and disable security
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
I had this issue. I had installed JDK 10 on Windows Server 2016. With JMC and the JVM I wished to monitor on the same server.
When going live, we switched the IP from a temporary IP to a live IP. However, JMC resolved localhost to the original IP. Also when specifying the server's current IP, JMC resolved it to the original IP.
Adding -Djava.rmi.server.hostname=localhost to the Java process I wanted to monitor, resolved the issue.
However, I will would still be interested to know why JMC (or RMI) still resolves incorrectly.

connect failed: ECONNREFUSED

I am developing one app, and what I think I wanna do is receive data from server database in android. So I started to run some tutorials. I found one that is doing pretty much what I want.
But I am getting:
detailMessage "failed to connect to localhost/127.0.0.1 (port 8080): connect failed: ECONNREFUSED (Connection refused)" (id=830021648792)
Whole code of this tutorial is here link
Error occurs on :
OutputStreamWriter out = new OutputStreamWriter(connection.getOutputStream());
I checked that:
firewall is disabled
ping is working
connection string is exactly the same as when I run the servlet from server admin interface - http://localhost:8080/Requestor/RQSRV
-the servlet is running
My configuration :
Server : Glass Fish 4.0
Android App - Developed in Eclipse
Servlet - Developed in NetBeans
To access your PC localhost from Android emulator, use 10.0.2.2 instead of 127.0.0.1. localhost or 127.0.0.1 refers to the emulated device itself, not the host the emulator is running on.
Reference: https://developer.android.com/studio/run/emulator-networking#networkaddresses
For Genymotion use: 10.0.3.2 instead of 10.0.2.2
if you are using genymotion then go to command prompt type ipconfig
-find for Ethernet adapter virtualBox host-only network:
-find for Ipv4 Address..............192.1**.**.*
copy
http://192.1..*/foldername/filename/filename.json or filename.php
to check if its working go to browser in emulator copy paste the url you should find the file which you are looking in your browser..
Sorry for English..
This worked for me hope this might help some one..
Thank u..

Categories