How to debug Liferay portlet using IntelliJ idea? - intellij-idea

I deploy my application using Maven on Liferay 7 (on Tomcat 8). But I need to debug it. How to configure my debug? Because, when I start maven with debug mode, it builds and stops. I have no ideas how to deal with it

Maven with debug mode is only targeted to debug maven build processes. If you want to debug your portlet you should follow the next steps:
Run Menu Entry > Edit Configurations > Add New Remote Configuration > Configure your host and debug port
You have to check too that JPDA port is enabled your Tomcat (you can enable it in your startup.sh/startup.bat script adding jpda in the final line)
exec "$PRGDIR"/"$EXECUTABLE" jpda start "$#"

Quick generic answer (someone with actual IntelliJ experience can probably give more details):
You start tomcat, that has Liferay deployed. Follow the advice you have for "how to debug tomcat applications". The caveat is that you might need to point IntelliJ to the source files for some (all) of the modules in Liferay - which is a huge task (being composed out of 500 modules. For eclipse I'm aware of a fix, for IntelliJ I'm not aware. I'm pretty sure such a beast exists though.
It will be easier (e.g. quick) if you only need your own modules' source.

Related

How to enable JRebel with gradle and tomcat plugin for IntelliJ

I have a IntelliJ Community Edition with Gradle 4.3.1 and com.bmuschko.tomcat plugin running. My application will be deployed currently and its working, now I want to enable JRebel for this. So that changes on my webapp folder will be hot-deployed.
At the plugin site is a description for this
Edit your Gradle startup script and add the following line to it to
tell Gradle to use the JRebel agent. Please make sure to set the
environment variable REBEL_HOME that points to your JRebel
installation directory.
JAVA_OPTS="-javaagent:$REBEL_HOME/jrebel.jar $JAVA_OPTS"
Currenty its not clear for me where do I need to change this? Obiously JRebel is not active when I start my tomcat with the pluging.
What I did:
installed the jrebel plugin in intellij
enabled the jrebel functionality with the ide
manually added a rebel.xml file (as described on the plugin site) in the build/classes/main folder
Where do I need to edit the gradle start up so that jrebel is active for gradle builds?
There are two ways you can run gradle that will affect how to add the arguments, with the daemon and without.
If you run gradle tomcatRun --no-daemon the arguments for JRebel must be added via JAVA_OPTS or GRADLE_OPTS environment variables. So this means either running as GRADLE_OPTS=-agentpath:/path/to/jrebel/lib/libjrebel64.so gradle tomcatRun --no-daemon or specifying the variable in a script(gradlew if you are using it). If you run the gradle task directly from IntelliJ, you can specify environment variables there.
If you run with the daemon, the GRADLE_OPTS variable will set JVM arguments for the launcher process, not the daemon. This will mean that JRebel is included in the wrong process and your changes aren't monitored. One way to set JVM arguments for the daemon is by adding the following to your gradle.properties
org.gradle.jvmargs='-agentpath:/path/to/jrebel/lib/libjrebel64.so'
Running with the daemon will mean that the JRebel banner is not displayed so don't be alarmed as the changes will still be monitored.
Also since JRebel 7.0 the folder structure was changed and the jrebel.jar located in installation root is the new core which requires additional bootstrapping provided by the included native agents in the jrebel/lib dir. It is suggested to use the corresponding native agent for your OS/arch using the agentpath argument and not the javaagent argument as in the tomcat plugin docs.

how to setup the environment to debug the Restcomm-smsc source code

can you please describe me how to setup a development environment with intellij IDEA for restcomm-smsc to debug run compile build and doing breakpoints etc.
i am using ubuntu 14.04.
i could run the smsc gateway from the binary package and do the simulator tests but when it comes to do some coding and debugging and building stuff, i cannot creat e the correct development environment for restcomm-smsc source code.
i really appreciate if you can guide me simply how to do it?
Thanks a lot
BR
Gokhan
Do you want to debug application deployed on JBoss? If so you need to simply add/uncomment JAVA_OPTS="$JAVA_OPTS -agentlib:jdwp=transport=dt_socket,address=$DEBUG_PORT,server=y,suspend=n" in run.sh/standalone.sh.
In intellij Run -> Edit Configurations -> Remote and provide jboss IP and port from JAVA_OPTS.

Gradle + JRebel + rebel-remote.xml without JRebel IDE Plugin

Can you use standalone + JRebel remote?
I have my IDE on Box A
I have my App on Box B
I want to be able to make gradle build on Box A and automatically have B hot deploy that.
If Possible I'd like all this needs to work without The intelliJ plugin because it's broken and produces the wrong paths to lib locations in our complex gradle project.
No.
Synchronization with remote servers can only done via JRebel IDE plugin.
If you have any troubles with the IDE plugin or the Gradle plugin, please contact support at support#zeroturnaround.com
It's not possible to use JRebel remoting without the IDE plugin as the remote server does licensing checks during a sync transaction and classes simply copied to the remote .cache folder will be rejected otherwise.
However you can still setup a manual remoting setup. For example you can create a "virtual" workspace on BoxB where classes/jars/wars are copied after the build. In this scenario disable the remoting plugin and use standard rebel.xml-s which map to the workspace on BoxB.
When doing changes, simply copy the files from BoxA to BoxB e.g. using rsync and they will be reloaded as usual. However note that in this setup you must provide the server on BoxB with a valid license.

Tomcat support on WebStorm

I am JavaScript developer, and currently working on project where Tomcat server is used.
I am familiar with IntelliJ idea but recently read about another JetBrains product specially for web-development - WebStorm. I've found some cool features in WebStorm(especially related to AngularJS autocompletion) but it seems that there is no Tomcat server support and I have to build server side of project into *.war-file and run it manually through terminal each time.
So is there any Tomcat/Java support in WebStorm?
(Or I should continue to use IntelliJ idea and forget about WebStorm and its cool functionality =) )
You can do one thing.
First start your apache tomcat server with startup.bat/startup.sh. (Suppose your project directory name is "AngularJSTest" in WebStorm.)
Right click on that > Refactor > Move .
Give the path to webapps directory of Apache tomcat.
So from now on whatever changes you make in the project from WebStorm, it will get reflected in the webapps directory. You can access it from the link http://localhost:8080/AngularJSTest/yourHtml.html.

How is Tomcat handled by IntelliJ IDEA 10.5

I am a newbie to IntelliJ IDEA. I was trying to deploy a web app in Tomcat.
It failed to deploy and i was not able to see any errors in the log console.
After much searching, I was able to find out the log files at
~/Library/Caches/IntelliJIdea10/tomcat/_p1/logs/ folder.
There were a bunch of log files here and one of the files contained the error. I then could solve the issue and proceed.
I was a user of eclipse and this error would have come directly in the log console in eclipse. However this is not the case in IntelliJ IDEA. Can somebody please explain what I am missing here?
Also, it would be nice if somebody could point out how the integration with Tomcat is done in IDEA (for better understanding). Note: I am using IntelliJ IDEA 10.5.2 Ultimate edition on Mac OS 10.6.8.
IntelliJ IDEA instructs Tomcat to use temporary directory as CATALINA_BASE where it places context configuration with the Artifact path from your project settings, it doesn't copy your web application into webapps directory.
In the Tomcat Run/Debug configuration there is Logs tab where you can specify custom logs to show in IDEA console, it should work out of the box, but probably you have customized logging in Tomcat configuration or in the application itself. Or maybe Tomcat 7 logging configuration is different and doesn't work with IDEA in which case you should submit a bug.
Here's some info for Windows users....if you check the boxes for 'Show console when stdout/stderr change', you may find that the Output tab does not show up even if stdout/stderr change.
For me, this was due to directory structure for the project containing spaces.
When I renamed the directory structure so that it did not contain spaces the Output tab showed up.
Found solution here: Cannot deploy project to tomcat inside intellij IDEA 14. Applications Context was incorrect.
Run/Debug Configurations -> Deployment tab -> Applications Context