Search code examples
bashpermissionsinit.datlassian-fisheyeatlassian-crucible

Atlassian Fisheye Crucible - Init.d service fisheye No default permission scheme exists Error creating bean with name 'defaultMentionParserListener'


Ubuntu 14.04 (VirtualBox/Vagrant machine).

Fisheye artifact zip version: 3.9.1

As it doesn't come with a init.d level startup script, I created the following script /etc/init.d/fisheye:

#!/bin/bash

# FISHEYE_HOME: The path to the FishEye installation. It's recommended to create a symbolic link to the latest version so
# the process will still work after upgrades. Be sure to update the symlink itself when upgrading.
# Example: ln -s /usr/local/atlassian/applications/fisheye/4.2.0 /usr/local/atlassian/applications/fisheye/latest
FISHEYE_HOME="/mnt/fecru-3.9.1"

# FISHEYE_INST: The path to store Fisheye data.
# The 2 lines below should be uncommented only if you don't have the environment variables set in /etc/environment file.
#export FISHEYE_INST="/mnt/fecru-3.9.1_fisheye_data"
#mkdir -p $FISHEYE_INST || sudo mkdir -p $FISHEYE_INST

fisheyectl() {
    if [ ! -f "$FISHEYE_HOME/fisheyeboot.jar" ] ; then
       echo "Error: Could not find $FISHEYE_HOME/fisheyeboot.jar"  
       exit 1
    fi
    #exec "$FISHEYE_HOME/bin/fisheyectl.sh" "$1"
    "$FISHEYE_HOME/bin/fisheyectl.sh" "$1"
}

case "$1" in
        start)
                fisheyectl start
                ;;
        stop)
                fisheyectl stop
                ;;
        restart)
                fisheyectl stop
                sleep 10
                fisheyectl start
                ;;
        status)
                fecru_pid=$(ps -eAf|grep fecru|grep -v grep|sed "s/[ \t][ \t]*/ /g"|cut -d" " -f2|head -1)
                if [[ -n "${fecru_pid}" ]]; 
                then
                    echo "Process 'fecru' fisheye/crucible is running. PID (${fecru_pid})"
                else
                    echo "Process 'fecru' fisheye/crucible is NOT running."
                fi
                ;;

        *)
                echo "Usage: $0 {start|stop|status|restart}"
esac

echo "- Log files are available here:" 
if [[ -n "${FISHEYE_INST}" ]]; 
then
  echo "$(find "${FISHEYE_INST}/var/log" | sed "s/^/  /")"; 
else
  echo "$(find "${FISHEYE_HOME}/var/log" | sed "s/^/  /")"
fi
echo

exit 0

As a root user, when I'm trying to run service fisheye start, I see it's starts the process but fails at the end showing the following main error.

2017-03-03 19:59:30,586 ERROR - No default permission scheme exists
2017-03-03 19:59:30,743 ERROR - The Web context could not be started
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'defaultMentionParserListener' defined in URL 

Full log: /mnt/fecru-3.9.1/var/log/fisheye.out file: download here

How can I get this resolve and get fisheye started? Folder /mnt/fecru-3.9.1 has valid 775 permissions (recursively set) for the user root.

Turning the debug (shell / bash -x) option on fisheyectl.sh file, shows:

+ CMD=/usr/bin/java  -Xmx1024m  -Dfisheye.library.path= -Dfisheye.inst=/mnt/fecru-3.9.1 -Djava.awt.headless=true -Djava.endorsed.dirs=/mnt/fecru-3.9.1/lib/endorsed -jar /mnt/fecru-3.9.1/fisheyeboot.jar start 
+ echo Starting FishEye/Crucible... Output redirected to /mnt/fecru-3.9.1/var/log/fisheye.out
Starting FishEye/Crucible... Output redirected to /mnt/fecru-3.9.1/var/log/fisheye.out
+ whoami
root
+ echo

+ echo

+ nohup sh -c exec /usr/bin/java  -Xmx1024m  -Dfisheye.library.path= -Dfisheye.inst=/mnt/fecru-3.9.1 -Djava.awt.headless=true -Djava.endorsed.dirs=/mnt/fecru-3.9.1/lib/endorsed -jar /mnt/fecru-3.9.1/fisheyeboot.jar start 

Solution

  • I didn't have to be root. I turned to root user as I was getting those weird permission issues even though both vagrant/root user had 775 (vagrant:root as chown) set recursively on /mnt/fecru-3.9.1 folder.

    Solution was: 1) I changed the init.d level script to set FISHEYE_INST folder (which was different than /mnt/fecru-3.9.1 folder.

    #!/bin/bash
    
    # FISHEYE_HOME: The path to the FishEye installation. It's recommended to create a symbolic link to the latest version so
    # the process will still work after upgrades. Be sure to update the symlink itself when upgrading.
    # Example: ln -s /usr/local/atlassian/applications/fisheye/4.2.0 /usr/local/atlassian/applications/fisheye/latest
    FISHEYE_HOME="/mnt/fecru-3.9.1"
    
    # FISHEYE_INST: The path to store Fisheye data.
    # The 2 lines below should be uncommented only if you don't have the environment variables set in /etc/environment file.
    export FISHEYE_INST="/mnt/fecru-3.9.1_fisheye_data"
    mkdir -p $FISHEYE_INST || sudo mkdir -p $FISHEYE_INST
    
    fisheyectl() {
        if [ ! -f "$FISHEYE_HOME/fisheyeboot.jar" ] ; then
           echo "Error: Could not find $FISHEYE_HOME/fisheyeboot.jar"  
           exit 1
        fi
        "$FISHEYE_HOME/bin/fisheyectl.sh" "$1" 
    }
    
    case "$1" in
            start)
                    fisheyectl start
                    ;;
            stop)
                    fisheyectl stop
                    ;;
            restart)
                    fisheyectl stop
                    sleep 10
                    fisheyectl start
                    ;;
            status)
            fecru_pid=$(ps -eAf|grep fecru|grep -v grep|sed "s/[ \t][ \t]*/ /g"|cut -d" " -f2|head -1)
                    if [[ -n "${fecru_pid}" ]]; 
                    then
                        echo "Process 'fecru' fisheye/crucible is running. PID (${fecru_pid})"
                    else
                        echo "Process 'fecru' fisheye/crucible is NOT running."
                    fi
                    ;;
    
            *)
                    echo "Usage: $0 {start|stop|status|restart}"
    esac
    
    echo "- Log files are available here:" 
    if [[ -n "${FISHEYE_INST}" ]]; 
    then
      echo "$(find "${FISHEYE_INST}/var/log" 2>/dev/null | sed "s/^/  /")"; 
    else
      echo "$(find "${FISHEYE_HOME}/var/log" 2>/dev/null | sed "s/^/  /")"
    fi
    echo
    
    exit 0
    

    2) Note: /mnt/fecru-3.9.1 folder I got from unzipping the artifact which I placed under /mnt folder. 3) As I set FISHEYE_INST variable, what the process would do is it'll use that folder (for running Fisheye/Crucible) process and will store it's data/log inside /mnt/fecru-3.9.1_fisheye_data

    4) Now I can be any user with valid sudo access (and don't have to be root).

    5) So I ran: sudo service fisheye start, sudo service fisheye status, this start step started Fisheye portal on port 8060 (default).

    vagrant@myubuntuvagrant:~$ sudo service fisheye status
    Process 'fecru' fisheye/crucible is running. PID (9080)
    - Log files are available here:
      /mnt/fecru-3.9.1_fisheye_data/var/log
      /mnt/fecru-3.9.1_fisheye_data/var/log/atlassian-fisheye-2017-03-03.log
      /mnt/fecru-3.9.1_fisheye_data/var/log/fisheye.out
    

    This time log file (as per the new location FISHEYE_INST based) was: /mnt/fecru-3.9.1_fisheye_data/var/log/fisheye.out and it showed the following:

        17  2017-03-03 21:25:54,927 INFO  - =======================================================
        18  2017-03-03 21:25:54,927 INFO  - 
        19  2017-03-03 21:25:54,928 INFO  - Welcome to FishEye!
        20  2017-03-03 21:25:54,928 INFO  - 
        21  2017-03-03 21:25:54,928 INFO  - You need to configure an admin password and enter your
        22  2017-03-03 21:25:54,928 INFO  - license key. You can do this by accessing FishEye through
        23  2017-03-03 21:25:54,928 INFO  - a web browser, once the server has started:
        24  2017-03-03 21:25:54,928 INFO  - 
        25  2017-03-03 21:25:54,935 INFO  - http://myubuntuvagrant:8060
        26  2017-03-03 21:25:54,935 INFO  - 
        27  2017-03-03 21:25:54,936 INFO  - Refer to the FishEye administration guide
        28  2017-03-03 21:25:54,936 INFO  - for more information:
        29  2017-03-03 21:25:54,936 INFO  - 
        30  2017-03-03 21:25:54,937 INFO  - https://confluence.atlassian.com/display/FISHEYE/Starting+to+use+FishEye
        31  2017-03-03 21:25:54,937 INFO  - 
        32  2017-03-03 21:25:54,937 INFO  - =======================================================
        33  2017-03-03 21:25:54,937 INFO  - 
        34  2017-03-03 21:25:54,940 INFO  - Your Server ID is B0SX-F5FH-3753-40DM
        35  2017-03-03 21:25:55,251 INFO  - Adding secondary content dir of /mnt/fecru-3.9.1_fisheye_data/content
        36  2017-03-03 21:26:02,175 INFO  - Starting database...
        37  2017-03-03 21:26:03,233 INFO  - BoneCP - tracking statements enabled for pool [mainPool]
        38  2017-03-03 21:26:05,304 INFO  - BoneCP - tracking statements enabled for pool [retriablePool]
        39  2017-03-03 21:26:05,786 INFO  - Database started.
        40  2017-03-03 21:26:07,515 INFO  - Starting plugin system...
    2017-03-03 21:25:54,937 INFO  - 
    2017-03-03 21:25:54,937 INFO  - =======================================================
    2017-03-03 21:25:54,937 INFO  - 
    2017-03-03 21:25:54,940 INFO  - Your Server ID is B0SX-F5FH-3753-40DM
    2017-03-03 21:25:55,251 INFO  - Adding secondary content dir of /mnt/fecru-3.9.1_fisheye_data/content
    2017-03-03 21:26:02,175 INFO  - Starting database...
    2017-03-03 21:26:03,233 INFO  - BoneCP - tracking statements enabled for pool [mainPool]
    2017-03-03 21:26:05,304 INFO  - BoneCP - tracking statements enabled for pool [retriablePool]
    2017-03-03 21:26:05,786 INFO  - Database started.
    2017-03-03 21:26:07,515 INFO  - Starting plugin system...
    2017-03-03 21:26:11,119 INFO  - Mail system not configured.
    2017-03-03 21:26:55,616 INFO  - Plugin system started.
    2017-03-03 21:26:57,088 INFO  - Server started on :8060 (http) (control port on 127.0.0.1:8059)
    

    NOTE: As I was using a Vagrant machine, in my vagrant file's configuration Vagrantfile, I had the following port mapping on my Guest VM (ubuntu) and my Host machine (Mac OS).

      # Create a forwarded port mapping which allows access to a specific port
      # within the machine from a port on the host machine. In the example below,
      # accessing "localhost:8080" will access port 80 on the guest machine.
      config.vm.network "forwarded_port", guest: 80, host: 8180
      config.vm.network "forwarded_port", guest: 8060, host: 8160
    

    This means, I can access an application/portal running in the Guest VM on port 8060 on my Host Mac machine as port 8160.

    Thus, doing http://localhost:8160 -OR- http://10.20.30.40:8160 (IP of my Mac machine) will show Fisheye portal running which I can easily configure.

    I don't know why when the default installation folder was /mnt/fecru-3.9.1 as I had FISHEYE_INST varible commented out, then I got those errors even though user/owner and group was set to vagrant/root and with 775 permission in the whole path.

    Setting FISHEYE_INST solved the issue.

    This init.d script can be enhanced by adding a little logic to create a PID file as well.

    Actions start, stop, restart, status all worked as expected.

    vagrant@myubuntuvagrant:~$ sudo service fisheye status
    Process 'fecru' fisheye/crucible is running. PID (9080)
    - Log files are available here:
      /mnt/fecru-3.9.1_fisheye_data/var/log
      /mnt/fecru-3.9.1_fisheye_data/var/log/atlassian-fisheye-2017-03-03.log
      /mnt/fecru-3.9.1_fisheye_data/var/log/fisheye.out
    
    vagrant@myubuntuvagrant:~$ sudo service fisheye stop
    INFO  - Using log4j configuration file: /mnt/fecru-3.9.1/log4j-client.xml
    INFO  - FishEye arguments: []
    FishEye Shutdown successfully
    Problem connecting to 127.0.0.1:8059
    java.net.SocketException: Connection reset
        at java.net.SocketInputStream.read(SocketInputStream.java:210)
        at java.net.SocketInputStream.read(SocketInputStream.java:141)
        at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284)
        at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326)
        at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
        at java.io.InputStreamReader.read(InputStreamReader.java:184)
        at java.io.BufferedReader.fill(BufferedReader.java:161)
        at java.io.BufferedReader.readLine(BufferedReader.java:324)
        at java.io.BufferedReader.readLine(BufferedReader.java:389)
        at com.cenqua.fisheye.ctl.BaseRemoteCommand.sendCommand(BaseRemoteCommand.java:96)
        at com.cenqua.fisheye.ctl.BaseRemoteCommand.mainImpl(BaseRemoteCommand.java:57)
        at com.cenqua.fisheye.ctl.Stop.main(Stop.java:11)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at com.cenqua.fisheye.FishEyeCtl.mainImpl(FishEyeCtl.java:101)
        at com.cenqua.fisheye.FishEyeCtl.main(FishEyeCtl.java:44)
    - Log files are available here:
      /mnt/fecru-3.9.1_fisheye_data/var/log
      /mnt/fecru-3.9.1_fisheye_data/var/log/atlassian-fisheye-2017-03-03.log
      /mnt/fecru-3.9.1_fisheye_data/var/log/fisheye.out
      /mnt/fecru-3.9.1_fisheye_data/var/log/atlassian-fisheyectl-2017-03-03.log
    
    vagrant@myubuntuvagrant:~$ sudo service fisheye status
    Process 'fecru' fisheye/crucible is NOT running.
    - Log files are available here:
      /mnt/fecru-3.9.1_fisheye_data/var/log
      /mnt/fecru-3.9.1_fisheye_data/var/log/atlassian-fisheye-2017-03-03.log
      /mnt/fecru-3.9.1_fisheye_data/var/log/fisheye.out
      /mnt/fecru-3.9.1_fisheye_data/var/log/atlassian-fisheyectl-2017-03-03.log
    
    vagrant@myubuntuvagrant:~$ sudo service fisheye start
    Starting FishEye/Crucible... Output redirected to /mnt/fecru-3.9.1_fisheye_data/var/log/fisheye.out
    - Log files are available here:
      /mnt/fecru-3.9.1_fisheye_data/var/log
      /mnt/fecru-3.9.1_fisheye_data/var/log/atlassian-fisheye-2017-03-03.log
      /mnt/fecru-3.9.1_fisheye_data/var/log/fisheye.out
      /mnt/fecru-3.9.1_fisheye_data/var/log/atlassian-fisheyectl-2017-03-03.log
    
    vagrant@myubuntuvagrant:~$ sudo service fisheye status
    Process 'fecru' fisheye/crucible is running. PID (9657)
    - Log files are available here:
      /mnt/fecru-3.9.1_fisheye_data/var/log
      /mnt/fecru-3.9.1_fisheye_data/var/log/atlassian-fisheye-2017-03-03.log
      /mnt/fecru-3.9.1_fisheye_data/var/log/fisheye.out
      /mnt/fecru-3.9.1_fisheye_data/var/log/atlassian-fisheyectl-2017-03-03.log
    
    vagrant@myubuntuvagrant:~$ 
    

    6) Portal (per the mapped port 8160) was like: enter image description here

    NOTE: For a machine to auto start fisheye service/process at reboot/boot time, I ran the following: sudo update-rc.d fisheye defaults and made sure /etc/init.d/fisheye file had valid 755 executable permissions.

    To test that, after I did the above, I logged out of my Ubuntu vagrant machine, went to the the folder where I had my Vagrantfile place, and ran the following commands: vagrant halt; vagrant up; vagrant ssh. I was again, logged into my vagrant machine, where I ran the following to make sure Fisheye/Crucible service/process was running by running:

    vagrant@myubuntuvagrant:~$ ps -eAf|grep fecru
    root      1119     1 65 21:55 ?        00:00:21 /usr/bin/java -Xmx1024m -Dfisheye.library.path= -Dfisheye.inst=/mnt/fecru-3.9.1_fisheye_data -Djava.awt.headless=true -Djava.endorsed.dirs=/mnt/fecru-3.9.1/lib/endorsed -jar /mnt/fecru-3.9.1/fisheyeboot.jar start
    vagrant   2023  1924  0 21:55 pts/0    00:00:00 grep --color=auto fecru
    vagrant@myubuntuvagrant:~$ date
    Fri Mar  3 21:55:39 UTC 2017
    vagrant@myubuntuvagrant:~$ sudo service fisheye status
    Process 'fecru' fisheye/crucible is running. PID (1119)
    - Log files are available here:
      /mnt/fecru-3.9.1_fisheye_data/var/log
      /mnt/fecru-3.9.1_fisheye_data/var/log/atlassian-fisheye-2017-03-03.log
      /mnt/fecru-3.9.1_fisheye_data/var/log/fisheye.out
      /mnt/fecru-3.9.1_fisheye_data/var/log/atlassian-fisheyectl-2017-03-03.log