Click here to Skip to main content
11,790,021 members (54,832 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: Java JSP struts
Error(1,32): cannot access class com.opensymphony.xwork2.ActionContext; class file has wrong version 49.0, should be 45.3 or 46.0 or 47.0 or 48.0
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import java.util.Map;
public class loginAction extends ActionSupport 
private String userId;
  private String password;
  public String execute() throws Exception{
    if ("admin".equals(userId) && "admin".equals(password)) {
      Map session = ActionContext.getContext().getSession();
            return SUCCESS;
       return ERROR;
    public String logout() throws Exception {
    Map session = ActionContext.getContext().getSession();
        return SUCCESS;
    public String getPassword() {
        return password;
    public void setPassword(String password) {
        this.password = password;
    public String getUserId() {
        return userId;
    public void setUserId(String userId) {
        this.userId = userId;
Posted 31-Mar-11 0:35am
Edited 31-Mar-11 0:45am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

This means you compiled a class with the wrong java version (49.0 is Java 1.5, I think) and it seems in this case you try to run it in an older Java-VM...

Try to set the javac to compile for an older Version e.g. 1.4 and retry.

You can set this in your build files - assuming ant it would look like this:

<javac srcdir="${src.dir}" destdir="${bin.dir}" debug="on" deprecation="off" optimize="off" includes="**" source="1.4" target="1.4" fork="yes" memoryMaximumSize="256m" encoding="utf-8">
    <classpath refid="build.classpath" />

Hope this helps,
Cheers, Arndt

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 1,029
1 Maciej Los 790
2 KrunalRohit 686
3 CPallini 606
4 Richard MacCutchan 460

Advertise | Privacy | Mobile
Web02 | 2.8.1509028.1 | Last Updated 31 Mar 2011
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100