Issue
I have a problem migrating my application to java 11.
I recieve a FileNotFoundException
when trying to load my logging config.
java.io.FileNotFoundException: class path resource [logging/logback-local.xml] cannot be resolved to URL because it does not exist
at [email protected]/org.springframework.util.ResourceUtils.getURL(ResourceUtils.java:137)
at [email protected]/org.springframework.boot.context.logging.LoggingApplicationListener.initializeSystem(LoggingApplicationListener.java:293)
at [email protected]/org.springframework.boot.context.logging.LoggingApplicationListener.initialize(LoggingApplicationListener.java:264)
at [email protected]/org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEnvironmentPreparedEvent(LoggingApplicationListener.java:226)
at [email protected]/org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:203)
at [email protected]/org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
at [email protected]/org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
at [email protected]/org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
at [email protected]/org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127)
at [email protected]/org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:76)
at [email protected]/org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:53)
at [email protected]/org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:342)
at [email protected]/org.springframework.boot.SpringApplication.run(SpringApplication.java:305)
at [email protected]/org.springframework.boot.SpringApplication.run(SpringApplication.java:1215)
at [email protected]/org.springframework.boot.SpringApplication.run(SpringApplication.java:1204)
at [email protected]/foo.bar.Application.main(Application.java:23)
This is done via configuration and worked in Java 8:
This is my application.yml
logging:
config: classpath:logging/logback-local.xml
application structure looks like this:
src
-main
-java
-foo.bar.Application.java
-resources
-application.yml
-logging
-logback-local.xml
pom.xml
pom:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.10.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>foo.group</groupId>
<artifactId>application</artifactId>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>11</java.version>
<spring.version>5.2.1.RELEASE</spring.version>
<spring.boot.version>2.1.10.RELEASE</spring.boot.version>
</properties>
<dependencies>
...
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
<resources>
<resource>
<directory>${project.basedir}/src/main/resources</directory>
</resource>
</resources>
<testSourceDirectory>${project.basedir}/src/test/java</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<annotationProcessorPaths>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${mapstruct.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>
</project>
I think this is a problem with the jigsaw modular system, but I could not find any solutions to this on the Internet.
Thanks for the help!
Solution
So after some fiddling around, using the suggestion from Hatice, the problem disappeared. I have no idea what caused the problem.
Answered By - Amir Schnell
Answer Checked By - Dawn Plyler (JavaFixing Volunteer)