my dog learned polymorphism*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Error" Watch "Error" New topic
Author

Error

gajanan balshetwar
Greenhorn

Joined: Mar 06, 2007
Posts: 14
I am trying to execute some simple jstl program.
But tomcat throwing error. Please anyone tell me how to
solve this error.


org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 2 in the jsp file: /datetime.jsp
Generated servlet error:
C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\simpletag\org\apache\jsp\datetime_jsp.java:70: cannot resolve symbol
symbol : class DateTimeTag1
location: class org.apache.jsp.datetime_jsp
DateTimeTag1 _jspx_th_ch06_datetime12_0 = new DateTimeTag1();
^


An error occurred at line: 2 in the jsp file: /datetime.jsp
Generated servlet error:
C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\simpletag\org\apache\jsp\datetime_jsp.java:70: cannot resolve symbol
symbol : class DateTimeTag1
location: class org.apache.jsp.datetime_jsp
DateTimeTag1 _jspx_th_ch06_datetime12_0 = new DateTimeTag1();
^
2 errors
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9351
    
    2

Can you post your jsp and associated files here???


SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Make sure the DateTimeTag1 class (your class ?) is in the path. Probably under WEB-INF/classes or WEB-INF/lib if it's in a JAR file.


[My Blog]
All roads lead to JavaRanch
gajanan balshetwar
Greenhorn

Joined: Mar 06, 2007
Posts: 14
Here are diffrent file for tag.please check it.

DateTimeTag.java file in simpletag\WEB-INF\classes directory

import java.io.IOException;
import java.text.DateFormat;
import java.util.Date;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.SimpleTagSupport;
public class DateTimeTag extends SimpleTagSupport {
public void doTag() throws JspException, IOException {
DateFormat df = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM);
getJspContext().getOut().write(df.format(new Date()));
}
}
-----------------------------------------------
cho6.tld in simpletag\WEB-INF\tlds

<?xml version="1.0" encoding="UTF-8" ?>
<taglib xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd"
version="2.1">
<description>
Tag library for Professional JSP 2.1, Chapter 6.
</description>
<jsp-version>2.1</jsp-version>
<tlib-version>1.0</tlib-version>
<short-name>ch06</short-name>
<uri>http://www.apress.com/projsp/ch06</uri>
<tag>
<name>datetime</name>
<tag-class>DateTimeTag</tag-class>
<body-content>empty</body-content>

<description>
Outputs the current date and time to the page.
</description>
</tag>
</taglib>
----------------------------------------
datetime.jsp

<%@ taglib uri="/WEB-INF/tlds/ch06.tld" prefix="ch06" %>
The current date and time is <ch06 atetime/>
------------------------------------------
Dhananjay Inamdar
Ranch Hand

Joined: Jan 27, 2003
Posts: 130
Hello Gajanan,

Just want to clarify that you have to keep compiled version of java Soruce file, .class file in WEB-INF/Classes folder. You have mentioned that DateTimeTag.java file is in simpletag\WEB-INF\classes directory. If not already then please compile this DateTimeTag.java and keep DateTimeTag.class file in simpletag\WEB-INF\classes directory.

Thanks


Just like you, struggeling to get the right solutions!<br /> <br />Sun Certified Java Programmer 1.5<br /> <br />Target - SCWCD
gajanan balshetwar
Greenhorn

Joined: Mar 06, 2007
Posts: 14
Hello dhananjay,
Thanks for reply.I compiled java file and kept in \WEB-INF\classes.
All files kept in all specified location.There is no
compile error in any file. These same problem occurs
for other application.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

First,
TLD: <uri>http://www.apress.com/projsp/ch06</uri>
JSP: uri="/WEB-INF/tlds/ch06.tld"
Why are URI different ?

Second,
you really should put your classes into packages.
gajanan balshetwar
Greenhorn

Joined: Mar 06, 2007
Posts: 14
Hello,
Thanks Satou kurinosuke,Dhananjay Inamdar,Jothi Shankar Kumar Sankararaj
for reply. Program now working fine.
Dhananjay Inamdar
Ranch Hand

Joined: Jan 27, 2003
Posts: 130
Hello Gajanan,

If you got some solution then better post it here, so it will help next person who will visit this forum in search of answer.

Thanks
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Error