Can't receive data remotely from one computer - java

So I wrote this jar that interacts with a database and also serves as a server. Problem is that I can only interact with that jar when I'm on the lan or run the jar from a different computer. The system with the problem is running windows xp with the firewall disabled and yes it is correctly set up with the router as I can launch a web server and view it remotely. I have no clue what the problem would be as the firewall is disabled and the jar works on other computers on the same network.
Note: I was noticing an exception "java.net.SocketException: Address family not supported by protocol family" earlier

1.Open Network Connections
2.Right-click any local area connection, and then click Properties.
3.Click Install.
4.In the Select Network Component Type dialog box, click Protocol, and then click Add.
5.In the Select Network Protocol dialog box, click Microsoft TCP/IP version 6, and then click OK
6.Click Close to save changes to your network connection.
Lastly Restart your application

See this: http://www.martinahrer.at/2009/04/16/javanetsocketexception-address-family-not-supported-by-protocol-family-bind/
Generally the problem is related to IPv6 support. Try to google your exception text and I am sure you will find an answer quickly.

Related

WinAppDriver based automation stops working on windows 10 VM when I close the RDP connection

I am doing all the work remotely on my Windows 10 Virtual Machine (Via RDP). Whenever I am logged in to the server, I can see my automation running fine but when I close my RDP connection, the WinAppDriver can't find the elements on the desktop application and thus it stops working.
How can I solve it?
Please let me know If I am missing something.
Thanks
When you disconnect the RDP session windows knows it doesn't have the render the gui, so it doesn't.
The trick is to disconnect a different way. Terminate your connection from the remote sever with this:
%windir%\System32\tscon.exe RDP-Tcp#NNN /dest:console
where RDP-Tcp#NNN is the ID of your current Remote Desktop session, for example, RDP-Tcp#5. You can see it in the Windows Task Manager on the Users tab, in the Session column.
If you need more info have a look at this site https://support.smartbear.com/testcomplete/docs/testing-with/running/via-rdp/keeping-computer-unlocked.html
The link is for test complete not selenium but the steps are sound.

Why does IntelliJ want to accept incoming network connections?

➠ What feature in IntelliJ is acting as a server to accept incoming connections?
When first running IntelliJ 2017.1.1 I get a dialog box asking permission for incoming network connections.
Do you want the application “java” to accept incoming network connections?
Clicking Deny may limit the application’s behavior. This setting can be changed in the Firewall pane of Security & Privacy preferences.
[Deny] [Allow]
Example of dialog appearing on a fresh install of IntelliJ 2017.2 Ultimate edition, in the New Project wizard, when clicking on the Maven tab.
Why is IntelliJ causing this prompt? I got no such event when running NetBeans.
What exactly is the effect of denying or accepting? I am concerned about letting a Java process accept outside network connections as doing so is a serious security risk.
Possibly related to:
Question: How to bind IntelliJ IDEA random open ports to localhost only?
Issue IDEA-175889: IDE opens random ports on wildcard interface in some configurations
This Question is not about the source of the message. The source is the Apple macOS app-level firewall. You can allow or block an app from listening for incoming network connections. Allowing this is a security risk.
IntelliJ is asking to be added to the list of apps allowed to listen for incoming messages. My Question is, "Why does IntelliJ need to accept incoming network connections?".
Problably it is linked to the below.
If you click on http://localhost:63342/ you should be able to access the built-in server. Which by default should listen only on the local interface.
Open port in range 6942-6992 seems to be linked to SocketLock.java
myServer = BuiltInServer.startNioOrOio(workerCount, 6942, 50, false, handler);
note: Ports 6953, 6969, 6970 are excluded from that range. See BuiltInServer.java
private static final int[] FORBIDDEN_PORTS = {6953, 6969, 6970};
Another open port is linked to a process org.jetbrains.idea.maven.server.RemoteMavenServer
jps -l | grep jetbrains
24628 org.jetbrains.idea.maven.server.RemoteMavenServer
You could find out open port with netstat
on Linux: `netstat -ltupne`
on OSX (something like): nettop -np java
and the related java processes with jps (as show above)
as doing so is a serious security risk.
It isn't, unless you don't trust the specific product. And if you don't trust a product, why are you using it at all?
IntelliJ needs to check its license once in a while, connect to update servers, maven repositories, plugin repositories, external application servers you may want to connect to, ditto with database servers.
Netbeans needs the same, you no doubt just forgot you gave it permission at some point, or it uses an external JVM that you gave permission at some point.

How to connect android device to localhost server?

I am trying to establish a connection between my client app running on my android mobile and a server running on my windows 7 PC.
I am new to android and so while looking for some client server tutorial, got the below 2 links.
http://www.compiletimeerror.com/2013/09/creating-java-web-service-using-axis-2.html
http://www.compiletimeerror.com/2013/09/accessing-web-service-from-android.html
Here, server is developed on java and published using axis2 webservice. I followed the tutorial and could develop the similar client and server which runs fine on the emulator. But if I try to access the same using my android mobile it is not working. My mobile is unable to speak to the localhost on my PC.
What I am doing here is,
1. Connected both my PC and mobile to same WIFI network.
2. Connected the mobile to PC using USB.
3. Started the Server on Tomcat
4. Running the Client Project from eclipse and selecting my mobile as target.
Below is my published webservice URL which I am calling from client code,
http://192.168.0.3:8080/MyWebService/services/WebService?wsdl
Here 192.168.0.3 is my PC IP
Please let me know what am I doing wrong here?
Windows 7 might block port 8080. You could test that your port is open from another pc using
telnet 192.168.0.3 8080
or from android using this code.
If 8080 is blocked, then you may want to open it using these steps:
Open Windows Firewall by clicking the Start button Picture of the Start button, and then clicking Control Panel. In the search box, type firewall, and then click Windows Firewall.
In the left pane, click Advanced settings. Administrator permission required If you're prompted for an administrator password or confirmation, type the password or provide confirmation.
In the Windows Firewall with Advanced Security dialog box, in the left pane, click Inbound Rules, and then, in the right pane, click New Rule.
Follow the instructions in the New Inbound Rule wizard.
Note: You must be sure beforehand that your android device is connected to the same local area network or wifi.
Try to access your URL
http://192.168.0.3:8080/MyWebService/services/WebService?wsdl
from your android browser. If you are getting an xml page, then it's not the network problem. If it's network problem, try restarting your local server and changing firewall and router configurations.
You have to provide more information to get a specific answer.
If everything is fine then u should check your Android App.
U have to add the following permission for Internet access.
<uses-permission android:name="android.permission.INTERNET"/>

Run jsp pages from remote server

I am new to JSP and servlets. I configured my eclipse and am now able to run a helloworld jsp program. Now, i want this to be run on a different system.
Following were my queries.
1) Can i enter the IP of my current system where eclipse and tomcat are installed and running and run the application on the computer 2?
2) If question one is not possible, how can i test my application outside local host without purchasing the server.
Please share your knowledge
If I got you right, option number 1 should work.
You currently have a webapplication running on your local machine. So you can enter something like http://localhost:8080/myapp in your browser and see a webpage from your application.
Next step to replace localhost with an ip adress or computer name. So still on the same computer the following should work: http://192.168.123.1:8080/myapp and http://mycomputer:8080/myapp. Of course I just made the ip address and the computer name up and you have the real values.
These two urls should also work from a remote computer that is on the same network. Like the computer of you coworker, or the second computer in your home network.
Possibly the next step would be to deploy your application on a cloud service. But that is a different story worth its own question.
You can put your app in tomcat directory/webapp.
you have to put there .war file of your application.
Then from firewall add inbound rules that on port 8080 incoming request to all connection.
then from at any place from your intranet just type your ip :8080/app.
look here my answer of same query like you.
it is possible in LAN you just need to put the SERVER IP instead of localhost
example: 192.168.1.23:8080/test
if you want to access it in outside via Internet connection
first you should have STATIC IP it is provided by your internet service provider ask them.
and dont forget to off your firewall or add it to exception

How can I make MS SQL Server available for connections?

I'm trying to connect to MS SQL Server (running on my machine) from a Java program. I'm getting the following long winded exception:
Exception in thread "main" com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host localhost, port 1433 has failed. Error: "Connection refused: connect. Verify the connection properties, check that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port, and that no firewall is blocking TCP connections to the port.".
When I check "Properties" and click "View Connection Properties" in the Object Explorer of MS SQL, I find that the "Server is Unavailable." This seems possibly related to the exception message.
How can I make the server available?
Edit:
I am using SQL Server 2008, and I have now enabled TCP/IP, and restarted my instance. I am still told that "Server is unavailable."
Any other ideas?
I ran into this problem as well.
The MSKB article applies to SQL server 2005.
As the "SQL Server Surface Area Configuration" tool has been dropped in lieu of "Facets" - this wasn't obvious to me.
I resolved this by setting the TCPAll port and enabling the relevant IP.
Steps
Open the Sql Server Configuration Manager (Start -> Programs -> Microsoft SQL Server 2008 -> Configuration Tools)
Expand SQL Server Network Configuration -> [Your Server Instance]
Double click TCP/IP
Under Protocol:
Ensure Enabled is Yes
Under IP Addresses:
Scroll to the bottom and set the TCP Port under IPAll, (1433 by default)
Find the IP address you want to connect to and set Enabled and Active to Yes
Before messing about with connections, first check that the SQL Server Service is actually running.
You can do this by either using the SQL Server Configuration Manager (located in the configuration tools folder) or in the standard services console in the Windows control panel.
Once you have checked the service is up and running, you need to ensure that SQL Server has been configured to allow remote connections.
See below for an explanation on how to do this:
http://support.microsoft.com/kb/914277
I am using SQL Server 2012 and have had same issues.
Please note when you activate TCP/IP there are 2 options:
Active - YES - If you just click yes on this it wont work
Enabled - click yes on this too. I did not pay attention to this
and was wondering why its was not working, wasting a lot of time in
the process
You can test listening ports with this:
netstat -an
Depending on the version of SQL Server you're using, it may well be set up only to use named pipes by default.
You need to enable TCP/IP connections to the server. If you can tell us which version of SQL server you're using, we can give more precise instructions for how to enable TCP/IP.
As usual, check the obvious:
1. See if your router has ports 1433 and 1434 enabled (these are the defaults for IP/UDP communication)
2. Ensure that if you have a firewall in place on either the client or the server, that said ports are not blocked (this is the one that was my "gotcha").
3. Go into Sql Configuration Manager and under Sql Server Network Configuration, ensure that TCP/IP is enabled. Also, in the same program under Sql Native Client 1.0 (if installed) that it, too has TCP/IP enabled.
A cheap and sleazy way to ensure that all of your connection information is working is to create a .udl file (anywhere on your system), fill in the appropriate information and hit "Test Connection". If there is something wrong there, you'll get a (fairly) informative message as to the problem.
If you don't know about .udl files, right click in Windows explorer (right side pane) to create a "New Text File". Type any acceptable name but change the extension from .txt to .udl. You will be asked to confirm the extension change, answer yes. Once created, click the file (or double click if you don't use single click) to open it. There are 4 tabs. The first allows you to select the provider. For Visual studio use the Sql Native client, for any other program try the standard Sql Server Provider. On the second tab you can fill in the server name, sql server user name and password (if used), etc. Then test the connection. One other item to note - if you are using Windows Authentication, ensure that those users have been added to the Server Logins.
Open up Sql Server Configuration Manager. ( Start | Programs | Whatever version of sql server | Configuration Tools)
Browse down to 'SQL Server Services' and restart your instance. However you could do this in Management Studio by right clicking on the instance and selecting restart.
If your restart fails then, check out Computer Management | Event Viewer | Application and look for sql server events. it will record successful and error messages here.
Here are my screenshots. If you can't read the words, then download the image or copy and paste the image into Paint.
Inside Glassfish:
"General" Tab:
"Additional Properties" Tab
URL= jdbc:sqlserver://localhost;databaseName=NETEAV
Inside Microsoft SQL Server Management Studio:
Check is the connection is blocked by Firewall or not. If third-party Firewall is active then it may block the TCP connection. After this step-
1. Check TCP enabled on or not
a. Open SQL Server Configuration Manager
b. SQL Server network configuration
c. Protocols for MSSQLSERVER
d. TCP – Enable it
e. Also check listen all – Yes
f. In IP Addresses tab, IPAll – port number should be 1433
First off, check that the sql server service is running. If you're using SQL 2005 or 2008, check Configuration manager (2008) or Surface are configuration tool (2005) to make sure the TCP/IP protocol is enabled and TCP/IP connections are allowed. With SSE(express) these are off by default, which would cause your problem. Also just in case you're running multiple instances, you may need SQL browser service running. If this is the case, you should be able to connect object explorer by using (local) as the server address, since this will use a local/shared memory connection.
From 2005 and up the SQL server browser service has te be running.
That one fooled me many times.
Same error observed while connecting to SQL Server 2014.
I logged in the sql server to ensure that the correct port number was set.
For my case the Port number was not set for the sql instance.
Hence I removed the Port number from the connection string url, then I was able to connect .
Anybody facing this issue, can try this way

Categories

Resources