Я разрабатываю веб-приложение на Джерси, которое служит веб-крючком для чат-ботов, в настоящее время у меня есть универсальный сервис, который обрабатывает основные соединения, и теперь я хочу создать специальный веб-крючок приложения, который сможет использовать универсальный сервис.
Я уже добавил универсальное веб-приложение в качестве зависимости maven и могу использовать его в своем рабочем пространстве, но при развертывании на tomcat я получаю сообщение об ошибке:
[org.glassfish.jersey.server.ContainerException: java.lang.NoClassDefFoundError:
.../generic/services/Webhook] with root cause
java.lang.ClassNotFoundException: ...generic.services.Webhook
Файл pom общих служб:
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>...</groupId>
<artifactId>...</artifactId>
<version>...</version>
</parent>
<artifactId>...-generic-services</artifactId>
<name>...</name>
<groupId>...</groupId>
<packaging>jar</packaging>
<properties>
<jersey.version>2.27</jersey.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.glassfish.jersey</groupId>
<artifactId>jersey-bom</artifactId>
<version>${jersey.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
...
</dependencies>
<build>
<finalName>...</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<inherited>true</inherited>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<attachClasses>true</attachClasses>
</configuration>
</plugin>
</plugins>
</build>
Файл pom служб приложений:
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>...</groupId>
<artifactId>...</artifactId>
<version>...</version>
</parent>
<artifactId>...-app-services</artifactId>
<name>...</name>
<groupId>...</groupId>
<packaging>war</packaging>
<properties>
<jersey.version>2.27</jersey.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>..generic.services</groupId>
<artifactId>...-generic-services</artifactId>
<version>...</version>
<classifier>classes</classifier>
</dependency>
</dependencies>
<build>
<finalName>...-app-services</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<inherited>true</inherited>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
Итак, что я в основном хочу сделать, так это иметь возможность вызывать функции общих служб из веб-приложения службы приложений, например, если в общемВ сервисе есть функция, которая получает и возвращает json, тогда я хочу иметь возможность создать подобную функцию в приложении, вызывать универсальную сервисную функцию с помощью json и получать от нее.