no main manifest attribute, in app.jar(Docker run命令出错)

这篇具有很好参考价值的文章主要介绍了no main manifest attribute, in app.jar(Docker run命令出错)。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

解决no main manifest attribute, in app.jar

环境:SpringBoot2.6.13+java8

  • 重点:pom.xml文件是IDEA自动配的,然后出错

我在将一个SpringBoot程序打包成镜像部署到Docker容器上,然后执行run命令启动容器:

docker run --rm springboot-test:1.0

springboot-test:1.0是我的镜像

出现报错:

no main manifest attribute, in app.jar

我排查出来问题就在pom.xml文件中我画红线的这一句
no main manifest attribute, in app.jar,jar,docker,java,运维,容器,云原生,spring boot

改为下面这张图这样就好了
no main manifest attribute, in app.jar,jar,docker,java,运维,容器,云原生,spring boot

完整的pom.xml文件如下:文章来源地址https://www.toymoban.com/news/detail-779687.html

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.example</groupId>
    <artifactId>DockerTest</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>DockerTest</name>
    <description>DockerTest</description>
    <properties>
        <java.version>1.8</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <spring-boot.version>2.6.13</spring-boot.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>${spring-boot.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>${spring-boot.version}</version>
                <configuration>
                    <mainClass>com.example.dockertest.DockerTestApplication</mainClass>
                    <layout>JAR</layout>
                </configuration>
                <executions>
                    <execution>
                        <id>repackage</id>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>

到了这里,关于no main manifest attribute, in app.jar(Docker run命令出错)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • Docker部署(5)——使用docker run命令部署运行jar项目

           对于一些简单的单体项目,可以使用 docker run 命令可以直接在命令行中运行容器,无需事先构建镜像。这相较于之前使用的 dockerfile 文件来运行部署项目相当于是另外一种简单的部署方法,关于之前使用dockerfile 文件来运行部署这种方法,具体可以参考下面这篇文章

    2024年02月10日
    浏览(35)
  • idea Error running Application. Command line is too long. Shorten the command line via JAR manifest

    idea内容太长报错 报错: Error running Application. Command line is too long. Shorten the command line via JAR manifest or via a classpath file and rerun. 解决方法: 点击“Edit Configurations...”   选择左边的一个应用,点击 “Modify options”   点击 “Shorten command line”  点击 “Jar mainfest”  点击“Apply” 依

    2024年02月12日
    浏览(34)
  • 最近复现deepsort,发现run demo 出现错误module ‘numpy‘ has no attribute ‘float‘.

    AttributeError: module \\\'numpy\\\' has no attribute \\\'float\\\'. `np.float` was a deprecated alias for the builtin `float`. To avoid this error in existing code, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use ` np.float64 ` here. The aliases was originally deprecated in NumPy 1.20; fo

    2024年02月13日
    浏览(29)
  • Exception in thread “main“ java.sql.SQLException: No suitable driver

    详细报错信息如下: Exception in thread \\\"main\\\" java.sql.SQLException: No suitable driver     at java.sql.DriverManager.getDriver(DriverManager.java:315)     at org.apache.spark.sql.execution.datasources.jdbc.JDBCOptions.$anonfun$driverClass$2(JDBCOptions.scala:107)     at scala.Option.getOrElse(Option.scala:189)     at org.apache.spark.sq

    2024年02月07日
    浏览(42)
  • sparkbug解决:Exception in thread “main“ java.lang.UnsupportedOperationException: No Encoder found for

    报错: 问题原因: Spark SQL中的 Dataset 类需要一个编码器来将JVM对象序列化为内部的Spark SQL格式。而对于复杂类型(比如 Row 或者自定义类),Spark 需要隐式的 Encoder ,代码因为缺少这样的编码器,所以会导致 UnsupportedOperationException 异常。 附上代码 问题解决: 添加 Encoders.kr

    2024年02月04日
    浏览(36)
  • Flink提交jar出现错误RestHandlerException: No jobs included in application.

    今天打包一个flink的maven工程为jar,通过flink webUI提交,发现居然报错。 如上图所示,提示错误为: Server Response Message: org.apache.flink.runtime.rest.handler.RestHandlerException: No jobs included in application. at 【解决方案】 查看  JOB Manager日志 发现是环境问题,再仔细看 ,居然使用了 Stream

    2024年02月10日
    浏览(92)
  • 解决:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin 命令行mvn打包的时候报错:No compiler is provided in this environment. Perhaps you are running on a JRE

    1.mvn clean install -DskipTests; idea terminal 打包报错(用idea右边maven插件打包是没有问题的)。 [ INFO ] BUILD FAILURE [ INFO ] ------------------------------------------------------------------------ [ INFO ] Total time:  1.095 s [ INFO ] Finished at: 2022-03-30T03:40:49+08:00 [ INFO ] --------------------------------------------------

    2024年02月08日
    浏览(47)
  • 超详细干货解决Exception in thread “main“ java.lang.ClassNotFoundException及No suitable driver found for jdbc

    最近一直被eclipse的WindowBuilder和java继jdbc连接Mysql的问题困扰,终于摸索出对我有用的解决方法,希望这对你也有所帮助! 首先,当你在eclipse等IDE编译器里Run数据库连接后,出现Exception in thread \\\"main\\\" java.lang.ClassNotFoundException的结果报错,我本人后面出现的还有illegal一串字符,

    2024年02月06日
    浏览(46)
  • Run sql server in docker

    Pull the latest image of SQL Server 2022 It\\\'s recommended to use the same string for \\\'name\\\' and \\\'hostname\\\', could be \\\'sqlserver2022\\\' or anything you like. 1. Start an interactive bash shell inside your running container 2. Inside the bash shell, connect locally with \\\'sqlcmd\\\' 3. You can connect with SSMS too,  using the public IP address, followed by comma

    2024年02月05日
    浏览(69)
  • Error: L6406E: No space in execution regions with .ANY selector matching main.o(.bss).

    编译程序出现多个类似报错报错:.FlashLPC17xx-uCos-II-Mould.axf: Error: L6406E: No space in execution regions with .ANY selector matching main.o(.bss). 这个问题其中原因可能是 芯片的IRAM空间不足。解决方法是 在KEIL 的Target中选择 IRAM2前的框打勾。 打勾后编译,如果还是不行,那么就点开 C/C++,将

    2024年02月15日
    浏览(34)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包