1

When I run my spring boot application using IntelliJ IDEA Right click main() -> Run 'Application' my application will run and properly serve pages. However, when I package the application as a .jar using mvn clean package while it'll properly become a .jar it will not serve the pages, throwing a .

Here's the IntelliJ Output when running the application, and a page request, pastebin links will be added for everything for ease of reading:

IntelliJ Run Pastebin

And here's my console output after running 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

Here's the console output when trying to run the application .jar file:

Console build failure 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>

EDIT

Ran a few other tests, this is the error thrown when running the project without prettyfaces: Pastebin

/EDIT

I apologize for basically doing a Log dump, I checked a few other solutions but couldn't fix this.

I tried many stackoverflow solutions, but could not resolve this problem.

Thank you for any help.


Solutions tried

Erick
  • 2,488
  • 6
  • 29
  • 43
  • 1
    I consider the pom.xml to be relevant for this question, so post it, please. – Aritz May 14 '15 at 08:57
  • pom.xml has been added to the post. – Erick May 14 '15 at 09:03
  • 1
    You're including different versions of `jsf-api` and `jsf-impl`, please match them. Also, what happens if you remove `prettyfaces-jsf2` from your project? Is it working properly just with JSF? Also try with Tomcat 7.x versions: http://mvnrepository.com/artifact/org.apache.tomcat.embed/tomcat-embed-core/7.0.55 I just had a similar problem with Tomcat 8 + JSF 2.2 – Aritz May 14 '15 at 09:26
  • Alright, give me a sec gonna go try those one by one and report back – Erick May 14 '15 at 09:33
  • Updated jsf-api and jsf-impl to 2.2.11, no changes. Switched to Tomcat 7.0.61, that still worked on IntelliJ, didn't work on Console. Switched to Tomcat 7.0.55, that still worked on IntelliJ, didn't work on Console. Removed Prettyfaces, worked on IntelliJ with http://localhost:10443/templates/user/addenda.xhtml, didn't work on Console, threw new error. New error added on question. Readded Prettyfaces. – Erick May 14 '15 at 09:51
  • 1
    Please, remove your doctype declaration for the pom.xml. Keeps the question much more readable – Aritz May 14 '15 at 09:53
  • Removed Doctype declaration – Erick May 14 '15 at 09:57
  • 1
    `javaee-api` is not needed AFAIK. You've got many dependencies which make difficult to know where the problem comes from. If I were you, I would try setting up a basic spring boot project from scratch and adding JSF to it until you get it working. Then you'll be able to see what's causing this mess in your classpath. – Aritz May 14 '15 at 09:58
  • I did try removing javaee-api, and the jsf-api/jsf-impl one at a time, either let the project work. I'll definitely take your advice if the answer can't be found in a ~24 hour span. Thanks for your time. – Erick May 14 '15 at 10:01

0 Answers0