This week's book giveaway is in the General Computing forum.
We're giving away four copies of Emmy in the Key of Code and have Aimee Lucido on-line!
See this thread for details.
Win a copy of Emmy in the Key of Code this week in the General Computing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

JSP just wont work

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello I am fairly new to programming all together. I have done some jsp stuff, and I have done servlet programming too. I really want to know how jsp(s) work. I wanted to make a simple chart and found a tutorial [http://cewolf.sourceforge.net/new/tutorial/step1.html] and followed it. The thing is, the servlet compiles fine and I cp[ed] the .class file to the classes directory (by the way I am using Linux, Apache Tomcat 5.0.30, jdk1.5.0_06 is my java home). Then I took the code that was in the Tutorial for the jsp and put it into a file that I call PageViewCountData.jsp and when I went to enter the http://localhost:8080/PageViewCountData.jsp I get an error message (which I pasted at the bottom). I looked in the directory that the java.io.FileNotFoundException showed and the file is not there. I have shutdown and started apache several time to see if that would show me the graphs but it did not; I keep getting the same message.

Please help with detailed explaination; what am I doing wrong? I have been stuck for days.

I have indicated where all my files and the directory structure.
Thank you soooo much in advance, if there are any pieces that I left out please let me know and I will gladly provide it.

Here is the error message:
org.apache.jasper.JasperException: Unable to compile class for JSP
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:520)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause

java.io.FileNotFoundException: /home/c047647/jakarta-tomcat-5.0.30/work/Catalina/localhost/_/org/apache/jsp/PageViewCountData_jsp.java (Permission denied)
java.io.FileOutputStream.open(Native Method)
java.io.FileOutputStream.<init>(FileOutputStream.java:179)
java.io.FileOutputStream.<init>(FileOutputStream.java:70)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:188)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:495)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:476)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:464)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

Here is the JSP code:
<%@page contentType="text/html"%>
<%@taglib uri='/WEB-INF/cewolf.tld' prefix='cewolf' %>
<HTML>
<BODY>
<H1>Page View Statistics</H1>
<HR>
<jsp:useBean id="pageViews" class="de.laures.cewolf.example.PageViewCountData"/>
<cewolf:chart
id="line"
title="Page View Statistics"
type="line"
xaxislabel="Page"
yaxislabel="Views">
<cewolf ata>
<cewolf roducer id="pageViews"/>
</cewolf ata>
</cewolf:chart>
<p>
<cewolf:img chartid="line" renderer="cewolf" width="400" height="300"/>
<P>
</BODY>
</HTML>


Here is the servlet code:
package de.laures.cewolf.example;

import java.io.Serializable;
import java.util.Date;
import java.util.Map;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jfree.data.category.CategoryDataset;
import org.jfree.data.category.DefaultCategoryDataset;

import de.laures.cewolf.DatasetProduceException;
import de.laures.cewolf.DatasetProducer;
import de.laures.cewolf.links.CategoryItemLinkGenerator;
import de.laures.cewolf.tooltips.CategoryToolTipGenerator;

/**
* An example data producer.
* @author Guido Laures
*/
public class PageViewCountData implements DatasetProducer, CategoryToolTipGenerator, CategoryItemLinkGenerator, Serializable {

private static final Log log = LogFactory.getLog(PageViewCountData.class);

// These values would normally not be hard coded but produced by
// some kind of data source like a database or a file
private final String[] categories = {"mon", "tue", "wen", "thu", "fri", "sat", "sun"};
private final String[] seriesNames = {"cewolfset.jsp", "tutorial.jsp", "testpage.jsp", "performancetest.jsp"};

/**
* Produces some random data.
*/
public Object produceDataset(Map params) throws DatasetProduceException {
log.debug("producing data.");
DefaultCategoryDataset dataset = new DefaultCategoryDataset(){
/**
* @see java.lang.Object#finalize()
*/
protected void finalize() throws Throwable {
super.finalize();
log.debug(this +" finalized.");
}
};
for (int series = 0; series < seriesNames.length; series ++) {
int lastY = (int)(Math.random() * 1000 + 1000);
for (int i = 0; i < categories.length; i++) {
final int y = lastY + (int)(Math.random() * 200 - 100);
lastY = y;
dataset.addValue(y, seriesNames[series], categories[i]);
}
}
return dataset;
}

/**
* This producer's data is invalidated after 5 seconds. By this method the
* producer can influence Cewolf's caching behaviour the way it wants to.
*/
public boolean hasExpired(Map params, Date since) {
log.debug(getClass().getName() + "hasExpired()");
return (System.currentTimeMillis() - since.getTime()) > 5000;
}

/**
* Returns a unique ID for this DatasetProducer
*/
public String getProducerId() {
return "PageViewCountData DatasetProducer";
}

/**
* Returns a link target for a special data item.
*/
public String generateLink(Object data, int series, Object category) {
return seriesNames[series];
}

/**
* @see java.lang.Object#finalize()
*/
protected void finalize() throws Throwable {
super.finalize();
log.debug(this + " finalized.");
}

/**
* @see org.jfree.chart.tooltips.CategoryToolTipGenerator#generateToolTip(CategoryDataset, int, int)
*/
public String generateToolTip(CategoryDataset arg0, int series, int arg2) {
return seriesNames[series];
}

}

My directories are:
/home/c047647/jakarta-tomcat-5.0.30/webapps/ROOT/WEB-INF/classes
where I cp all my .class files go

/home/c047647/jakarta-tomcat-5.0.30/webapps/ROOT
where I put all my .jsp files

/home/c047647/jakarta-tomcat-5.0.30
where I put and compile all my .java files

/home/c047647/jdk1.5.0_06
where my JAVA_HOME is
 
Marshal
Posts: 67292
170
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Jeanne Pierre:
I have shutdown and started apache several time



Apache does not support JSP and servlets. Did you mean Tomcat?


java.io.FileNotFoundException: /home/c047647/jakarta-tomcat-5.0.30/work/Catalina/localhost/_/org/apache/jsp/PageViewCountData_jsp.java (Permission denied)



Permission problems perhaps? Check that the user you are running Tomcat and the file system are set up for proper file access.
 
Jeanne Pierre
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yeah sorry I mean tomcat and the permissions are rwxr-xr-x for all the files and the directories
 
Bear Bibeault
Marshal
Posts: 67292
170
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since this is clearly a Tomcat setup issue rather than a JSP problem, I've moved this to the Tomcat forum.
 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Are you sure all jar files are placed in lib folder of WEB-INF.

Try this one


--- yourjsp.jsp
--- WEB-INF
|
----classes--> class files
|
----lib---> servlet-api.jar
---> jsp-api.jar.

correct me if any wrong.

Raj.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeanne Pierre,

Javaranch tip:

If you are going to post more than a line or two of your code, wrap that
code in a set of UBB Code tags.
Doing so will help to preserve your code's indenting, making it easier to read.
If it is easier to read, more people will actaully read it and you will
stand a better chance of getting help with your question.
 
Never trust an airline that limits their passengers to one carry on iguana. Put this tiny ad in your shoe:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!