Error during Intellij idea remote Tomcat Server debug - java

I've some problems during configuration of remote Tomcat Server in Intellij
I've got a java web app that need to run in a cluster configuration, so I've got 3 Linux VMS in which I've installed tomcat server.
The problem is that I need to use this 3 tomcat servers together in debug mode in order to test and check issues.
I've tried some things but I was not able to get a solution.
OPTION A: configuring Remote JVM Debug:
I've tried to configure a Remote JVM Debug on my intellij configuring Catalina to listen to another port (2001) and launch it with the command: sh catalina.sh jpda start -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:2001 but it stucks on this message "Connected to the target VM, address: 'IP:2001', transport: 'socket'"
OPTION B: remote Tomcat server:
I've tried configuring a remote Tomcat server (that is the thing I prefer) configuring remote host with SFTP, but in this case Tomcat service start, it works for some minutes and after that it goes in TimeoutException
[](https://i.stack.imgur.com/XmDKx.png)
I hope anyone can help me, I read a lot of thing on the internet but no-one works.

Related

How to remote debug WebLogic server when it started as Windows Service

I tried almost all internet and stackoverflow tips and no one didn't help me to open ports in Weblogic Server. My Weblogic server starts as windows service in windows server 2008 r2. In config.xml on the path
..user_projects\domains\%Any_app%\config\config.xml i added this string for each server in arguments -
<server-start>
<arguments>... -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=1777,server=y,suspend=n ...
</arguments>
</server-start>
and i always check in cmd with netstate -a or telnet this port but it doesn't appear and doesn't work.
For the first, check your firewall - ensure that port is open.
Second, check config.xml again, then in administration console go to
Servers - Configuration - Listen Port - made modifications if needed.
Restart weblogic. Check if service is started, if not then modify windows service.
Read this article how to manage ports.
Change the port number with WLST, if it possible for you.
For me the solution was to edit regedit with my weblogic as win service. Path:HKEY_LOCAL_MACHINE/SYSTEM/services/%Name_of_service% and here u can edit settings
(add some strings in setting fields) and then restart machine with u server.

how to debug a web service in IntelliJ?

Please correct me if I did anything wrong:
I created a web service (WSDL) in Java and it has a method TestCall().
I also created a website http://testwebsite:8000/abc/index.html, and this website is calling the web service in step 1.
I created a remote debugging for it in IntelliJ. I put testwebsite as the host and 8000 as the port number.
Once I went to http://testwebsite:8000/abc/index.html and click on TestCall(), it didn't go to the breakpoint in IntelliJ. When I was trying to remote debug the web service, I got error:
Unable to open debugger port (testwesite:8000), handshake failed, connection permanently closed.
Can someone tell me what steps I missed? thanks
When you need to remotely debug an application, go to the settings (Run->Edit configurations) in IntelliJ.
Now click the + sign and add a Remote configuration. It tells you the command line to add to the startup of the JVM you start on the remote machine. It will be something like:
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 for jvm 5-8.
Now you can start your remote web service on the server with these extra command line options. Then you start this configuration in IntelliJ. It will tell you Connected to target VM, address: 'server name', transport: 'socket'. You can add breakpoints as you are used to with local debugging.
As you see: the remote debugging does not use the web-port, but a different port that is opened especially for debugging purposes. If there are firewalls between the server and your workstation, please choose a port that is open, or have the firewall port opened (if possible).

Connect JVisualVM to a Remote Wildfly Instance?

I'm trying to connect JVisualVM, running on my local machine, to a remote machine which is running a WildFly server (version 8.1.0, to be specific.)
I didn't configure the WildFly server myself, and I don't know who did, but I do know that I can log in as an administrative user from my local machine by pointing my browser at:
https://[ip address of the remote machine]:9443/console
Note that it's https, not ordinary http, and that the port for that has been set to 9443 (I think the default is 8080 or 9990 or something... IDK, I saw a lot of port numbers online. I have been explicitly told that http was disabled for this WildFly server).
I can SSH into the remote machine. I can navigate to the bin directory for WildFly and run jboss-client.sh. I have to connect on port 9999 (I think the default is 9990 for that?)
I copied the jboss-client.jar (under bin/client) to my local machine and ran JVisualVM from the command line like this:
.\jvisualvm.exe -cp:a C:\[path to]\jboss-client.jar
It launches fine. File > Add Remote Host: Then I entered the IP. OK. I right clicked on it under Remote in the tree and picked Add JMX Connection. I entered
service:jmx:http-remoting-jmx://[ip]:9999
I checked off that I wanted to use the security credentials and entered the username and password. Checked off to save the security credentials. Left "Do not require SSL Connection" unchecked. Hit OK. It immediately spat out the message
Cannot connect to admin#service:jmx:http-remoting-jmx://[ip]:9999 using service:jmx:http-remoting-jmx://[ip]:9999
I also tried the port 9443, 9990, and 8080 instead. None of those worked. I tried https instead of http in the protocol name. That also didn't work.
What am I missing? How is it that I can access the console, and connect with jboss-client.sh, but I can't use JVisualVM? Is there some log I can use somewhere to see what's wrong? Maybe someone can point out a configuration I've missed somewhere?
Not sure if it's important or not, but my local machine is running Windows 10 with JDK8 installed. The WildFly server is using Java 6 on CentOS 6.3.
You need to add the jboss-client.jar (or jboss-cli-client.jar) to the class path for JVisualVM. The library can be found in the bin/client directory of the WildFly install.
I used the following command to add the library to the class path.
jvisualvm --cp:a ~/servers/wildfly-10.0.0.Final/bin/client/jboss-client.jar
Then I used service:jmx:remote+http://[ip]:[port] and was able to connect.
I don't know if someone else is also (still) having the same issue (Wildfly10 on a remote machine where management console is available at 9443 with HTTPS). The following worked for me.
For ssh connections:
Starting jvisualvm with jboss-client.jar
jvisualvm --cp:a #JBOSS_HOME/bin/client/jboss-client.jar
Using the following connection string:
service:jmx:remote+https://remote-server:9443
NOTE: I used here remote+https
Provide username and password
Hope this helps.
you missed run jstatd command in remote host ,
this little program is RMI server that possible connection from client to remote host though you using jmx connection it used jmxrmi protocol for that connection .
so first in remote host create file name as security.policy with this contain :
grant codebase "file:${java.home}/../lib/tools.jar" {
permission java.security.AllPermission;
};
off course you must in file section for linux put explicit path and then of creation this file put it in bin directory of jdk.home
then you should run this command on remote host
$JAVA_HOME/bin/jstatd -J-Djava.security.policy=path of /security.policy -J-Djava.rmi.server.hostname=remote ip address -J-Djava.net.preferIPv4Stack=true
then you could connect to server off course with correct settings.
Include jboss-cli-client.jar and jboss-client.jar under \lib\visualvm\platform\lib and restart jvisualvm to pickup new jars.

Weblogic 10.3 can not be accessed after enableing Administrator port

I was was following this blog to set up some SSL connection. One-Way SSL with JAX-WS using JDeveloper 11gR1 and WLS 10.3.1
One of the steps mentioned is to enable the Administration port from weblogic console. I did that and change the Admin port. But, after saving everything get missed up the conclose closed and the I could not run the application form Jdeveloper .
The Error message is:
User 'principals=[weblogic, Administrators]' has administration role. All tasks by adminstrators must go through an Administration Port.
**** Authentication error while connecting to application server IntegratedWebLogicServer. Please check settings.
**** Failed to complete start-up of application server IntegratedWebLogicServer.
[Server Instance IntegratedWebLogicServer is shutting down. All applications currently running will be terminated and undeployed.]
[Forcing termination of IntegratedWebLogicServer]
taskkill /F /PID 7480
Process exited.
This blog: SOA OIM integration and WebLogic administration port
discuss this issue BUT under the assumption that I can access the weblogic console. But it is not happening for me.
I am using Jdeveloper 11.1.1.7 and the weblogic 10.3
The problem solved by deleting the system files for jdeveloper. This action will re insinuate the weblogic server. This file is located in my case in the following path: C:\Users\[UserName goes here]\AppData\Roaming\JDeveloper.
Check this thread form Oracle community for more information : Authentication error while connecting to application server IntegratedWebL

java remote debugging Tomcat app: Why does the JVM not listen?

I want to remote debug an application running in Tomcat 7. Tomcat is running as a service on a Win2008 server.
I added the following to the Java options in the Java Configuration Panel of Tomcat:
-Xdebug -Xrunjdwp:transport=dt_socket,address=4711,server=y,suspend=n and opened the firewall on my workstation and the server for this port.
But when I try debugging from IntelliJ 9 on my workstation, I get an error message Unable to open debugger port : java.net.ConnectException "Connection timed out: connect". The jvm is the standatd Sun/Oracle 64 bit JVM version 1.6.0_27.
I verified that the command line parameters are in use by accessing ManagementFactory.getRuntimeMXBean().getInputArguments() within the application deployed to Tomcat and logging the result to the log file.
I verified via Wireshark on my workstation and on the server that the TCP request on port 4711 is sent from my pc and arriving on the server, but there is is no answer. Running netstat -a on the server does not show a process listening on this port. So I assume somehow Tomcat/JVM does not start the remote debugging.
You need to put -Xdebug and -Xrunjdwp... on separate lines in the Java panel of the Tomcat Service Configuration Panel.
So having:
-Xdebug -Xrunjdwp:transport=dt_socket,address=4711,server=y,suspend=n
will not work, but:
-Xdebug
-Xrunjdwp:transport=dt_socket,address=4711,server=y,suspend=n
will.

Categories

Resources