1

Tengo mi ambiente de trabajo en Ubuntu 16.04 y estoy trabajando con spring 5 , he tratado de generar mi archivo war pero me genera los siguientes mensajes de error:

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

[INFO] 
[INFO] --- maven-war-plugin:2.6:war (default-war) @ spring-boot-web-jsp ---
[INFO] Packaging webapp
[INFO] Assembling webapp [spring-boot-web-jsp] in [/home/henry/Documents/workspace/spring-boot-web-jsp/target/spring-boot-web-jsp-0.0.1-SNAPSHOT]
[INFO] Processing war project
[INFO] Copying webapp resources [/home/henry/Documents/workspace/spring-boot-web-jsp/src/main/webapp]
[INFO] Webapp assembled in [57 msecs]
[INFO] Building war: /home/henry/Documents/workspace/spring-boot-web-jsp/target/spring-boot-web-jsp-0.0.1-SNAPSHOT.war
[INFO] 
[INFO] --- spring-boot-maven-plugin:1.5.9.RELEASE:repackage (default) @ spring-boot-web-jsp ---
[INFO]    ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.451 s
[INFO] Finished at: 2018-02-01T23:49:07-05:00
[INFO] Final Memory: 24M/269M
[INFO] ------------------------------------------------------------------------
[WARNING] The requested profile "pom.xml" could not be activated because it does not exist.
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-   plugin:1.5.9.RELEASE:repackage (default) on project spring-boot-web-jsp: Execution default of goal org.springframework.boot:spring-boot-maven-plugin:1.5.9.RELEASE:repackage failed: Unable to find main class -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:

[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException


SpringBootWebJspApplication.java

package com.bolsadeideas.springboot.app;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class SpringBootWebJspApplication {

    public static void main(String[] args) {
        SpringApplication.run(SpringBootWebJspApplication.class, args);
    }
}

pom.xml

http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0

<groupId>com.bolsadeideas.springboot.app</groupId>
<artifactId>spring-boot-web-jsp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>

<name>spring-boot-web-jsp</name>
<description>Demo project for Spring Boot</description>

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.9.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.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-tomcat</artifactId>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <optional>true</optional>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
            <!--  JSTL para JSP -->
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
    </dependency>
            <!-- Para compilar JSP -->
    <dependency>
        <groupId>org.apache.tomcat.embed</groupId>
        <artifactId>tomcat-embed-jasper</artifactId>
        <scope>test</scope>
    </dependency>

</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

1 respuesta 1

2

Por el error parece que Spring no sabe donde está tu clase main. Puedes indicarlo en el pom.xml de la siguente forma:

<properties>
    <start-class>com.bolsadeideas.springboot.app.SpringBootWebJspApplication</start-class>
</properties>
3
  • la inclusión de la línea en las propiedades corrigió el error pero al tratar de correr el war genera otro error: *henry@desarrollo:~/Documents/workspace/spring-boot-web-jsp/target$ java -jar .\spring-boot-web-jsp-0.0.1-SNAPSHOT.war Error: Unable to access jarfile .spring-boot-web-jsp-0.0.1-SNAPSHOT.war Commented el 2 feb. 2018 a las 16:04
  • Estás intentando acceder a un .war con el comando java -jar. Por eso no te funciona. Busca cómo ejecutar una aplicación spring boot.
    – kerten
    Commented el 5 feb. 2018 a las 10:46
  • War es para desplegar en tomcat o glassfish server. Ocupas desplegar desde ahí la aplicación.
    – Legna
    Commented el 5 mar. 2018 a las 20:14

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge you have read our privacy policy.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.