Error when deploying spring Error creating bean with name 'JettyServletWebServerFactory'

0

I want to deploy my spring v2.0.1 project and with spring security, but it gives me a lot of headaches when I activate it, it boosts me multiple errors if I do not activate the security everything goes as normal.

  

Can not upload deployment: {"WFLYCTL0080: Failed services" = >   {"jboss.undertow.deployment.default-server.default-host. \" / restTeatro-0.0.1-SNAPSHOT \ ""   = > "java.lang.RuntimeException: org.springframework.beans.factory.BeanCreationException: Error   creating bean with name 'JettyServletWebServerFactory' defined in   class path resource   [org / springframework / boot / autoconfigure / web / servlet / ServletWebServerFactoryConfiguration $ EmbeddedJetty.class]:   Bean instantiation via factory method failed; nested exception is   org.springframework.beans.BeanInstantiationException: Failed to   instantiate   [org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory]:   Factory method 'JettyServletWebServerFactory' threw exception; nested   exception is java.lang.NoClassDefFoundError:   org / eclipse / jetty / server / session / SessionDataStore Caused by:   java.lang.RuntimeException:   org.springframework.beans.factory.BeanCreationException: Error   creating bean with name 'JettyServletWebServerFactory' defined in   class path resource   [org / springframework / boot / autoconfigure / web / servlet / ServletWebServerFactoryConfiguration $ EmbeddedJetty.class]:   Bean instantiation via factory method failed; nested exception is   org.springframework.beans.BeanInstantiationException: Failed to   instantiate   [org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory]:   Factory method 'JettyServletWebServerFactory' threw exception; nested   exception is java.lang.NoClassDefFoundError:   org / eclipse / jetty / server / session / SessionDataStore Caused by:   org.springframework.beans.factory.BeanCreationException: Error   creating bean with name 'JettyServletWebServerFactory' defined in   class path resource   [org / springframework / boot / autoconfigure / web / servlet / ServletWebServerFactoryConfiguration $ EmbeddedJetty.class]:   Bean instantiation via factory method failed; nested exception is   org.springframework.beans.BeanInstantiationException: Failed to   instantiate   [org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory]:   Factory method 'JettyServletWebServerFactory' threw exception; nested   exception is java.lang.NoClassDefFoundError:   org / eclipse / jetty / server / session / SessionDataStore Caused by:   org.springframework.beans.BeanInstantiationException: Failed to   instantiate   [org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory]:   Factory method 'JettyServletWebServerFactory' threw exception; nested   exception is java.lang.NoClassDefFoundError:   org / eclipse / jetty / server / session / SessionDataStore Caused by:   java.lang.NoClassDefFoundError:   org / eclipse / jetty / server / session / SessionDataStore Caused by:   java.lang.ClassNotFoundException:   org.eclipse.jetty.server.session.SessionDataStore from [Module   \ "deployment.restTeatro-0.0.1-SNAPSHOT.war \" from Service Module   Loader] "}}

This is my porm:

restTeatro     Demo project for Spring Boot

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

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.version>
    <start-class>restTeatroproyecto.RestTeatroApplication</start-class>
</properties>

<dependencies>
    <!-- https://mvnrepository.com/artifact/javax.mail/mail -->
    <dependency>
        <groupId>javax.mail</groupId>
        <artifactId>mail</artifactId>
        <version>1.4</version>
    </dependency>

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


    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-batch</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-jdbc</artifactId>
    </dependency>

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

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>com.microsoft.sqlserver</groupId>
        <artifactId>mssql-jdbc</artifactId>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    <!-- <dependency> -->
    <!-- <groupId>org.springframework.boot</groupId> -->
    <!-- <artifactId>spring-boot-starter-data-jpa</artifactId> -->
    <!-- <exclusions> -->
    <!-- <exclusion> -->
    <!-- <groupId>org.hibernate</groupId> -->
    <!-- <artifactId>hibernate-entitymanager</artifactId> -->
    <!-- </exclusion> -->
    <!-- <exclusion> -->
    <!-- <groupId>org.hibernate</groupId> -->
    <!-- <artifactId>hibernate-core</artifactId> -->
    <!-- </exclusion> -->
    <!-- </exclusions> -->
    <!-- </dependency> -->
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
    </dependency>
    <dependency>
        <groupId>io.jsonwebtoken</groupId>
        <artifactId>jjwt</artifactId>
        <version>0.9.0</version>
    </dependency>
    <!-- <dependency> -->
    <!-- <groupId>javax.json</groupId> -->
    <!-- <artifactId>javax.json-api</artifactId> -->
    <!-- <version>1.1.2</version> -->
    <!-- </dependency> -->
    <!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-security -->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-security</artifactId>
        <version>2.0.0.RELEASE</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.springframework.security/spring-security-core -->
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-core</artifactId>
        <version>5.0.3.RELEASE</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.springframework.security/spring-security-web -->
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-web</artifactId>
        <version>5.0.3.RELEASE</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.springframework.security/spring-security-config -->
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-config</artifactId>
        <version>5.0.3.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>commons-httpclient</groupId>
        <artifactId>commons-httpclient</artifactId>
        <version>3.1</version>
    </dependency>
    <dependency>
        <groupId>org.eclipse.jetty.aggregate</groupId>
        <artifactId>jetty-all</artifactId>
        <version>9.2.13.v20150730</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-thymeleaf</artifactId>
        <version>1.4.0.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>io.jsonwebtoken</groupId>
        <artifactId>jjwt</artifactId>
        <version>0.9.0</version>
    </dependency>
    <dependency>
        <groupId>org.jsoup</groupId>
        <artifactId>jsoup</artifactId>
        <version>1.8.3</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
    <dependency>
        <groupId>com.google.code.gson</groupId>
        <artifactId>gson</artifactId>
        <version>2.8.2</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.jaxrs/jackson-jaxrs-json-provider -->
    <dependency>
        <groupId>com.fasterxml.jackson.jaxrs</groupId>
        <artifactId>jackson-jaxrs-json-provider</artifactId>
        <version>2.9.0</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/net.sf.jasperreports/jasperreports -->
    <dependency>
        <groupId>net.sf.jasperreports</groupId>
        <artifactId>jasperreports</artifactId>
        <version>6.1.0</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/net.sf.barcode4j/barcode4j -->
    <dependency>
        <groupId>net.sf.barcode4j</groupId>
        <artifactId>barcode4j</artifactId>
        <version>2.0</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.apache.xmlgraphics/batik-bridge -->
    <dependency>
        <groupId>org.apache.xmlgraphics</groupId>
        <artifactId>batik-bridge</artifactId>
        <version>1.6.1</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/xerces/xercesImpl -->
    <dependency>
        <groupId>xerces</groupId>
        <artifactId>xercesImpl</artifactId>
        <version>2.9.0</version>
    </dependency>


    <!-- POI for jasper reports demo -->
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi</artifactId>
        <version>3.7</version>
    </dependency>

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

    <!-- marked the embedded servlet container as provided -->
    <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-starter-jetty</artifactId>
    </dependency>

</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <version>1.4.2.RELEASE</version>
            <executions>
                <execution>
                    <goals>
                        <goal>repackage</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <configuration>
                <packagingExcludes>WEB-INF/lib/websocket-*.jar</packagingExcludes>
            </configuration>
        </plugin>
    </plugins>
</build>

This is my class that gives security to my spring:

@Configuration
@Order(99)
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
    @Autowired
    private IUsuarioService usuarioService;

//  @Autowired
//  public WebSecurityConfig() {
//      super(true);
//  }
//  
    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.csrf().disable().authorizeRequests().antMatchers(HttpMethod.OPTIONS, "/**").permitAll()// allow CORS option
                                                                                                    // calls
                .antMatchers(HttpMethod.POST, "/api/login").permitAll().antMatchers(HttpMethod.POST, "/login")

                .permitAll().anyRequest().authenticated().and()
                // We filter the api/login requests
                .addFilterBefore(new JWTLoginFilter("/login", authenticationManager()),
                        UsernamePasswordAuthenticationFilter.class)
                // And filter other requests to check the presence of JWT in header
                .addFilterBefore(new JWTAuthenticationFilter(), UsernamePasswordAuthenticationFilter.class)
                .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS);

    }
}
    
asked by eduwin30 07.04.2018 в 01:18
source

0 answers