Questions tagged [nullpointerexception]

The Java exception thrown when an application attempts to use null in a case where an object is required.

This Java is thrown when an application attempts to use null in a case where an object is required.

These include:

  • Calling the instance method of a null object.
  • Accessing or modifying the field of a null object.
  • Taking the length of null as if it were an array.
  • Accessing or modifying the slots of null as if it were an array.
  • Throwing null as if it were a Throwable value.
  • Unboxing of null object.

Applications should throw instances of this exception to indicate other illegal uses of the null object.

It's often abbreviated as NPE

Practically all questions with this tag are duplicates of the canonical What is a NullPointerException and how do I fix it?.

15961 questions
2
votes
0 answers

Weblogic Error A RuntimeException was generated by the RMI server: weblogic.common.internal.RMIBootServiceImpl.authenticate

I am getting below error when I try to run my web app from Netbeans. This was working successfully but it stopped working after upgrading to MacOs Big Sur. Need your assisting to resolve this issue. java.lang.NullPointerException.…
Inno v8.2
  • 31
  • 3
2
votes
0 answers

Android - How to Generate Key Presses Programmatically

After reading through this " How to Generate Key Presses Programmatically Android " and the associated answers, I created a class that extends InputMethodService, but is empty otherwise. I create an instance of that class and then do something…
corbin
  • 1,446
  • 2
  • 27
  • 40
2
votes
0 answers

NullPointerException on View.PerformClick on BottomNavigationBar

I'm getting a lot of crashes on this in my production application. I have not been able to reproduce it myself, and the crash stack trace does not mention any of my own files. As you can see on the crash overview, I get the same crash many different…
Otziii
  • 2,304
  • 1
  • 25
  • 34
2
votes
1 answer

How to avoid NullPointerExceptions when calling getter-methods on a nested class

Hope you can help me with my question. Actually I know there are solutions (e.G. nullchecking), but I am searching for a super-elegant solution! In the best case a oneliner. Hopefully, you can help me. I will describe now the problem by using simple…
2
votes
5 answers

Strange Java compiler warning: incorrect "potential null access warning"

(JDK 1.6.0_23, Eclipse 3.7.0 with "Potential null pointer access" warning level at "Warning") Consider the following example code: Object obj = null; for (;;) { obj = getObject(); if (obj != null) break; …
Alex Abdugafarov
  • 6,112
  • 7
  • 35
  • 59
2
votes
1 answer

Jenkinsfile - Jenkins build user getUserName() NullPointerException: Cannot invoke method getUserName() on null object Mutli Branch Indexing Scanning

Jenkins 2.138.1.2-rolling --and-- using MultiBranch Pipeline (to build build from master, branches and Pull Requests etc). I want to show Jenkins build job's user who initiated the build in build description. Ex: For implemennting the same, in my…
2
votes
1 answer

NullPointerException while trying to run my tests from testng.xml

So, the issue is next - I'm trying to refactor my base test to do multiple browser parallel testing, but after running my code from the testng.xml file I've got the NullPointerExeption. My BaseTest: public class BaseTest { String browser =…
2
votes
1 answer

java.lang.IllegalArgumentException: Texture must be non-null (CanvasJs and JavaFX)

I am currently using JavaFX and CanvasJS to display graphics I have several charts that show dots I have JS variables which contain the points of each graph (you can modify a point one by one by entering a value and a date in an HTML input) When the…
arnaud
  • 31
  • 3
2
votes
2 answers

NullPointerException thrown from Socket.getInputStream()

I am getting a NullPointerException raised in this code very rarely. This is part of a video streaming application that consumes multiple RTSP streams simultaneously, and disconnects and reconnects to them regularly (i.e. based on the user). private…
user545680
2
votes
1 answer

Unable to generate Kubernetes manifests yaml files using JKube maven plugin

I'm trying to generate my Kubernetes manifests (deployment.yml and service.yml) using JKube via this command : mvn k8s:resource But I'm getting this error : [INFO] Scanning for projects... [INFO] [INFO] -------------------<…
Ghassen
  • 591
  • 1
  • 15
  • 33
2
votes
2 answers

Cannot invoke method because inject is null

I'm creating web application and i'm using java ee 7, deploying it using maven tomcat plugin creating war. I have servlets, ejb, some logic, jpa integration and etc. I use command pattern to process requests. My main servlet fetches parameters and…
2
votes
2 answers

java.lang.NullPointerException

I keep getting this exception: Exception in thread "Thread-1" java.lang.NullPointerException at Info.(Info.java:168) at Rcon.data(Rcon.java:130) at Rcon$1.run(Rcon.java:105) Line 168 is at bot.redScore =…
Dekken
  • 89
  • 1
  • 7
2
votes
1 answer

Android app NullPointerException where it should not happen?

I have an Android app that is recently published, and I'm receiving crash reports from Google Play Console. One of the crashes is strange. It happens in code similar to the following: private final List items = new ArrayList<>(); public void…
ycsun
  • 1,825
  • 1
  • 13
  • 21
2
votes
2 answers

Simplifying conditions with Optional.ofNullable()

I'm wondering if there is an exit in the use of Optional.ofNullable() for(String name: names){ if(name != null) person = "Mr./Mrs."+name; else continue; greeting(person); } My code is like above. I want to check the argument before…
2
votes
1 answer

Android SQLiteOpenHelper NullPointerException on getwritabledatabase()

I'm now search for hours for a solution for the following problem: I'm using a SQLite Database for an Androidapplication: My OpenHelper extends SQLiteOpenHelper public OpenHelper(Context context) { super(context, "ukra.db", null,…
1 2 3
99
100