Re: Memory usage

2001-05-04 Thread Jason Kary

Newer versions of Java (1.3 and 1.2.2) have different GC algorithms that might
also aid in the clean-up process.

JK


Courtney, James wrote:

 Actually, setting a Java object to null (assuming that there are no other
 references to that object) is the normal way of telling the VM that the
 object may be garbage collected.  The garbage collection takes place
 asynchronously however and at the discretion of the VM in a background
 thread.  The act of deleting all references to an object does not free the
 memory associated with the object until the garbage collector cleans up the
 object.
 -Jamey

 -Original Message-
 From: Jurrius, Mark [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, May 03, 2001 7:43 AM
 To: [EMAIL PROTECTED]
 Subject: RE: Memory usage

 Correct me if I'm wrong.  If for instance I want a bean removed knowing that
 System.gc() does not happen immediately, would setting the bean equal to
 null force the bean to be removed from memory right away and not have to
 rely on the garbage collection to eventually take place?

 Mark

 -Original Message-
 From:   William Kaufman [mailto:[EMAIL PROTECTED]]
 Sent:   Thursday, May 03, 2001 10:07 AM
 To: '[EMAIL PROTECTED]'
 Subject:RE: Memory usage

  That your finalize method is called, doesn't mean that
  the garbage collector has released your objects. The
  only way to be shure that this happens, is to explicitly
  run System.gc().

 Even that's not sufficient: it just suggests to the VM that
 garbage-collecting might be a good idea right now.  Any actual garbage
 collection would take place later, in another thread.

 And, even when it does happen, that doesn't mean all the memory will
 necessarily be released to the OS: the VM will hold on to some so that it
 won't need to go back to the OS on the next allocation.

 You might want to get a memory profiler (like JProbe) and see where the
 memory is going.  At the very least, try doing something like,

 Runtime rt = Runtime.getRuntime();
 System.err.println(Free=+rt.freeMemory()+,
 total=+rt.totalMemory());

 often, to see how much memory is actually in use, and how much is just
 allocated from the OS.

 -- Bill K.

  -Original Message-
  From: Ralph Einfeldt [mailto:[EMAIL PROTECTED]]
  Sent: Thursday, May 03, 2001 5:51 AM
  To: '[EMAIL PROTECTED]'
  Subject: AW: Memory usage
 
 
  That your finalize method is called, doesn't mean that
  the garbage collector has released your objects. The
  only way to be shure that this happens, is to explicitly
  run System.gc(). Otherwise it's up to the VM when it will
  free the memory. (Sun's JDK per default only releases
  memory if otherwise an OutOfMemoryError would occur, so
  unless you reach this border the VM will constanly grow)
 
  See also the options for the JVM:
-verbose:gc (Any VM)
-Xincgc (Sun SDK 1.3.*)
-Xms (Sun + IBM)
-Xmx (Sun + IBM)
 
  -Ursprüngliche Nachricht-
  Von: Garry De Toffoli [mailto:[EMAIL PROTECTED]]
  Gesendet: Donnerstag, 3. Mai 2001 14:34
  An: [EMAIL PROTECTED]
  Betreff: Memory usage
 
  snip/
  I have in trouble with the memory usage with Tomcat 3.21, WinNt 2000
  and Jdk 1.3 of Sun. the problem is that any operation does
  not release
  the memory occuped; to control the memory usage I use the
  Task Manager;
  when Tomcat start, the memory used from the process Java is of 9608 K;
  when I request a Jsp page that has an error, like a variable
  not declared,
  the memory used is 11868K; if I wait for 1 ay also, this
  value does not
  change, so the memory used is not released,
 
  running a correct Jsp page, the memory used increase, and this is not
  released yet;
  I have written a log on the finalize method of my class, and this is
  called, so the garbage collector release all my object.
 
  This behavoir is normal?
  Probably changing the version of Tomcat this problem may be corrected.
  snip/
 




Re: Set an application's working path

2001-03-15 Thread Jason Kary

Alexander,

I would suggest that you have a couple of options here:

1)  HttpServletRequest  has the following methods  getRealPath() and
getTranslatedPath().  You could use these to get the path to you application
directory structure.
2)  Lookup the context attribute javax.servlet.context.tempdir to get a private
directory for you servlet context.

Take Care
Jason Kary


Alexander Batzios wrote:

 Hello.

 I am using a JSP file to call a class, say myClass, which is a pure java
 application. From that class, I then need to call a method, say myMethod. The
 part of the JSP file that does the above is like:

 myClass mc = new myClass(parameters);
 mc.myMethod();

 Part of myMethod() functionality is reading/writting files. Well, the thing is
 that it only works in the /bin directory of tomcat (where the startup,shutdown
 scripts are). That is, it expects to find files there, and it creates files
 there. How can I change it's working path to a virtual path of the webserver?
 Or to where the JSP file that calls it lives?

 Any help will be greatly appreciated.

 Thanks,
 alex

 
  Get your FREE web-based e-mail and newsgroup access at:
 http://MailAndNews.com

  Create a new mailbox, or access your existing IMAP4 or
  POP3 mailbox from anywhere with just a web browser.
 

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, email: [EMAIL PROTECTED]




Cannot create bean error?

2001-03-14 Thread Jason Kary

Hi,

I've been searching through the archives and I can't seem to find an
answer to this question.  I just upgraded to Tomcat 3.2.1 from Tomcat
3.1.1.   Everything was working fine.  Now when I try to access my
application I get the following error:



javax.servlet.ServletException:  Cannot create bean of class
com.cisco.gseit.webportal.UserLoginMI
at
jsp._0002fjsp_0002fansportal_0005fLoginProcess_0002ejspansportal_0005fLoginProcess_jsp_0._jspService(_0002fjsp_0002fansportal_0005fLoginProcess_0002ejspansportal_0005fLoginProcess_jsp_0.java:102)

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$JspServletWrapper.service(JspServlet.java:177)



The JSP file has the following tag:

jsp:useBean class="com.company.UserLoginMI" id="myDBBean"
scope="request" 
 jsp:setProperty  name="myDBBean" property="*" /
/jsp:useBean

I've verified UserLoginMI has a constructor with no arguements.   It
worked in 3.1.1.  Is this a known bug?

Take Care
Jason Kary




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]