aspose file tools*
The moose likes Struts and the fly likes Problem in struts 2.0 autocompleter tag. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem in struts 2.0 autocompleter tag." Watch "Problem in struts 2.0 autocompleter tag." New topic
Author

Problem in struts 2.0 autocompleter tag.

amishrm sharma
Greenhorn

Joined: Dec 08, 2008
Posts: 7
Hi Every one,

i am new in struts 2.0. and i am using autocompleter tag of struts-dojo for autocomplete the field from database. But i am facing the below error while running my code.

java.lang.NoSuchMethodError: com.opensymphony.xwork2.ActionContext.get(Ljava/lang/String;)Ljava/lang/Object;
at com.googlecode.jsonplugin.JSONResult.execute(JSONResult.java:157)
at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:355)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:259)
at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:141)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
at com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:230)
at com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:229)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:456)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:227)
at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:248)
at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:49)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
at com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:230)
at com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:229)


below is my jsp code.

<s:url var="userList" value="/autocomplete/LookupAction.action"/>


<sx:autocompleter
indicator="indicator1"
href="%{userList}"
cssStyle="width: 200px;"
autoComplete="true"
searchType="substring"
name="firstName" label="First Name" showDownArrow="false"/>


and below is my struts.xml code

<package name="autocomplete" namespace="/autocomplete" extends="json-default">
<default-interceptor-ref name="completeStack" />
<action name="LookupAction" class="example.LookupAction">
<result type="json" />
</action>
</package>

and my action code.

package example;
import java.util.List;
import com.myapp.dao.LookupDaoImpl;
import com.myapp.dto.User;
import com.opensymphony.xwork2.ActionSupport;
import java.util.HashMap;
import java.util.Map;

public class LookupAction extends ActionSupport {
/**
*
*/
private static final long serialVersionUID = 7025220437464516839L;
private Map<String, String> map;

public String execute() throws Exception {
map = new HashMap<String, String>();

LookupDaoImpl objLookupDaoImpl = new LookupDaoImpl();
List<User> users = objLookupDaoImpl.doLookup();

for (User user : users) {
map.put(user.getUserCode(), user.getUserFirstName() + " "
+ user.getUserLastName());
}

return SUCCESS;
}
public Map<String, String> getMap() {
return map;
}

public void setMap(Map<String, String> map) {
this.map = map;
}
}


i would appreciate you guys, could you please help me find out the problem.

Regards,
Amit Sharma
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
amishrm sharma wrote:java.lang.NoSuchMethodError: com.opensymphony.xwork2.ActionContext.get(Ljava/lang/String;)Ljava/lang/Object;
The given method is missing in the classpath. That´s all. Just upgrade the JAR file with the desired class to a version containing the method. Or if it is already there, then you most probably have an older version of the JAR/class somewhere else in the classpath. Remove it then.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem in struts 2.0 autocompleter tag.