Intellij remote tomcat print to console - intellij-idea

I'm learning java webdevelopment and I'm using tomcat 7. I set everything up so that I can remotely debug (breakspoints seem to work) my deployment on a remote tomcat server using IntelliJ.
My book on webdevelopment states that I can use System.out.println() in most IDE's to print to the console.
But in IntelliJ nothing shows up in the console...
Does IntelliJ support printing to the console from a remote server?
And if it does, hoe do I set it up?
Or are there any alternatives to do this?

I found 2 solutions for my problem:
1) Use the intellij local run configuration
2) Instead of System.out.println() use log() to write to the catalina log file.

Related

No dropdown option of IntelliJ in IDE version of Remote Development using SSH in JetBrains Gateway

I am trying to connect to a remote server using JetBrains Gateway, so that I can use IntelliJ IDE for code changing purposes.
Both IntelliJ and JetBrains Gateway are -newly installed- on my device and I've rebooted my PC after installation as well.
I entered the hostname, password and it says that I'm "Successfully Connected".
But in the IDE version dropdown, nothing shows up even though I have IntelliJ installed on the system.
I do see the Other options... link. But the following options seem like they are to be used if no IDE is installed :
My Question is
How to get IntelliJ IDE (which is already installed) in the dropdown of JetBrains Gateway
You need to run a script to turn the server on
"The main script to run a remote IDE is remote-dev-server.sh, located in the bin subdirectory of your unpacked IDE"
From the Jetbrains instructions here

IntelliJ Remote debugger connects successfully but doesn't stop

I'm trying to do a remote debug on IntelliJ. I have my remote debug setup using this command in IntelliJ -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=40779 Currently when I hit local server with port 40779 and I check the logs I see that logging works so the code does execute. I set the breakpoint at the log just for sanity check to make sure that it would suspend at the point however it doesn't. I'm currently using Intellij 2020.2. I tried upgrading to Intellij 2020.3 and also the latest version 2021.1. I also tried invalidating the cache/restarting and also removing/adding all my breakpoints again.
The files I'm setting the breakpoints are Kotlin files and my Kotlin plugin version 203-1.5.0-release-759-IJ7717.8. I can also successfully run debug and connect to remote server Connected to the target VM, address: 'localhost:40779', transport: 'socket' but when I make a request to that server, the breakpoints don't stop.

How to debug custom mule 4 SDK connector?

I have a custom mule 4 SDK connector, I want to debug runtime and design time.
Just connect a Java debugger to the JVM. The connector is Java code.
To debug runtime:
Go to your Anypoint Studio, open "Run Configurations", select your Mule project from "Mule Applications" on the left (you need to run it at least once for it to appear here). Then in the "Arguments" tab add to the VM arguments: -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=1044 - this will enable to attach to your debugger from the IDE you use for SDK development.
In your IDE add a debug config with connection type "Socket Attach", provide host (localhost) and port (1044).
Now you can set breakpoints in your IDE then start the Mule project in Anypoint Studio. When it is at the point of launching the runtime JVM (watch the Console) it will stop and wait for you to start the debug config set above and execution shall hit your breakpoints.
To debug design-time:
Go to where you installed Anypoint Studio, find AnypointStudio.ini
Add following contents after the -vm plugins line:
-vmargs
-Xdebug
-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8888
also uncomment following two lines near the end, so they look like this:
#To_debug_the_mule_instance_uncomment_the_following_line
-Dmule.tooling.debug=true
#To_specify_the_debug_port_for_the_design_time_mule._E.g._To_debug_connectors_code_at_design_time.
-Dmule.toolingInstance.debugPort=8000
In your IDE create two "Socket Attach" type debug config, for localhost and ports 8888 and 8000.
Start Anypoint Studio. It will wait for you to start the debug config for port 8888, then it will come up. A minute later start the debug config for port 8000 - this is the one attaching to the design-time JVM. You can watch the threads starting in the Debug perspective of your IDE.
Just select Connect Java Debugger checkbox in Window -> Preferences -> Anypoint Studio -> Debugger

Apache Tomcat 8.5 . Error: Service terminated with service specific error incorrect function

i have installed apache tomcat 8.5 one month ago with java 1.8 on Windows Server 2008 and it works ok.
now the service is stopped and i'm not able to restart it from apache configuration or Windows Services . It is always stopped.
i got the following error: "service terminated with service specific error incorrect function".
ther error in Windows Event viewer does not saying nothing more:
even its details tab:
What can i do?
I was trying to install Apache Tomcat/8.5.31 as Windows service and i was also facing the same error.
For me what finally worked was following these steps. Go to Tomcat installation directory's bin folder. You will see two EXEs (tomcat8.exe and tomcat8w.exe). tomcat8w.exe is a GUI application for monitoring and configuring Tomcat services. Double-click it and then go to Java tab
1) Enable the check box for Use default
2) In Java Classpath: section, specify the path to bootstrap.jar and tomcat-juli.jar. These should be present in your tomcat installation's bin directory itself:
<path_to_tomcat_installation>\bin\bootstrap.jar;<path_to_tomcat_installation>\bin\tomcat-juli.jar
To get more help, you may check the log at the following location provided you installed your Tomcat as Windows service using default LogPath option as described in the documentation: %SystemRoot%\System32\LogFiles\Apache
UPDATE: In another recent installation, i noticed that despite having configuration settings exactly similar to another working setup, i was still getting Incorrect function error under System log in Event Viewer. This time, i had to uncheck the Use default option and had to explicitly provide path to jvm.dll as shown below:
Java Classpath setting was still required as explained above.
Currently I have a Windows Server 2012 R2 Datacenter running Tomcat 9 & had the same problem. This happened after I ran Windows updates & restarted the Server.
Error messages below. (The blanked out text is my private data.)
Error showed when attempting to start the service.
Error in System Event Log
The following steps fixed the issue...
Navigate to your tomcat9w.exe Location: \Tomcat9\bin\
Right click your tomcat9w.exe and select Run as administrator.
Select the Java tab. Select Use default, Apply, & OK
Start your service.
Note: I unchecked the "Use default" box after I was able to get the service running correctly. Because I wanted to retain my existing configuration. Going forward the service has continued to work correctly.
Hope this helps!
I was also facing some issue with Tomcat 9 and Java 13 (tried all previously mentioned solutions but nothing worked). When I downgraded it to Java 11 and Pointed the jvm.dll from JDK 11 my issue got fixed (or Use Default if JAVA_HOME is set to Java 11).
In my case the only way I could get it to work, was to go to the "Startup" tab and change "Mode" from "JVM" to "Java". After that, it started fine and was able to confirm that by visiting the localhost.
(Definitely not an expert)
I fixed this issue by (re)installing Java. I was using the Java SDK downloaded by IntelliJ. Although I was able to direct Tomcat to that download during installation, it returned this "error service terminated" message at runtime. Instead I installed Java SDK directly from Oracle, Tomcat found the installation immediately during installation (I didn't need to point it), and this error disappeared.
It's possible the Java installation by IntelliJ was incomplete somehow and is the underlying cause of the problem, but I am definitely not an expert.
I fixed the issue by reinstalling Tomcat:
Search the Command Prompt icon
Right-click on it
Select Run as administrator
Change the folder to the bin folder of Tomcat
Execute appserver uninstall
Execute appserver install
It solved my problem.
I followed the below steps to fix the the above issue. it may help if someone still face the same.
Step 1. opened the installation directory : tomcat9w.exe Location: \Tomcat9\bin\
Step 2. Browsed the Jvm.dll path under "Java Tab" in Tomcat where it has installed
Step 3. Run the service but still faced same.
Step 4. then, Opened ""C:\Program Files (x86)\Apache Software Foundation\Tomcat 9.0\bin>startup.bat --> entered.
Finally it got fixed .

Can't launch JBoss7 from Eclipse Indigo

I can't figure out where I am going wrong. I have Eclipse Indigo, JBoss 7.1, JBoss Tools installed. I have this configuration working on my Windows7 64-bit system. I am attempting to set up a co-worker's Windows XP 32-bit machine with the same configuration but am not able to get the server to launch. I have configured the server but when I attempt to start the server, I get an error indicating that it was unable to start the server but there is no specific error listed.
I am able to start JBoss from the command prompt using the standalone.bat file.
I am able to configure the standalone.xml file from within Eclipse. I have confirmed this by checking the file in the standalone/configuration directory.
When I attempt to publish the project from within Eclipse, it does not publish.
Nothing gets written to server.log
The startup parameters match what I have on my computer.
I can't figure out what I am missing. Any suggestions would be appreciated!
Edit:
I have done some more checking. I am able to publish to the server and I am able to start the server (with the published application) fine from the command prompt. That part works. When I attempt to start the server from within Eclipse it gives me "Server JBoss 7.1 Runtime Server failed to start." It never writes anything to the console tab in Eclipse either so I can't tell why it is failing to start.
Also in the Servers tab, there is an entry called "Server Details". When I expand that entry, it says "Not Connected".
The answer to my problem is that Eclipse had be configured to use the java JDK, not the JRE. As soon as I switched over to use the JDK it started working fine. For some reason JBoss will start under 64-bit windows with the JRE but under 32-bit you need to use the JDK. I found the answer here: https://community.jboss.org/thread/169097