Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
lilyzhang79 opened this issue Aug 20, 2018 · 4 comments

Comments

@lilyzhang79
Copy link

lilyzhang79 commented Aug 20, 2018

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:https://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:https://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>
@0crat
Copy link

0crat commented Aug 20, 2018

@yegor256/z please, pay attention to this issue

@0crat
Copy link

0crat commented Aug 20, 2018

@lilyzhang79/z this project will fix the problem faster if you donate a few dollars to it; just click here and pay via Stripe, it's very fast, convenient and appreciated; thanks a lot!

@lilyzhang79
Copy link
Author

I added two more dependencies in pom.xml and the error after service started changed to

Initialization of bean failed; nested exception is java.lang.AbstractMethodError: org.apache.bval.jsr303.ConfigurationImpl.getParameterNameProvider()Ljavax/validation/ParameterNameProvider;
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:564)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)

@l3r8yJ
Copy link
Contributor

l3r8yJ commented Aug 2, 2024

@lilyzhang79 do you remember which deps were added?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants