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

IllegalArgumentException: No visible constructors in class cz.jiripinkas.jsitemapgenerator.generator.SitemapGenerator #16

Closed
ptahchiev opened this issue Apr 24, 2020 · 1 comment

Comments

@ptahchiev
Copy link

So i've just updated to 4.4 and now I get this error from spring:

Caused by: org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class cz.jiripinkas.jsitemapgenerator.generator.SitemapGenerator: Common causes of this problem include using a final class or a non-visible class; nested exception is java.lang.IllegalArgumentException: No visible constructors in class cz.jiripinkas.jsitemapgenerator.generator.SitemapGenerator
	at org.springframework.aop.framework.CglibAopProxy.getProxy(CglibAopProxy.java:208)
	at org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:110)
	at org.springframework.aop.scope.ScopedProxyFactoryBean.setBeanFactory(ScopedProxyFactoryBean.java:117)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeAwareMethods(AbstractAutowireCapableBeanFactory.java:1818)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1783)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:595)
	... 13 more
Caused by: java.lang.IllegalArgumentException: No visible constructors in class cz.jiripinkas.jsitemapgenerator.generator.SitemapGenerator
	at org.springframework.cglib.proxy.Enhancer.filterConstructors(Enhancer.java:760)

I'm creating a SitemapGenerator bean like this:

    @Bean(name = "sitemapGenerator")
    @ConditionalOnMissingBean(name = "sitemapGenerator")
    public SitemapGenerator webSitemapGenerator(
                    @Value("#{jobParameters['" + PlatformCoreSessionConfig.PARAMETER_KEY_SESSION + SiteServiceImpl.SITE_SESSION_ATTR_KEY
                                    + "']}") String siteCode, @Qualifier(SiteRepository.NAME) SiteRepository siteRepository) {
        return SitemapGenerator.of(((SitemapSiteEntityDefinition) siteRepository.findByCode(siteCode)).getSitemapConfig().getBaseUrl());
    }

and apparently spring tries to create a proxy but you don't provide any constructors and spring doesn't know how to make the proxy.

Is it possible to provide a constructor?

@jirkapinkas
Copy link
Owner

In a few moments will be on Maven Central version 4.5, where it's fixed.

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

2 participants