Search code examples
javajsptomcattomcat6

How to resolve error in my Jsp program?


I have been trying to run a simple JSP scriptlet but I am encountering the following error:

The type java.io.ObjectInputStream cannot be resolved. It is indirectly referenced from required .class files.

I am using JDK 1.8 and tomcat version 6.

    <%@ page import="java.util.*"%>
    <html>
    <body>
    <%!
        Date d;
        String s1;
    %>
    <%
        d=new Date();
        out.println(d);
        out.println(d.toString());
        s1=d.toString();
        out.println(s1);
    %>
    </body>
    </html> 

Solution

  • Consider upgrading your Tomcat version to 7. This might help. I'm using 7 and the code worked perfectly. Here is a sample of my code and output.

    Code and Preview Image