• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

error in jsp when calling a javabean

 
raji navaneethan
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
// my html code that calls the Javabean stored in the following path : "http//localhost:8080/vennila/Beans/bean.jsp"
<html>

<body>
<jsp:useBean id="a" class="sun.bean" scope="session"/>
<jsp:setProperty name="a" property="*"/>
<%=a.getName()%>
<%=a.getName2()%>
</body>

</html>


// my input page that calls the <html>

<head>

<title>New Page 1</title>
</head>

<body>

<form method="POST" action="http://localhost:8080/vennila/Beans/bean.jsp">

<p><input type="text" name="name" size="20"></p>
<p><input type="text" name="name2" size="20"></p>
<p><input type="submit" value="Submit" name="B1"></p>
</form>

</body>

</html>

// my java bean stored in the following path : C:\Program Files\Apache Tomcat 4.0\webapps\vennila\WEB-INF\classes

package sun;
public class bean implements java.io.Serializable
{
private String name;
private String name2;

public bean()
{
}

public void setName(String name1)
{
name=name1;
}
public String getName()
{
return name;
}

public void setName2(String name3)
{
name2=name3;
}
public String getName2()
{
return name2;
}
}

while compiling the bean file i haven't got any error but when executing the jsp file i am getting the following error,

org.apache.jasper.JasperException: Unable to compile class for JSPNote: sun.tools.javac.Main has been deprecated.
error: Invalid class file format in C:\Program Files\Apache Tomcat 4.0\webapps\vennila\WEB-INF\classes\sun\bean.class. The major.minor version '49.0' is too recent for this tool to understand.


An error occurred at line: 4 in the jsp file: /Beans/bean.jsp

Generated servlet error:
C:\Program Files\Apache Tomcat 4.0\work\localhost\vennila\Beans\bean$jsp.java:60: Class sun.bean not found.
sun.bean a = null;
^

when i execute the same code in my neighbours system its working. kindly let me know what could be the reason in my system or is it in my program.
 
Purushoth Thambu
Ranch Hand
Posts: 425
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you check whether you compiled the file using the JDK version used by tomcat. Most likely you are having multiple JDK versions in your system
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic