Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

null pointer exception from remote DriverService class when outputstream or logfile are not passed. #2004

Closed
vnkunta opened this issue Sep 6, 2023 · 15 comments · Fixed by SeleniumHQ/selenium#12696

Comments

@vnkunta
Copy link

vnkunta commented Sep 6, 2023

https://github.com/appium/java-client/blob/2fd8c0cadce1a97a8a73e6ede893499f3d80414b/src/main/java/io/appium/java_client/service/local/AppiumDriverLocalService.java#L92C32-L92C32

java.lang.NullPointerException
at java.base/java.io.FileOutputStream.(FileOutputStream.java:228)
at java.base/java.io.FileOutputStream.(FileOutputStream.java:187)
at org.openqa.selenium.remote.service.DriverService$Builder.getLogOutput(DriverService.java:448)
at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:495)
at io.appium.java_client.service.local.AppiumDriverLocalService.buildService(AppiumDriverLocalService.java:92)
at io.appium.java_client.service.local.AppiumDriverLocalService.buildDefaultService(AppiumDriverLocalService.java:88)

vnkunta referenced this issue in SeleniumHQ/selenium Sep 6, 2023
@vladburian1
Copy link

I got same error

@titusfortner
Copy link
Contributor

Does Appium want process output sent to Console or Null by default?

@titusfortner
Copy link
Contributor

(I'm assuming stderr?)

@vnkunta
Copy link
Author

vnkunta commented Sep 6, 2023

Appium does not pass anything by default. So it is DriverService that used to decide

@titusfortner
Copy link
Contributor

So by default it is off, and only turned on if you specify a log location? How would you specify sending to console?

I created a PR above, but it would default to sending output to stderr. Should it be discarded by default?

Right now you can avoid this error by using any of these methods on an Appium service instance:

withLogOutput(System.out);
withLogOutput(System.err);
withLogOutput(ByteStreams.nullOutputStream());
withLogFile(new File(logLocation));

@titusfortner
Copy link
Contributor

Ok, I just updated it to get discarded. This can be overridden using either of the methods above.

@vnkunta
Copy link
Author

vnkunta commented Sep 6, 2023

yes @titusfortner I had used the same i.e. withLogOutput(System.out);

@madhura-75
Copy link

I still find this issue, Can you give solution to resolve this?

@titusfortner
Copy link
Contributor

Is it still an issue with Selenium 4.12.1?

@madhura-75
Copy link

Yes, I am still facing the same issue

@titusfortner
Copy link
Contributor

@madhura-75 please provide the code, the exception, the new stack trace, and if you can turn on logging and provide the output that would be great: https://www.selenium.dev/documentation/webdriver/troubleshooting/logging/

You can also open a ticket in Selenium with this information, either way.

@madhura-75
Copy link

@titusfortner Is it fixed in selenium 4.12.1?

@madhura-75
Copy link

this is the issue I am facing

java.lang.NullPointerException

at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:226)

at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:184)

at org.openqa.selenium.remote.service.DriverService$Builder.getLogOutput(DriverService.java:448)

at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:495)

at io.appium.java_client.service.local.AppiumDriverLocalService.buildService(AppiumDriverLocalService.java:92)

at io.appium.java_client.service.local.AppiumDriverLocalService.buildDefaultService(AppiumDriverLocalService.java:88)

at eposautomation.Appium.EPOSBaseClass.startAppiumServer(EPOSBaseClass.java:48)

at eposautomation.Appium.HomeScreenTestCase.HomeScreenValidation(HomeScreenTestCase.java:43)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)

at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.base/java.lang.reflect.Method.invoke(Method.java:568)

at org.testng.internal.invokers.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:139)

at org.testng.internal.invokers.TestInvoker.invokeMethod(TestInvoker.java:677)

at org.testng.internal.invokers.TestInvoker.invokeTestMethod(TestInvoker.java:221)

at org.testng.internal.invokers.MethodRunner.runInSequence(MethodRunner.java:50)

at org.testng.internal.invokers.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:962)

at org.testng.internal.invokers.TestInvoker.invokeTestMethods(TestInvoker.java:194)

at org.testng.internal.invokers.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:148)

at org.testng.internal.invokers.TestMethodWorker.run(TestMethodWorker.java:128)

at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)

at org.testng.TestRunner.privateRun(TestRunner.java:806)

at org.testng.TestRunner.run(TestRunner.java:601)

at org.testng.SuiteRunner.runTest(SuiteRunner.java:433)

at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:427)

at org.testng.SuiteRunner.privateRun(SuiteRunner.java:387)

at org.testng.SuiteRunner.run(SuiteRunner.java:330)

at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)

at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:95)

at org.testng.TestNG.runSuitesSequentially(TestNG.java:1256)

at org.testng.TestNG.runSuitesLocally(TestNG.java:1176)

at org.testng.TestNG.runSuites(TestNG.java:1099)

at org.testng.TestNG.run(TestNG.java:1067)

at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:115)

at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)

at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)

@madhura-75
Copy link

Is there any solution as of now? Till it gets merged in selenium?

@titusfortner
Copy link
Contributor

We're hoping to get 4.13 out soon. You can try using the snapshot of latest, here - https://www.selenium.dev/downloads/#nightly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants