I'm not aware that a servlet container, such as Tomcat,
makes any guarantee's about what:

    curDir = new File("images");

is going to be relative too.  As a result,:

    filenames = curDir.list();

results in an empty array.  You might use:

    application.getRealPath("/images");

to get a full path in a portable way to pass
to your FileBean.  I don't think the FileBean
can assume anything about relative paths.  It
needs to be told by the caller.

Cheers,
Larry

> -----Original Message-----
> From: Charles Webber [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, December 05, 2001 9:27 AM
> To: Tomcat Users List
> Cc: Webber, Charles
> Subject: Re: Problem with Bean
> 
> 
> Hi,
> I am working on a jsp and a bean class that I can't seem to 
> make work and
> the errors I get from Tomcat are less than helpful.  I'll 
> include the source
> and error messages later.  What I am attempting to accomplish 
> is to write a
> single jsp that auto-refreshes.  Each time that the page 
> refreshes itself,
> it grabs a different file from a directory and displays it.
> The way I am attempting to accomplish this is by using a 
> bean.  When the
> bean is instantiated, it grabs a list of the files in the 
> directory.  Each
> refresh gives a different index into the array that stores 
> file names, and
> the page displays the file given.
> Error messages are listed below and I am attaching the source 
> of my files.
> Since I am just getting started with Tomcat and jsps, I've 
> placed the jsp in
> $TOMCAT_HOME/webapps/examples/jsp and the bean class in
> $TOMCAT_HOME/webapps/examples/WEB-INF/classes/display.
> What am I missing?/
> Thanks.
> 
> Errors:
> Internal Servlet Error:
> 
> javax.servlet.ServletException:  Cannot create bean of class
> display.FileBean
>         at
> jsp._0002fjsp_0002ftestdisplay_0002ejsptestdisplay_jsp_4._jspS
> ervice(_0002fj
> sp_0002ftestdisplay_0002ejsptestdisplay_jsp_4.java:70)
>         at
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
>         at 
> javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>         at
> org.apache.jasper.servlet.JspServlet$JspCountedServlet.service
> (JspServlet.ja
> va:130)
>         at 
> javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>         at
> org.apache.jasper.servlet.JspServlet$JspServletWrapper.service
> (JspServlet.ja
> va:282)
>         at
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet
> .java:429)
>         at 
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:500)
>         at 
> javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>         at
> org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper
> .java:405)
>         at org.apache.tomcat.core.Handler.service(Handler.java:287)
>         at
> org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
>         at
> org.apache.tomcat.core.ContextManager.internalService(ContextM
> anager.java:81
> 2)
>         at
> org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)
>         at
> org.apache.tomcat.service.http.HttpConnectionHandler.processCo
> nnection(HttpC
> onnectionHandler.java:213)
>         at
> org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoin
> t.java:416)
>         at
> org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPo
> ol.java:501)
>         at java.lang.Thread.run(Thread.java:484)
> 

--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to