1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

  2. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[JBoss] experiensing "Protocol vfs has not been enabled as an allowed protocol" error while...

Discussão em 'StackOverflow' iniciado por Stack, Novembro 13, 2024.

  1. Stack

    Stack Membro Participativo

    I am working on developing a spring boot(3.3.5) web service with log4j2 as my logging library. I generated a spring boot project from spring initializer, excluded the logging from web module to exclude the logback from the spring boot and added the following log4j2 recommended dependencies

    <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
    <exclusions>
    <exclusion>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-logging</artifactId>
    </exclusion>
    </exclusions>
    </dependency>
    <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-log4j2</artifactId>
    </dependency>
    <dependency>
    <groupId>org.apache.logging.log4j</groupId>
    <artifactId>log4j-spring-boot</artifactId>
    </dependency>
    <dependency>
    <groupId>commons-logging</groupId>
    <artifactId>commons-logging</artifactId>
    <version>1.3.4</version>
    </dependency>


    added properties to config how to log

    <log.entry.pattern><![CDATA[%d{MM/dd/yyyy HH:mm:ss.SSS} | %t | %-5p | %c{1}: %m%n]]></log.entry.pattern>
    <log.file.root>/service/logs</log.file.root>
    <log.file.name>${log.file.root}/${project.artifactId}/${project.artifactId}.log</log.file.name>
    <log.file.pattern>${log.file.root}/${project.artifactId}/${project.artifactId}-%d{yyyy-MM-dd}.log</log.file.pattern>


    added log4j2-spring.xml as follows in the src/main/resources

    <?xml version="1.0" encoding="UTF-8"?>
    <Configuration>
    <Appenders>
    <RollingFile name="FILE"
    fileName="/bcbsapps/logs/@project.artifactId@/@project.artifactId@.log"
    filePattern="/bcbsapps/logs/@project.artifactId@/@project.artifactId@-%d{yyyy-MM-dd}.log">
    <PatternLayout>
    <pattern><![CDATA[%d{MM/dd/yyyy HH:mm:ss.SSS} | %t | %-5p | %c{1}: %m%n]]></pattern>
    </PatternLayout>
    <Policies>
    <TimeBasedTriggeringPolicy interval="1" modulate="true"/>
    </Policies>
    </RollingFile>
    </Appenders>

    <Loggers>
    <Root level="debug">
    <AppenderRef ref="FILE" />
    </Root>
    </Loggers>
    </Configuration>


    added controller method to just have some basic logging messages

    @GetMapping("/testlogs")
    @ResponseStatus(HttpStatus.OK)
    public void fetch() {

    LOGGER.debug("Debug log message");
    LOGGER.info("Info log message");
    LOGGER.error("Error log message");
    LOGGER.warn("Warn log message");
    LOGGER.trace("Trace log message");
    }


    My jboss-deployment-structure.xml looks as below


    <?xml version="1.0" encoding="UTF-8"?>
    <jboss-deployment-structure>
    <deployment>
    <exclude-subsystems>
    <subsystem name="logging" />
    <subsystem name="datasources" />
    <subsystem name="ejb3" />
    <subsystem name="infinispan" />
    <subsystem name="jaxrs" />
    <subsystem name="jca" />
    <subsystem name="jmx" />
    <subsystem name="jpa" />
    <subsystem name="jsf" />
    <subsystem name="mail" />
    <subsystem name="pojo" />
    <subsystem name="remoting" />
    <subsystem name="resource-adapters" />
    <subsystem name="sar" />
    <subsystem name="security" />
    <subsystem name="transactions" />
    <subsystem name="webservices" />
    <subsystem name="weld" />
    <subsystem name="bean-validation" />
    </exclude-subsystems>
    <exclusions>
    <module name="javax.validation.api" />
    <module name="javax.faces.api" />
    <module name="org.hibernate.validator" />
    <module name="org.apache.commons.logging" />
    <module name="org.apache.log4j" />
    <module name="org.jboss.logging" />
    <module name="org.jboss.logging.jul-to-slf4j-stub" />
    <module name="org.jboss.logmanager" />
    <module name="org.jboss.logmanager.log4j" />
    <module name="org.slf4j" />
    <module name="org.slf4j.impl" />
    </exclusions>
    </deployment>
    </jboss-deployment-structure>


    my folder structure is as follows

    [​IMG]

    experiencing the following error in Jboss EAP 8

    {"WFLYDC0074: Operation failed or was rolled back on all servers. Server failures:" => {"server-group" => {"ProvAccess" => {"host" => {"BCDEVINTRAJB099-primary" => {"ProvAccs1_1" => {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"logtest.war\".undertow-deployment" => "java.lang.RuntimeException: java.lang.IllegalStateException: java.lang.IllegalStateException: Could not initialize Log4J2 logging from classpath:log4j2-spring.xml
    Caused by: java.lang.RuntimeException: java.lang.IllegalStateException: java.lang.IllegalStateException: Could not initialize Log4J2 logging from classpath:log4j2-spring.xml
    Caused by: java.lang.IllegalStateException: java.lang.IllegalStateException: Could not initialize Log4J2 logging from classpath:log4j2-spring.xml
    Caused by: java.lang.IllegalStateException: Could not initialize Log4J2 logging from classpath:log4j2-spring.xml
    Caused by: java.net.ProtocolException: Protocol vfs has not been enabled as an allowed protocol"}}}}}}}}

    Continue reading...

Compartilhe esta Página