How to change default user and password for Tomcat?

682

Solution 1

Look at conf/tomcat_users.xml.

Uncomment the roles and users block. Define a role named admin (if tomcat6) or manager-gui (tomcat7). Then, define a user named as you want with the password you like AND the role admin or manager-gui assigned to it.

Restart your tomcat. Test.

Solution 2

Just look for C:\xampp\tomcat\conf\tomcat_users.xml then put your user account within <tomcat-users> tag. For example:

<tomcat-users>
  <role rolename="admin"/>
  <role rolename="manager"/>
  <user username="admin" password="letmein" roles="admin,manager"/>
</tomcat-users>

Also, don't forget to restart your Tomcat server!

Solution 3

This worked for me. Use the admin-gui and admin-script roles as well

<role rolename="admin-gui"/>
<role rolename="admin-script"/>
<role rolename="admin"/>
<role rolename="manager"/>
<user username="nick" password="1" roles="admin,manager,admin-gui,admin-script"/>

Solution 4

Look at conf/tomcat_users.xml.

Share:
682

Related videos on Youtube

NJGUY
Author by

NJGUY

Updated on September 18, 2022

Comments

  • NJGUY
    NJGUY over 1 year

    In my code below, I have created two sounds, sound1 and sound2. Each sound contains a number of samples that allow the same sound to be played simultaneously. The problem is that if I create seemingly more than 6 to 8 AVAudioPlayerNodes with a AVAudioUnitTimePitch for each, the audio gets completely messed up. I can't even play a single sound when I increase the number of samples too high. I'm not sure if my code is wrong, or what the node limit of AVAudioEngine is.

    class AudioManager{
        var audioEngine:AVAudioEngine!;
        var mixer:AVAudioMixerNode!;
        var sound1:Sound!;
        var sound2:Sound!;
        init(){
            audioEngine = AVAudioEngine();
            mixer = audioEngine.mainMixerNode; //automatically creates instance of mixer node, output node, and connects
    
            do{
                try audioEngine.start();
            }catch let e as NSError{
                print("Error Starting AudioEngine \(e)");
            }
    
            sound1 = Sound(aManager: self, path: "assets/sounds/waterRefill", ofType: "mp3", numOfSamples: 7);
            sound2 = Sound(aManager: self, path: "assets/sounds/balloonCreate", ofType: "mp3", numOfSamples: 2);
    
    
        }
    
        func playSound(){
            sound1.play(1.0, pitch: 1.0);
        }
    
        func playSound2(){
            sound2.play(1.0, pitch: 1.0);
        }
    
        class Sound {
            var audioManager:AudioManager!;
            var audioFileBuffer:AVAudioPCMBuffer!;
            var numSamples:Int = 1;
            var audioIndex:Int = 0;
            var sampleList:[Sample] = [Sample]();
    
            init(aManager:AudioManager, path:String, ofType:String, numOfSamples:Int){
                audioManager = aManager;
                if(numOfSamples < 1){
                    numSamples = 1;
                }else{
                    numSamples = numOfSamples;
                }
                audioFileBuffer = createAudioBuffer(path, ofType: ofType);
                for (var i = 0; i < numSamples; i++){
                    sampleList.append(Sample(sound: self));
                }
            }
    
            func createAudioBuffer(path:String, ofType:String)-> AVAudioPCMBuffer?{
                let filePath: String = NSBundle.mainBundle().pathForResource(path, ofType: ofType)!
                let fileURL: NSURL = NSURL(fileURLWithPath: filePath)
                do{
                    let audioFile = try AVAudioFile(forReading: fileURL)
                    let audioFormat = audioFile.processingFormat
                    let audioFrameCount = UInt32(audioFile.length)
                    let audioFileBuffer = AVAudioPCMBuffer(PCMFormat: audioFormat, frameCapacity: audioFrameCount)
                    do{
                        try audioFile.readIntoBuffer(audioFileBuffer)
                        return audioFileBuffer;
                    }catch let e as NSError{
                        print("Error loading Audio Into Buffer: \(e)");
                    }
                }catch let e as NSError{
                    print("Error loading Audio File: \(e)");
                }
                return nil;
            }
    
            private func runIndex(){
                if(audioIndex < (numSamples-1)){
                    audioIndex++;
                }else{
                    audioIndex = 0;
                }
            }
    
            func play(volume:Float, pitch:Float){
    
                var count:Int = 0;
                while(count < numSamples){
                    if(numSamples > 1){
                        runIndex();
                    }
                    if (!sampleList[audioIndex].pitchPlayer.playing) {
                        sampleList[audioIndex].volume = volume;
                        sampleList[audioIndex].pitch = pitch;
                        sampleList[audioIndex].playSample();
                        break;
                    }
                    count++;
                }
    
            }
    
            class Sample{
                var parentSound:Sound!
                var pitchPlayer:AVAudioPlayerNode!;
                var timePitch:AVAudioUnitTimePitch!;
                var volume:Float = 1.0
                var pitch:Float = 1.0
    
                init(sound:Sound){
                    parentSound = sound;
                    pitchPlayer = AVAudioPlayerNode();
                    timePitch = AVAudioUnitTimePitch();
    
                    parentSound.audioManager.audioEngine.attachNode(pitchPlayer);
                    parentSound.audioManager.audioEngine.attachNode(timePitch);
    
                    parentSound.audioManager.audioEngine.connect(pitchPlayer, to: timePitch, format: parentSound.audioFileBuffer.format);
                    parentSound.audioManager.audioEngine.connect(timePitch, to: parentSound.audioManager.mixer, format: parentSound.audioFileBuffer.format);
    
    
                }
    
                func playSample(){
                    pitchPlayer.volume = volume;
                    timePitch.pitch = pitch;
                    print("Sample Play");
    
                    pitchPlayer.play();
                    pitchPlayer.scheduleBuffer(parentSound.audioFileBuffer, atTime: nil, options:.Interrupts, completionHandler: {[unowned self]() in
                        print("Is Stopped: \(self.pitchPlayer.playing)");
                        self.pitchPlayer.stop();
                        print("Is Stopped: \(self.pitchPlayer.playing)");
                        });
                }
            }
        }
    }
    
    • vikzilla
      vikzilla about 8 years
      My app that plays files using AVAAudioEngine and AVAudioPlayerNodes was not playing sounds on certain devices (worked fine on newer devices like iPhone 6s Plus though). When I reduced the number of nodes on the engine, it worked on the older devices. I am looking into how I can adjust my code to allow it to work on these older devices because node count seems to be the issue.
  • George Bora
    George Bora over 12 years
    Thank you for the help, I've edited the file with Notepad ++ and decomented the roles and have tried the role1,tomcat,both and manager ones. But now while I can enter a password I get : HTTP Status 403 - Access to the requested resource has been denied .
  • Nils
    Nils over 12 years
    What tocmat version are we talking about? 5.5 should have the UserDataBase activated by default in conf/server.xml and conf/Catalina/localhost/manager.xml.