unable to create a service for SpringBoot on Linux Ubuntu 14.04.5 LTS

Question!

i just deployed a springboot app 1.4.1.RELEASE on Ubuntu 14.04.5(linode server) but having hard time making it run as service(start, stop, restart). I chanced on http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/html/deployment-install.html#deployment-service but it didn't help. I can't upgrade the Ubuntu server at the moment to a 16.04.1 since other apps are dependent on this version. I desperately need help on this.

  • I tried running

    ~$ sudo ln -s /opt/xxxx/xxxx-0.0.1.jar /etc/init.d/xxxx-0.0.1

  • sudo service myapp start

but got response: xxxx-0.0.1: unrecognized service

Please Help



Answers

Issue resolved with great joy:)

i had to change my pom.xml file from

          <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <executions>
                <execution>
                    <goals>
                        <goal>repackage</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

to

        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
                <executable>true</executable>
            </configuration>
        </plugin>

and it worked perfectly...



It looks like a strange issue.

For now, I can suggest you do the following things:

  • Check if your *.jar file is executable. Type sudo chmod +x /opt/xxxx/xxxx-0.0.1.jar to be sure about that and start service again.
  • Try to copy *.jar file to /etc/init.d/ directory instead of creating link. Type cp /opt/xxxx/xxxx-0.0.1.jar /etc/init.d/ and start service again.

Let me know if it helped. If not, maybe we can figure out a different solution.

Regards



This video can help you solving your question :)
By: admin