Click here to Skip to main content
15,885,537 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
C#
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();
      session.put("logged-in","true");
            return SUCCESS;
        }
    else{
       return ERROR;
    }
    }

    public String logout() throws Exception {

    Map session = ActionContext.getContext().getSession();
    session.remove("logged-in");
        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
Updated 31-Mar-11 0:45am
v2

1 solution

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:

XML
<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" />
</javac>




Hope this helps,
Cheers, Arndt
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900