Spring Boot在IntelliJ IDEA中运行,mvn打包.jar抛出java.lang.IllegalStateException

时间:2015-05-14 08:30:17

标签: spring maven jsf intellij-idea

当我使用IntelliJ IDEA Right click main() -> Run 'Application'运行我的春季启动应用程序时,我的应用程序将运行并正确提供页面。但是,当我使用mvn clean package将应用程序打包为.jar时,它会正确地成为.jar,它将不会为页面提供服务,抛出一个。

这是运行应用程序时的IntelliJ输出,以及页面请求,将为所有内容添加pastebin链接以便于阅读:

IntelliJ Run Pastebin

运行mvn clean build后,这是我的控制台输出:

mvn clean build Pastebin

"C:\Program Files\Java\jdk1.8.0_45\bin\java" -Xms256m "-Dmaven.home=C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1\plugins\maven\lib\maven3" "-Dclassworlds.conf=C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1\plugins\maven\lib\maven3\bin\m2.conf" -Didea.launcher.port=7534 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1\bin" -Dfile.encoding=windows-1252 -classpath "C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1\plugins\maven\lib\maven3\boot\plexus-classworlds-2.4.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain org.codehaus.classworlds.Launcher -Didea.version=14.1.3 clean package
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building recepcion-cfdi 0.1
[INFO] ------------------------------------------------------------------------
[WARNING] The artifact jdom:jdom:jar:1.1 has been relocated to org.jdom:jdom:jar:1.1
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ CFDI ---
[INFO] Deleting C:\tsap\Recepcion-CFDI\target
[INFO] Deleting C:\tsap\Recepcion-CFDI\src\main\webapp\WEB-INF\classes
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ CFDI ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 61 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.0:compile (default-compile) @ CFDI ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 61 source files to C:\tsap\Recepcion-CFDI\src\main\webapp\WEB-INF\classes
[WARNING] /C:/tsap/Recepcion-CFDI/src/main/java/com/isap/validaCFDI/ValidaCFDi32.java: Some input files use unchecked or unsafe operations.
[WARNING] /C:/tsap/Recepcion-CFDI/src/main/java/com/isap/validaCFDI/ValidaCFDi32.java: Recompile with -Xlint:unchecked for details.
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ CFDI ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\tsap\Recepcion-CFDI\src\test\resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.0:testCompile (default-testCompile) @ CFDI ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 7 source files to C:\tsap\Recepcion-CFDI\target\test-classes
[INFO] 
[INFO] --- maven-surefire-plugin:2.17:test (default-test) @ CFDI ---
[INFO] 
[INFO] --- maven-jar-plugin:2.5:jar (default-jar) @ CFDI ---
[INFO] Building jar: C:\tsap\Recepcion-CFDI\target\CFDI-0.1.jar
[INFO] 
[INFO] --- spring-boot-maven-plugin:1.2.3.RELEASE:repackage (default) @ CFDI ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 16.615s
[INFO] Finished at: Thu May 14 03:10:48 CDT 2015
[INFO] Final Memory: 28M/349M
[INFO] ------------------------------------------------------------------------

Process finished with exit code 0

这是尝试运行应用程序.jar文件时的控制台输出:

控制台构建失败 Pastebin

的pom.xml

<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>


    <groupId>iSAP</groupId>
    <artifactId>CFDI</artifactId>
    <version>0.1</version>
    <inceptionYear>2015</inceptionYear>
    <packaging>jar</packaging>

    <name>recepcion-cfdi</name>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.2.3.RELEASE</version>
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <java-version>1.8</java-version>
        <io.spring.platform-version>1.1.2.RELEASE</io.spring.platform-version>
        <!-- AssertJ is not a part of Spring IO platform, so the version must be provided explicitly -->
        <assertj-core-version>1.5.0</assertj-core-version>
        <tomcat.version>8.0.21</tomcat.version>
        <start-class>com.isap.config.Application</start-class>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>io.spring.platform</groupId>
                <artifactId>platform-bom</artifactId>
                <version>${io.spring.platform-version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <!-- PRIMEFACES -->
        <dependency>
            <groupId>org.primefaces</groupId>
            <artifactId>primefaces</artifactId>
            <version>5.2</version>
        </dependency>

        <dependency>
            <groupId>org.primefaces.themes</groupId>
            <artifactId>bootstrap</artifactId>
            <version>1.0.10</version>
        </dependency>
        <!-- /PRIMEFACES -->

        <!-- Tomcat -->
        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-core</artifactId>
            <version>8.0.21</version>
        </dependency>

        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-logging-juli</artifactId>
            <version>8.0.21</version>
        </dependency>

        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-jasper</artifactId>
            <version>8.0.21</version>
        </dependency>
        <!-- /Tomcat -->

        <!-- Microsoft JDBC -->
        <!-- NOTE: This is saved locally in the /lib folder.
             Microsoft doesn't allow maven to have it in a public repository. -->
        <dependency>
            <groupId>com.microsoft.sqlserver</groupId>
            <artifactId>sqljdbc41</artifactId>
            <version>4.1</version>
            <!-- These two lines are edited out when the local repo is installed, if you don't
             have JDBC installed locally you should unedit these two lines -->
            <!--<scope>system</scope>-->
            <!--<systemPath>${basedir}/lib/sqljdbc41.jar</systemPath>-->
        </dependency>
        <!-- /Microsoft JDBC -->

        <!-- Hibernate -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>5.1.3.Final</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>4.3.9.Final</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>4.3.9.Final</version>
        </dependency>
        <!-- /Hibernate -->

        <!-- Prettyfaces -->
        <dependency>
            <groupId>com.ocpsoft</groupId>
            <artifactId>prettyfaces-jsf2</artifactId>
            <version>3.3.3</version>
        </dependency>
        <!-- /Prettyfaces -->

        <!-- Spring -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-aop</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-tx</artifactId>
        </dependency>

        <!-- Utilities -->
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
        </dependency>
        <dependency>
            <groupId>commons-fileupload</groupId>
            <artifactId>commons-fileupload</artifactId>
            <version>1.3.1</version>
        </dependency>

        <!-- Core -->
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-api</artifactId>
            <version>7.0</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.sun.faces</groupId>
            <artifactId>jsf-api</artifactId>
            <version>2.2.7</version>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>com.sun.faces</groupId>
            <artifactId>jsf-impl</artifactId>
            <version>2.2.10</version>
            <scope>compile</scope>
        </dependency>
        <!-- /Core -->

        <!-- Imported for CFDI -->
        <dependency>
            <groupId>mx.bigdata.cfdi</groupId>
            <artifactId>cfdi-base</artifactId>
            <version>0.2.5</version>
        </dependency>
        <!-- /Imported for CFDI -->

        <!-- Imported for validacionCFDI -->
        <!-- JDOM -->
        <dependency>
            <groupId>jdom</groupId>
            <artifactId>jdom</artifactId>
            <version>1.1</version>
        </dependency>
        <!-- /JDOM -->

        <!-- Xerces -->
        <dependency>
            <groupId>xerces</groupId>
            <artifactId>xerces</artifactId>
            <version>2.4.0</version>
        </dependency>
        <!-- /Xerces -->

        <dependency>
            <groupId>xerces</groupId>
            <artifactId>xercesImpl</artifactId>
            <version>2.11.0</version>
        </dependency>
        <!-- Imported for validacionCFDI -->



    </dependencies>

    <build>
        <outputDirectory>src/main/webapp/WEB-INF/classes</outputDirectory>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.0</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <repositories>
        <repository>
            <id>spring-releases</id>
            <name>Spring Releases</name>
            <url>https://repo.spring.io/libs-release</url>
        </repository>
        <repository>
            <id>prime-repo</id>
            <name>PrimeFaces Maven Repository</name>
            <url>http://repository.primefaces.org</url>
            <layout>default</layout>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>spring-releases</id>
            <name>Spring Releases</name>
            <url>https://repo.spring.io/libs-release</url>
        </pluginRepository>
    </pluginRepositories>
</project>

修改

进行一些其他测试,这是运行没有漂亮脸的项目时抛出的错误:Pastebin

/修改

我为基本上进行日志转储而道歉,我检查了一些其他解决方案,但无法解决这个问题。

我尝试了很多stackoverflow解决方案,但无法解决这个问题。

感谢您的帮助。

已尝试解决方案

0 个答案:

没有答案