Я получаю это исключение:
org.jboss.arquillian.container.spi.client.container.DeploymentException: java .lang.ClassNotFoundException: org. apache .http .client.methods.HttpUriRequest
Я пытаюсь всеми силами протестировать корпоративное приложение с помощью Junit 4 + Arquillian + WebLogi c. Но всегда есть проблемы с классами, не найденными. Я ничего не нашел в сети. Мой локальный сервер приложений -> WebLogic Server: 12.2.1.3.0
POM Parent:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.11</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.12.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.12.1</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
<version>${org.mapstruct.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-bom</artifactId>
<version>3.1.4</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
<version>1.6.0.Final</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
<annotationProcessorPaths>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${org.mapstruct.version}</version>
</path>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>
POM где находится Junit:
<dependencies>
<dependency>
<groupId>it.gc.ss</groupId>
<artifactId>GCGateway-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>it.gc.ss</groupId>
<artifactId>GCGateway-ejb</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<!-- arquillian -->
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-wls-remote-rest</artifactId>
<version>1.0.1.Final</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-spi</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-api-maven</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-spi-maven</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-impl-maven</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-impl-maven-archive</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-aether-provider</artifactId>
<version>3.3.9</version>
<scope>test</scope>
</dependency>
</dependencies>
Это Arquillian. xml:
<?xml version="1.0"?>
<arquillian
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://jboss.org/schema/arquillian"
xsi:schemaLocation="http://jboss.org/schema/arquillian
http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
<!--
<engine><property name="deploymentExportPath">target/</property></engine>
-->
<container qualifier="weblogic" default="true">
<defaultProtocol type="Servlet 3.0" />
<configuration>
<property name="wlHome">C:/Oracle/Middleware/Oracle_Home/wlserver</property>
<property name="adminUrl">http://localhost:7001</property>
<property name="adminUserName">weblogic</property>
<property name="adminPassword">password</property>
<property name="target">AdminServer</property>
</configuration>
</container>
</arquillian>
и, наконец, это мой тестовый класс
import lombok.extern.log4j.Log4j2;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.RunAsClient;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.arquillian.test.api.ArquillianResource;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.jboss.shrinkwrap.resolver.api.maven.Maven;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.io.File;
import java.net.URISyntaxException;
import java.net.URL;
@Log4j2
@RunWith(Arquillian.class)
public class GCGatewayTest {
@Deployment
public static Archive < ? > createDeployment() {
EnterpriseArchive ear = ShrinkWrap
.create(EnterpriseArchive.class, "GCGateway.ear");
//Common dependencies
File[] commonDependecies = Maven.configureResolver()
.fromFile("C:\\GC\\B2B\\apache-maven-3.6.3\\conf\\settings.xml")
.loadPomFromFile("C:\\GC\\B2B\\progetti\\GCGateway\\trunk\\pom.xml")
.importRuntimeDependencies()
.resolve("it.gc.ss:GCGateway-common:1.0.0-SNAPSHOT")
.withTransitivity()
.asFile();
File[] toAdd = new File[commonDependecies.length - 1];
int i = 0;
for (File f: commonDependecies) {
if (f.getName().startsWith("GCGateway-common")) {
continue;
}
toAdd[i] = f;
i++;
}
ear.addAsLibraries(toAdd);
JavaArchive common = ShrinkWrap.create(JavaArchive.class, "GCGateway-common.jar")
.addPackages(true, "it.gc.ss.gcgateway.common")
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
.addAsResource("log4j2.xml")
.addAsResource("configuration.properties");
log.info(common.toString(true));
log.info("---------------");
ear.addAsLibraries(common);
JavaArchive ejb = ShrinkWrap.create(JavaArchive.class, "GCGateway-ejb.jar")
.addPackages(true, "it.gc.ss.gcgateway.ejb")
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
log.info(ejb.toString(true));
log.info("---------------");
WebArchive ws = ShrinkWrap.create(WebArchive.class, "GCGateway-ws.war")
.addPackages(true, "it.gc.ss.gcgateway.ws")
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
log.info(ws.toString(true));
log.info("---------------");
ear.addAsModule(ws);
ear.addAsModule(ejb);
ear.setApplicationXML("application.xml");
log.info("---------------");
log.info(ear.toString(true));
return ear;
}
@Test
@RunAsClient
public void myTest(@ArquillianResource URL url) throws URISyntaxException {
WebTarget target = ClientBuilder.newClient()
.target(url.toURI())
.path("api")
.path("gctool")
.path("greet");
log.info(target.toString());
Response response = target
.request(MediaType.APPLICATION_JSON_TYPE)
.get();
log.info(response.toString());
log.info("OK");
}
}
, и это исключение:
org.jboss. arquillian.container.spi.client.container.DeploymentException: java .lang.ClassNotFoundException: org. apache .http.client.methods.HttpUriRequest
в org.jboss.arquillian.container.w rest.RESTUtils.deploy (RESTUtils. java: 227) в org.jboss.arquillian.container.wls.remote.rest.RemoteContainer.deploy (RemoteContainer. java: 63) в org.jboss.arquillian.container. wls.remote.rest.WebLogicContainer.deploy (WebLogicContainer. java: 63) в org.jboss.arquillian.container.impl.client.container.ContainerDeployController $ 3.call (ContainerDeployController. java 15): 15) или 15): .arquillian.container.impl.client.container.ContainerDeployController $ 3.call (ContainerDeployController. java: 118) по адресу org.jboss.arquillian.container.impl.client.container.ContainerDeployController.executeOperation (ContainerDeployController. java: 239) по адресу org.jboss.arquillian.container.impl.client.conlerontC () ContainerDeployController. java: 118) в sun.reflect.NativeMethodAccessorImpl.invoke0 (собственный метод) в sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl. java: 62) при получении запроса на получение вторичного доступа. *: 43) в java .lang.reflect.Method.invoke (Метод. java: 498) в org.jboss.arquillian.core.impl.ObserverImpl.invoke (ObserverImpl. java: 86) в org .jboss.arquillian.core.impl.EventContextImpl.invokeObservers (EventContextImpl. java: 103) в org.jboss.arquillian.core.impl.EventContextImpl.proceed (EventContextImpl. javaquj.. org. 90) или 90) .container.impl.client.ContainerDeploymentContextHandler.createContainerContext (ContainerDeploymentContextHandler. java: 54) в sun.reflect.Na tiveMethodAccessorImpl.invoke0 (родной метод) в sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl. java: 62) в sun.reflect.DelegatingMethodAccessorImpl.invoke * 52. *. Method.invoke (Method. java: 498) в org.jboss.arquillian.core.impl.ObserverImpl.invoke (ObserverImpl. java: 86) в org.jboss.arquillian.core.impl.EventContextImpl.proceed ( EventContextImpl. java: 95) в org.jboss.arquillian.container.impl.client.ContainerDeploymentContextHandler.createDeploymentContext (ContainerDeploymentContextHandler. java: 71) в sun.reflect.NativeMetmplf. Native. NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl. java: 62) в sun.reflect. в org.jboss.arquillian.core.impl.ObserverImpl.invoke (ObserverImpl. java: 86) в org.jboss.arquillian.core. impl.EventContextImpl. Собственный метод) в sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl. java: 62) в sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl. java: 43) в * 1066. refle.Method.invoke (Метод. java: 498) в org.jboss.arquillian.core.impl.ObserverImpl.invoke (ObserverImpl. java: 86) в org.jboss.arquillian.core.impl.EventContextImpl. продолжить (EventContextImpl. java: 95) в org.jboss.arquillian.core.impl.ManagerImpl.fire (ManagerImpl. java: 133) в org.jboss.arquillian.core.impl.ManagerImpl.fire (ManagerImpl. java: 105) в org.jboss.arquillian.core.impl.EventImpl.fire (EventImpl. java: 62) в org.jboss.arquillian.container.impl.client.container.ContainerDeployController $ 1.perform (ContainerDeployController . java: 92) в org.jboss.arquillian.container.impl.client.container.ContainerDeployController $ 1.perform (ContainerDeployController. java: 77) в org.jboss.arquillian.container.impl.client.container. ContainerDeployController.forEachDeployment (ContainerDeployController. java: 232) по адресу org.jboss.arquillian.container.impl.client.container.ContainerDeployController.forEachManagedDeployment (ContainerDeployControlill. at. , at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl. java: 43) в java .lang.reflect.Method.invoke (Method. java: 498) в org.jboss.arquillian.core.implIbser .invoke (ObserverImpl. java: 86) в org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers (EventContextImpl. java: 103) в org.jboss.arquillian.core.impl.EventContempImpl . java: 90) в org.jboss.arquillian.core.impl.ManagerImpl.fire (ManagerImpl. java: 133) в org.jboss.arquillian.core.impl.ManagerImpl.fire (ManagerImpl. java : 105) в org.jboss.arquillian.core.impl.EventImpl.fire (EventImpl. java: 62) в org.jboss.arquillian.container.test.impl.client.ContainerEventController.execute (ContainerEventControll er. java: 96) в sun.reflect. Родной метод. *: 43) в java .lang.reflect.Method.invoke (Метод. java: 498) в org.jboss.arquillian.core.impl.ObserverImpl.invoke (ObserverImpl. java: 86) в org .jboss.arquillian.core.impl.EventContextImpl.invokeObservers (EventContextImpl. java: 103) в org.jboss.arquillian.core.impl.EventContextImpl.proceed (EventContextImpl. javaquj.. org. 90 или at). .test.impl.TestContextHandler.createClassContext (TestContextHandler. java: 83) в sun.reflect.NativeMethodAccessorImpl.invoke0 (родной метод) в sun.reflect.NativeMethodAccessorImpl.inl_force *. .DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl. java: 43) в java .lang.reflect.Method.invoke (Метод. java: 498) в org.jboss.arquillian.co re.impl.ObserverImpl.invoke (ObserverImpl. java: 86) в org.jboss.arquillian.core.impl.EventContextImpl.proceed (EventContextImpl. java: 95) в org.jboss.arquillian.test.impl. TestContextHandler.createSuiteContext (TestContextHandler. java: 69) по адресу sun.reflect.NativeMethodAccessorImpl.invoke0 (собственный метод) по адресу sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodImpl. DelegatingMethodAccessorImpl. java: 43) в java .lang.reflect.Method.invoke (Method. java: 498) в org.jboss.arquillian.core.impl.ObserverImpl.invoke (ObserverImpl. java: 86) в org.jboss.arquillian.core.impl.EventContextImpl.proceed (EventContextImpl. java: 95) в org.jboss.arquillian.core.impl.ManagerImpl.fire (ManagerImpl. java: 133) в org .jboss.arquillian.core.impl.ManagerImpl.fire (ManagerImpl. java: 105) в org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.beforeClass (EventTestRunnerAdaptor. java: 89) в org.jboss.arquillian.junit.Arquillian $ 2.оценки (Arquillian. java: 163) в orgill.js .junit.Arquillian.multiExecute (Arquillian. java: 350) в org.jboss.arquillian.junit.Arquillian.access $ 200 (Arquillian. java: 54) в org.jboss.arquillian.junit.Arquillian $ 3.оценить (Arquillian. java: 177) в org.junit.runners.ParentRunner $ 3.evaluate (ParentRunner. java: 306) в org.junit.runners.ParentRunner.run (ParentRunner. java: 413) в организации .jboss.arquillian.junit.Arquillian.run (Arquillian. java: 115) в org.junit.runner.JUnitCore.run (JUnitCore. java: 137) в com.intellij.junit4.JUnit4IdeaTestRunner . java: 68) по адресу com.intellij.rt.junit.IdeaTestRunner $ Repeater.startRunnerWithArgs (IdeaTestRunner. java: 33) по адресу com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart: 230, июнь 23 июня. ) на com.intellij.rt.junit.JUnitStarter.main (JUnitStart er. java: 58) Вызвано: java .lang.RuntimeException: java .lang.ClassNotFoundException: org. apache .http.client.methods.HttpUriRequest ... еще 90