5
respostas

Erro ao inicial o SPRIMG

Boas,

Ao tentar rodar a classa configurações, estou a obter erro os avisos abaixo:

WARNING: An illegal reflective access operation has occurred
...

Que por sua vez não sobre o servidor. Abaixo detalhes do erro


  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v1.4.1.RELEASE)

2019-01-07 21:23:18.805  INFO 10752 --- [           main] ao.com.isata.listavip.Configuracao       : Starting Configuracao on LAPTOP-ISATA with PID 10752 (C:\Java\workspace\listavip\target\classes started by isata in C:\Java\workspace\listavip)
2019-01-07 21:23:18.847  INFO 10752 --- [           main] ao.com.isata.listavip.Configuracao       : No active profile set, falling back to default profiles: default
2019-01-07 21:23:19.111  INFO 10752 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@6e005dc9: startup date [Mon Jan 07 21:23:18 WAT 2019]; root of context hierarchy
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.springframework.cglib.core.ReflectUtils$1 (file:/C:/Users/isata/.m2/repository/org/springframework/spring-core/4.3.3.RELEASE/spring-core-4.3.3.RELEASE.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of org.springframework.cglib.core.ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
2019-01-07 21:23:20.851  WARN 10752 --- [           main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tomcatEmbeddedServletContainerFactory' defined in class path resource [org/springframework/boot/autoconfigure/web/EmbeddedServletContainerAutoConfiguration$EmbeddedTomcat.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.web.HttpEncodingAutoConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'spring.http.encoding-org.springframework.boot.autoconfigure.web.HttpEncodingProperties': Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/ValidationException
2019-01-07 21:23:20.885 ERROR 10752 --- [           main] o.s.boot.SpringApplication               : Application startup failed

org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tomcatEmbeddedServletContainerFactory' defined in class path resource [org/springframework/boot/autoconfigure/web/EmbeddedServletContainerAutoConfiguration$EmbeddedTomcat.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.web.HttpEncodingAutoConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'spring.http.encoding-org.springframework.boot.autoconfigure.web.HttpEncodingProperties': Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/ValidationException
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:137) ~[spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:535) ~
5 respostas

Boa noite Martins, pode postar seus códigos?

Oi Martins, tudo bem?

Utilizando as mesmas versões de dependências do seu pom.xml que o instrutor está utilizando deve resolver esse problema de não conseguir startar o container embedded.

Se preferir atualizar a versão, tente com essa:

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

Ola Otávio Felipe,

Mesmo utilizando o esta dependência devolve o mesmo erro.

   __
 :: Spring Boot ::       (v1.5.18.RELEASE)

2019-01-08 07:43:42.651  INFO 18836 --- [           main] ao.com.isata.listavip.Configuracao       : Starting Configuracao on LAPTOP-ISATA with PID 18836 (C:\Java\workspace\listavip\target\classes started by isata in C:\Java\workspace\listavip)
2019-01-08 07:43:42.653  INFO 18836 --- [           main] ao.com.isata.listavip.Configuracao       : No active profile set, falling back to default profiles: default
2019-01-08 07:43:42.698  INFO 18836 --- [           main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@3f191845: startup date [Tue Jan 08 07:43:42 WAT 2019]; root of context hierarchy
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.springframework.cglib.core.ReflectUtils$1 (file:/C:/Users/isata/.m2/repository/org/springframework/spring-core/4.3.21.RELEASE/spring-core-4.3.21.RELEASE.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of org.springframework.cglib.core.ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

Boas Guilherme,

Abaixo o meu código da class configuração:

package ao.com.isata.listavip;

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

//Configurar o SPRING com a anotação abaixo:
@SpringBootApplication

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

    }

}

Cara, já passei por isso. O Mavem está corrompido, apague essa pasta . m2, depois abre o eclipse e da um refresh no pom.xml