How can I troubleshoot the RegistryBuilder problem encountered during Junit testing with Maven?

I recently created a test in Juni and added it to my Maven project. However, when I try to build the project, I encounter the following error:

java.lang.NoClassDefFoundError: org/apache/http/config/RegistryBuilder at org.openqa.selenium.remote.internal.HttpClientFactory.getClientConnectionManager(HttpClientFactory.java:69) at org.openqa.selenium.remote.internal.HttpClientFactory.(HttpClientFactory.java:57) at org.openqa.selenium.remote.internal.HttpClientFactory.(HttpClientFactory.java:60) at org.openqa.selenium.remote.internal.ApacheHttpClient$Factory.getDefaultHttpClientFactory(ApacheHttpClient.java:250) at org.openqa.selenium.remote.internal.ApacheHttpClient$Factory.(ApacheHttpClient.java:227) at org.openqa.selenium.remote.HttpCommandExecutor.getDefaultClientFactory(HttpCommandExecutor.java:96) at org.openqa.selenium.remote.HttpCommandExecutor.(HttpCommandExecutor.java:70) at org.openqa.selenium.remote.service.DriverCommandExecutor.(DriverCommandExecutor.java:62) at org.openqa.selenium.chrome.ChromeDriverCommandExecutor.(ChromeDriverCommandExecutor.java:40) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:170) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:159) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:116) at com.sap.drools.controller.Resource.openCheckoutPage(Resource.java:18) at com.sap.drools.controller.TestExpressMode.ExpressModeFileUploadTest(TestExpressMode.java:11) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184) at org.junit.runners.ParentRunner.run(ParentRunner.java:236) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192) Caused by: java.lang.ClassNotFoundException: org.apache.http.config.RegistryBuilder at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 36 more

Any suggestions on how to resolve this issue and successfully execute junit tests in a Maven project?

Thank you

Answer №1

To include necessary dependencies in your pom.xml file:

org.apache.httpcomponents httpcore 4.4 test

org.apache.httpcomponents httpclient 4.5.2

org.apache.httpcomponents httpmime 4.5.2

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The NoSuchMethodError is thrown when trying to open Selenide

Can someone help me with this issue I'm facing while trying to navigate to the Google page? String url = "https://www.google.com"; Selenide.open(url); The specific exception that is being thrown is: java.util.stream.Collector com.google ...

Automating POST API requests with Selenium by incorporating a JSON header

Is it possible to automate REST API with Selenium (Java) if it includes header and body parts in JSON form? ...

Having trouble selecting a desired option from the drop-down menu by clicking on it

When using Selenium WebDriver, I am attempting to click on the Manual Testing option within the Testing menu on . The Manual Testing option is displayed after hovering the mouse over the Testing option. To achieve this functionality, I have implemented the ...

ChromeDriver continuously launches multiple times

Whenever I run the test below, Chrome keeps launching multiple times which causes the test to fail. I have been debugging for the past two days without success. Could you please help me identify where I am going wrong? Any assistance would be greatly appre ...

Selenium Chromedriver fails to redirect to specified website

Currently, my code looks like this: chrome_options = Options() chrome_options.add_extension(r"C:\Users\x\OneDrive\Desktop\pp\crxSolver.crx") driver = webdriver.Chrome(r'C:\Users\x\OneDrive\Desktop&bso ...

Selenium: Despite launching the Chrome browser, no commands are executing

Recently attempted to write a TestNG code that would print 'pass' after launching the Chrome browser. The Chrome browser does open, but no further action is taken. After some time, an error is encountered: public class NewTest { public WebDr ...

Set all option elements to have identical values

I am struggling to make all the rounds uniform, as I can only change the first one. Currently, all player scorecards are open, but I need to be able to select the same round for each of them. Let's ignore all the imports, as I was experimenting with ...

GeckoDriver Firefox and Protractor(Selenium) encountered a NoSuchWindowError due to the browsing context being discarded

I need assistance with running a basic test script using protractor. Environment: Node Version: v9.8.0 Protractor Version: 5.4.1 Angular Version: 1.x Browser(s): Mozilla Firefox 60.1.0 Operating System and Version: HELiOS release 6.10 Below is my config ...

When using Protractor with Typescript, you may encounter the error message "Failed: Cannot read property 'sendKeys' of undefined"

Having trouble creating Protractor JS spec files using TypeScript? Running into an error with the converted spec files? Error Message: Failed - calculator_1.calculator.prototype.getResult is not a function Check out the TypeScript files below: calculato ...

What is the best method to empty an input field using Intern JS?

I have developed a code snippet for inline editing table fields. This functionality allows users to click on an element, which then gets replaced by an input field for editing. Once the modification is made, the input field is removed and replaced with a s ...

Exploring the shadow DOM hierarchy is permitted

Having trouble accessing an element inside a shadow DOM. See the screenshot below for how it looks: https://i.stack.imgur.com/LYLo8.png I attempted to solve this issue using the following code: WebElement root1 = DriverFactory.driver.findElement(B ...

Ways to eliminate the absence of the 'Access-Control-Allow-Origin' header in an error message when using a Java-based web-service server

I'm currently working on developing a webservice using Java as the server and Javascript as the client. My goal is to send a Post request with JSON data and receive a Post response with JSON data from the server. However, since the client and server h ...

Having difficulty in choosing the link by its link_text in Python using Selenium

I am a beginner in the world of automation and I'm currently working on automating a website that contains various links. Initially, I hardcoded the user name and password, and was able to select the link using Link_text successfully. However, when I ...

Encountering an error in the response body while attempting to send body data from an external file using J

I am facing an issue where I need to send data in the request body from an external file within jmeter, but every time I attempt to do this, I receive an ERR in the response body. Below is my post method request body: ${__FileToString(/Users/public/${__eva ...

Protecting your application with Spring security and integrating Ajax functionalities

My spring security setup currently redirects to the login page when a user is not authenticated: <form-login login-page="/login/" authentication-failure-handler-ref="customAuthenticationFailureHandler" authentication-success-handler-ref="custom ...

Trying to create an allure report for my gradle IntelliJ project using a terminal command, but it seems to be taking forever to load. Additionally, I'm encountering a 404 error on

I completed running tests with the first command and then generated a report using the last command to view it. As I am new to using Allure reports, I would appreciate some guidance on how to interpret the report. Project Details Gradle: 7.2 Kotli ...

retrieve a compilation of all the events linked to a specific DOM element

When using Firefox, you can view events associated with each element in the Inspect Element of developers tools. https://i.stack.imgur.com/bKOK0.png I am looking to create a list of elements and their associated events automatically, ideally using seleniu ...

Unable to generate production package

NPM version (npm --v): 5.4.2 Gulp version (gulp -v): [email protected], [email protected] JHipster version: 4.6.1 Node version: 6.11.3 I am facing difficulties in generating a production package for my application. The process of running ...

Automate Citrix web tasks using Selenium or similar tools for efficient and streamlined processes

Are there any methods for implementing selenium or a similar tool on Citrix web systems? I have been relying on pyautogui, but it seems to be quite ineffective by itself. Any suggestions on how to enhance pyautogui would be greatly appreciated. ...

Looping through elements with Python's Selenium WebDriver능 utilizing a For Loop

Basically, I am trying to extract all information from the 'Others' page on a website starting from the first item to the last. Here is my attempt: I encountered some difficulties due to the unique structure of the website. My goal is to retriev ...