Spring Boot service RPM returns code=exited status=203/EXEC when installing on CentOS

946 Views Asked by At

I prepared an RPM package to be installed on CentOS. It seems to install successfully. However I cannot launch it - it throws that 203 error. Process: 4574 ExecStart=/opt/vcs/cegp/dtm/my_service/my_service.jar (code=exited, status=203/EXEC)

The parent pom has an rpm plugin inside <build><pluginManagement>:

    <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>rpm-maven-plugin</artifactId>
    <version>${plugin-rpm-maven.version}</version>
    </plugin>

It also has a resources plugin which copies the needed resources. All of them seem to end up where I need them. The actual code and everything is placed in child module, which has all the dependencies, assembly plugin, etc. and this rpm plugin:

<profile><id>rpm</id>
   <build>
<pluginManagement>
  <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>
<version>${plugin-rpm-maven.version}</version>
<executions>
<execution>
 <id>generate-rpm</id>
     <phase>install</phase> 
      <goals>
         <goal>rpm</goal>
  </goals>
 </execution>
</executions>
<configuration>
<license>...</license>
<version>${project.version}</version>
<group>Applications/System</group>
<name>${artifact-id}</name>
<defaultUsername>${rpm.username}</defaultUsername>
<defaultGroupname>${rpm.groupname}</defaultGroupname>
<vendor>...</vendor>
<distribution>rhel8</distribution>
<defaultDirmode>755</defaultDirmode>
<defaultFilemode>755</defaultFilemode>

<mappings>
<mapping>
  <directory>${rpm.service.file.directory}</directory>
   <directoryIncluded>false</directoryIncluded>
    <filemode>555</filemode>
    <username>root</username>
         <groupname>root</groupname>
           <sources>
               <source>
                <destination>my_service.service</destination>
                <location>
                    target/scripts/rpm/etc/systemd/system/my_service.service
                </location>
            </source>
        </sources>
    </mapping>
    <mapping>
        <directory>${rpm.install.directory}</directory>
        <filemode>550</filemode>
        <sources>
            <source>
                <location>${main.basedir}/SERVICE_HOME</location>
            </source>
        </sources>
    </mapping>

    <mapping>
        <directory>${rpm.install.directory}</directory>
        <filemode>777</filemode>
        <sources>
            <source>
                <destination>${artifact-id}.jar</destination>
                <location>${project.build.directory}/MyService.jar</location>
            </source>
        </sources>
    </mapping>


</mappings>
<preinstallScriptlet>
    <scriptFile>${main.basedir}/src/main/scripts/rpm/preInstall.sh</scriptFile>
</preinstallScriptlet>
<postinstallScriptlet>
    <scriptFile>${main.basedir}/src/main/scripts/rpm/postInstall.sh</scriptFile>
</postinstallScriptlet>
<preremoveScriptlet>
    <scriptFile>${main.basedir}/src/main/scripts/rpm/preRemove.sh</scriptFile>
</preremoveScriptlet>
</configuration>
</plugin>

Here's the my_service.service file

[Unit]
Description=Event Consumer
After=syslog.target

[Service]
Type=simple
Restart=always
RestartSec=5
User=vcs_pbl
ExecStart=/opt/vcs/cegp/dtm/my_service/my_service.jar
WorkingDirectory=/opt/vcs/cegp/dtm/my_service/
SuccessExitStatus=143

[Install]
WantedBy=multi-user.target

This, as I said, does generate an RPM (Jenkins, RedHat) which I'm able to install on CentOS 8, but it fails to launch. I've read a ton of other answers regarding this error here and on Linux branch, but none of them helped me.

0

There are 0 best solutions below