Click here to Skip to main content
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 1:35am
Edited 31-Mar-11 1: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 Suvendu Shekhar Giri 265
1 Sergey Alexandrovich Kryukov 260
2 Andy Lanng 185
3 PIEBALDconsult 180
4 OriginalGriff 130
0 Sergey Alexandrovich Kryukov 6,425
1 OriginalGriff 5,918
2 Peter Leow 2,514
3 Maciej Los 2,263
4 Abhinav S 2,249

Advertise | Privacy | Mobile
Web02 | 2.8.150414.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