java.lang.NullPointerException at org.apache.jsp.init_jsp.jspInit(init_jsp.java:39)

I am writing a java webapp with intellij and Maven. When I try to deploy the webapp on tomcat 7 I got the following exception

Don't mark this as a duplicate of NullPointerException as this is regarding a jsp error.

SEVERE: Servlet /SynapseChat threw load() exception
java.lang.NullPointerException
at org.apache.jsp.init_jsp.jspInit(init_jsp.java:39)
at org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:48)
at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:180)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395)
at org.apache.jasper.servlet.JspServlet.init(JspServlet.java:138)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1284)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1197)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1087)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5231)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5518)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:649)
at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1762)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:618)
at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:565)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1487)
at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:97)
at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1328)
at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1420)
at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:848)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:322)
at sun.rmi.transport.Transport$2.run(Transport.java:202)
at sun.rmi.transport.Transport$2.run(Transport.java:199)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:198)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:567)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:828)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.access$400(TCPTransport.java:619)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler$1.run(TCPTransport.java:684)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler$1.run(TCPTransport.java:681)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:681)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)  

I tried all similar questions and couldn't find a working solution. I checked my WEB-INF/lib folder for possible conflicting jars and couldn't find anything that's mentioned in the answers. Here is the list of jars in my WEB-INF/lib folder

  1. ampcore-1.0.7.5.jar
  2. aopalliance-repackaged-2.4.0-b31.jar
  3. gson-2.4.jar
  4. hk2-api-2.4.0-b31.jar
  5. hk2-locator-2.4.0-b31.jar
  6. hk2-utils-2.4.0-b31.jar
  7. javassist-3.18.1-GA.jar
  8. javax.annotation-api-1.2.jar
  9. javax.inject-2.4.0-b31.jar
  10. javax.ws.rs-api-2.0.1.jar
  11. jdom-1.1.2.jar
  12. jersey-client-2.22.1.jar
  13. jersey-common-2.22.1.jar
  14. jersey-container-servlet-2.22.1.jar
  15. jersey-container-servlet-core-2.22.1.jar
  16. jersey-guava-2.22.1.jar
  17. jersey-media-jaxb-2.22.1.jar
  18. jersey-server-2.22.1.jar
  19. jxmpp-core-0.4.2.jar
  20. jxmpp-util-cache-0.4.2.jar
  21. log4j-1.2.12.jar
  22. logger-1.0.0.jar
  23. mysql-connector-java-5.1.6.jar
  24. osgi-resource-locator-1.0.1.jar
  25. rest-api-client-1.1.3.jar
  26. slf4j-api-1.7.12.jar
  27. slf4j-simple-1.7.12.jar
  28. smack-core-4.1.4.jar
  29. smack-im-4.1.4.jar
  30. smack-tcp-4.1.4.jar
  31. validation-api-1.1.0.Final.jar
  32. xmlconfreader-1.0.0.jar
  33. xpp3-1.1.4c.jar

And here is my init.jsp code.

<%@page import="java.lang.*"%>
<%@ page import="java.util.*" %>
<%@ page import="java.io.*" %>

<%@ page import="java.net.URLEncoder" %>
<%@ page import="org.jdom.*" %>
<%@ page import="synapse.ivr.logger.*" %>
<%@ page import="java.io.File" %>
<%@ page import="org.apache.log4j.BasicConfigurator" %>
<%@ page import="org.apache.log4j.PropertyConfigurator" %>
<%@ page import="synapse.ivr.xmlreader.SystemConfig" %>
<%@ page import="org.apache.log4j.Logger" %>

<%
    jspInit();
%>
<%!public void jspInit(){

    System.out.println("START INITIALIZING AMP API");

    LoggerConguratorXML.DEFAULT_FILE =  "/etc/cms/chatapi/log4j.xml";
    LoggerConguratorXML.loggerConfig();

    SystemConfig.DEFAULT_FILE =  "/etc/cms/chatapi/config.xml";
    SystemConfig.getInstance();

    String softVersion =    SystemConfig.getInstance().getStr("ivr.chatserver.version").toString();

    GlobleLogging synapseUMS = new GlobleLogging();
    Logger cat = synapseUMS.returnLogger();

    cat.info("Config files initiated");
    cat.info("SW Version : "+softVersion);
    System.out.println("SW Version : "+softVersion);
    System.out.println("##############################################");


}%>

Answers


SystemConfig.getInstance().getStr("ivr.chatserver.version") might be null in which case calling .toString() would cause exactly that behaviour.

It's still a duplicate of What is a NullPointerException, and how do I fix it? though.


Need Your Help

IE textbox loses focus after DOM modification

javascript jquery internet-explorer

I have a search box(normal text box) that changes a HTML Table after each keypress.

Highlighting Text Color using Html.fromHtml() in Android?

android text highlight textview

I am developing an application in which there will be a search screen