Я создал Службу отдыха, используя компоненты Camel Rest DSL, camel-swagger-java и Camel-Serlet, затем упаковал ее в файл war и развернул в wildfly-11.0.0.Final, но получил следующее исключение:
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: java.lang.ClassNotFoundException: org.jboss.weld.environment.servlet.Listener from [Module \"deployment.camelSample-0.0.1-SNAPSHOT.war\" from Service Module Loader]
есть ли способ создать файл войны с помощью camel-swagger-java и camel-servlet, который можно успешно развернуть на wildfly-11.0.0. Наконец?Ждем ваших ответов.Заранее спасибо.
pom.xml
<dependencies>
<!-- CDI API -->
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
<version>1.2</version>
<scope>provided</scope>
</dependency>
<!-- Camel -->
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-cdi</artifactId>
<version>2.22.0</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-swagger-java</artifactId>
<version>2.22.0</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-servlet</artifactId>
<version>2.22.0</version>
<scope>runtime</scope>
<exclusions>
<exclusion>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-logging-juli</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- JSON support -->
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-jackson</artifactId>
<version>2.22.0</version>
</dependency>
</dependencies>
web.xml
<listener>
<listener-class>org.jboss.weld.environment.servlet.Listener</listener-class>
</listener>
<servlet>
<servlet-name>CamelServlet</servlet-name>
<servlet-class>org.apache.camel.component.servlet.CamelHttpTransportServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CamelServlet</servlet-name>
<url-pattern>/camel/*</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>SwaggerServlet</servlet-name>
<servlet-class>org.apache.camel.swagger.servlet.RestSwaggerServlet</servlet-class>
<init-param>
<param-name>base.path</param-name>
<param-value>rest</param-value>
</init-param>
<init-param>
<param-name>api.path</param-name>
<param-value>api-docs</param-value>
</init-param>
<init-param>
<param-name>api.version</param-name>
<param-value>1.2.3</param-value>
</init-param>
<init-param>
<param-name>api.title</param-name>
<param-value>User Services</param-value>
</init-param>
<init-param>
<param-name>api.description</param-name>
<param-value>Camel Rest Example with Swagger that provides an User REST service</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- swagger api -->
<servlet-mapping>
<servlet-name>SwaggerServlet</servlet-name>
<url-pattern>/api-docs/*</url-pattern>
</servlet-mapping>
UserRestRoute.java
открытый класс UserRestRoute extends RouteBuilder {
@Override
public void configure() {
rest("/user").description("User rest service")
.consumes("application/json").produces("application/json")
.get("/{id}").description("Find user by id").outType(User.class)
.param().name("id").type(path).description("The id of the user to get").dataType("integer").endParam()
.responseMessage().code(200).message("The user").endResponseMessage()
.to("bean:userService?method=getUser(${header.id})");
}
}