Skip to content

'JSR-303 validator failed to initialize' error remains even I followed instruction #260

@lilyzhang79

Description

@lilyzhang79

I want to use the @RetryOnFailure annotation, so I added the dependencies and it compiled but got the following error.

log4j:WARN No appenders could be found for logger (org.jboss.logging).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
[ERROR] JSR-303 validator failed to initialize: Unable to instantiate Configuration. (see http://www.jcabi.com/jcabi-aspects/jsr-303.html)

I do not need to use the validator annotation. Is there a way I can exclude it so I do not need to solve the dependencies here?

I tried to resolve the dependency by following https://aspects.jcabi.com/jsr-303.html, but still got the same error.

In docker when I started the service by java $JAVA_OPTS -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -Djava.security.egd=file:/dev/./urandom -jar /app.jar, it gave error.

Caused by: javax.validation.ValidationException: Unable to load class: org.hibernate.validator.HibernateValidator
at org.apache.bval.jsr303.xml.ValidationParser.loadClass(ValidationParser.java:282)
at org.apache.bval.jsr303.xml.ValidationParser.applyProviderClass(ValidationParser.java:179)
at org.apache.bval.jsr303.xml.ValidationParser.applyConfig(ValidationParser.java:158)
at org.apache.bval.jsr303.xml.ValidationParser.processValidationConfig(ValidationParser.java:82)
at org.apache.bval.jsr303.ConfigurationImpl.parseValidationXml(ConfigurationImpl.java:268)
at org.apache.bval.jsr303.ConfigurationImpl.prepare(ConfigurationImpl.java:258)
at org.apache.bval.jsr303.ConfigurationImpl.doPrivBuildValidatorFactory(ConfigurationImpl.java:248)
at org.apache.bval.jsr303.util.SecureActions$5.run(SecureActions.java:131)
at org.apache.bval.jsr303.util.SecureActions$5.run(SecureActions.java:129)
at org.apache.bval.jsr303.ConfigurationImpl.run(ConfigurationImpl.java:337)
at org.apache.bval.jsr303.ConfigurationImpl.buildValidatorFactory(ConfigurationImpl.java:244)
at org.springframework.validation.beanvalidation.LocalValidatorFactoryBean.afterPropertiesSet(LocalValidatorFactoryBean.java:305)
at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor$ValidatedLocalValidatorFactoryBean.<init>

so my current pom.xml have the following:

        <dependency>
            <groupId>com.jcabi</groupId>
            <artifactId>jcabi-aspects</artifactId>
            <version>0.22.6</version>
        </dependency>
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjrt</artifactId>
            <version>1.6.12</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>1.1.0.CR3</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.bval</groupId>
            <artifactId>bval-jsr303</artifactId>
            <version>0.4</version>
            <scope>runtime</scope>
        </dependency>

and

            <plugin>
                <groupId>com.jcabi</groupId>
                <artifactId>jcabi-maven-plugin</artifactId>
                <version>0.9.2</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>ajc</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions