首页 > 解决方案 > 在“更新服务器的部署扫描程序:WildFly 23”期间发生内部错误

问题描述

我正在尝试连接到我的 http://localhost:8080/spring-boot-test/ui,但不幸的是我失败了,因为我在 Eclips 上有错误。WildFly 23 理论上可行,因为我通常会得到他们的本地主机

An internal error occurred during: "Updating Deployment Scanners for Server: WildFly 23".
Could not initialize class org.wildfly.security.auth.client.DefaultAuthenticationContextProvider

An internal error occurred during: "Checking Deployment Scanners for server".
Could not initialize class org.wildfly.security.auth.client.DefaultAuthenticationContextProvider

当我尝试将 Standalone.xml 中的目录重定向到具有 META-INF 和 WEB-INF 的目标时,我遇到了两个错误

ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) WFLYDS0011: The deployment scanner found a directory named META-INF that was not inside a directory whose name ends with .ear, .jar, .rar, .sar or .war. This is likely the result of unzipping an archive directly inside the C:\Users\adame\eclipse-workspace\spring-boot-test\target directory, which is a user error. The META-INF directory will not be scanned for deployments, but it is possible that the scanner may find other files from the unzipped archive and attempt to deploy them, leading to errors.
ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) WFLYDS0011: The deployment scanner found a directory named WEB-INF that was not inside a directory whose name ends with .ear, .jar, .rar, .sar or .war. This is likely the result of unzipping an archive directly inside the C:\Users\adame\eclipse-workspace\spring-boot-test\target\ directory, which is a user error. The WEB-INF directory will not be scanned for deployments, but it is possible that the scanner may find other files from the unzipped archive and attempt to deploy them, leading to errors.

Pom.xml

    <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.adamkaim.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>2.0.3.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>16</java.version>
      </properties>
      
      <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>
      <packaging>war</packaging>
    </project>

应用程序.java

    package com.adamkaim.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);
         }
     }

地址.java

package com.adamkaim.spring;

import org.springframework.stereotype.Component;

@Component
public class Address {

    private String address="Wall Street 34";

    public String getAddress() {
        return this.address;
    }
}

学生.java

package com.adamkaim.spring;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class Student {

    @Autowired
    private Address address;

    public String showInfo(){
        return this.address.getAddress();
    }
}

主视图.java

package com.adamkaim.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;

@SuppressWarnings("serial")
@SpringUI(path="/ui")
@Title("Titlett")
@Theme("valo")
public class MainView extends UI{
    
    @Override
    protected void init(VaadinRequest request) {
        final VerticalLayout verticalLayout = new VerticalLayout();
        
        verticalLayout.addComponent(new Label("Welcome"));
        
        Button button = new Button("Click me");
        
        verticalLayout.addComponent(button);
        
        button.addClickListener(new Button.ClickListener() {
            
            @Override
            public void buttonClick(ClickEvent event) {
                verticalLayout.addComponent(new Label("Button is clicked.."));
            }
        });
        
        setContent(verticalLayout);
    }

}

标签: javaspringeclipsespring-bootwildfly

解决方案


尝试从 Eclipse (2021-09) 启动 Wildfly 19.1.0 容器时遇到了同样的错误。容器似乎开始成功,但这条消息让我发疯。

过了一会儿,我在 Wildfly Google Groups 上看到了这条消息,这解决了我的问题!

将 --add-opens=java.base/java.security=ALL-UNNAMED 添加到 eclipse.ini 解决了我这边的问题

感谢https://groups.google.com/g/wildfly/c/_OuPrpsF2pY/m/xLt6u-IfBgAJ中的原作者 Rahim Alizada 。

该选项--add-opens在运行时打开通知模块(所有类型和成员),允许从目标模块(在这种情况下,其他所有人 - ALL-UNNAMED )进行深度反射

JEP 261中有关此选项的更多信息。

我尝试在我的系统中仅使用 Java 8 运行 Eclipse,如果我记得清楚的话,我可以让它工作,但是这些较新的 Eclipse 版本上的一些模块需要 Java 11 才能正确加载。


推荐阅读