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

NullPointerException in getScopeDecider #135

Closed
GoogleCodeExporter opened this issue Mar 16, 2015 · 9 comments
Closed

NullPointerException in getScopeDecider #135

GoogleCodeExporter opened this issue Mar 16, 2015 · 9 comments

Comments

@GoogleCodeExporter
Copy link

One user reports:

I have just installed 5.0.2 on Win XP, MySQL 5.1, and Java 1.6.

I am able to run Ontopoly, but Omnigator produces NPEs in
getScopeDecider (stack trace below) when attempting to display any of
the type indices (though the various Topic Map Overview links all work
w/o error).

ERROR 2009-10-19 22:08:48,420 [/omnigator].[jsp] - Servlet.service()
for servlet jsp threw exception
java.lang.NullPointerException
    at net.ontopia.topicmaps.nav2.utils.ScopeUtils.getScopeDecider
(ScopeUtils.java:61)
    at
net.ontopia.topicmaps.nav2.taglibs.value.BaseScopedTag.getScopeDecider
(BaseScopedTag.java:32)
    at
net.ontopia.topicmaps.nav2.taglibs.value.BaseScopedTag.getScopeFilter
(BaseScopedTag.java:41)
    at net.ontopia.topicmaps.nav2.taglibs.TMvalue.NamesTag.process
(NamesTag.java:46)
    at
net.ontopia.topicmaps.nav2.taglibs.value.BaseValueProducingAndAcceptingTag.doEnd
Tag
(BaseValueProducingAndAcceptingTag.java:63)
    at net.ontopia.utils.ontojsp.JSPPageExecuter.runTag
(JSPPageExecuter.java:114)
    at net.ontopia.utils.ontojsp.JSPPageExecuter.loopTag
(JSPPageExecuter.java:124)
    at net.ontopia.utils.ontojsp.JSPPageExecuter.runTag
(JSPPageExecuter.java:106)
    at net.ontopia.utils.ontojsp.JSPPageExecuter.loopTag
(JSPPageExecuter.java:124)
    at net.ontopia.utils.ontojsp.JSPPageExecuter.runTag
(JSPPageExecuter.java:106)
    at net.ontopia.utils.ontojsp.JSPPageExecuter.run
(JSPPageExecuter.java:
57)
    at net.ontopia.topicmaps.nav2.impl.basic.Function.call
(Function.java:
77)
    at net.ontopia.topicmaps.nav2.impl.basic.AbstractFunction.execute
(AbstractFunction.java:40)
    at net.ontopia.topicmaps.nav2.taglibs.logic.CallTag.doEndTag
(CallTag.java:80)
    at
org.apache.jsp.models.topic_005fcomplete_jsp._jspx_meth_logic_005fcall_005f1
(topic_005fcomplete_jsp.java:532)
    at
org.apache.jsp.models.topic_005fcomplete_jsp._jspx_meth_template_005fput_005f3
(topic_005fcomplete_jsp.java:488)
    at
org.apache.jsp.models.topic_005fcomplete_jsp._jspx_meth_template_005finsert_005f
0
(topic_005fcomplete_jsp.java:243)
    at org.apache.jsp.models.topic_005fcomplete_jsp._jspService
(topic_005fcomplete_jsp.java:127)
    at org.apache.jasper.runtime.HttpJspBase.service
(HttpJspBase.java:98)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    at org.apache.jasper.servlet.JspServletWrapper.service
(JspServletWrapper.java:331)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile
(JspServlet.java:329)
    at org.apache.jasper.servlet.JspServlet.service
(JspServlet.java:265)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
(ApplicationFilterChain.java:269)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter
(ApplicationFilterChain.java:188)
    at org.apache.catalina.core.StandardWrapperValve.invoke
(StandardWrapperValve.java:213)
    at org.apache.catalina.core.StandardContextValve.invoke
(StandardContextValve.java:172)
    at org.apache.catalina.core.StandardHostValve.invoke
(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke
(ErrorReportValve.java:117)
    at org.apache.catalina.core.StandardEngineValve.invoke
(StandardEngineValve.java:108)
    at org.apache.catalina.connector.CoyoteAdapter.service
(CoyoteAdapter.java:174)
    at org.apache.coyote.http11.Http11Processor.process
(Http11Processor.java:875)
    at org.apache.coyote.http11.Http11BaseProtocol
$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:
665)
    at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket
(PoolTcpEndpoint.java:528)
    at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt
(LeaderFollowerWorkerThread.java:81)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run
(ThreadPool.java:689)
    at java.lang.Thread.run(Thread.java:619)

Original issue reported on code.google.com by lar...@gmail.com on 20 Oct 2009 at 8:45

@GoogleCodeExporter
Copy link
Author

The problem is that UserIF.getFilterContext() returns null, which should be 
impossible, since it's initialized in the constructor. However, there is a 
setFilterContext() method, which theoretically could be called with a null 
argument. 
However, I deleted the method, recompiled everything, and it ran just fine. So 
that 
makes it quite a mystery how this could possibly fail.

Original comment by lar...@gmail.com on 20 Oct 2009 at 9:02

@GoogleCodeExporter
Copy link
Author

I get the same stacktrace in omnigator when trying to access Topics, but only in
special circumstances:

After starting tomcat and opening a new session in the browser, this error never
occurred to me, but when I just reload tomcat, and refresh the active session, 
I get
this error every time I want to access a topic.

btw, I have tested it with java build 1.5.0_19-b02, so it is not related to 
Java 1.6.

Original comment by thomas.n...@spaceapplications.com on 20 Oct 2009 at 9:48

@GoogleCodeExporter
Copy link
Author

I was able to reproduce using the same approach, so that takes us a lot closer 
to 
the source of the problem. I'll see if I can solve this now.

Original comment by lar...@gmail.com on 20 Oct 2009 at 9:54

@GoogleCodeExporter
Copy link
Author

The problem is that when you stop the server, then restart it and reload the 
page 
the User object is of course not created from scratch, but deserialized from 
Tomcat's persistent session storage. The filterContext is marked as transient, 
so it 
doesn't survive the transition, and therefore the User object is resurrected 
with a 
null value there, causing this bug.

Revision 583 solves this by basically rewriting the class so that the code 
handles 
the case where the object is revived with all these fields set to null. The 
constructor no longer initializes the fields, either.

Did some testing, and everything appears to still work fine, including 
filtering by 
scope.

Original comment by lar...@gmail.com on 20 Oct 2009 at 11:30

  • Changed state: Fixed

@GoogleCodeExporter
Copy link
Author

I have experienced exactly the same with two recent installments of 5.0.2, one 
under 
XP, the other under Vista. In both cases the problem went away, I believe after 
stopping and starting the server, but possibly after increasing the memory 
allocation to Java, and has not (yet) recurred since.

Original comment by pepper.s...@gmail.com on 20 Oct 2009 at 2:05

@GoogleCodeExporter
Copy link
Author

Issue 153 has been merged into this issue.

Original comment by lar...@gmail.com on 17 Nov 2009 at 10:48

@GoogleCodeExporter
Copy link
Author

I am still experiencing this issue; Ontopia version 5.0.2, Mac OS 10.5.8, 
Tomcat 6.0.18. Could it be any jar files 
that are missing in my setup? Or some configuration in web.xml or 
tm-sources.xml?

Stian Lavik

Original comment by stian.lavik@gmail.com on 30 Nov 2009 at 6:10

@GoogleCodeExporter
Copy link
Author

This problem was solved after we released 5.0.2. I guess we need to either 
release 
5.0.3 with this fix or get 5.1 out soon.

Original comment by lar...@gmail.com on 30 Nov 2009 at 7:37

@GoogleCodeExporter
Copy link
Author

Ah...I see. 

Original comment by stian.lavik@gmail.com on 30 Nov 2009 at 8:05

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

No branches or pull requests

1 participant