IntelliJ throwing Java.Net.SocketException: unable to open debugger, "socket closed" - java

I have seen several topics on this problem, but all of them are either for Android Studio or Glassfish.
Problem:
I'm sending a POST Request from Postman to a web app hosted in WebSphere. I set a breakpoint in the web service code in IntelliJ, but when I fire up the debugger, I get this error:
Error running 'WebSphere Traditional 8.5.5.0': Unable to open debugger port
(127.x.x.x:xxxxx): java.net.SocketException "socket closed"
WebSphere Debug Configuration in IntelliJ:
Things I've tried:
read this SO post and discovered the WebSphere debug configuration
restart the app server
restart the web service
restart IntelliJ
restart my PC
read several Android Studio posts on the same subject
read the JavaDoc on Java.net.SocketException
blasphemed
Questions:
If the issue is simply that I need to change the debug port, how can I determine what to change it to?
If necessary, where in the WebSphere Application Server admin console would I navigate to if I wanted to check the sockets? I'm very new to WebSphere AS and the documentation is a bit scattered.

The problem was human error.
Because of my poor understanding of WebSphere, I was starting the server manually, and then starting the web service in IntelliJ.
IntelliJ was trying to launch the server for me, but when it saw that the server was already running, it threw an error stating that the socket was closed.
The solution was simply to let IntelliJ to launch the server as part of the Run process.

Related

How to debug dynamic web page in Eclipse?

I am trying to debug my dynamic web application in Eclipse (Helios) as Debug mode but it could not work out. I have googled eventually i confirmed that i have to do Remote Debug. I trying to do Remote Debug. It seems doesn't work. Could please any one help me out to how to do set up Remote Debug and please mention steps to setup.
What app. server (web container) are you using ? I.e. tomcat , Add that server to your eclipse using "add server" and add project to it then run server in debug mode.
Sometimes its an issue with port.The port which you are trying to access is already occupied and wouldn't be released and you get this exception.Try restarting your system,in my case it worked.See the below post for more troubleshooting.
See Also
Eclipse : Failed to connect to remote VM. Connection refused.

java.sql.sqlnontransientconnectionexception: java.net.connectException : error connecting to server localhost on port

I've being working on a java project using Derbyclient (database locally hosted). I'm done with everything except that when I'm trying the desktop app while I'm not manually connected to the database (from Netbeans), the error in the title pops up and I can't seem to solve it. Thank you for taking the time to read this and help me.
Derby can be run in two modes embedded or server-based. Server-based allows multiple programs to access the same database. Embedded allows your application to run without a server. Your url selects server-based. The connection refused error indicates that the server is not running. Since the server was started within Netbeans it is shutdown when Netbeans is not running.
The options are:
Switch to embedded.
Start the server with a command outside Netbeans.
Just keep Netbeans running.
To switch to embedded see Apache's documentation for deployment options:
Eliminate the "//localhost:1527" from the url.
also see the tutorial "Run SQL using the embedded driver" at https://builds.apache.org/job/Derby-docs/lastSuccessfulBuild/artifact/trunk/out/getstart/index.html
To start the server in a seperate command window see the syntax for derbyrun.jar:
https://builds.apache.org/job/Derby-docs/lastSuccessfulBuild/artifact/trunk/out/getstart/rgsderbyrunjarsyntax.html

Debugging an already deployed JAX-WS service in Eclipse

There is a Webservice written in Java (using jax-ws api's), already deployed on server. Suddenly, it has started giving wierd results, for some HTTP requests, that I could not reproduce on my local-box. Is it possible that I fire the HTTP request on the same server, and start debugging the code on eclipse installed on my local box.
Please help me with the steps for the same.
Thanks
On what application server are deployed your web service ?
You need to enable remote debug on your Tomcat, JBoss, Websphere, whatever application server, and just need to create a remote debug task in eclipse to connect on the right ip/port.
This is all you have to do.
To activate remote debugging for your application server, just add the following line to the JAVA_OPTS: -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n
For eclipse you can follow this link

GWT and an unreproducable 503 error

I have a web-application built with GWT (2.0.3) and run on Apache Tomcat 6.
My application uses long polling to enable client-server conversations.
When a client is unable to connect to the server it displays a disconnected message on the page and grays out the controls until it is able to resume conversation with the server.
This happens through the use of the onFailure method of the rpc services; I keep track on how many consequtive exceptions I've received and if it passes a defined threshhold the above scenario happens.
This allows notifying the user of a problem while in the background continuing to resume the server conversation.
This has been the configuration for about 6 months, and without a problem.
I compiled the application after a change and wanted to see it in stand-alone mode so I started up tomcat (not via eclipse) and everything seemed to work fine.
When I ctrl+c'd the apache (while having clients up) I saw the clients displaying a 503 error instead of my app with the disconnected message.
I then tried to reproduce the issue but was unable as the next times the app behaved as expected.
I'm not sure if it's relevant but recently I added an UncaughtExceptionHandler to my module's onModuleLoad.
Has anyone encountered such an issue?
Do you know how I can make my client immune to such an issue?
Thanks a lot,
Ittai
Probably your app tried to connect to server while it was in process of shutting down. Some of the services might have already shut so the request failed with internal server error.
I've got similar issue having an apache httpd in front of the tomcat and stopping tomcat while one of the "background" async requests were being made, due to the security redirection policy the failing request ends redirecting the browser and voilĂ  our 503 error page.

CLI Application Unknown error in Java

I wrote a socket client in java that 24/7 connected to a socket server and receive data from it.
the client is running for about 3 days in testing, everything looks fine, and than suddenly I saw this message in the eclipse console (No stack trace):
ServerCommunicatorAdmin reqIncoming
The server has decided to close this
client connection.
I restart the application and now its working again.
I asked the server sysadmin, he says that everything looks fine the his logs.
my system uses mysql jdbc and log4j.
Any idea what can be the source?
Thanks
If you Google ServerCommunicatorAdmin you'll see that it's part of JMX
com.sun.jmx.remote.internal:
ServerCommunicatorAdmin.java
and if you search for "reqIncoming The server has decided to close this client connection" you get lots of hits. There should be something in there to help you.

Categories