1

When I start Spring Boot application with Spring-Devtools enabled and classes generated from the WSDL schema I get:

Caused by: java.lang.IllegalArgumentException: org.wsdl.WsdlServiceWs referenced from a method is not visible from class loader

I have a project based on Spring Boot with some of the classes generated from the WSDL file using the org.apache.cxf:cxf-codegen-plugin plugin. Generated classes are stored in target/generated/wsdl/** directory. The name of the package of generated classes differs from the project package name.

I tried several exclusions following the documentation:

https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#using-boot-devtools-restart-exclude

But all my attempts failed.

restart.exclude.wsdl=target/generated/wsdl
restart.exclude.wsdl=org.wsdl.*
restart.exclude.wsdl=**WsdlServiceWs.class

I want to have Spring-Devtools enabled, having org.wsdl.** generated classes excluded from the restart cycle.

2 Answers2

1

The problem was, that I tried to use the WsdlServiceWs which was in fact an interface returned by WsdlServiceWsService. I had the WsdlServiceWs interface returned as a bean in the configuration:

    ...

    @Bean
    public WsdlServiceWs wsdlService() {
        return new WsdlServiceWsService().getService();
    }

    ...

I have not thought that this will be the problem. Simply changing the bean to the following:

    ...

    @Bean
    public WsdlServiceWsService wsdlService() {
        return new WsdlServiceWsService();
    }

    ...

Did the work.


Edit:

This solution only moved the invocation of exception from the Bean creation phase to the execution phase. The issue is still not resolved.

0

You Can't

  • because the devtools only check the class parent path, not every folder, you can add an breakpoint on ChangeableUrls.java:59
private ChangeableUrls(URL... urls) {
        DevToolsSettings settings = DevToolsSettings.get();
        List<URL> reloadableUrls = new ArrayList<>(urls.length);
        for (URL url : urls) {
            if ((settings.isRestartInclude(url) || isDirectoryUrl(url.toString())) && !settings.isRestartExclude(url)) {
                reloadableUrls.add(url);
            }
        }
        if (logger.isDebugEnabled()) {
            logger.debug("Matching URLs for reloading : " + reloadableUrls);
        }
        this.urls = Collections.unmodifiableList(reloadableUrls);
    }
  • you can see the url is file:/xxx/target/classes/
  • so, you can't exclude one class by this way
Lambda
  • 138
  • 2
  • 6