Buenas. Me sale el siguiente error. No sé a que se debe. Vi en un comentario anterior que podría ser por no tener la base de datos activa...

David Alejandro García Graterón

David Alejandro García Graterón

Pregunta
studenthace 6 años

Buenas. Me sale el siguiente error. No sé a que se debe. Vi en un comentario anterior que podría ser por no tener la base de datos activa ( con el docker ) pero al ejecutar el comando “docker restart postgres” me sale un error de conexión, indicando que paso mucho tiempo y no hay respuestas del servidor. Por otro lado me sale este error al darle “Maven built” intente con localhost y una base de datos que ya tenia creada con PgAdmin y el error sigue existiendo

[INFO] Scanning for projects…

[INFO]

[INFO] ----------------------< com.platzi:e-reservation >----------------------

[INFO] Building e-reservation 0.0.1-SNAPSHOT

[INFO] --------------------------------[ jar ]---------------------------------

[INFO]

[INFO] — maven-clean-plugin:3.1.0:clean (default-clean) @ e-reservation —

[INFO] Deleting C:\Users\Carlos\Documents\workspace-spring-tool-suite-4-4.2.1.RELEASE\e-reservation\target

[INFO]

[INFO] — maven-resources-plugin:3.1.0:resources (default-resources) @ e-reservation —

[INFO] Using ‘UTF-8’ encoding to copy filtered resources.

[INFO] Copying 2 resources

[INFO] Copying 0 resource

[INFO]

[INFO] — maven-compiler-plugin:3.8.1:compile (default-compile) @ e-reservation —

[INFO] Changes detected - recompiling the module!

[INFO] Compiling 3 source files to C:\Users\Carlos\Documents\workspace-spring-tool-suite-4-4.2.1.RELEASE\e-reservation\target\classes

[INFO]

[INFO] — maven-resources-plugin:3.1.0:testResources (default-testResources) @ e-reservation —

[INFO] Using ‘UTF-8’ encoding to copy filtered resources.

[INFO] skip non existing resourceDirectory C:\Users\Carlos\Documents\workspace-spring-tool-suite-4-4.2.1.RELEASE\e-reservation\src\test\resources

[INFO]

[INFO] — maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ e-reservation —

[INFO] Changes detected - recompiling the module!

[INFO] Compiling 1 source file to C:\Users\Carlos\Documents\workspace-spring-tool-suite-4-4.2.1.RELEASE\e-reservation\target\test-classes

[INFO]

[INFO] — maven-surefire-plugin:2.22.2:test (default-test) @ e-reservation —

[INFO]

[INFO] -------------------------------------------------------

[INFO] T E S T S

[INFO] -------------------------------------------------------

[INFO] Running com.platzi.EReservationApplicationTests

20:26:48.181 [main] DEBUG org.springframework.test.context.junit4.SpringJUnit4ClassRunner - SpringJUnit4ClassRunner constructor called with [class com.platzi.EReservationApplicationTests]

20:26:48.190 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating CacheAwareContextLoaderDelegate from class [org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate]

20:26:48.256 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating BootstrapContext using constructor [public org.springframework.test.context.support.DefaultBootstrapContext(java.lang.Class,org.springframework.test.context.CacheAwareContextLoaderDelegate)]

20:26:48.292 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating TestContextBootstrapper for test class [com.platzi.EReservationApplicationTests] from class [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]

20:26:48.372 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Neither @ContextConfiguration nor @ContextHierarchy found for test class [com.platzi.EReservationApplicationTests], using SpringBootContextLoader

20:26:48.384 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [com.platzi.EReservationApplicationTests]: class path resource [com/platzi/EReservationApplicationTests-context.xml] does not exist

20:26:48.385 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [com.platzi.EReservationApplicationTests]: class path resource [com/platzi/EReservationApplicationTestsContext.groovy] does not exist

20:26:48.386 [main] INFO org.springframework.test.context.support.AbstractContextLoader - Could not detect default resource locations for test class [com.platzi.EReservationApplicationTests]: no resource found for suffixes {-context.xml, Context.groovy}.

20:26:48.388 [main] INFO org.springframework.test.context.support.AnnotationConfigContextLoaderUtils - Could not detect default configuration classes for test class [com.platzi.EReservationApplicationTests]: EReservationApplicationTests does not declare any static, non-private, non-final, nested classes annotated with @Configuration.

20:26:48.539 [main] DEBUG org.springframework.test.context.support.ActiveProfilesUtils - Could not find an ‘annotation declaring class’ for annotation type [org.springframework.test.context.ActiveProfiles] and class [com.platzi.EReservationApplicationTests]

[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.277 s <<< FAILURE! - in com.platzi.EReservationApplicationTests

[ERROR] initializationError(com.platzi.EReservationApplicationTests) Time elapsed: 0.011 s <<< ERROR!

java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=…) with your test

[INFO]

[INFO] Results:

[INFO]

[ERROR] Errors:

[ERROR] EReservationApplicationTests.initializationError » IllegalState Unable to find…

[INFO]

[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0

[INFO]

[INFO] ------------------------------------------------------------------------

[INFO] BUILD FAILURE

[INFO] ------------------------------------------------------------------------

[INFO] Total time: 15.725 s

[INFO] Finished at: 2019-05-18T20:26:49-04:00

[INFO] ------------------------------------------------------------------------

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test (default-test) on project e-reservation: There are test failures.

[ERROR]

[ERROR] Please refer to C:\Users\Carlos\Documents\workspace-spring-tool-suite-4-4.2.1.RELEASE\e-reservation\target\surefire-reports for the individual test results.

[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.

[ERROR] -> [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/MojoFailureException

2 respuestas
para escribir tu comentario
    Cesar David Ramírez Dimaté

    Cesar David Ramírez Dimaté

    studenthace 5 años

    Es importante empezar a saber cómo leer los errores de compilación ya que copiar toda la trama es innecesario.

    [ERROR] initializationError(com.platzi.EReservationApplicationTests) Time elapsed: 0.008 s <<< ERROR! java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=…) with your test

    Y radica en que el test o el proyecto no fueron creados correctamente al momento de generarlo.

    Unable to find a @SpringBootConfiguration when doing a JpaTest

    César Espitia

    César Espitia

    studenthace 6 años

    Hola ale1716, puedes compartir tus otros archivos para revisar por favor? Principalmente la clase EReservationApplicationTests.java. Parace que esa clase tiene algun error en las anotaciones que esta usando.

Curso de Hibernate y Java Spring

Curso de Hibernate y Java Spring

Crear aplicaciones intuitivas comienza con un desarrollo ágil y eficiente. ¿Sabías que con Hibernate y Java Spring puedes optimizar procesos entre apps y bases de datos, o evitar acciones repetitivas, como escribir varias veces la mismas líneas de código? Ahora tendrás tiempo para hacer más de lo que te gusta: ¡nunca parar de aprender con Platzi!

Curso de Hibernate y Java Spring
Curso de Hibernate y Java Spring

Curso de Hibernate y Java Spring

Crear aplicaciones intuitivas comienza con un desarrollo ágil y eficiente. ¿Sabías que con Hibernate y Java Spring puedes optimizar procesos entre apps y bases de datos, o evitar acciones repetitivas, como escribir varias veces la mismas líneas de código? Ahora tendrás tiempo para hacer más de lo que te gusta: ¡nunca parar de aprender con Platzi!