Running tomcat in debug mode as a brew service? - homebrew

I have got tonnes of articles to run tomcat in debug mode by starting it as a with the startup scripts. I am running tomcat as a brew service on Mac, and using the below command(s) to start/stop the service:
brew services start/stop/restart tomcat
I also tried adding the jpda startup script in startup.sh with the above method but it didn't work. Still exploring around to see if someone has the solution to this. Meanwhile, if someone can help?
Running Tomcat 9 via Homebrew.

You can determine where your tomcat installation is located with brew list tomcat.
Then create a setenv.sh in the libexec/bin folder of your installation. Make sure that the file owner/permissions are set as for the other files in this directory.
In the setenv.sh, you can specify the debugging options that you want to set by e.g. adding the following line at the bottom:
export CATALINA_OPTS="$CATALINA_OPTS -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=18000"
Then restart tomcat and you should be able to connect your debugger to tomcat applications.

Related

Autoload/PHPUnit not found by PhpStorm with Docker Desktop + Docker Compose + WSL

My PHP project is stored in WSL, accessed by PhpStorm installed on Windows and running with Docker Desktop installed on Windows.
The Project itself is totally fine, but running Tests is not possible because PhpStorm cannot find the vendor autoload or phpunit.phar in Test Framework configuration.
Setup:
Windows 10 with WSL2 Ubuntu 20.04 LTS
PhpStorm on Windows
Docker Desktop on Windows, Docker Compose files in WSL
Code in home folder in WSL (see following screens)
I read in some older threads that Docker Compose v2 needs to be enabled in Docker Desktop. It is:
Docker is configured inside of PhpStorm and shows that the connection is successful (I know that works because things like Xdebug is working without any issues):
Notice that I configured a path mapping here for the project root.
in WSL: \\wsl$\Ubuntu\home\USERNAME\workspace\PROJECTNAME-web-docker
in Docker: /var/www/PROJECTNAME-web
I can see that those paths are correct by either logging into the Docker container or by checking the Service Tab of PhpStorm and inspecting files:
This is my CLI Interpreter using the docker-compose configuration:
It does not matter if I use the existing container or if it should be starting a new one
PHP Version is always detected
And finally the error inside of Test Framework:
Here I tried different things:
use composer autoloader or phpunit.phar
it doesn't matter if I use a full path /var/www... or just vendor/...
tried different path mappings here
clicking on refresh shows this error in a small popup
Cannot parse PHPUnit version output: Could not open input file: /var/www/PROJECTNAME-web/SUBTOPIC/vendor/phpunit/phpunit/phpunit
autoload.php is definitely available and correct, phpunit is installed and available.
Maybe someone has a hint what is missing or wrong? Thanks!
EDIT:
How do I know that autoload is available or path mapping is correct?
I have Xdebug configured and running. When Xdebug stops in my code, I know that the path mapping is correct. The output of Debug -> Console for example shows stuff like this:
PHP Deprecated: YAML mapping driver is deprecated and will be removed in Doctrine ORM 3.0, please migrate to annotation or XML driver. in /var/www/PROJECTNAME-web/SUBTOPIC/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php on line 62
so I know the path mapping for xdebug works, but seems like Test Framework config does not like it.

Docker not starting on Windows 11 with WSL 2

I'm trying to setup docker with WSL 2 to run a Dockerfile. I downloaded Docker Desktop, and when I tried to follow the quick start guide, I got the following error:
docker: error during connect: This error may indicate that the docker daemon is not running.: Post "http://%2F%2F.%2Fpipe%d2Fdocker_engine/v1.24/containers/create?name=repo": open //./pipe/docker_enginer: The system cannot find the file specified.
I set com.docker.service to run in the Task Manager, and have run:
“c:\Program Files\Docker\Docker\DockerCli.exe” -SwitchDaemon
I have also quit Docker Desktop and reopened it in admin mode, and I still get the message that Docker Desktop has stopped.
Please let me know if there's any other options, thanks!
I managed to solve the problem in this way:
delete config file AppData/Roaming/Docker/settings.json
start Docker Desktop (it will create new default settings.json)
You need to re-configure settings, so it is also good idea to save the old settings.json and compare settings with the new one.
If you are running Docker Desktop for Windows 4.5.0 then you should be aware of an existing issue where the default backend selected after installing is not the correct one.
You can switch to the correct backend manually by editing the file located at: %AppData%\Docker\settings.json (full path: C:\Users\%UserName%\AppData\Roaming\Docker\settings.json) and at the bottom of the file change the value for the wslEngineEnabled field to true. After that Docker Desktop should start correctly.
Similar issue and solution is mentioned here by the user mccaa25.
latest version 4.5.0 It won't work for me too, for me downgrade to 4.4.4 it worked. It may be problem with the latest version
for released note and older version Here
Note: You can install an older version and update to latest version 4.5.0
Wow! I spent multiple days trying to get Docker for windows 11 to work. What finally did it was downgrading to version 4.4.4 as #GinglrBell recommended. Here's a link Docker version 4.4.4.
Make sure WSL is installed and virtualization is enabled. If you try to open WSL and you get an error telling you to enable virtualization in BIOS, run this command as Admin in powershell: bcdedit /set hypervisorlaunchtype auto (Docker src). Then restart your PC.
I hit this issue today, and the steps below are what worked for me - the gist is that I needed to install WSL 2 beforehand. Most of my steps were derived from here:
open powershell as admin
wsl -l -v # Windows Subsystem for Linux has no installed distributions
install linux kernel update from here # in my case, x64-based
wsl --set-default-version 2
wsl --list --online # shows several linux distributions, I picked a recent one
wsl --install -d Ubuntu-20.04 # then create default linux user name and password
install windows docker desktop from here # now starts successfully
Manged to switch to Windows Containers. (Docker v4.9.0)
What I did was to change the following in the settings.json:
"useWindowsContainers": true,
"wslEngineEnabled": true,
Also set security on folder:
C:\ProgramData\Docker (I set "Everyone" full control.)
After that I used the "Switch to Windows Containers"-feature from the task-bar icon content menu
I tried Janne Rantala's method.
But the same problem occurs again after several days.
My final solution is to uninstall Docker Desktop, then download and run the installation file as an administrator.
Then the problem no longer appears again.
I was able to resolve this issue on my machine by installing the Linux kernel update package as described in the Microsoft guide
I have been having some Docker setting up troubles for a fair amount of time. I think I had to just make sure I removed all references of Docker. After buying Windows 10 pro I still had issues, I did have to look into the following folders:
C:\Users\%UserName%\AppData\Local\Temp\Docker
C:\Users\%UserName%\AppData\Roaming\Docker
I also deleted the Docker file in my programfiles folder
Navigated to said file and deleted Docker files.
Used the docker installer, checkboxes (to use wsl2).
I was faicing the same issue and resolved. I have just open Microsoft Store application and after that opened the docker and its working fine. This is wired but sharing this so it might helps someone.
I solved this issue by enabling the windows feature "Windows Hypervisor Platform" and restarting my computer.
I installed Docker Desktop v4.16.2

IntelliJ is not detecting php.ini inside a container when using docker compose

I'm trying to configure Xdebug for IntelliJ and my docker-compose project. Xdebug is installed and loaded inside the app container, I have confirmed this with phpinfo(); , the php.ini file that is responsible for the configuration of Xdebug is also loaded which was confirmed through php --ini.
The problem. IntelliJ detects my container from which it can determine a PHP version as well as a host of other configuration files. But php.ini is not detected and Xdebug is not detected, I confirmed this through the phpinfo output that IntelliJ provides.
Any help would be much appreciated.
edit: I don't have any other containers running, only web and db. IntelliJ is targeting web for its scan.

Jenkins won't start after plugin installation *and does not log anything*

I installed Jenkins' Gradle plugin and used the automatic restart option via the Jenkins web interface. Jenkins seemed to hang on the "restarting..." page, so I finally tried to manually restart the Jenkins service on the server (64-bit Debian 7) using service jenkins restart.
Now, Jenkins is no longer running at all (verified with ps -ef | grep -i [J]enkins and service jenkins status), and when I try service jenkins [re]start, I see an [ ok ] message but nothing else seems to happen. I've deleted /var/log/jenkins/jenkins.log, and each time I try a service start (or restart), the log file reappears, but it's blank (ls -lA shows that the file was recently made, but cat produces no output). I also tried rebooting the server, with no effect. I finally deleted the Gradle folders under /var/lib/jenkins/plugins, which also did not appear to make a difference.
How do I even begin to approach this problem? Should I just re-install Jenkins?
EDIT: System info:
> uname -a
Linux AUC-Workstation1 3.2.0-4-amd64 #1 SMP Debian 3.2.68-1+deb7u1 x86_64 GNU/Linux
According to dpkg -l, I'm using Debian's jenkins package, version 1.617.
EDIT 2: I'm actually using the jenkins package provided directly by Jenkins, as per the instructions here.
I just had a problem where multiple Jenkins plugins were breaking Jenkins startup (after an upgrade) and here is the procedure I followed to resolve the issue, which might work for other plugin startup issues.
I'm working on an Ubuntu server, but I expect that this would work for Debian if it's going to work at all - I encourage others to adjust the procedure:
logged into the server and switched to the jenkins user (sudo su jenkins in my case)
went to the main jenkins directory
renamed plugins to plugins.problems_YYYYMMDD
previously, I attempted to disable the plugins, but this did not work for me (system still would not start)
created an empty directory plugins
restarted jenkins (sudo service jenkins restart)
In my case, this started just fine
iteratively followed the following procedure to add plugins back in
copied 1 or more plugins from plugins.problems_YYYYMMDD/ to plugins/
restarted jenkins
went to the plugin center and installed updates as available
sometimes I needed to install updates in a particular order due to dependencies
evaluated results in 'Manage Old Data'
I think I'm facing some manual updates of the old data
Note: if you know which plugins are likely the problem, then it is easier to just disable or temporarily (re)move them rather than (re)moving all of the plugins!
I never did figure out the initial problem, but I did get Jenkins working again, sort of.
I uninstalled Jenkins (using apt-get purge) and then re-installed it. This time it failed to start because it needed Java 7, but I apparently only had Java 6 installed (this surprised me, because I thought I had previously configured Jenkins to use Java 7 on that machine). So I installed openjdk-7-jdk and openjdk-7-jre, set JAVA and JAVA_HOME appropriately in the Jenkins config file, and started the service again. This allowed Jenkins to start.

How to set Neo4j auto start when booting?

I want to start my Neo4j service when booting, and my system environment is Redhat.
I add below text on /etc/rc.d/rc.local, but it is not working
/opt/neo4j/bin/neo4j start
But it works for MongoDB...
/opt/mongodb/bin/mongod
Please take a look at the Neo4j reference for Linux installation. You can find it here:
http://docs.neo4j.org/chunked/stable/server-installation.html#_linux_service
We have an installer script that will configure Neo4j to startup at system boot $ /path/to/neo4j-community-2.1.4/bin/neo4j-installer install
First remove the text you've added from /etc/rc.d/rc.local to make sure there aren't any conflicts.
You can also use our debian package installation to automatically download, install, and configure Neo4j as a service on Linux.
That information can be found here: http://debian.neo4j.org/

Resources