NullPointerException being seen but no stack trace

I see the following message below in the app.log repeatedly and I believe it is also shown to users in a pop up stating “NullPointerException”. There is no associated stack trace so I can’t work out what is happening - has anyone else seen this?

2018-08-23 12:06:23.572 ERROR [http-nio-8080-exec-12] com.haulmont.cuba.web.log.AppLog - Exception:
java.lang.NullPointerException: null

Hi,

Do you known something about the user scenario?

Missing stack trace is a JVM optimization for frequently repeated exceptions.
You can disable it by adding -XX:-OmitStackTraceInFastThrow to setenv.sh (setenv.bat) file.

2 Likes

Hi Alex,

Thanks that does explain it as sometimes I’ll see an exception with full stack trace then future ones do not have it.

I’m using a Docker image with Tomcat but I must admit I can’t see where the setenv.sh/bat file is - I know slightly off topic but would you by any chance know a likely location for it?

Thanks

Mark,

setenv.sh can be created in the bin folder to set variables before JVM start. It is automatically found and invoked by catalina.sh.
As an example, see this file created by local deployment when you start Tomcat from Studio or Gradle task.