admin管理员组文章数量:1289384
I have a mutli module maven project divided into the following modules: web, model, persistence and service. I have a serviceimpl in my service-module that should use the web client. However, I get the following error when starting the project:
Caused by: java.lang.ClassNotFoundException: ioty.channel.ChannelHandler at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) ~[na:na] at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) ~[na:na]
It's not because the dependency is missing, because it comes with the webflux-starter dependendy. Does anyone have an idea? Thanks in advance :)
I configure the web client on its own config file, which I also reference in my application file so that it is scanned.
I show you the different files here:
ServiceImpl:
private final WebClient webClient;
public BerufesucheServiceImpl(@Qualifier("paWebClient") WebClient webClient) {
this.webClient = Objects.requireNonNull(webClient);
}
the configfile, where I configure the webclient:
@Configuration
@ComponentScan(basePackages = {"de.mlp.pa.berufesuche.service.persistence"})
public class ServiceConfig {
@Bean("paWebClient")
public WebClient paWebClient() {
HttpClient httpClient = HttpClient.create()
press(true)
.doOnConnected(connection -> connection
.addHandlerFirst(new ReadTimeoutHandler(180000, TimeUnit.MILLISECONDS))
.addHandlerFirst(new WriteTimeoutHandler(180000, TimeUnit.MILLISECONDS)));
return WebClient.builder()
.baseUrl("http://localhost:8082/berufe-enricher")
.clientConnector(new ReactorClientHttpConnector(httpClient))
.build();
}
}
the pom from my servicemodule:
<project xmlns=".0.0" xmlns:xsi=";
xsi:schemaLocation=".0.0 .xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>de.mlp.pa.berufesuche</groupId>
<artifactId>berufesuche-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>berufesuche-service</artifactId>
<dependencies>
<dependency>
<groupId>de.mlp.pa.berufesuche</groupId>
<artifactId>berufesuche-model</artifactId>
</dependency>
<!-- Spring Boot -->
<dependency>
<groupId>.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<!-- Spring -->
<dependency>
<groupId>.springframework</groupId>
<artifactId>spring-context-support</artifactId>
</dependency>
</dependencies>
</project>
the parent-pom:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns=".0.0" xmlns:xsi=";
xsi:schemaLocation=".0.0 .0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.mlp.pa.berufesuche</groupId>
<artifactId>berufesuche-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>berufesuche-web</module>
<module>berufesuche-persistence</module>
<module>berufesuche-model</module>
<module>berufesuche-service</module>
</modules>
<properties>
<!-- Compiler Properties -->
<java.version>21</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- dependency versions -->
<springboot.version>3.4.2</springboot.version>
<!-- Plugin Versions -->
<maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version>
<maven-clean-plugin.version>3.4.0</maven-clean-plugin.version>
<maven-source-plugin.version>3.3.1</maven-source-plugin.version>
<maven-surefire-plugin-version>3.5.2</maven-surefire-plugin-version>
<maven-dependency-plugin.version>3.8.1</maven-dependency-plugin.version>
<dependency-check-maven.version>10.0.4</dependency-check-maven.version>
</properties>
<dependencyManagement>
<dependencies>
<!-- Project internal dependencies -->
<dependency>
<groupId>de.mlp.pa.berufesuche</groupId>
<artifactId>berufesuche-web</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>de.mlp.pa.berufesuche</groupId>
<artifactId>berufesuche-persistence</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>de.mlp.pa.berufesuche</groupId>
<artifactId>berufesuche-model</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>de.mlp.pa.berufesuche</groupId>
<artifactId>berufesuche-service</artifactId>
<version>${project.version}</version>
</dependency>
<!-- Spring Boot -->
<dependency>
<groupId>.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${springboot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- Testing dependencies -->
<dependency>
<groupId>.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>${maven-source-plugin.version}</version>
<executions>
<execution>
<id>attach-sources</id>
<phase>verify</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>${maven-clean-plugin.version}</version>
<configuration>
<filesets>
<fileset>
<directory>src/main/generated/</directory>
<includes>
<include>*</include>
</includes>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${springboot.version}</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
<configuration>
<classifier>spring-boot</classifier>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>${maven-dependency-plugin.version}</version>
<executions>
<execution>
<goals>
<goal>properties</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin-version}</version>
<configuration>
<includes>
<include>**/*Test.java</include>
<include>**/*IT.java</include>
</includes>
<!-- This fixes the problem of dynamic agent loading in jdk21+ -->
<argLine>
@{argLine} -Xms1G -Xmx4G -javaagent:${.mockito:mockito-core:jar}
</argLine>
</configuration>
</plugin>
<plugin>
<groupId>.owasp</groupId>
<artifactId>dependency-check-maven</artifactId>
<version>${dependency-check-maven.version}</version>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
</plugin>
<plugin>
<groupId>.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
</plugin>
<plugin>
<groupId>.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>OWASP</id>
<build>
<plugins>
<plugin>
<groupId>.owasp</groupId>
<artifactId>dependency-check-maven</artifactId>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
the applicationfile, where I import ther configfile:
@SpringBootApplication
@Import(value = {
PersistenceConfig.class,
ServiceConfig.class,
WebConfig.class,
})
public class BerufesucheApplication {
public static void main(String[] args) {
SpringApplication.run(BerufesucheApplication.class, args);
}
}
本文标签: javaWebclient maven Dependency errorsStack Overflow
版权声明:本文标题:java - Webclient maven Dependency errors? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741476201a2380898.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论