Ошибка 403 | «Запрещено» при развертывании WAR на сервере wildfly - PullRequest
0 голосов
/ 13 июля 2020

Мой проект состоит из 3 файлов 1-App. java Class

package com.udemy.spring;

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

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

2-MainView. java Class (Vaadin)

package com.udemy.spring;

import com.vaadin.annotations.Theme;
import com.vaadin.annotations.Title;
import com.vaadin.server.VaadinRequest;
import com.vaadin.spring.annotation.SpringUI;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Label;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;

@SpringUI(path="/ui")
@Title("Home")
@Theme("valo")
public class MainView extends UI{

    @Override
    protected void init(VaadinRequest request) {
        final VerticalLayout vl = new VerticalLayout();
        vl.addComponent(new Label("Welcome to spring boot vaadin"));
        Button btn = new Button("Click me!");
        vl.addComponent(btn);
        
        btn.addClickListener(new Button.ClickListener() {
            
            public void buttonClick(ClickEvent event) {
                vl.addComponent(new Label("Btn has been clicked"));
            }
        });
        setContent(vl);
    }

}

3-spring- boot-test / pom. xml (файл POM)

<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.udemy.spring</groupId>
    <artifactId>spring-boot-test</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.3.5.RELEASE</version>
    </parent>
    <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>com.vaadin</groupId>
            <artifactId>vaadin-spring-boot-starter</artifactId>
            <version>1.0.0</version>
        </dependency>
    </dependencies>
    <properties>
        <java.version>1.5</java.version>
    </properties>
    <packaging>war</packaging>
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <executable>true</executable>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

Я создал сервер WildFly 10.x. Затем я добавил веб-модуль J2EE моего проекта на сервер, затем я упаковал проект с помощью сборки maven запустите configuratiton, и я добился успеха, и я успешно запустил сервер

18:15:20,388 INFO  [org.jboss.modules] (main) JBoss Modules version 1.5.1.Final
18:15:20,656 INFO  [org.jboss.msc] (main) JBoss MSC version 1.2.6.Final
18:15:20,728 INFO  [org.jboss.as] (MSC service thread 1-6) WFLYSRV0049: WildFly Full 10.0.0.Final (WildFly Core 2.0.10.Final) starting
18:15:22,345 INFO  [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) WFLYDS0004: Found spring-boot-test-0.0.1-SNAPSHOT.war in deployment directory. To trigger deployment create a file called spring-boot-test-0.0.1-SNAPSHOT.war.dodeploy
18:15:22,368 INFO  [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0039: Creating http management service using socket-binding (management-http)
18:15:22,386 INFO  [org.xnio] (MSC service thread 1-7) XNIO version 3.3.4.Final
18:15:22,397 INFO  [org.xnio.nio] (MSC service thread 1-7) XNIO NIO Implementation Version 3.3.4.Final
18:15:22,481 WARN  [org.jboss.as.txn] (ServerService Thread Pool -- 54) WFLYTX0013: Node identifier property is set to the default value. Please make sure it is unique.
18:15:22,509 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 38) WFLYCLINF0001: Activating Infinispan subsystem.
18:15:22,525 INFO  [org.jboss.as.naming] (ServerService Thread Pool -- 46) WFLYNAM0001: Activating Naming Subsystem
18:15:22,537 INFO  [org.jboss.as.security] (ServerService Thread Pool -- 53) WFLYSEC0002: Activating Security Subsystem
18:15:22,545 INFO  [org.jboss.as.security] (MSC service thread 1-1) WFLYSEC0001: Current PicketBox version=4.9.4.Final
18:15:22,552 INFO  [org.jboss.as.webservices] (ServerService Thread Pool -- 56) WFLYWS0002: Activating WebServices Extension
18:15:22,575 INFO  [org.jboss.as.naming] (MSC service thread 1-3) WFLYNAM0003: Starting Naming Service
18:15:22,589 INFO  [org.jboss.as.jsf] (ServerService Thread Pool -- 44) WFLYJSF0007: Activated the following JSF Implementations: [main]
18:15:22,742 INFO  [org.jboss.as.connector] (MSC service thread 1-6) WFLYJCA0009: Starting JCA Subsystem (WildFly/IronJacamar 1.3.2.Final)
18:15:22,746 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 55) WFLYUT0003: Undertow 1.3.15.Final starting
18:15:22,748 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-4) WFLYUT0003: Undertow 1.3.15.Final starting
18:15:22,751 INFO  [org.wildfly.extension.io] (ServerService Thread Pool -- 37) WFLYIO001: Worker 'default' has auto-configured to 8 core threads with 64 task threads based on your 4 available processors
18:15:22,783 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 33) WFLYJCA0004: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
18:15:22,789 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-3) WFLYJCA0018: Started Driver service with driver-name = h2
18:15:22,794 INFO  [org.jboss.as.mail.extension] (MSC service thread 1-6) WFLYMAIL0001: Bound mail session [java:jboss/mail/Default]
18:15:22,911 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 55) WFLYUT0014: Creating file handler for path 'C:\Users\Cisco\wildfly-10.0.0.Final/welcome-content' with options [directory-listing: 'false', follow-symlink: 'false', case-sensitive: 'true', safe-symlink-paths: '[]']
18:15:23,082 INFO  [org.jboss.as.ejb3] (MSC service thread 1-4) WFLYEJB0481: Strict pool slsb-strict-max-pool is using a max instance size of 64 (per class), which is derived from thread worker pool sizing.
18:15:23,083 INFO  [org.jboss.as.ejb3] (MSC service thread 1-1) WFLYEJB0482: Strict pool mdb-strict-max-pool is using a max instance size of 16 (per class), which is derived from the number of CPUs on this host.
18:15:23,727 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-5) WFLYUT0012: Started server default-server.
18:15:23,728 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-5) WFLYUT0018: Host default-host starting
18:15:23,737 INFO  [org.jboss.remoting] (MSC service thread 1-7) JBoss Remoting version 4.0.18.Final
18:15:23,902 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-1) WFLYUT0006: Undertow HTTP listener default listening on 127.0.0.1:8080
18:15:24,097 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-8) WFLYSRV0027: Starting deployment of "spring-boot-test-0.0.1-SNAPSHOT.war" (runtime-name: "spring-boot-test-0.0.1-SNAPSHOT.war")
18:15:24,115 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-1) WFLYDS0013: Started FileSystemDeploymentService for directory C:\Users\Cisco\wildfly-10.0.0.Final\standalone\deployments
18:15:24,467 INFO  [org.infinispan.factories.GlobalComponentRegistry] (MSC service thread 1-3) ISPN000128: Infinispan version: Infinispan 'Mahou' 8.1.0.Final
18:15:24,635 INFO  [org.jboss.ws.common.management] (MSC service thread 1-5) JBWS022052: Starting JBossWS 5.1.3.Final (Apache CXF 3.1.4) 
18:15:24,653 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-1) WFLYJCA0001: Bound data source [java:jboss/datasources/ExampleDS]
18:15:31,066 WARN  [org.jboss.as.ee] (MSC service thread 1-4) WFLYEE0007: Not installing optional component org.springframework.http.server.ServletServerHttpAsyncRequestControl due to an exception (enable DEBUG log level to see the cause)
18:15:31,070 WARN  [org.jboss.as.ee] (MSC service thread 1-4) WFLYEE0007: Not installing optional component org.springframework.web.context.request.async.StandardServletAsyncWebRequest due to an exception (enable DEBUG log level to see the cause)
18:15:32,062 INFO  [io.undertow.servlet] (ServerService Thread Pool -- 61) 1 Spring WebApplicationInitializers detected on classpath
18:15:32,144 INFO  [javax.enterprise.resource.webcontainer.jsf.config] (ServerService Thread Pool -- 61) Initializing Mojarra 2.2.12-jbossorg-2 20150729-1131 for context '/spring-boot-test-0.0.1-SNAPSHOT'
18:15:34,032 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 61) WFLYUT0021: Registered web context: /spring-boot-test-0.0.1-SNAPSHOT
18:15:34,059 INFO  [org.jboss.as.server] (ServerService Thread Pool -- 34) WFLYSRV0010: Deployed "spring-boot-test-0.0.1-SNAPSHOT.war" (runtime-name : "spring-boot-test-0.0.1-SNAPSHOT.war")
18:15:34,244 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:9990/management
18:15:34,244 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:9990
18:15:34,245 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 10.0.0.Final (WildFly Core 2.0.10.Final) started in 14271ms - Started 444 of 735 services (382 services are lazy, passive or on-demand)
18:30:21,021 INFO  [org.jboss.as.repository] (ServerService Thread Pool -- 30) WFLYDR0009: Content C:\Users\Cisco\wildfly-10.0.0.Final\standalone\data\content\14\b678e9f8500382a42005aa2384bc719e3aef1a is obsolete and will be removed
18:30:21,028 INFO  [org.jboss.as.repository] (ServerService Thread Pool -- 30) WFLYDR0002: Content removed from location C:\Users\Cisco\wildfly-10.0.0.Final\standalone\data\content\14\b678e9f8500382a42005aa2384bc719e3aef1a\content

Теперь в моем веб-браузере (Chrome) я перешел по этой ссылке http://localhost: 8080 / spring-boot-test- 0.0.1-SNAPSHOT / он не показал ничего, кроме слова «Запрещено». Примечание: программа успешно работала без сервера, и я мог получить доступ к localhost: 8080 / spring-bot-test / ui. Обычно теперь я не знаю, почему я получаю это » запрещено »сообщение. Пожалуйста, помогите мне. Спасибо

...