qq_41917077
2018-11-07 06:28
采纳率: 75%
浏览 986
已采纳

boot项目eclipse可以正常运行,打包成jar包之后就报错Cannot determine embedded...

图片说明
图片说明

    <packaging>pom</packaging>

    <properties>
        <java.product.version>8</java.product.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <aspectj.plugin.version>1.8</aspectj.plugin.version>
        <asciidoclet.version>1.5.4</asciidoclet.version>
        <spring-boot.version>1.4.1.RELEASE</spring-boot.version>
        <java.version>1.8</java.version>
        <druid.version>1.0.28</druid.version>
        <sanoryza.jsl.version>0.2-SNAPSHOT</sanoryza.jsl.version>
        <spymemcached.version>2.12.2</spymemcached.version>
        <mina.version>2.0.16</mina.version>
        <mysql-connector.version>5.1.40</mysql-connector.version>
        <ehcache.version>2.10.3</ehcache.version>
        <spring-security-oauth2.version>2.0.12.RELEASE</spring-security-oauth2.version>
        <jcaptcha.version>1.0</jcaptcha.version>
        <spring-integration-http.version>4.3.7.RELEASE</spring-integration-http.version>
        <httpclient.version>4.5.1</httpclient.version>
        <httpcore.version>4.4.5</httpcore.version>
    </properties>

    <modules>
        <module>common</module>
        <module>wcp</module>
        <module>wmc</module>
    </modules>

    <repositories>
        <repository>
            <id>Sanoryza.Internal</id>
            <name>Sanoryza Internal Repository</name>
            <url>http://10.0.0.15:8082/repository/internal/</url>
        </repository>
        <repository>
            <id>Sanoryza.Snapshots</id>
            <name>Sanoryza Snapshots Repository</name>
            <url>http://10.0.0.15:8082/repository/snapshots/</url>
        </repository>
    </repositories>

    <dependencyManagement>
        <dependencies>

            <dependency>
                <groupId>org.springframework.integration</groupId>
                <artifactId>spring-integration-http</artifactId>
                <version>${spring-integration-http.version}</version>
            </dependency>

            <dependency>
                <groupId>com.bxwell</groupId>
                <artifactId>bxwcp.common</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>com.bxwell</groupId>
                <artifactId>bxwcp.wcp</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>com.bxwell</groupId>
                <artifactId>bxwcp.wmc</artifactId>
                <version>${project.version}</version>
            </dependency>

            <dependency>
                <groupId>com.alibaba</groupId>
                <artifactId>druid</artifactId>
                <version>${druid.version}</version>
            </dependency>
            <dependency>
                <groupId>com.sanoryza.standard.lib</groupId>
                <artifactId>jsl</artifactId>
                <version>${sanoryza.jsl.version}</version>
            </dependency>

            <dependency>
                <groupId>net.spy</groupId>
                <artifactId>spymemcached</artifactId>
                <version>${spymemcached.version}</version>
            </dependency>

            <dependency>
                <groupId>mysql</groupId>
                <artifactId>mysql-connector-java</artifactId>
                <version>${mysql-connector.version}</version>
            </dependency>

            <dependency>
                <groupId>net.sf.ehcache</groupId>
                <artifactId>ehcache</artifactId>
                <version>${ehcache.version}</version>
            </dependency>

            <dependency>
                <groupId>org.springframework.security.oauth</groupId>
                <artifactId>spring-security-oauth2</artifactId>
                <version>${spring-security-oauth2.version}</version>
            </dependency>

            <dependency>
                <groupId>org.apache.mina</groupId>
                <artifactId>mina-legal</artifactId>
                <version>${mina.version}</version>
            </dependency>
            <dependency>
                <groupId>com.octo.captcha</groupId>
                <artifactId>jcaptcha</artifactId>
                <version>${jcaptcha.version}</version>
            </dependency>

            <dependency>
                <groupId>org.apache.httpcomponents</groupId>
                <artifactId>httpclient</artifactId>
                <version>${httpclient.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.httpcomponents</groupId>
                <artifactId>httpcore</artifactId>
                <version>${httpcore.version}</version>
            </dependency>

        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jdbc</artifactId>
        </dependency>
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>druid</artifactId>
        </dependency>

        <dependency>
            <groupId>com.sanoryza.standard.lib</groupId>
            <artifactId>jsl</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-log4j12</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>net.spy</groupId>
            <artifactId>spymemcached</artifactId>
        </dependency>

        <dependency>
            <groupId>com.octo.captcha</groupId>
            <artifactId>jcaptcha</artifactId>
        </dependency>
    </dependencies>

    <build>
        <pluginManagement>
            <plugins>

                <!-- Compiler plugin -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <source>${java.version}</source>
                        <target>${java.version}</target>
                        <encoding>${project.build.sourceEncoding}</encoding>
                        <useIncrementalCompilation>false</useIncrementalCompilation>
                    </configuration>
                </plugin>

                <!-- AspectJ plugins -->
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>aspectj-maven-plugin</artifactId>
                    <version>${aspectj.plugin.version}</version>
                    <configuration>
                        <source>${java.version}</source>
                        <target>${java.version}</target>
                        <Xlint>ignore</Xlint>
                        <complianceLevel>${java.version}</complianceLevel>
                        <encoding>UTF-8</encoding>
                    </configuration>
                    <executions>
                        <execution>
                            <phase>process-sources</phase>
                            <goals>
                                <goal>compile</goal>
                                <goal>test-compile</goal>
                            </goals>
                        </execution>
                    </executions>
                    <dependencies>
                        <dependency>
                            <groupId>org.aspectj</groupId>
                            <artifactId>aspectjtools</artifactId>
                            <version>${aspectj.version}</version>
                        </dependency>
                    </dependencies>
                </plugin>

                <!-- Surefire plugin configuration -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <configuration>
                        <excludes>
                            <exclude>**/*_Roo_*</exclude>
                        </excludes>
                    </configuration>
                </plugin>
                <!-- Asciidoclet plugin -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <configuration>
                        <additionalparam>
                            --base-dir ${project.basedir}
                            --attribute
                            "projectName=${project.name}"
                            --attribute
                            "projectVersion=${project.version}"
                            --attribute "doctype=book"
                        </additionalparam>
                        <dependencySourceIncludes>
                            <dependencySourceInclude>${project.groupId}:*</dependencySourceInclude>
                        </dependencySourceIncludes>
                        <doclet>org.asciidoctor.Asciidoclet</doclet>
                        <docletArtifact>
                            <groupId>org.asciidoctor</groupId>
                            <artifactId>asciidoclet</artifactId>
                            <version>${asciidoclet.version}</version>
                        </docletArtifact>
                        <includeDependencySources>true</includeDependencySources>
                        <linksource>true</linksource>
                        <links>
                            <link>http://docs.oracle.com/javase/${java.version}/docs/api/</link>
                            <link>http://docs.oracle.com/javaee/${java.product.version}/api/</link>
                            <link>http://docs.spring.io/spring-framework/docs/${spring.version}/javadoc-api/</link>
                            <link>http://docs.spring.io/spring-boot/docs/${spring-boot.version}/api/</link>
                            <link>http://fasterxml.github.io/jackson-core/javadoc/2.8/</link>
                            <link>http://fasterxml.github.io/jackson-databind/javadoc/2.8</link>
                            <link>http://cxf.apache.org/javadoc/latest-3.1.x/</link>
                        </links>
                        <overview>src/main/java/overview.adoc</overview>
                        <show>private</show>
                        <source>${java.version}</source>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <configuration>
                        <mainClass>${start-class}</mainClass>
                        <classifier>exec</classifier>
                        <excludeDevtools>true</excludeDevtools>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
</project>

打包方式为mvn package,运行java -jar xxx.jar 就报出了这样的错误。跪求大佬解决一下啊,急!!!

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • 小达哥的垃圾桶 2018-11-07 07:48
    已采纳

    你引入了数据库的依赖,但是项目在配置文件中找不到数据库链接配置。
    1、要不就去掉数据库依赖(如果不需要数据库的话):

    org.springframework.boot
    spring-boot-starter-jdbc


    com.alibaba
    druid


    mysql
    mysql-connector-java
    ${mysql-connector.version}


    com.alibaba
    druid
    ${druid.version}

    2、要不就加上数据库链接:
    #数据库连接配置
    spring.datasource.url=jdbc:mysql://localhost/mysql?useUnicode=true&characterEncoding=utf-8
    spring.datasource.username=root
    spring.datasource.password=root
    spring.datasource.driver-class-name=com.mysql.jdbc.Driver

    还有,就是你的依赖有点问题:你引入了两个alibaba的druid依赖。望采纳!!

    点赞 打赏 评论
  • qq_41917077 2018-11-07 06:34

    打包方式为mvn package,然后java -jar xxx.jar 运行jar包。又遇到过类似这种情况的吗?跪求大牛解决

    点赞 打赏 评论

相关推荐