[KULRICE-8500] Auto suggestion is throwing a stackTrace Created: 05/Nov/12  Updated: 03/Apr/13  Resolved: 26/Nov/12

Status: Closed
Project: Kuali Rice Development
Component/s: Development
Affects Version/s: None
Fix Version/s: 2.2.0-rc1, 2.2
Security Level: Public (Public: Anyone can view)

Type: Bug Fix Priority: Critical
Reporter: Hemanth Gajula (Inactive) Assignee: Jerry Neal (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Text File autosuggestviewdefinition.txt    
Rice Module:
KRAD
KAI Review Status: Not Required
KTI Review Status: Not Required

 Description   

Getting a stackTrace using a austosuggest

I have used this bean:

<bean parent="Uif-InputField" p:label="Suggest 4"
p:instructionalText="static method and query result suggestions option, type a or c for suggestions"
p:propertyName="field65">
<property name="suggest">
<bean parent="Uif-Suggest" p:render="true" p:sourceQueryMethodResults="true">
<property name="suggestQuery">
<bean parent="Uif-AttributeQueryConfig" p:queryMethodInvokerConfig.staticMethod=
"edu.sampleu.demo.kitchensink.TestSuggestClass.getLanguages"/>
</property>
<property name="templateOptions">
<map merge="true">
<entry key="minLength" value="0"/>
</map>
</property>
</bean>
</property>
</bean>

And the method is this one:

public static List<String> getLanguages(String term) {
List<String> matchingLanguages = new ArrayList<String>();

String[] languageArray =

{"ActionScript", "AppleScript", "Asp", "BASIC", "C", "C++", "Clojure", "COBOL", "ColdFusion", "Erlang", "Fortran", "Groovy", "Haskell", "Java", "JavaScript", "Lisp", "Perl", "PHP", "Python", "Ruby", "Scala", "Scheme"}

;

for (int i = 0; i < languageArray.length; i++) {
String language = languageArray[i];
if (language.toLowerCase().startsWith(term.toLowerCase()))

{ matchingLanguages.add(language); }

}

return matchingLanguages;
}

StackTrace:

2012-10-26 17:00:53,000 [qtp447932931-182] u:admin/d: ERROR org.kuali.rice.krad.web.controller.UifHandlerExceptionResolver -
java.lang.NullPointerException
at org.kuali.rice.krad.uif.service.impl.AttributeQueryServiceImpl.performFieldSuggestQuery(AttributeQueryServiceImpl.java:66)
at org.kuali.rice.krad.web.controller.UifControllerBase.performFieldSuggest(UifControllerBase.java:602)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:436)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:424)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:900)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:827)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:534)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1352)
at org.kuali.rice.kew.web.UserLoginFilter.doFilter(UserLoginFilter.java:89)
at org.kuali.rice.kew.web.UserLoginFilter.doFilter(UserLoginFilter.java:77)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1323)
at org.kuali.rice.krad.web.filter.HideWebInfFilter.doFilter(HideWebInfFilter.java:69)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1323)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:474)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:517)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:934)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:404)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:184)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:869)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:247)
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:151)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
at org.eclipse.jetty.server.Server.handle(Server.java:346)
at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:581)
at org.eclipse.jetty.server.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:1040)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:592)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:214)
at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:411)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:526)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:41)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:528)
at java.lang.Thread.run(Thread.java:662)

Its failing in the AttributeQueryServiceImpl class performFieldSuggestQuery() where the view passed in is Null.



 Comments   
Comment by Hemanth Gajula (Inactive) [ 05/Nov/12 ]

it is not a Task it is a bug. I accidentally created this as a task. I think i don't have privileges to change this

Comment by Jerry Neal (Inactive) [ 05/Nov/12 ]

Hemanth,

This same configuration is working fine in our example view. There must be something to the view configuration causing a difference. Can you include the view definition that contains this field?

thanks,
Jerry

Comment by Hemanth Gajula (Inactive) [ 05/Nov/12 ]

Attaching the view definition. Please have a look at it.

Comment by Jerry Neal (Inactive) [ 09/Nov/12 ]

Hemanth,

Can you also attach the definition for MyPlanBaseFormView? I am wondering if the form is not being stored in session and this is causing a problem for the query. Have you guys done field queries successfully in the past?

thanks,
Jerry

Comment by Hemanth Gajula (Inactive) [ 09/Nov/12 ]

<bean id="MyPlanBaseFormView" abstract="true" parent="Uif-FormView">
<property name="preloadPoolSize" value="5"/>
<property name="theme">
<bean parent="MyPlanBaseTheme"/>
</property>
<property name="persistFormToSession" value="false"/>
<property name="breadcrumbs.render" value="false"/>
<property name="applyDirtyCheck" value="false"/>
<property name="onLoadScript" value="try

{Typekit.load();}

catch(e){}"/>
</bean>

The persistFormToSession is set to false in the view. Is this the session property for the form .

And we havent used any field queries till now.

Comment by Jerry Neal (Inactive) [ 09/Nov/12 ]

Hemanth,

That is the problem then. If the form is not persisted it can't get the view. Many things depend on that. In the case of a field query it needs to read the query information from the field when a request is made. Otherwise we would have to pass a lot of stuff around.

One thing you might look into is keeping the form around, and doing more selective removal from session. Each component also has an option for not storing in session. For the data, you can add an annotation of @SessionTransient that will cause it to be cleared (I think this is the correct annotation but please verify).

In the future we might be able to read the configuration from the XML if the view is not present. But that can't be relied on in call cases but so much can happen during the processing (including fields getting created), expression evaluation and so on.

So you don't do any component refresh in this page as well? I don't think that would work without the session form persistence either.

Jerry

Comment by Jerry Neal (Inactive) [ 14/Nov/12 ]

Hemanth,

Are you good with this one? I think with the work that has been done if you enable form persistence and take advantage of the other configuration you should not see the memory issues as before. We also have a configuration parameter that can be set for how many forms can be stored in the users session (which prevents it from growing unbounded). The default is 5.

Jerry

Comment by Jerry Neal (Inactive) [ 26/Nov/12 ]

Resolving until more information is provided about any issues

Generated at Mon Oct 26 11:44:14 CDT 2020 using JIRA 7.0.11#70121-sha1:19d24976997c1d95f06f3e327e087be0b71f28d4.