Re: Relative paths in servlets?

2003-01-06 Thread Øyvind Hvamstad
On Mon, 2003-01-06 at 16:31, Jacob Kjome wrote:

> Assuming the .war file is in CATALINA_HOME/webapps
> 
> 
> Make sure to stop tomcat before you put the .war file into webapps.  Add 
> the above to your server.xml or a context configuration file (like 
> admin.xml or manager.xml are set up).  Then put the .war file into 
> webapps.  Now start Tomcat.  Then, try to access a servlet which uses 
> getRealPath("/").  Check the value.  I guarantee it is null.
> 


I am using the ant installTask, I was somehow confused to believe that
it used .war, but that was a mistake. No need to be agrevated.


  


 war="file://${build.home}"/>

  


> Jake

Thanks

Øyvind


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: Relative paths in servlets?

2003-01-06 Thread Øyvind Hvamstad
On Mon, 2003-01-06 at 15:22, Jacob Kjome wrote:

> Check is that is null before using it as it *will* be null if you serve 
> your app directly from a .war file rather than from a directory on the file 
> system.

Odd, I do serve mine from a .war file, however the contextPath is not
null, but points to the build directory. This is probably not true if
the war is buildt elsewhere than on the local host.

> Jake

Thanks

Øyvind


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Relative paths in servlets?

2003-01-06 Thread Øyvind Hvamstad
Hi, could anyone tell me how to access files using relative paths from a
servlet? Say, if servlet is mapped to /bar and the file foo.html is in
the webapps top dir. How do I access the foo.html file from the servlet.
I tried ../foo.html, /foo.html and even
getServletContext().getRealPath(/bar)+"/../foo.html" but none works.

Any pointers?
-- 
Øyvind Hvamstad


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




RE: Release of memory

2003-01-03 Thread Øyvind Hvamstad
> -Original Message-
> From: news [mailto:[EMAIL PROTECTED]] On Behalf Of Bill Barker


> If you search
http://nagoya.apache.org/bugzilla/buglist.cgi?product=fop
> you
> will find several reports of memory leaks using fop.  Your best bet is
to
> take it up on the fop-users list.

I did. I got no answer. 
I found it out though. The current design of fop is not memory usage
transparent, and if you use one page-sequence in the document, the hole
thing is held in memory till the end.

However, what does tomcat do after the "service" method returns? The
Servlet interface has a "destroy" method, is it used? Why doesn't Tomcat
release the servlet instance? Can anyone explain the reason?


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RE: Release of memory

2003-01-02 Thread Øyvind Hvamstad
> -Original Message-
> From: Shapira, Yoav [mailto:[EMAIL PROTECTED]]
> 
> It may not be another tomcat thread.  And conversely, it may be a
> different (possibly new) instance of your servlet.  Does your servlet
> implement SingleThreadModel?

No it does not! That would mean bad performance. I can not have my
clients block.

> Tomcat doesn't hold on to these objects.  Make sure nothing in your
code
> does either.   That way they will be garbage collected.

But if tomcat releases the reference to the servlet, the hole thing
should be garbage collected. The standard way of doing that is by
reference counting, right? And that should be enough, but apparently
not. How does incremental (I run 1.3) gc differ from ref counting? My
code sets variables to null before I "suggest" it to do gc.

> Have you tried any of the other garbage collection tuning parameters
> mentioned in my previous message?   It's worth trying a few runs,
> recording your results, and analyzing them.  You can get vastly
> different memory profiles with the Java runtime options previously
> mentioned.

I might try this when I start optimizing. Now am trying to get it to not
hold all my memory. Could it be a bug? Doesn't tomcat drop the reference
to the hole servlet when do_GET returns? To me it seems that it holds
every thing.

Øyvind Hvamstad


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




RE: Release of memory

2003-01-02 Thread Øyvind Hvamstad
I have to specify that the servlet is done! And the next time the
servlet is run (another tomcat thread) the memory usage starts at the
percentage used by the former run. Say, if I want a report and that
takes up about 50% of memory, and then you want the same. Then you will
take the memory up to 100%, because tomcat still holds 50% from my run,
even though it has terminated!

I don't know if that was any clearer?

Øyvind Hvamstad


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




Release of memory

2003-01-02 Thread Øyvind Hvamstad
Hi, I have a servlet that is generating reports on demand from a client
program. I'm using tomcat as servlet container, xml and xsl to generate
fo and fop to give me pdf. The reports tend to be big and memory is
being exhausted.

Can anyone tell me how to make tomcat release memory after a servlet is
finished? Now tomcat simply hold it and sooner or later my server starts
to swap processes because of it. It does so even if I force GC at the
end of the servlet. If it is left idle, it frees some over time, but it
takes to long.

Please help!

Øyvind Hvamstad


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>