Tomcat Database connection config

dmeridith
New Contributor III

Does anybody know where the TomCat Configuration is stored. I am having a problem where it is asking for a password every time tomcat is restarted.

2 REPLIES 2

rderewianko
Valued Contributor II

Depends on the OS
Mac: /Library/JSS/Tomcat/webapps/ROOT/WEB-INF/xml/DataBase.xml
Linux: /usr/local/jss/tomcat/webapps/ROOT/WEB-INF/xml/DataBase.xml
Windows: C:Program FilesJSSTomcatwebappsROOTWEB-INFDataBase.xml

More Information: https://jamfnation.jamfsoftware.com/article.html?id=360

- RD

charliwest
Contributor II

When tomcat is restarted it will be expanding the ROOT.war file each time, therefor over writing the edits to the DataBase.xml (at least I believe thats how it works). They way I do it is take the ROOT.war, expand it, change the files I need, DataBase.xml and log4j.properties (as the location is the mac default location which isn't good for linux). Then repack the war file and put that in the webapps directory.

#!/bin/bash
unzip -qq -o -d /tmp/JSS ~/LOCATION/OF/ORIGINAL/WAR/ROOT.war

OLD="Library/JSS/Logs"
NEW="var/log/JSS"
DPATH="/tmp/JSS/WEB-INF/classes/log4j.properties"
BPATH="/tmp"
TFILE="/tmp/out.tmp.$$"
[ ! -d $BPATH ] && mkdir -p $BPATH || :
for f in $DPATH
do
  if [ -f $f -a -r $f ]; then
    /bin/cp -f $f $BPATH
   sed "s/$OLD/$NEW/g" "$f" > $TFILE && mv $TFILE "$f"
  else
   echo "Error: Cannot read $f"
  fi
done
/bin/rm $TFILE

OLD2="jamfsw03"
NEW2="YOURDBPW"
DPATH2="/tmp/JSS/WEB-INF/xml/DataBase.xml"
BPATH2="/tmp"
TFILE2="/tmp/out.tmp.$$"
[ ! -d $BPATH2 ] && mkdir -p $BPATH2 || :
for f in $DPATH2
do
  if [ -f $f -a -r $f ]; then
    /bin/cp -f $f $BPATH2
   sed "s/$OLD2/$NEW2/g" "$f" > $TFILE2 && mv $TFILE2 "$f"
  else
   echo "Error: Cannot read $f"
  fi
done
/bin/rm $TFILE2
echo 'Files edited'
cd /tmp/JSS ;
zip -r -qq /LOCATION/TO/SAVE/ROOT.war *