Debugging an already deployed JAX-WS service in Eclipse - java

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

Related

Sending requests to spring boot service application hosted in remote Linux Server

I have deployed a stand alone spring boot jar file to a Redhat Linux server. The jar is running in localhost:8081 in the Linux server.
The Spring Boot application has some endpoints. For example localhost:8081/api/some-post-endpoint.
Usually, I would hit an endpoint in my local machine using Postman by selecting the HTTP method and putting localhost:8081/api/some-post-endpoint in the url bar of Postman.
I'm clueless on how I would hit and endpoint from the instance of application I deployed in Redhat Linux server.
For example, if my Redhat Server address is u12345.test.cloud.com, when I tried to put u12345.test.cloud.com/api/some-post-endpoint in Postman, it returned an error saying
Could not send request
Error: connect ECONNREFUSED
I am able to ping the Linux server and it succeeds.
It's just my first time to deploy an app to cloud and I saw something that says "Service Name" in the deployment options.
Is Service Name required to hit a remote endpoint?
What steps can I do to check if I can possibly hit the endpoint via postman?
I'd appreciate any comments.
Thank you.

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

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.

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.

Can't connect to tomcat webservice

So I've been doing a java webservice in Eclipse in which I have launched on a localhost tomcat from Eclipse. This has worked very good as long as I've been connecting to the tomcat started from Eclipse.
However now I want to try deploy it on my tomcat separated from Eclipse but still on localhost. So I exported my web project to a .war file and deployed it with the tomcat manager app. However now I cant reach it from my client any longer. I'm running the tomcat on port 8080, just as my Eclipse tomcat did. BUT I can go to a reasource URL from my web browser and receive proper information, so the service is running(which the manager app is saying as well).
The client is a android device connected to the same network. The service fetches information from a MySQL database on the same machine. This connection worked fine before exporting it to war on my other tomcat
What am I doing wrong here? Just ask if you need any further information!
Ok so after testing I found it strange that I got connection time-outs and not something else. It also took at least 10 seconds before any feedback occurred. Sooo it felt like a firewall problem which indeed it was.
First I needed to portforward the tomcat port in my router to the machine ip that was hosting it. Then I remembered I had Windows firewall on that very machine which was also blocking conenctions on that port. So I allowed connections on tomcat port and BAM! It worked.
Thanks for all your comments, of course I should have thought about opening my ports before coming here.

What is Tomcat Running?

I'm trying to see if a WAR I just built is even running inside of Tomcat (7.0.19). I am deploying to a linux box and so my only two options are the Tomcat admin console (web app) or, hopefully, determining webapp status through the terminal.
I already know how to get in through the console web app; I am wondering if there is any way to see the status (ACTIVE/INACTIVE/TERMINATED, etc) of deployed web apps from the terminal.
Thanks in advance.
PSI-Probe is a great application for monitoring your applications deployed to a tomcat instance. It will tell you if an application is running or down. If the application is not deployed, it will simply not be in the list.
curl --user user:pass http://localhost:8080/manager/text/list
It prints
OK - Listed applications for virtual host localhost
/manager:running:0:manager
/docs:running:0:docs
/examples:running:0:examples
/host-manager:running:0:host-manager
/myapp:running:0:myapp
Your user needs the manager-script role. Documentation: Manager App HOW-TO, List_Currently_Deployed_Applications
You can probably do it using JMX.
Find appropriate MBean that shows this information on local tomcat using regular JConsole. If you want to connect JConsole to remote you will probably have some problems with firewall, so you have other solution.
Take command line JMX client and run it on the monitored host through SSH terminal. I used the following command line JMX client: cmdline-jmxclient-0.10.3.jar
wget http://<username>:<password>#<hostname>:<port>/manager/list -O - -q
(Not sure about Tomcat 7 though)

Categories