I saw these threads:
java.net.SocketException: Connection reset on Selenium driver.close() or driver.quit() statements
selenium/java- java.net.SocketException: Connection reset
But I still don't understand the issue here. Everything is working fine, I get the response and content from the website and when I'm done I call the driver.quit(); / driver.close(); and get the exception. If I don't call that .quit(); I don't get the exception.
I get this exception after I get the web scraping content:
2023-01-31T21:28:31.222+01:00 WARN 8400 --- [cHttpClient-1-4] o.a.netty.handler.WebSocketHandler : onError
java.net.SocketException: Connection reset
at java.base/sun.nio.ch.SocketChannelImpl.throwConnectionReset(SocketChannelImpl.java:394) ~[na:na]
at java.base/sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:426) ~[na:na]
at io.netty.buffer.PooledByteBuf.setBytes(PooledByteBuf.java:259) ~[netty-buffer-4.1.87.Final.jar:4.1.87.Final]
at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1132) ~[netty-buffer-4.1.87.Final.jar:4.1.87.Final]
at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:357) ~[netty-transport-4.1.87.Final.jar:4.1.87.Final]
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:151) ~[netty-transport-4.1.87.Final.jar:4.1.87.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788) ~[netty-transport-4.1.87.Final.jar:4.1.87.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724) ~[netty-transport-4.1.87.Final.jar:4.1.87.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650) ~[netty-transport-4.1.87.Final.jar:4.1.87.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562) ~[netty-transport-4.1.87.Final.jar:4.1.87.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) ~[netty-common-4.1.87.Final.jar:4.1.87.Final]
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[netty-common-4.1.87.Final.jar:4.1.87.Final]
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[netty-common-4.1.87.Final.jar:4.1.87.Final]
at java.base/java.lang.Thread.run(Thread.java:833) ~[na:na]
2023-01-31T21:28:31.229+01:00 WARN 8400 --- [cHttpClient-1-4] o.openqa.selenium.remote.http.WebSocket : Connection reset
java.net.SocketException: Connection reset
at java.base/sun.nio.ch.SocketChannelImpl.throwConnectionReset(SocketChannelImpl.java:394) ~[na:na]
at java.base/sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:426) ~[na:na]
at io.netty.buffer.PooledByteBuf.setBytes(PooledByteBuf.java:259) ~[netty-buffer-4.1.87.Final.jar:4.1.87.Final]
at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1132) ~[netty-buffer-4.1.87.Final.jar:4.1.87.Final]
at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:357) ~[netty-transport-4.1.87.Final.jar:4.1.87.Final]
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:151) ~[netty-transport-4.1.87.Final.jar:4.1.87.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788) ~[netty-transport-4.1.87.Final.jar:4.1.87.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724) ~[netty-transport-4.1.87.Final.jar:4.1.87.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650) ~[netty-transport-4.1.87.Final.jar:4.1.87.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562) ~[netty-transport-4.1.87.Final.jar:4.1.87.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) ~[netty-common-4.1.87.Final.jar:4.1.87.Final]
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[netty-common-4.1.87.Final.jar:4.1.87.Final]
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[netty-common-4.1.87.Final.jar:4.1.87.Final]
at java.base/java.lang.Thread.run(Thread.java:833) ~[na:na]
This is the code from the main:
String url = "https://relatedwords.org/relatedto/";
System.setProperty("webdriver.chrome.driver", filePath);
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.addArguments("--headless");
WebDriver driver = new ChromeDriver(chromeOptions);
driver.get(url + "Fishsticks");
WebElement words = driver.findElement(By.className("words"));
final List<WebElement> wordList = words.findElements(By.tagName("a"));
wordList.forEach(word -> System.out.println(word.getText()));
// when I remove this I do not get any exceptions
driver.quit();
I use the latest chrome version I just checked, and there are no updates available (Version 109.0.5414.120) and I am using chrome driver version ChromeDriver 109.0.5414.74 and the latest selenium version 4.8.0
So what is the solution here? I tried to read so many stack threads but have not found any solution
Below is the same code I have tried and it works fine with no exceptions. Only difference is that I have not added following code System.setProperty("webdriver.chrome.driver", filePath);. You do not need to set property when you are using the latest version of selenium(which you are using anyways). Try removing this line and see if it resolves your issue.
public static void main(String[] args){
ChromeOptions options = new ChromeOptions();
options.addArguments("--headless");
WebDriver driver = new ChromeDriver(options);
driver.get("https://relatedwords.org/relatedto/" + "Fishsticks");
WebElement words = driver.findElement(By.className("words"));
final List<WebElement> wordList = words.findElements(By.tagName("a"));
wordList.forEach(word -> System.out.println(word.getText()));
driver.quit();
}
Here is the console output:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Starting ChromeDriver 109.0.5414.74 (e7c5703604daa9cc128ccf5a5d3e993513758913-refs/branch-heads/5414#{#1172}) on port 2732
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
batter
cod
united kingdom
ketchup
herring
whitefish
hake
haddock
pollock
refrigerator
british english
breaded
american english
europe
food processing
supermarket
grilling
tartar sauce
fish
machine
backbone
parents
frozen food
wheel
blade
television commercial
southampton
shallow frying
skin
breadcrumbs
salmon
bone
deep frying
world war ii
gorton's of gloucester
clarence birdseye
store brand
vegetable oil
java.net.SocketException: Connection reset
java.net.SocketException may occur due to several possible reasons as follows:
It can occur on the server-side when the client closed the socket connection before the response could be returned over the socket. For example, by quitting the browser before the response was retrieved.
It can also occur by writing to a connection that the other end has already closed normally resulting in an application protocol error.
This usecase
I took your program and executed it. Here is the result:
Code block:
System.setProperty("webdriver.chrome.driver", "C:\\BrowserDrivers\\chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.addArguments("--start-maximized");
WebDriver driver = new ChromeDriver(options);
driver.get("https://relatedwords.org/relatedto/Fishsticks");
WebElement words = driver.findElement(By.className("words"));
final List<WebElement> wordList = words.findElements(By.tagName("a"));
wordList.forEach(word -> System.out.println(word.getText()));
driver.quit();
Console output:
batter
cod
united kingdom
ketchup
herring
whitefish
hake
haddock
pollock
refrigerator
british english
breaded
american english
europe
food processing
supermarket
grilling
tartar sauce
fish
machine
backbone
parents
frozen food
wheel
blade
television commercial
southampton
shallow frying
skin
breadcrumbs
salmon
bone
deep frying
world war ii
gorton's of gloucester
clarence birdseye
store brand
vegetable oil
Conclusion
Programmatically, I don't see any error in your code block. However ensure that:
JDK is upgraded to current levels JDK 8u351.
Selenium is upgraded to current levels Version 4.8.0.
ChromeDriver is updated to current ChromeDriver v109.0 level.
Chrome Browser is updated to current chrome=109.0 (as per chromedriver=109.0.5414.74 release notes).
Take a System Reboot.
Execute your Test as a non-root user.
References
You can find a couple of relevant detailed discussions in:
Selenium shows java.net.SocketException: Connection reset
java.net.SocketException: Connection reset
What's causing my java.net.SocketException: Connection reset?
Related
I have changed from desired capabilities to UiAutomator2Options options = new UiAutomator2Options();
STILL GETTING ERROR
FAILED CONFIGURATION: #BeforeTest setup
java.lang.NoClassDefFoundError: org/openqa/selenium/remote/AcceptedW3CCapabilityKeys
at io.appium.java_client.remote.options.BaseOptions.(BaseOptions.java:54)
at test.java.launch.setup(launch.java:30)
Please refer this
Use UiAutomator2Options instead of DesiredCapabilities
I know that Selenium is an automated testing tool, but i'm trying to use it for RPA instead (things to do with my work environment)
I've gotten the java code down, and it runs exactly how i want it. It takes data from an excel sheet, converts the data into java objects, then enters data into a web application. It works fine for the first 20-25 entries, then starts to slow down, and eventually crashes the application. I have a few thousand rows to enter.
I've tried starting the chrome webdriver with disabled cache, but doesn't solve the problem.
Here is the code for disabling the cache.
System.setProperty("webdriver.chrome.driver","C:\\\\DRIVERS\\\\chromedriver.exe");
DesiredCapabilities cap = DesiredCapabilities.chrome();
cap.setCapability("applicationCacheEnabled", false);
WebDriver webDriver = new ChromeDriver(cap);
WebDriverWait wait = new WebDriverWait(webDriver, 20);
JavascriptExecutor js = (JavascriptExecutor) webDriver;
I'm using a for each loop to key in the data.
/* Add vehicle data */
for(VehicleData vehicleData : testDataList) {
Thread.sleep(2500);
/* Add new inspection */
webDriver.findElement(By.xpath("/html/body/app-component/div/div/mat-sidenav-container/mat-sidenav-content/div[1]/div[2]/count-survey-component/count-survey-vehicle/div[2]/div/mat-tab-group/div/mat-tab-body[1]/div/div[2]/div/div/button")).click();
js.executeScript("window.scrollBy(0,-1000)");
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("dd/MM/yyyy");
LocalDateTime now = LocalDateTime.now();
String inspectionDate = dtf.format(now).toString();
Thread.sleep(5000);
webDriver.findElement(By.name("InspectionDate")).click();
webDriver.findElement(By.name("InspectionDate")).sendKeys(inspectionDate);
webDriver.findElement(By.name("InspectionDate")).sendKeys(Keys.ESCAPE);
Thread.sleep(1000);
webDriver.findElement(By.id("cmbCity")).sendKeys(vehicleData.getCityMaster());
webDriver.findElement(By.id("cmbCity")).sendKeys(Keys.ARROW_DOWN);
webDriver.findElement(By.id("cmbCity")).sendKeys(Keys.ENTER);
Thread.sleep(1000);
webDriver.findElement(By.id("cmbvehicleTypeNew")).sendKeys(surveyType);
webDriver.findElement(By.id("cmbvehicleTypeNew")).sendKeys(Keys.ARROW_DOWN);
webDriver.findElement(By.id("cmbvehicleTypeNew")).sendKeys(Keys.ENTER);
Thread.sleep(1000);
webDriver.findElement(By.id("cmbWheel")).sendKeys("4");
webDriver.findElement(By.id("cmbWheel")).sendKeys(Keys.ARROW_DOWN);
webDriver.findElement(By.id("cmbWheel")).sendKeys(Keys.ENTER);
Thread.sleep(1000);
webDriver.findElement(By.id("maker")).sendKeys(vehicleData.getMake());
webDriver.findElement(By.id("maker")).sendKeys(Keys.ARROW_DOWN);
webDriver.findElement(By.id("maker")).sendKeys(Keys.ENTER);
Thread.sleep(1000);
webDriver.findElement(By.id("model")).sendKeys(vehicleData.getModelMaster());
webDriver.findElement(By.id("model")).sendKeys(Keys.ARROW_DOWN);
webDriver.findElement(By.id("model")).sendKeys(Keys.ENTER);
Thread.sleep(1000);
webDriver.findElement(By.id("cmbchassis")).click();
webDriver.findElement(By.id("cmbchassis")).sendKeys("2s-2d");
Thread.sleep(1000);
webDriver.findElement(By.id("cmbchassis")).sendKeys(Keys.ARROW_DOWN);
webDriver.findElement(By.id("cmbchassis")).sendKeys(Keys.ENTER);
Thread.sleep(3000);
js.executeScript("window.scrollBy(0,1000)");
/* Enter Front Left Data */
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("/html/body/app-component/div/div/mat-sidenav-container/mat-sidenav-content/div[1]/div[2]/count-survey-component/count-survey-vehicle/count-survey-addedit-inspection/div[2]/form/div[10]/kendo-grid/div/table/tbody/tr[1]/td[2]/div[1]/mat-form-field/div/div[1]/div/input"))).sendKeys(vehicleData.getSizeFL());
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("/html/body/app-component/div/div/mat-sidenav-container/mat-sidenav-content/div[1]/div[2]/count-survey-component/count-survey-vehicle/count-survey-addedit-inspection/div[2]/form/div[10]/kendo-grid/div/table/tbody/tr[1]/td[2]/div[1]/mat-form-field/div/div[1]/div/input"))).sendKeys(Keys.ARROW_DOWN);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("/html/body/app-component/div/div/mat-sidenav-container/mat-sidenav-content/div[1]/div[2]/count-survey-component/count-survey-vehicle/count-survey-addedit-inspection/div[2]/form/div[10]/kendo-grid/div/table/tbody/tr[1]/td[2]/div[1]/mat-form-field/div/div[1]/div/input"))).sendKeys(Keys.ENTER);
Thread.sleep(1000);
webDriver.findElement(By.xpath("/html/body/app-component/div/div/mat-sidenav-container/mat-sidenav-content/div[1]/div[2]/count-survey-component/count-survey-vehicle/count-survey-addedit-inspection/div[2]/form/div[10]/kendo-grid/div/table/tbody/tr[1]/td[2]/div[2]/div[1]/mat-form-field/div/div[1]/div/input")).sendKeys(vehicleData.getBrandFL());
webDriver.findElement(By.xpath("/html/body/app-component/div/div/mat-sidenav-container/mat-sidenav-content/div[1]/div[2]/count-survey-component/count-survey-vehicle/count-survey-addedit-inspection/div[2]/form/div[10]/kendo-grid/div/table/tbody/tr[1]/td[2]/div[2]/div[1]/mat-form-field/div/div[1]/div/input")).sendKeys(Keys.ARROW_DOWN);
webDriver.findElement(By.xpath("/html/body/app-component/div/div/mat-sidenav-container/mat-sidenav-content/div[1]/div[2]/count-survey-component/count-survey-vehicle/count-survey-addedit-inspection/div[2]/form/div[10]/kendo-grid/div/table/tbody/tr[1]/td[2]/div[2]/div[1]/mat-form-field/div/div[1]/div/input")).sendKeys(Keys.ENTER);
Thread.sleep(1000);
webDriver.findElement(By.xpath("/html/body/app-component/div/div/mat-sidenav-container/mat-sidenav-content/div[1]/div[2]/count-survey-component/count-survey-vehicle/count-survey-addedit-inspection/div[2]/form/div[10]/kendo-grid/div/table/tbody/tr[1]/td[2]/div[2]/div[2]/mat-form-field/div/div[1]/div/input")).sendKeys(vehicleData.getPatternFL());
webDriver.findElement(By.xpath("/html/body/app-component/div/div/mat-sidenav-container/mat-sidenav-content/div[1]/div[2]/count-survey-component/count-survey-vehicle/count-survey-addedit-inspection/div[2]/form/div[10]/kendo-grid/div/table/tbody/tr[1]/td[2]/div[2]/div[2]/mat-form-field/div/div[1]/div/input")).sendKeys(Keys.ARROW_DOWN);
webDriver.findElement(By.xpath("/html/body/app-component/div/div/mat-sidenav-container/mat-sidenav-content/div[1]/div[2]/count-survey-component/count-survey-vehicle/count-survey-addedit-inspection/div[2]/form/div[10]/kendo-grid/div/table/tbody/tr[1]/td[2]/div[2]/div[2]/mat-form-field/div/div[1]/div/input")).sendKeys(Keys.ENTER);
/* Enter Front Right Data */
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("/html/body/app-component/div/div/mat-sidenav-container/mat-sidenav-content/div[1]/div[2]/count-survey-component/count-survey-vehicle/count-survey-addedit-inspection/div[2]/form/div[10]/kendo-grid/div/table/tbody/tr[2]/td[2]/div[1]/mat-form-field/div/div[1]/div/input"))).sendKeys(vehicleData.getSizeFR());
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("/html/body/app-component/div/div/mat-sidenav-container/mat-sidenav-content/div[1]/div[2]/count-survey-component/count-survey-vehicle/count-survey-addedit-inspection/div[2]/form/div[10]/kendo-grid/div/table/tbody/tr[2]/td[2]/div[1]/mat-form-field/div/div[1]/div/input"))).sendKeys(Keys.ARROW_DOWN);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("/html/body/app-component/div/div/mat-sidenav-container/mat-sidenav-content/div[1]/div[2]/count-survey-component/count-survey-vehicle/count-survey-addedit-inspection/div[2]/form/div[10]/kendo-grid/div/table/tbody/tr[2]/td[2]/div[1]/mat-form-field/div/div[1]/div/input"))).sendKeys(Keys.ENTER);
Thread.sleep(1000);
webDriver.findElement(By.xpath("/html/body/app-component/div/div/mat-sidenav-container/mat-sidenav-content/div[1]/div[2]/count-survey-component/count-survey-vehicle/count-survey-addedit-inspection/div[2]/form/div[10]/kendo-grid/div/table/tbody/tr[2]/td[2]/div[2]/div[1]/mat-form-field/div/div[1]/div/input")).sendKeys(vehicleData.getBrandFR());
webDriver.findElement(By.xpath("/html/body/app-component/div/div/mat-sidenav-container/mat-sidenav-content/div[1]/div[2]/count-survey-component/count-survey-vehicle/count-survey-addedit-inspection/div[2]/form/div[10]/kendo-grid/div/table/tbody/tr[2]/td[2]/div[2]/div[1]/mat-form-field/div/div[1]/div/input")).sendKeys(Keys.ARROW_DOWN);
webDriver.findElement(By.xpath("/html/body/app-component/div/div/mat-sidenav-container/mat-sidenav-content/div[1]/div[2]/count-survey-component/count-survey-vehicle/count-survey-addedit-inspection/div[2]/form/div[10]/kendo-grid/div/table/tbody/tr[2]/td[2]/div[2]/div[1]/mat-form-field/div/div[1]/div/input")).sendKeys(Keys.ENTER);
Thread.sleep(1000);
webDriver.findElement(By.xpath("/html/body/app-component/div/div/mat-sidenav-container/mat-sidenav-content/div[1]/div[2]/count-survey-component/count-survey-vehicle/count-survey-addedit-inspection/div[2]/form/div[10]/kendo-grid/div/table/tbody/tr[2]/td[2]/div[2]/div[2]/mat-form-field/div/div[1]/div/input")).sendKeys(vehicleData.getPatternFR());
webDriver.findElement(By.xpath("/html/body/app-component/div/div/mat-sidenav-container/mat-sidenav-content/div[1]/div[2]/count-survey-component/count-survey-vehicle/count-survey-addedit-inspection/div[2]/form/div[10]/kendo-grid/div/table/tbody/tr[2]/td[2]/div[2]/div[2]/mat-form-field/div/div[1]/div/input")).sendKeys(Keys.ARROW_DOWN);
webDriver.findElement(By.xpath("/html/body/app-component/div/div/mat-sidenav-container/mat-sidenav-content/div[1]/div[2]/count-survey-component/count-survey-vehicle/count-survey-addedit-inspection/div[2]/form/div[10]/kendo-grid/div/table/tbody/tr[2]/td[2]/div[2]/div[2]/mat-form-field/div/div[1]/div/input")).sendKeys(Keys.ENTER);
/* Enter Rear Left Data */
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("/html/body/app-component/div/div/mat-sidenav-container/mat-sidenav-content/div[1]/div[2]/count-survey-component/count-survey-vehicle/count-survey-addedit-inspection/div[2]/form/div[10]/kendo-grid/div/table/tbody/tr[3]/td[2]/div[1]/mat-form-field/div/div[1]/div/input"))).sendKeys(vehicleData.getSizeRL());
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("/html/body/app-component/div/div/mat-sidenav-container/mat-sidenav-content/div[1]/div[2]/count-survey-component/count-survey-vehicle/count-survey-addedit-inspection/div[2]/form/div[10]/kendo-grid/div/table/tbody/tr[3]/td[2]/div[1]/mat-form-field/div/div[1]/div/input"))).sendKeys(Keys.ARROW_DOWN);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("/html/body/app-component/div/div/mat-sidenav-container/mat-sidenav-content/div[1]/div[2]/count-survey-component/count-survey-vehicle/count-survey-addedit-inspection/div[2]/form/div[10]/kendo-grid/div/table/tbody/tr[3]/td[2]/div[1]/mat-form-field/div/div[1]/div/input"))).sendKeys(Keys.ENTER);
Thread.sleep(1000);
webDriver.findElement(By.xpath("/html/body/app-component/div/div/mat-sidenav-container/mat-sidenav-content/div[1]/div[2]/count-survey-component/count-survey-vehicle/count-survey-addedit-inspection/div[2]/form/div[10]/kendo-grid/div/table/tbody/tr[3]/td[2]/div[2]/div[1]/mat-form-field/div/div[1]/div/input")).sendKeys(vehicleData.getBrandRL());
webDriver.findElement(By.xpath("/html/body/app-component/div/div/mat-sidenav-container/mat-sidenav-content/div[1]/div[2]/count-survey-component/count-survey-vehicle/count-survey-addedit-inspection/div[2]/form/div[10]/kendo-grid/div/table/tbody/tr[3]/td[2]/div[2]/div[1]/mat-form-field/div/div[1]/div/input")).sendKeys(Keys.ARROW_DOWN);
webDriver.findElement(By.xpath("/html/body/app-component/div/div/mat-sidenav-container/mat-sidenav-content/div[1]/div[2]/count-survey-component/count-survey-vehicle/count-survey-addedit-inspection/div[2]/form/div[10]/kendo-grid/div/table/tbody/tr[3]/td[2]/div[2]/div[1]/mat-form-field/div/div[1]/div/input")).sendKeys(Keys.ENTER);
Thread.sleep(1000);
webDriver.findElement(By.xpath("/html/body/app-component/div/div/mat-sidenav-container/mat-sidenav-content/div[1]/div[2]/count-survey-component/count-survey-vehicle/count-survey-addedit-inspection/div[2]/form/div[10]/kendo-grid/div/table/tbody/tr[3]/td[2]/div[2]/div[2]/mat-form-field/div/div[1]/div/input")).sendKeys(vehicleData.getPatternRL());
webDriver.findElement(By.xpath("/html/body/app-component/div/div/mat-sidenav-container/mat-sidenav-content/div[1]/div[2]/count-survey-component/count-survey-vehicle/count-survey-addedit-inspection/div[2]/form/div[10]/kendo-grid/div/table/tbody/tr[3]/td[2]/div[2]/div[2]/mat-form-field/div/div[1]/div/input")).sendKeys(Keys.ARROW_DOWN);
webDriver.findElement(By.xpath("/html/body/app-component/div/div/mat-sidenav-container/mat-sidenav-content/div[1]/div[2]/count-survey-component/count-survey-vehicle/count-survey-addedit-inspection/div[2]/form/div[10]/kendo-grid/div/table/tbody/tr[3]/td[2]/div[2]/div[2]/mat-form-field/div/div[1]/div/input")).sendKeys(Keys.ENTER);
/* Enter Rear Right Data */
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("/html/body/app-component/div/div/mat-sidenav-container/mat-sidenav-content/div[1]/div[2]/count-survey-component/count-survey-vehicle/count-survey-addedit-inspection/div[2]/form/div[10]/kendo-grid/div/table/tbody/tr[4]/td[2]/div[1]/mat-form-field/div/div[1]/div/input"))).sendKeys(vehicleData.getSizeRL());
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("/html/body/app-component/div/div/mat-sidenav-container/mat-sidenav-content/div[1]/div[2]/count-survey-component/count-survey-vehicle/count-survey-addedit-inspection/div[2]/form/div[10]/kendo-grid/div/table/tbody/tr[4]/td[2]/div[1]/mat-form-field/div/div[1]/div/input"))).sendKeys(Keys.ARROW_DOWN);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("/html/body/app-component/div/div/mat-sidenav-container/mat-sidenav-content/div[1]/div[2]/count-survey-component/count-survey-vehicle/count-survey-addedit-inspection/div[2]/form/div[10]/kendo-grid/div/table/tbody/tr[4]/td[2]/div[1]/mat-form-field/div/div[1]/div/input"))).sendKeys(Keys.ENTER);
Thread.sleep(1000);
webDriver.findElement(By.xpath("/html/body/app-component/div/div/mat-sidenav-container/mat-sidenav-content/div[1]/div[2]/count-survey-component/count-survey-vehicle/count-survey-addedit-inspection/div[2]/form/div[10]/kendo-grid/div/table/tbody/tr[4]/td[2]/div[2]/div[1]/mat-form-field/div/div[1]/div/input")).sendKeys(vehicleData.getBrandRL());
webDriver.findElement(By.xpath("/html/body/app-component/div/div/mat-sidenav-container/mat-sidenav-content/div[1]/div[2]/count-survey-component/count-survey-vehicle/count-survey-addedit-inspection/div[2]/form/div[10]/kendo-grid/div/table/tbody/tr[4]/td[2]/div[2]/div[1]/mat-form-field/div/div[1]/div/input")).sendKeys(Keys.ARROW_DOWN);
webDriver.findElement(By.xpath("/html/body/app-component/div/div/mat-sidenav-container/mat-sidenav-content/div[1]/div[2]/count-survey-component/count-survey-vehicle/count-survey-addedit-inspection/div[2]/form/div[10]/kendo-grid/div/table/tbody/tr[4]/td[2]/div[2]/div[1]/mat-form-field/div/div[1]/div/input")).sendKeys(Keys.ENTER);
Thread.sleep(1000);
webDriver.findElement(By.xpath("/html/body/app-component/div/div/mat-sidenav-container/mat-sidenav-content/div[1]/div[2]/count-survey-component/count-survey-vehicle/count-survey-addedit-inspection/div[2]/form/div[10]/kendo-grid/div/table/tbody/tr[4]/td[2]/div[2]/div[2]/mat-form-field/div/div[1]/div/input")).sendKeys(vehicleData.getPatternRL());
webDriver.findElement(By.xpath("/html/body/app-component/div/div/mat-sidenav-container/mat-sidenav-content/div[1]/div[2]/count-survey-component/count-survey-vehicle/count-survey-addedit-inspection/div[2]/form/div[10]/kendo-grid/div/table/tbody/tr[4]/td[2]/div[2]/div[2]/mat-form-field/div/div[1]/div/input")).sendKeys(Keys.ARROW_DOWN);
webDriver.findElement(By.xpath("/html/body/app-component/div/div/mat-sidenav-container/mat-sidenav-content/div[1]/div[2]/count-survey-component/count-survey-vehicle/count-survey-addedit-inspection/div[2]/form/div[10]/kendo-grid/div/table/tbody/tr[4]/td[2]/div[2]/div[2]/mat-form-field/div/div[1]/div/input")).sendKeys(Keys.ENTER);
Thread.sleep(1000);
webDriver.findElement(By.xpath("/html/body/app-component/div/div/mat-sidenav-container/mat-sidenav-content/div[1]/div[2]/count-survey-component/count-survey-vehicle/count-survey-addedit-inspection/div[1]/span[3]/button")).click();
Thread.sleep(2500);
js.executeScript("window.scrollTo(0,0)");
Error is:
[1576641990.504][WARNING]: Timed out connecting to Chrome, retrying...
[1576644529.565][SEVERE]: Timed out receiving message from renderer: 600.000
org.openqa.selenium.TimeoutException: timeout
(Session info: chrome=79.0.3945.79)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48'
System info: host: 'SGLT009696', ip: '10.225.5.54', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '12.0.2'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 79.0.3945.79, chrome: {chromedriverVersion: 78.0.3904.70 (edb9c9f3de024..., userDataDir: C:\Users\RAY~1.TON\AppData\...}, goog:chromeOptions: {debuggerAddress: localhost:61927}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: XP, platformName: XP, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify}
Session ID: 9a644474b16f372400389760be2c942b
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at org.openqa.selenium.remote.RemoteWebDriver.executeScript(RemoteWebDriver.java:489)
at rpa.EnterDataToWeb.enterDataToWeb(EnterDataToWeb.java:152)
at Main.main(Main.java:174)
I've read that this happens when trying to open Chrome DevTools during the test, but my code does not do that at all. Please advise.
Is it an issue with the chrome cache filling up? If so, must i clear it every 30 or so entries?
Just add this line:
chromeOptions.setPageLoadStrategy(PageLoadStrategy.NONE);
This should solve the problem.
This error message...
org.openqa.selenium.WebDriverException: disconnected: received Inspector.detached event
...implies that the WebDriverException was raised due to Inspector.detached event.
From your code trials it is pretty much evident you were using Thread.sleep(n); to wait for the elements to be clickable / interacable to invoke sendKeys() which is not the ideal way, as:
Thread.sleep() suspends the execution of the current thread for the given number of seconds. The argument may be a floating point number to indicate a more precise sleep time. The actual suspension time may be less than that requested because any caught signal will terminate the sleep() following execution of that signal’s catching routine. Also, the suspension time may be longer than requested by an arbitrary amount because of the scheduling of other activity in the system.
Invoking sendKeys() and Thread.sleep() back to back might have simulated sending either of the following:
Ctrl + Shift + I
Ctrl + Shift + J
Ctrl + Shift + C
F12
each of which will attempt to open the google-chrome-devtools
Now, as per the article DevTools window keeps closing if you try to open the google-chrome-devtools, ChromeDriver is automatically disconnected.
Solution
A full proof solution will be to replace all the instances of Thread.sleep() and ImplicitWait with ExplicitWait
Additional Consideration
As per the documentation of DesiredCapabilities, the applicationCacheEnabled is a read/write capability which takes a boolean value and configures whether the session can interact with the application cache.
Implementation
applicationCacheEnabled can be configured in either of the ways:
DesiredCapabilities capability = DesiredCapabilities.chrome();
capability.setCapability("applicationCacheEnabled", false);
Or
DesiredCapabilities capability = DesiredCapabilities.chrome();
capability.setCapability(CapabilityType.SUPPORTS_APPLICATION_CACHE, false);
So effectively your code block will be:
System.setProperty("webdriver.chrome.driver","C:\\DRIVERS\\chromedriver.exe");
DesiredCapabilities cap = DesiredCapabilities.chrome();
cap.setCapability(CapabilityType.SUPPORTS_APPLICATION_CACHE, false);
ChromeOptions opt = new ChromeOptions();
opt.merge(cap);
WebDriver driver = new ChromeDriver(opt);
Reference
You can find a relevant discussion in:
How to fix unknown error: unhandled inspector error: “Cannot find context with specified id”
With version 75 of Chrome just released, our tests no longer run properly. They give the stacktrace pasted below. We are using ruby on rails v. 5.1.6.2 with rspec, selenium-webdriver 3.8.0.
Stacktrace:
Selenium::WebDriver::Error::UnknownCommandError:
unknown command: Cannot call non W3C standard command while in W3C mode
# 0 chromedriver 0x000000010c46e8e9 chromedriver + 3594473
# 1 chromedriver 0x000000010c3fe543 chromedriver + 3134787
# 2 chromedriver 0x000000010c1aa29f chromedriver + 692895
# 3 chromedriver 0x000000010c11a691 chromedriver + 104081
# 4 chromedriver 0x000000010c11b7d5 chromedriver + 108501
# 5 chromedriver 0x000000010c42d555 chromedriver + 3327317
# 6 chromedriver 0x000000010c438e60 chromedriver + 3374688
# 7 chromedriver 0x000000010c438bf8 chromedriver + 3374072
# 8 chromedriver 0x000000010c40cd39 chromedriver + 3194169
# 9 chromedriver 0x000000010c4396d8 chromedriver + 3376856
# 10 chromedriver 0x000000010c420f27 chromedriver + 3276583
# 11 chromedriver 0x000000010c456064 chromedriver + 3493988
# 12 chromedriver 0x000000010c474617 chromedriver + 3618327
# 13 libsystem_pthread.dylib 0x00007fff7744c2eb _pthread_body + 126
# 14 libsystem_pthread.dylib 0x00007fff7744f249 _pthread_start + 66
# 15 libsystem_pthread.dylib 0x00007fff7744b40d thread_start + 13
# /Users/julie/.rvm/gems/ruby-2.5.1/gems/selenium-webdriver-3.8.0/lib/selenium/webdriver/remote/response.rb:69:in `assert_ok'
# /Users/julie/.rvm/gems/ruby-2.5.1/gems/selenium-webdriver-3.8.0/lib/selenium/webdriver/remote/response.rb:32:in `initialize'
# /Users/julie/.rvm/gems/ruby-2.5.1/gems/selenium-webdriver-3.8.0/lib/selenium/webdriver/remote/http/common.rb:81:in `new'
# /Users/julie/.rvm/gems/ruby-2.5.1/gems/selenium-webdriver-3.8.0/lib/selenium/webdriver/remote/http/common.rb:81:in `create_response'
# /Users/julie/.rvm/gems/ruby-2.5.1/gems/selenium-webdriver-3.8.0/lib/selenium/webdriver/remote/http/default.rb:104:in `request'
# /Users/julie/.rvm/gems/ruby-2.5.1/gems/selenium-webdriver-3.8.0/lib/selenium/webdriver/remote/http/common.rb:59:in `call'
# /Users/julie/.rvm/gems/ruby-2.5.1/gems/selenium-webdriver-3.8.0/lib/selenium/webdriver/remote/bridge.rb:166:in `execute'
# /Users/julie/.rvm/gems/ruby-2.5.1/gems/selenium-webdriver-3.8.0/lib/selenium/webdriver/remote/oss/bridge.rb:579:in `execute'
# /Users/julie/.rvm/gems/ruby-2.5.1/gems/selenium-webdriver-3.8.0/lib/selenium/webdriver/remote/oss/bridge.rb:526:in `element_displayed?'
# /Users/julie/.rvm/gems/ruby-2.5.1/gems/selenium-webdriver-3.8.0/lib/selenium/webdriver/common/element.rb:199:in `displayed?'
# /Users/julie/.rvm/gems/ruby-2.5.1/gems/capybara-2.17.0/lib/capybara/selenium/node.rb:148:in `visible?'
# /Users/julie/.rvm/gems/ruby-2.5.1/gems/capybara-2.17.0/lib/capybara/node/element.rb:269:in `block in visible?'
# /Users/julie/.rvm/gems/ruby-2.5.1/gems/capybara-2.17.0/lib/capybara/node/base.rb:81:in `synchronize'
# /Users/julie/.rvm/gems/ruby-2.5.1/gems/capybara-2.17.0/lib/capybara/node/element.rb:269:in `visible?'
# /Users/julie/.rvm/gems/ruby-2.5.1/gems/capybara-2.17.0/lib/capybara/queries/selector_query.rb:84:in `matches_filters?'
# /Users/julie/.rvm/gems/ruby-2.5.1/gems/capybara-2.17.0/lib/capybara/result.rb:29:in `block in initialize'
Our driver configuration:
File.write(LOG_FILE_PATH, '')
Selenium::WebDriver.logger.level = :debug
Selenium::WebDriver.logger.output = LOG_FILE_PATH
Capybara.register_driver :selenium do |app|
# from https://github.com/SeleniumHQ/selenium/issues/3738
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(loggingPrefs: {browser: 'ALL'})
options = Selenium::WebDriver::Chrome::Options.new
options.add_argument '--disable-infobars' # hide info bar about chrome automating test
# if we don't use this flag, every selenium test will die with the error:
# "unknown error: Chrome failed to start: exited abnormally"
options.add_argument '--no-sandbox'
options.add_argument '--headless' if ENV.fetch("HEADLESS", nil).present?
options.add_argument '--window-size=1600,2400'
options.add_argument '-–allow-file-access-from-files' # TODO Julie - may help with file specs?
options.add_preference('homepage', 'about:blank') # TODO is this working?
options.add_preference('profile.default_content_settings.popups', 0)
options.add_preference('download.default_directory', DownloadHelpers::PATH.to_s)
Capybara::Selenium::Driver.new(
app,
clear_local_storage: true,
clear_session_storage: true,
browser: :chrome,
options: options,
desired_capabilities: capabilities,
)
end
UPDATE:
I was able to get our tests to work temporarily using capabilities = { "chromeOptions" => {'w3c' => false} }.
After updating chromedriver, we began receiving the error "unknown error: DevToolsActivePort file doesn't exist". In order to fix this problem, we upgraded our selenium-webdriver gem to 3.142.3 and this fixed the issue, allowing us to use w3c without any additional parameters.
First the solution
As promised by John Chen [Owner - WebDriver for Google Chrome] yesterday, new versions of ChromeDriver 75.0.3770.90 and 76.0.3809.25 have been released, and are now available at the ChromeDriver Downloads site. These versions include the following bug fixes over the previous releases of ChromeDriver 75 and 76:
Fixed a bug that incorrectly rejected POST requests with empty body in OSS mode
Added new endpoints for retrieving Chrome log
In addition, version 76.0.3809.25 also includes the following change:
Added endpoint for Is Displayed command in W3C mode
Email Snapshot
Details
It will be against the best practices to turn off w3c in chromedriver to address the error:
Selenium::WebDriver::Error::UnknownCommandError:
unknown command: Cannot call non W3C standard command while in W3C mode
as the current implementation of ChromeDriver requests a W3C-compliant session to the client.
However, this error message implies that the ChromeDriver was unable to invoke a non W3C standard command while in W3C mode while initiating/spawning a new WebBrowser i.e. Chrome Browser session.
The main issue is, when ChromeDriver's client requests a W3C-compliant session, the response from ChromeDriver does not conform to the W3C spec, and causes errors in language APIs.
As per the discussion in ChromeDriver response in W3C mode is not standard compliant John Chen (Owner - WebDriver for Google Chrome) mentioned Simon Stewart (Creator - WebDriver) have updated that:
The new session response for a w3c session should look like:
{
"value": {
"sessionId": "some-uuid",
"capabilities": {
"browserName": "chrome",
...
}
}
}
But when starting a new session with the w3c option set to true in the chromeOptions, the returned response looked like:
{
"sessionId": "af4656c27fb94485b7872e1fc616923a",
"status": "ok",
"value": {
"browserName": "chrome",
...
}
}
Which is neither a correctly formed response for the JSON Wire Protocol (where "status" would be an integer), nor a correctly formed W3C response and without a correctly formed response, the w3c compatible cannot be used.
This revision and this commit addressed this issue.
This usecase
Presumably you are using ChromeDriver v75.x with Chrome v75.x and in case you are still seeing the error, you need to pass the ExperimentalOption w3c as true explicitly as follows:
Ruby code sample:
capabilities = { "chromeOptions" => {'w3c' => true} }
Java code sample:
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
public class W3c {
public static void main(String[] args) throws Exception {
ChromeOptions opt = new ChromeOptions();
opt.setExperimentalOption("w3c", true);
ChromeDriver driver = new ChromeDriver(opt);
driver.get("https://www.google.co.in");
}
}
Python code sample:
from selenium import webdriver
opt = webdriver.ChromeOptions()
opt.add_experimental_option('w3c', True)
driver = webdriver.Chrome(chrome_options=opt)
driver.get('https://www.google.co.in')
Update
Till ChromeDriver v74.x, Chrome and ChromeDriver combo was running in w3c mode by default but there was bug with in the chromedriver/server/http_handler.cc. As per the details in goog:chromeOptions.w3c=false doesn't work for POST request with empty body:
Method HttpHandler::HandleCommand checks the value of the kW3CDefault constant instead of session goog:chromeOptions.w3c value. As a result, JSON Wire protocol support was broken, where POST requests with an empty body are allowed.
JSON Wire protocol will be in demand until displayed endpoint is resumed in the w3c mode. It should be noted that W3C WebDriver specification doesn't forbid the use of 'displayed' endpoint and this feature is actively used in some APIs.
As Is Element Displayed command is not part of W3C spec, but is still used by some APIs, and its functionality can be difficult to replicate in those APIs. This Change List [revision and commit] re-enables this command in W3C mode to ease transition to W3C mode.
#John have already confirmed us to expect an update to ChromeDriver v75.0 tomorrow with the fix.
For the Javascript people (I specifically use WebdriverIO) make sure you use 'goog:chromeOptions'
capabilities: {
browserName: 'chrome',
'goog:chromeOptions': {
'w3c': false
}
}
Else you'll get
unknown error: Illegal key values seen in w3c capabilities: [chromeOptions]
After doing options = Selenium::WebDriver::Chrome::Options.new
you can do options.add_option('w3c', false)
I'm facing the same issue.
I tried to disable using capabilities = Selenium::WebDriver::Remote::Capabilities.chrome({ "chromeOptions" => {'w3c' => false} }) but it didn't work.
Then I changed to capabilities = { "chromeOptions" => {'w3c' => false} } and now it works.
Maybe it can help you.
This is how it can be done in Behat with Mink: #behat #mink
Behat\MinkExtension:
base_url: "your_site_url"
browser_name: 'chrome'
goutte: ~
javascript_session: selenium2
selenium2:
wd_host: http://127.0.0.1:4444/wd/hub
capabilities:
browser: chrome
extra_capabilities:
chromeOptions:
args: ['--headless', '--disable-gpu']
w3c: false
PHP Behat-Mink-Selenium users see this post for information:
https://medium.com/#alex.designworks/chromedriver-75-enforces-w3c-standard-breaking-behat-tests-460cad435545
and GitHub issue https://github.com/minkphp/MinkSelenium2Driver/issues/293
As of this post, the "workaround" is to fall back to Chrome 74 for those using Behat-Mink-Selenium.
{
'platformName':'Android',
'platformVersion':'8.0.0',
'deviceName':'Samsung Galaxy S9',
'deviceType':'Phone',
'nativeWebTap': 'True',
'browser' : 'Chrome',
"goog:chromeOptions": {'w3c': False}
}
use goog:chromeOptions options to set w3c True or False. on console you will see the same getting passed.
I recently upgraded appium to 1.18 , using chromeDriver version 84 and my chrome browser version is also 84. I use appium python library to start a browser. My capabilities are like below but I get error -"WebDriverException: Message: 'chromeOptions' must be of type object". Please let me know whats wrong with my capabilities.
{
'platformName':'Android',
'platformVersion':'8.0.0',
'deviceName':'Samsung Galaxy S9',
'deviceType':'Phone',
'nativeWebTap': 'True',
'browser' : 'Chrome',
'chromeOptions' : '{args: [ 'w3c : false']}'
}
I have written a small script that takes the default IP address for Epson printers we receive at my company and changes them automatically according to the requirement. This is done using Selenium HtmlUnitDriver.
The script gets the page, inserts the new IP, and than submits it. Because the IP changes once we submit a second time, the page is no longer 192.168.192.168, and the script does not want to complete.
Below is the script:
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
public class Main {
public static void main(String[] args) {
// Creating a new instance of the HTML unit driver.
WebDriver driver = new HtmlUnitDriver();
driver.get("http://192.168.192.168/ctcpip.htm");
// Find and change the IP Address field.
WebElement element = driver.findElement(By.name("IpAddress"));
element.clear();
element.sendKeys("192.168.192.169");
element.submit();
// Reset the printer. This changes it's IP as well, causing the initial driver page to no longer exist.
WebElement reset = driver.findElement(By.name("Submit"));
reset.submit();
// The script never gets this far.
driver.quit();
}
}
The script times out before it can complete. When the reset element is clicked, the initial URL of http://192.168.192.168/ctcpip.htm is effectively nonexistent, since we have changed it to 192.169.192.169. This is expected behavior, and the entire point of the program.
The console reads:
Nov 03, 2016 10:36:52 AM org.apache.http.impl.execchain.RetryExec execute
INFO: I/O exception (java.net.SocketException) caught when processing request to {}->http://192.168.192.168:80: Operation timed out
Nov 03, 2016 10:36:52 AM org.apache.http.impl.execchain.RetryExec execute
INFO: Retrying request to {}->http://192.168.192.168:80
Exception in thread "main" java.lang.RuntimeException: org.apache.http.conn.HttpHostConnectException: Connect to 192.168.192.168:80 [/192.168.192.168] failed: Operation timed out
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.doProcessPostponedActions(JavaScriptEngine.java:739)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.processPostponedActions(JavaScriptEngine.java:820)
at com.gargoylesoftware.htmlunit.html.HtmlElement.click(HtmlElement.java:1325)
at com.gargoylesoftware.htmlunit.html.HtmlElement.click(HtmlElement.java:1268)
at com.gargoylesoftware.htmlunit.html.HtmlElement.click(HtmlElement.java:1216)
at org.openqa.selenium.htmlunit.HtmlUnitWebElement.submit(HtmlUnitWebElement.java:175)
at Main.main(Main.java:19)
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 com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Caused by: org.apache.http.conn.HttpHostConnectException: Connect to 192.168.192.168:80 [/192.168.192.168] failed: Operation timed out
at org.apache.http.impl.conn.HttpClientConnectionOperator.connect(HttpClientConnectionOperator.java:140)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:318)
at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:363)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:219)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:195)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:86)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:108)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72)
at com.gargoylesoftware.htmlunit.HttpWebConnection.getResponse(HttpWebConnection.java:178)
at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseFromWebConnection(WebClient.java:1313)
at com.gargoylesoftware.htmlunit.WebClient.loadWebResponse(WebClient.java:1230)
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:338)
at com.gargoylesoftware.htmlunit.WaitingRefreshHandler.handleRefresh(WaitingRefreshHandler.java:92)
at com.gargoylesoftware.htmlunit.html.HtmlPage.executeRefreshIfNeeded(HtmlPage.java:1446)
at com.gargoylesoftware.htmlunit.html.HtmlPage.initialize(HtmlPage.java:306)
at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:475)
at com.gargoylesoftware.htmlunit.WebClient.loadDownloadedResponses(WebClient.java:2074)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.doProcessPostponedActions(JavaScriptEngine.java:733)
... 11 more
Caused by: java.net.ConnectException: Operation timed out
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.java:72)
at org.apache.http.impl.conn.HttpClientConnectionOperator.connect(HttpClientConnectionOperator.java:123)
... 29 more
Process finished with exit code 1
How do I tell my driver instance that it's totally cool the page changed so the process can exit properly?
The script needs to reach the driver.quit(); line.
Have you tried to call
driver.quit();
before
reset.submit();
? You no longer use the driver to retrieve any element, so you can quit before submitting the page.
I hope it helps.
If something doesn't work with findelement in Selenium, everyone uses js :).
How about this ?
driver.executeScript("window.document.getElementsByName("Submit")[0].click()");
Index could be wrong and need to be adjusted
Please try With the following Code :
It quits the driver in case of the provided Host or Host IPaddress is not available within the network.
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
public class Main {
public static void main(String[] args) {
// Creating a new instance of the HTML unit driver.
WebDriver driver = new HtmlUnitDriver();
try{
driver.get("http://192.168.192.168/ctcpip.htm");
WebElement element = driver.findElement(By.name("IpAddress"));
element.clear();
element.sendKeys("192.168.192.169");
element.submit();
// Reset the printer. This changes it's IP as well, causing the initial driver page to no longer exist.
WebElement reset = driver.findElement(By.name("Submit"));
reset.submit();
}
catch(HttpHostConnectException e){
System.out.println("Host Not Found : "+ e.getMessage())
}
finally{
driver.quit();
}
}
}
I'm using C3P0 as a connection pool in Tomcat, and I'm seeing very worrying errors:
2010-09-16 13:25:00,160 [Timer-0] WARN com.mchange.v2.async.ThreadPoolAsynchronousRunner - com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector#43502400 -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!
2010-09-16 13:25:01,407 [Timer-0] WARN com.mchange.v2.async.ThreadPoolAsynchronousRunner - com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector#43502400 -- APPARENT DEADLOCK!!! Complete Status:
Managed Threads: 10
Active Threads: 0
Active Tasks:
Pending Tasks:
com.mchange.v2.resourcepool.BasicResourcePool$1RefurbishCheckinResourceTask#6e4151a7
Pool thread stack traces:
Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#6,5,main]
java.lang.Object.wait(Native Method)
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:534)
Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2,5,main]
java.lang.Object.wait(Native Method)
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:534)
Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1,5,main]
java.lang.Object.wait(Native Method)
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:534)
Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0,5,main]
java.lang.Object.wait(Native Method)
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:534)
Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#5,5,main]
java.lang.Object.wait(Native Method)
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:534)
Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#4,5,main]
java.lang.Object.wait(Native Method)
... many more, exact same stack trace
Line 534 is:
while (true) {
Runnable myTask;
synchronized ( ThreadPoolAsynchronousRunner.this ) {
while ( !should_stop && pendingTasks.size() == 0 )
ThreadPoolAsynchronousRunner.this.wait( POLL_FOR_STOP_INTERVAL ); // <- here
if (should_stop) ...
It looks very much like all the threads are idle. They're waiting for work. 0 active threads, and only 1 task to complete. Any clues on what's going wrong?
Here's the configuration:
ds.setUser(userName);
ds.setPassword(password);
ds.setMaxPoolSize(16);
ds.setMaxConnectionAge(1800);
ds.setAcquireRetryAttempts(4);
ds.setMaxIdleTime(900);
ds.setNumHelperThreads(10);
ds.setCheckoutTimeout(1000);
I just experienced a similar issue against an Oracle database, but in my case Managed Thread and Active Thread counts were the same.
Managed Threads: 3
Active Threads: 3
For me it was actually an authentication error but appeared as the APPARENT DEADLOCK error because of the way I was doing login auditing.
2013-08-12 11:29:04,910 [Timer-4] WARN com.mchange.v2.async.ThreadPoolAsynchronousRunner: com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector#34996454 -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!
2013-08-12 11:29:04,914 [Timer-4] WARN com.mchange.v2.async.ThreadPoolAsynchronousRunner: com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector#34996454 -- APPARENT DEADLOCK!!! Complete Status:
Managed Threads: 3
Active Threads: 3
Active Tasks:
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask#6730b844 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2)
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask#2f91ad49 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0)
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask#507ac05 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1)
Pending Tasks:
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask#3aae7ed7
Pool thread stack traces:
Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2,5,main]
java.net.SocketInputStream.socketRead0(Native Method)
java.net.SocketInputStream.read(SocketInputStream.java:150)
java.net.SocketInputStream.read(SocketInputStream.java:121)
oracle.net.ns.Packet.receive(Packet.java:300)
oracle.net.ns.DataPacket.receive(DataPacket.java:106)
oracle.net.ns.NetInputStream.getNextPacket(NetInputStream.java:315)
oracle.net.ns.NetInputStream.read(NetInputStream.java:260)
oracle.net.ns.NetInputStream.read(NetInputStream.java:185)
oracle.net.ns.NetInputStream.read(NetInputStream.java:102)
oracle.jdbc.driver.T4CSocketInputStreamWrapper.readNextPacket(T4CSocketInputStreamWrapper.java:124)
oracle.jdbc.driver.T4CSocketInputStreamWrapper.read(T4CSocketInputStreamWrapper.java:80)
oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1137)
oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:290)
oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:192)
oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:380)
oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:760)
oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:401)
oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:546)
oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:236)
oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521)
com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:134)
com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)
com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)
com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137)
com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)
com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0,5,main]
java.net.SocketInputStream.socketRead0(Native Method)
java.net.SocketInputStream.read(SocketInputStream.java:150)
java.net.SocketInputStream.read(SocketInputStream.java:121)
oracle.net.ns.Packet.receive(Packet.java:300)
oracle.net.ns.DataPacket.receive(DataPacket.java:106)
oracle.net.ns.NetInputStream.getNextPacket(NetInputStream.java:315)
oracle.net.ns.NetInputStream.read(NetInputStream.java:260)
oracle.net.ns.NetInputStream.read(NetInputStream.java:185)
oracle.net.ns.NetInputStream.read(NetInputStream.java:102)
oracle.jdbc.driver.T4CSocketInputStreamWrapper.readNextPacket(T4CSocketInputStreamWrapper.java:124)
oracle.jdbc.driver.T4CSocketInputStreamWrapper.read(T4CSocketInputStreamWrapper.java:80)
oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1137)
oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:290)
oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:192)
oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:380)
oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:760)
oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:401)
oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:546)
oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:236)
oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521)
com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:134)
com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)
com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)
com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137)
com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)
com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1,5,main]
java.net.SocketInputStream.socketRead0(Native Method)
java.net.SocketInputStream.read(SocketInputStream.java:150)
java.net.SocketInputStream.read(SocketInputStream.java:121)
oracle.net.ns.Packet.receive(Packet.java:300)
oracle.net.ns.DataPacket.receive(DataPacket.java:106)
oracle.net.ns.NetInputStream.getNextPacket(NetInputStream.java:315)
oracle.net.ns.NetInputStream.read(NetInputStream.java:260)
oracle.net.ns.NetInputStream.read(NetInputStream.java:185)
oracle.net.ns.NetInputStream.read(NetInputStream.java:102)
oracle.jdbc.driver.T4CSocketInputStreamWrapper.readNextPacket(T4CSocketInputStreamWrapper.java:124)
oracle.jdbc.driver.T4CSocketInputStreamWrapper.read(T4CSocketInputStreamWrapper.java:80)
oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1137)
oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:290)
oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:192)
oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:380)
oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:760)
oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:401)
oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:546)
oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:236)
oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521)
com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:134)
com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)
com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)
com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137)
com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)
com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
This sounds like you have already acquired a connection from the pool and do not return it in time.
C3P0 determines "apparent deadlocks" when a connection is acquired but not returned to the pool within the deadlock detection timeout.
If you move the connection acquisition closer to the "action" and immediately return it to the pool after the database work is done, this message will disappear.
This will sort out your problem
ds.setMaxStatements(1000);
ds.setMaxStatementsPerConnection(100); (the maximum number of prepared statments your system can execute on a single connection)
check out : https://forum.hibernate.org/viewtopic.php?t=947246&highlight=apparent+deadlock+c3p0
Remember to close your statements after you are done with them !!
My comment on answer https://stackoverflow.com/a/18192588/1019307 received enough up-votes to suggest it should be an answer.
I received this error because I couldn't get through the firewall to the database server. Check to see if that is your problem.
#eebbesen, I got the same error as you did. I am running Tomcat version 9.0.6. I have hibernate core ver 5.2.10, hibernate c3p0 ver 3.6.3 in my maven project. Mine was not an authentication error, but rather due to me having previously changed the name of my computer. This did not have an immediate effect on tomcat, but upon a restart of my machine, when I tried to bring up tomcat again via eclipse (Oxygen 2), I could no longer start eclipse due exactly to the issue you raised.
I googled this and I found this link, which tipped me off to the issue:
https://community.oracle.com/thread/339825
where it says:
First see if OracleServiceXE and OracleXETNSListener services are
running. Replace 127.0.0.1 in the url, with the IP or the name of your
machine. It must match the host declared in the tnsnames.ora file.
Later it mentions where to find this tnsnames.ora file, and for me it was here:
C:\oraclexe\app\oracle\product\11.2.0\server\network\ADMIN
Looking at this tnsnames.ora file, I saw this:
XE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = MyMachineName-7)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
)
)
But I had recently renamed my machine to MyMachineName-5. I changed the 7 to a 5 and saved the file. I checked the "listener.ora" file in this directory, and it had the same issue:
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = MyMachineName-7)(PORT = 1521))
)
)
I changed the 7 to a 5 and saved the file.
Then I opened Task Manager, clicked the "Services" tab, and looked at the "Oracle" services. I did a restart on: OracleXETNSListener, OracleXEClrAgent, OracleServiceXE. I went to restart tomcat in eclipse again, and this time there was now problem.
Appendix:
I also googled this:
https://community.oracle.com/thread/2267906
This lead me to try:
1) Turned off the firewall in Windows Defender (already turned off mcaffee firewall)
2) Started sqlplus to make sure that I could log in with the credentials I was using in my hibernate file: hibernate.cfg.xml
C:\oraclexe\app\oracle\product\11.2.0\server\bin\sqlplus.exe
3) Started the desktop shortcut to Oracle Database 11g
This failed for me even after I fixed the machine name issue though, something I still have to look into.
4) Using dbVisualizer, I tried making a connection to Oracle. This only worked after I resolved the .ora file machine name issue: double click the connection and click the "ping server" button.
I've had the same problem but the cause was a bit hard to spot as it was caused by some simultaneous resources trying to acquire a connection at the same time.
As you can read if the pool had not been initialized the code provided to init it by calling a setup function.
public Connection getConnection() throws SQLException {
if (mCPDS == null) {
setupPool();
}
return mCPDS.getConnection();
}
The problem was that many resources were trying to acquire the connection at the beginning of the program so more than one were instantiating the pool causing your problem after a while.
The solution was just to declare the method synchronized to keep out other resources while one has called the method and it's still inside instantiating the pool for instance.
public synchronized Connection getConnection() throws SQLException {
if (mCPDS == null) {
setupPool();
}
return mCPDS.getConnection();
}
This may be a design error for not using a singleton but fixes the problem lacking some performance.
We ran into this problem and solved it by adding this to the C3P0 config:
<property name="statementCacheNumDeferredCloseThreads" value="1"/>
as per: this from the C3P0 doc
I had the same (was unable to detect) problem solved by correctly closing Statement and Resultset instances (somehow left unclosed):
String SQL = "SELECT 1";
try {
con = DriverManager.getConnection(host, userName, userPassword);
stmt = con.prepareStatement(SQL, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
try {
rs = stmt.executeQuery(SQL);
try {
rs.next();
// ...
} finally {
rs.close();
}
} finally {
stmt.close();
}
} catch (SQLException ex) {
Logger.getLogger(MyClass.class.getName()).log(Level.SEVERE, null, ex);
}
Hi my friend just to comment, I had the same case. I just configured my spring-hibernate eclipse project and showed up the same exception, it should be noted that my project still does not have any query.
I resolved that issue with below steps:
1) Clean project : Project--> Clean...
2) Build project : Project--> Build Project
I hope it works for you.
I've just had the same problem suddenly: after noticing that the deadlock was present only when launching my application in debug mode (I'm using IntelliJ) and it was fine when running with normal run, I started to dig it.
I finally figured out that a breakpoint was blocking the connection: I don't know why Intellij didn't "listen" that the application was passing through that breakpoint, but was hanged somewhere cause of a breakpoint, and this was causing appartent deadlock
After removing all breakpoints in my project, everything started smooth again.
Hope this helps someone
Similar problem was encountered on glassfish4 server while deploying the application. Turned out it was a database configuration issue. Just make sure your database connectivity configurations are proper, verify that the hostname provided in the configuration allows the connection to database. Try connecting to the database manually with the configured username and the hostname/domain. If required, allow the db user to connect from the required domain. Rebuild the application with correct db configurations and then deploy it.