java - Null pointer exception while running Spring project -
i unable figure out reason nullpointer exception in spring project. sometime project works fine time throwing null pointer exception here full stacktrace.
org.apache.jasper.jasperexception: javax.servlet.servletexception: java.lang.nullpointerexception org.apache.jasper.servlet.jspservletwrapper.handlejspexception(jspservletwrapper.java:585) org.apache.jasper.servlet.jspservletwrapper.service(jspservletwrapper.java:455) org.apache.jasper.servlet.jspservlet.servicejspfile(jspservlet.java:390) org.apache.jasper.servlet.jspservlet.service(jspservlet.java:334) javax.servlet.http.httpservlet.service(httpservlet.java:728) org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(filterchainproxy.java:322) org.springframework.security.web.access.intercept.filtersecurityinterceptor.invoke(filtersecurityinterceptor.java:116) org.springframework.security.web.access.intercept.filtersecurityinterceptor.dofilter(filtersecurityinterceptor.java:83) org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(filterchainproxy.java:334) org.springframework.security.web.access.exceptiontranslationfilter.dofilter(exceptiontranslationfilter.java:113) org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(filterchainproxy.java:334) org.springframework.security.web.session.sessionmanagementfilter.dofilter(sessionmanagementfilter.java:103) org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(filterchainproxy.java:334) org.springframework.security.web.authentication.anonymousauthenticationfilter.dofilter(anonymousauthenticationfilter.java:113) org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(filterchainproxy.java:334) org.springframework.security.web.servletapi.securitycontextholderawarerequestfilter.dofilter(securitycontextholderawarerequestfilter.java:54) org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(filterchainproxy.java:334) org.springframework.security.web.savedrequest.requestcacheawarefilter.dofilter(requestcacheawarefilter.java:45) org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(filterchainproxy.java:334) org.springframework.security.web.authentication.www.basicauthenticationfilter.dofilter(basicauthenticationfilter.java:150) org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(filterchainproxy.java:334) org.springframework.security.web.authentication.abstractauthenticationprocessingfilter.dofilter(abstractauthenticationprocessingfilter.java:182) org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(filterchainproxy.java:334) org.springframework.security.web.authentication.logout.logoutfilter.dofilter(logoutfilter.java:105) org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(filterchainproxy.java:334) org.springframework.security.web.context.securitycontextpersistencefilter.dofilter(securitycontextpersistencefilter.java:87) org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(filterchainproxy.java:334) org.springframework.security.web.filterchainproxy.dofilterinternal(filterchainproxy.java:184) org.springframework.security.web.filterchainproxy.dofilter(filterchainproxy.java:155) org.springframework.web.filter.delegatingfilterproxy.invokedelegate(delegatingfilterproxy.java:346) org.springframework.web.filter.delegatingfilterproxy.dofilter(delegatingfilterproxy.java:259) root cause javax.servlet.servletexception: java.lang.nullpointerexception org.apache.jsp.redirect_jsp._jspservice(index_jsp.java:72) org.apache.jasper.runtime.httpjspbase.service(httpjspbase.java:70) javax.servlet.http.httpservlet.service(httpservlet.java:728) org.apache.jasper.servlet.jspservletwrapper.service(jspservletwrapper.java:432) org.apache.jasper.servlet.jspservlet.servicejspfile(jspservlet.java:390) org.apache.jasper.servlet.jspservlet.service(jspservlet.java:334) javax.servlet.http.httpservlet.service(httpservlet.java:728) org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(filterchainproxy.java:322) org.springframework.security.web.access.intercept.filtersecurityinterceptor.invoke(filtersecurityinterceptor.java:116) org.springframework.security.web.access.intercept.filtersecurityinterceptor.dofilter(filtersecurityinterceptor.java:83) org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(filterchainproxy.java:334) org.springframework.security.web.access.exceptiontranslationfilter.dofilter(exceptiontranslationfilter.java:113) org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(filterchainproxy.java:334) org.springframework.security.web.session.sessionmanagementfilter.dofilter(sessionmanagementfilter.java:103) org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(filterchainproxy.java:334) org.springframework.security.web.authentication.anonymousauthenticationfilter.dofilter(anonymousauthenticationfilter.java:113) org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(filterchainproxy.java:334) org.springframework.security.web.servletapi.securitycontextholderawarerequestfilter.dofilter(securitycontextholderawarerequestfilter.java:54) org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(filterchainproxy.java:334) org.springframework.security.web.savedrequest.requestcacheawarefilter.dofilter(requestcacheawarefilter.java:45) org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(filterchainproxy.java:334) org.springframework.security.web.authentication.www.basicauthenticationfilter.dofilter(basicauthenticationfilter.java:150) org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(filterchainproxy.java:334) org.springframework.security.web.authentication.abstractauthenticationprocessingfilter.dofilter(abstractauthenticationprocessingfilter.java:182) org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(filterchainproxy.java:334) org.springframework.security.web.authentication.logout.logoutfilter.dofilter(logoutfilter.java:105) org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(filterchainproxy.java:334) org.springframework.security.web.context.securitycontextpersistencefilter.dofilter(securitycontextpersistencefilter.java:87) org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(filterchainproxy.java:334) org.springframework.security.web.filterchainproxy.dofilterinternal(filterchainproxy.java:184) org.springframework.security.web.filterchainproxy.dofilter(filterchainproxy.java:155) org.springframework.web.filter.delegatingfilterproxy.invokedelegate(delegatingfilterproxy.java:346) org.springframework.web.filter.delegatingfilterproxy.dofilter(delegatingfilterproxy.java:259) root cause java.lang.nullpointerexception org.apache.catalina.session.managerbase.generatesessionid(managerbase.java:807) org.apache.catalina.session.managerbase.createsession(managerbase.java:653) org.apache.catalina.connector.request.dogetsession(request.java:2892) org.apache.catalina.connector.request.getsession(request.java:2315) org.apache.catalina.connector.requestfacade.getsession(requestfacade.java:898) org.apache.catalina.connector.requestfacade.getsession(requestfacade.java:910) javax.servlet.http.httpservletrequestwrapper.getsession(httpservletrequestwrapper.java:238) javax.servlet.http.httpservletrequestwrapper.getsession(httpservletrequestwrapper.java:238) org.apache.jasper.runtime.pagecontextimpl._initialize(pagecontextimpl.java:146) org.apache.jasper.runtime.pagecontextimpl.initialize(pagecontextimpl.java:125) org.apache.jasper.runtime.jspfactoryimpl.internalgetpagecontext(jspfactoryimpl.java:112) org.apache.jasper.runtime.jspfactoryimpl.getpagecontext(jspfactoryimpl.java:65) org.apache.jsp.redirect_jsp._jspservice(redirect_jsp.java:53) org.apache.jasper.runtime.httpjspbase.service(httpjspbase.java:70) javax.servlet.http.httpservlet.service(httpservlet.java:728) org.apache.jasper.servlet.jspservletwrapper.service(jspservletwrapper.java:432) org.apache.jasper.servlet.jspservlet.servicejspfile(jspservlet.java:390) org.apache.jasper.servlet.jspservlet.service(jspservlet.java:334) javax.servlet.http.httpservlet.service(httpservlet.java:728) org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(filterchainproxy.java:322) org.springframework.security.web.access.intercept.filtersecurityinterceptor.invoke(filtersecurityinterceptor.java:116) org.springframework.security.web.access.intercept.filtersecurityinterceptor.dofilter(filtersecurityinterceptor.java:83) org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(filterchainproxy.java:334) org.springframework.security.web.access.exceptiontranslationfilter.dofilter(exceptiontranslationfilter.java:113) org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(filterchainproxy.java:334) org.springframework.security.web.session.sessionmanagementfilter.dofilter(sessionmanagementfilter.java:103) org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(filterchainproxy.java:334) org.springframework.security.web.authentication.anonymousauthenticationfilter.dofilter(anonymousauthenticationfilter.java:113) org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(filterchainproxy.java:334) org.springframework.security.web.servletapi.securitycontextholderawarerequestfilter.dofilter(securitycontextholderawarerequestfilter.java:54) org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(filterchainproxy.java:334) org.springframework.security.web.savedrequest.requestcacheawarefilter.dofilter(requestcacheawarefilter.java:45) org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(filterchainproxy.java:334) org.springframework.security.web.authentication.www.basicauthenticationfilter.dofilter(basicauthenticationfilter.java:150) org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(filterchainproxy.java:334) org.springframework.security.web.authentication.abstractauthenticationprocessingfilter.dofilter(abstractauthenticationprocessingfilter.java:182) org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(filterchainproxy.java:334) org.springframework.security.web.authentication.logout.logoutfilter.dofilter(logoutfilter.java:105) org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(filterchainproxy.java:334) org.springframework.security.web.context.securitycontextpersistencefilter.dofilter(securitycontextpersistencefilter.java:87) org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(filterchainproxy.java:334) org.springframework.security.web.filterchainproxy.dofilterinternal(filterchainproxy.java:184) org.springframework.security.web.filterchainproxy.dofilter(filterchainproxy.java:155) org.springframework.web.filter.delegatingfilterproxy.invokedelegate(delegatingfilterproxy.java:346) org.springframework.web.filter.delegatingfilterproxy.dofilter(delegatingfilterproxy.java:259)
i getting permgenspace error often. related this? changed project , tomcat vm option (using netbean ide) to:
-xx:maxpermsize=512m
i using netbeans ide 7.3.1 , apache tomcat 7.0.37, spring 3.1.1, hibernate 3.
its showing delegatingfilterproxy in exception. may because of security setting.
<?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:security="http://www.springframework.org/schema/security" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd"> <!-- configure spring-security --> <security:http auto-config="true" use-expressions="true" access-denied-page="/auth/denied" > <security:intercept-url pattern="/admin/**" access="hasrole('role_admin')"/> <security:intercept-url pattern="/auth/**" access="hasrole('role_user')"/> <security:form-login login-page="/index" authentication-failure-url="/index" default-target-url="/welcome" /> <security:logout invalidate-session="true" logout-success-url="/index" /> </security:http> <!-- custom service spring retrieve users , corresponding access levels --> <bean id="loginservice" class="com.tcs.ignite.ih.spring.service.loginservice"/> <!--a service spring redirect proper view after successfull login--> <!--<bean id="loginsuccesshandler" class="com.tcs.ignite.ih.spring.controller.loginsuccesshandler" />--> <!-- declare authentication-manager use custom userdetailsservice --> <security:authentication-manager> <security:authentication-provider user-service-ref="loginservice"> </security:authentication-provider> </security:authentication-manager> </beans>
update :
when trying access index file,welcome file application defined in web.xml, following url
localhost:8080/xxxx/index
i recieve following on browser:
http status 500 - not requestdispatcher [/web-inf/jsp/index.jsp]: check corresponding file exists within web application archive!
index.jsp in present in directory. need define mapping in spring security intercept url tag /index?
the root cause of problem null sessionidgenerator in tomcat managerbase.
a quick @ code : possible manager didn't start yet, or if stopped. guess here code using "already stopped" manager.
correct me if i'm wrong, guess have crash after undeploy/deploy of app (without restarting tomcat completely).
from invalid instance of managerbase comes ?
well, not easy say, guess comes threadlocal variable not cleaned-up when app undeployed. so, can check own code see if not misusing threadlocal variable (always clean threadlocal variables in finally
block in request filters).
if don't find in own code:
inspect logs (and warnings) occurs when undeploy/deploy web-app, chances find "resource x cannot released".
regarding recurrent outofmemory error : can linked problem. indeed, if threadlocal variable aren't clean-up correctly when app undeployed/deployed memory leak , @ end can cause outofmemory.
i hope helps. (posting logs when app undeployed/deployed may interesting.)
Comments
Post a Comment