How to run WildFly with standalone-full.xml from IntelliJ IDEA? - intellij-idea

I'm trying to run Wildfly 8.0 from Intellij IDEA. When starting WildFly through commmand-line I can use the -c standalone-full.xml parameter to use the standalone-full.xml configuration file. How can I specify this when running WildFly from Intellij IDEA?

In my opinion switch -c standalone-full.xml is not a VM Option so I will post a little bit different solution:
In the Run/Debug configuration for your server in the tab Startup/Connection you have the ability to set Startup script: On the end of line there is checkbox Use default. Please unselect it and paste on the end of the input -c standalone-full.xml

Adding -Djboss.server.default.config=standalone-full.xml to VM_OPTIONS is the equivalent of running standalone -c standalone-full.xml from a shell

As said by Mike Holdsworth -Djboss.server.default.config=standalone-full.xml works perfectly.
But there is another advantage over the -c standalone-full.xml method.
When you rename your standalone.xml file to create custom configuration files for multiple environments. Like env1.xml, env2.xml, etc.
If you use -c env1.xml, Intellij will give you the following message:
Error: HTTP management port configuration not found.
So you have to put a basic standalone.xml who will be overriden at the startup by the one you give with the -c option.
The -Djboss.server.default.config=env1.xml will prevent it.

Look out for different startup scripts for "Run" and "Debug" in Intellij IDEA. If you don't uncheck "Use default" in both of them then you can end up with two different profiles on "Run" and "Debug". It is easy to forget and annoying to figure it out.

If you want to run it by default w/o passing any command line parameters than go
to standalone.(bat|sh)
Append to the SERVER_OPTS variable: --server-config=standalone-full.xml
At least now you'll run it in full mode from any place (ide, service, command line)

I'm on a cross-platform team and we share our run configs. Modifying the startup script could cause problems (other teammate's paths and startup scripts are different), so my solution was:
Made a backup of standalone.xml
Renamed standalone-full.xml to standalone.xml
This doesn't answer the OP's question directly, but may be helpful for folks.

In the Run/Debug configuration for your server you have the ability to set VM options. You can put your switch in there. You may have problems however with jboss identifying the correct path for the file, so you may have to play with that a little bit before it works for you.

Run -> Edit configurations -> Click '+' in the top left corner -> JBoss Server -> Local
There you can configure your JBoss instance and set VM options and so on.

Related

How configure Azure function project in Intellij/Pycharm run/debug configurations on mac

How to configure Azure function project in Intellij/Pycharm run/debug configurations on Mac because I've tried to set it by my own but it doesnt work.
I would like to replace shell command: func start with run config
The image below from Pycharm
UPDATE
I've added path to Azure-CLI and imported my app-settings
I'm trying to configure the run configs but it asks to select the module but there is no any module in dropdown (see pic)
UPDATE-UPDATE:
Here is what azure-tools-for-intellij team me answered:
They dont support pure python functions run yet
I think you shouldn't use row shell scrip with IntelliJ/PyCharm instead of this you should use Azure Toolkit for IntelliJ and run/debug your functions like in this guide.
Also when you install Azure Toolkit for IntelliJ you will have the opportunity to create run/debug configuration with predefined Azure Function ready template.
Just example:
I found the way to debug in Intellij Idea/PyCharm.
add these lines at the top of your file/module:
import pydevd_pycharm
pydevd_pycharm.settrace('127.0.0.1', port=9091, stdoutToServer=True, stderrToServer=True)
set Python Debug Server with host and port in Run/Debug Configs
run your azure functions as used to (func host start) and press debugging button.
The way I do it in PyCharm is to define a shell script configuration (Edit Configurations > Shell Script) and set:
Execute: Script set
Script text: func start
Working directory: should be to project directory where host.json etc. is located
Environment variables: leave empty
Execute in the terminal: checked
Run this configuration, which will start the test server in terminal. Then go to Run > Attach to Process... and select the process (usually it's the one without any path after the number).

how to start Leingen with java -Djavax.net.debug=true option?

I am trying to diagnose a few issues with ssl connectivity with Leingen. I am trying to find what SSL Key Store and Trust Store is being Used by Leingen,
I am behind a corporate firewall and we have self signed certificates deployed on all our desktops . I am running lein.bat on a windows 10.
Hence I have to start Leingen with java -Djavax.net.debug=true option.
The :jvm-opts in the project.clj wont work -- I need to make sure the Liengen's JVM is started with this option
You can set leiningen JVM options by setting LEIN_JVM_OPTS environment variable before running lein in the same terminal session.
The lein command is just a shell script which eventually invokes java with various options. You can edit this script to see what options are used and/or to modify them.
As Piotrek mentioned, the LEIN_JVM_OPTS environment variable is the canonical way of passing options to the jvm in which lein runs. You can see it used on line 372 of the source code.
For your case:
> export LEIN_JVM_OPTS='-Djavax.net.debug=true'
> lein clean
> lein run
Since you're running windows, you'll want to actually look at the lein.bat file. You'll still need to update LEIN_JVM_OPTS, but how you go about it will be a bit different. If you're using windows command terminal (cmd.exe) you will want to use the set command.
set LEIN_JVM_OPTS="-Djavax.net.debug=true"
The command is likely different if you're using powershell, and you can likely find out how to set that on this page on environment variables.

IntelliJ HTTP-Proxy works but fails at gradle dependencies

so currently at work I face the problem, that I cannot build projects, which use global dependencies. We use an auto-config proxy script, which I already set in the File->Settings->Appearance & Behaviour->System Settings->HTTP Proxy and tested with the Check Connection-function.
The check connection function is working for any arbitrary html and also for the needed gradle-file (jcenter.bintray.com/com/android/tools/build/gradle/2.0.0/gradle-2.1.0-javadoc.jar).
For solutions I already tried to:
set the Proxy Information into the gradle.properties
tried to set http and/or https proxy settings
* systemProp.http(s).proxyHost=linktoproxyconfig.org
* systemProp.http(s).proxyPort=xxxx
* systemProp.http(s).proxyUser=xxxx
* systemProp.http(s).proxyPassword=xxxx
changing the repository direction (jcenter() vs. jcenter{url http://jcenter.bintray.com}
I am aware of the fact, that one can work offline, downloading the gradle locally. But to prevent the additional maintenance of gradle versions on different machines I would like to restrain from the work offline option.
Edit: Maybe I should also add the error message:
Gradle sync failed: Connection timed out: connect. If you are behind an HTTP proxy, please configure the proxy settings either in IDE or Gradle.
I would be most grateful if someone has an idea about a solution.
IntelliJ IDEA 2017.3 does not seem to respect the proxy options for downloading Gradle. So add the proxy options to both gradle.properties and gradle-wrapper.properties, and then run ./gradlew in a terminal. This will download Gradle. After that, IntelliJ will work.
It also happend to me and the problem was that Gradle installation was wrong. I added a GRADLE_HOME environment variable and appended %GRADLE_HOME%/bin to PATH. I restarted the IDE and it worked! :)
Source: https://docs.gradle.org/current/userguide/installation.html#sec:installation_environment_variables
Another possible caveat:
Check if your environment variables for GRADLE_USER_HOME is set. Gradle will look for the gradle.properties in this directory.
I am facing the same problem because I using the proxy in Windows 10. Going to set the auto dectect the proxy fixed the connection timeout problem:
version IntelliJ IDEA 2022.1.2 (Community Edition).

How to run Apache Tomcat 8 in debug mode?

I am trying to run Apache Tomcat 8.0.21 in debug mode.
When I give the command
sh catalina.sh jpda start
it gives this error.
error message
ERROR: Cannot load this JVM TI agent twice, check your java command
line for duplicate jdwp options. Error occurred during initialization
of VM agent library failed to init: jdwp
Can anyone help ?
Either
unset CATALINA_OPTS
unset JPDA_ADDRESS
unset JPDA_OPTS
unset JPDA_TRANSPORT
catalina.sh jpda start
Or
# in .bashrc, .profile etc.
export CATALINA_OPTS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000 -Djava.security.egd=file:/dev/urandom -Denv=dev -Xms1024M -Xmx2048M -XX:PermSize=256M -XX:MaxPermSize=768m"
# At your shell prompt
./startup.sh
Explanation
As Arnab said in the comments, if your shell configuration includes environment variables mentioning jdpw (such as CATALINA_OPTS, JDPA_ADDRESS, JPDA_OPTS), just launch using ./startup.sh as if you were not trying to do remote debugging and the script will pick up the jdpw option from your environment variables.
The launch option syntax catalina.sh jpda start should only be used if you don't have any environment variables that already specified a remote debug port. It's meant to be convenient but if you've previously configured your shell to support java remote debugging you're probably mixing the two alternative approaches.
You can just add env variable and run the tomcat as usual
Debug port is 8000 in this case
export CATALINA_OPTS="-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n"
Then run the tomcat
sh ./catalina.sh start
This happened to me with Eclipse when I tried to add the debugging parameters (-Xdebug -agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=y) so I could suspend Tomcat on start. Unfortunately I then launched my Tomcat (within Eclipse) using the Debug button.
Why this is a problem
When you are launching Tomcat in Debug mode Eclipse itself inserts the debug parameters. When you have your own debug parameters in the launch configuration you are indeed passing them twice.
So if you need to launch Tomcat from within Eclipse and suspend it on start (so you can connect with debugger) you need to:
- add the debugging parameters to the "Arguments -> VM arguments" box of your launch config,
- and then Run this config, not Debug.
This way only the debugging parameters from your launch config are added.
There is alternative approach, recommended in 'catalina.sh':
"Do not set the variables in this script. Instead put them into a script
setenv.sh in CATALINA_BASE/bin to keep your customizations separate."
For Windows, the file name with environment variables will be 'setenv.bat'.
Thank you mr Dimitar II
Verified this works perfectly and is consumed automatically when running startup.bat
file: setenv.bat
#echo off
rem The proper way to set environment up for running Catalina
set "CATALINA_OPTS=-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n"

Play 2 & Cloudbees: Could not resolve substitution to a value

I am deploying my Play! 2.1 application on Cloudbees.
I have in my application.conf:
# Database configuration
# ~~~~~
db.default.driver=com.mysql.jdbc.Driver
db.default.url=${MYSQL_URL_DB}
db.default.user=${MYSQL_USERNAME_DB}
db.default.password=${MYSQL_PASSWORD_DB}
I defined those values in Cloudbees configuration:
$ bees config:list -a myself/my-app
Application Parameters:
proxyBuffering=false
MYSQL_URL_DB=jdbc:cloudbees://my-app
MYSQL_USERNAME_DB=my-app
MYSQL_PASSWORD_DB=yummy
Runtime Parameters:
java_version=1.7
I publish my app using git (git push cloudbees cloudbees:master) which triggers Jenkins. But when it comes to deploying application, I get in Jenkins logs:
[error] (compile:compile)
com.typesafe.config.ConfigException$UnresolvedSubstitution:
conf/application.conf: 16: Could not resolve substitution to a value:
${MYSQL_PASSWORD_DB}
Is there anything else to do to make Jenkins aware of the configuration? Did I misunderstand something?
Thanks for your help!
Alban
You can add "?" to the beginning, so it will be treated as an override.
db.default.url=${?MYSQL_URL_DB}
You can also handle fallback situations with this approach, if you like.
db.default.url=mysql://fallback_url
db.default.url=${?MYSQL_URL_DB}
If MYSQL_URL_DB does not exist, fallback_url will be used.
This configuration is injected at runtime, not build time. You have to find a way to make the sbt build ignore unresolved substitution.
It seems a possible workaround is to set MYSQL_URL_DB=foo, etc as build environment variables, so that the check don't break, as they won't be actually injected in your configuration
I use a config like this:
https://github.com/CloudBees-community/play2-clickstart/blob/master/conf/application.conf
and a build command like this:
java -Xms512M -Xmx1536M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=384M -jar /opt/sbt/sbt-launch-0.11.3-2.jar -Dsbt.log.noformat=true clean compile test dist
And it does not worry about the missing environment variables.
My guess is that there is a scala macro or something that triggers the compiler to resolve those variables. Adding them in is fine.
I have amended the clickstart to set default values in case they are needed.