netbeans icon indicating copy to clipboard operation
netbeans copied to clipboard

Double deploy

Open Eccenux opened this issue 3 years ago • 1 comments

Apache NetBeans version

Latest release

What happened

  1. Deploy Java web application to Tomcat (run from Netbeans).
  2. Stop Tomcat (e.g. from Netbeans).
  3. Wait (for Tomcat to fully stop).
  4. Debug the app (debug project from Netbeans).

The app starts twice. Is first started with the server and then re-deployed. This causes various problems. Obviously longer startup. But also some tasks will run twice (tasks scheduled on app startup).

The app should be deployed once (remove the app before starting Tomcat and then start and deploy).

Did this work correctly in an earlier version?

  • [ ] This used to work!

Operating System

Windows 10

JDK

JDK 15

Apache NetBeans packaging

Apache NetBeans provided installer

Anything else

Note that I had this with JDK7 and Tomcat7 and the same on Tomcat9 with JDK15. The project is on Spring Boot 2.6 on Maven (older on Spring 3 something and also a Maven project). So none of that seem to be a factor.

Are you willing to submit a pull request?

  • [ ] Yes I am willing to submit a PR!

Code of Conduct

Eccenux avatar Feb 14 '22 18:02 Eccenux

i found this fixed on netbeans25

keepgoodwork avatar May 16 '25 09:05 keepgoodwork

Still the same on NB26.

Even relatively simple micro service projects that use latest SpringBoot deploy twice.

Workaround:

  1. Clear work and temp dirs (I use a script for that, on Windows running with Git bash). Crucially this removes: work\Catalina\localhost\aash\
  2. Remove project's xml from conf dir: conf\Catalina\localhost\aash.xml.

Perhaps Netbeans could do something like that: before starting Tomcat remove localhost/projectName.xml and localhost/projectName/ (where projectName is the name of the project being deployed).

clear-temp.sh:

: <<'COMMENT'

Running on Windows:
1. Open Tomcat's main dir in Git Bash (the dir with `conf` and `bin`).
2. Run this file. (or paste the code in console)

Or create lnk with tomcat as the workdir.

COMMENT

# del
echo "Removing work contents..."
rm -rf ./work/*
echo "Removing temp contents..."
rm -rf ./temp/*

echo -e "\nDone\n"

# PAUSE
read -rsp $'Press any key to continue...\n' -n 1 key

Eccenux avatar Jul 21 '25 15:07 Eccenux