Re: Memory issues with large query storage

2003-03-06 Thread Lloyd A. Duke
Saving 600K rows of data in memory for a user is quite extreme.
There are several alternatives here. Why save the entire row?
Typically I see (and do) the saving of id's instead of the entire row. 
Then subsequent calls use the id for the lookup.  Caching can help the 
performance of the trip to the database... although thats kinda what 
your problem is here (not enough memory)

Paging (your google previous, next) is typically done using only the 
records you display and perhaps the *next* and *previous* records and 
the number span you are viewing. a good example of paging can be found 
in suns petstore sample application (http://java.sun.com/blueprints/code/)

A good look over that should save you lots of pain.

regards,
Lloyd
Andrew Latham wrote:

I hope someone can assist here.

Basically I have been writing a 3 Tier Web app using Tomcat and trying
to adhere to the Struts framework. The application connects to an
existing MSSQL database and creates graphs of the data. The way I've
built it is I define an entity bean to store a row of returned data from
the select query. Each entity bean is appended to a Collection and then
made available to the JSP for me to access using . This
all works fine, until the Collection.size() reaches numbers like 600,000
and then I hit memory issues. I know there is not much I can do but
increase -Xmx and page it or buy more physical memory.
The question I have relates to displaying the data. Some of the output I
want in a table. Showing all results returned is not good if its more
than 100, so I created a "google" type <> to cycle
through them, so for this to happen I need the Collection of what can be
100,000 beans to sit in memory as having to go back and get the next 10
from the SQL database is about 2 minutes each time. When the Collection
is returned it has a scope of "Request". To make this available to
another JSP page (for the next 10) I rescoped the Collection to
"session". This introduces a memory problem where it sits around until
the session ends and the GC picks it up. Is there a better way to pass
the Collection from one JSP to another without re-scoping it or what I
can see happen is that if a user runs many queries they all sit around
until the session ends utilising memory.
I've thought I've setting the Collection to NULL when a new query is
run. Is this an acceptable method?
Appreciate any advice

Thanks

Andrew Latham



*--
This message and any attachment(s) is intended only for the use of the addressee(s) 
and may contain information that is PRIVILEGED and CONFIDENTIAL. If you are not the 
intended addressee(s), you are hereby notified that any use, distribution, disclosure 
or copying of this communication is strictly prohibited. If you have received this 
communication in error, please erase all copies of the message and its attachment(s) 
and notify the sender or Kanbay postmaster immediately.
Any views expressed in this message are those of the individual sender and not of Kanbay.

Although we have taken steps to ensure that this e-mail and any attachment(s) are free from any virus, we advise that in keeping with good computing practice the recipient should ensure they are actually virus free.

 





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


Re: cannot shut down

2003-03-06 Thread Lloyd A. Duke
Looks as if your running on windows.
If you are not running as a service you could always CTRL-C the window 
tomcat is running on. or kill the java process via the task manager. At 
this point i see that as your only option.

Lloyd

Michael Ni wrote:

heres my dilemma, i dont think my tomcat uses the WEB-INF folder under 
my webapps/root folder.  i think it only reads from common folder.  im 
trying to delete some jars from my common folder but it says its in 
use.  i cant shut down my tomcat, it gives me the error below.  anyone 
got any tips?

mike






From: "Michael Ni" <[EMAIL PROTECTED]>
Reply-To: "Tomcat Users List" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: cannot shut down
Date: Thu, 06 Mar 2003 14:52:32 -0800
i get this error when shutting down...does anyone know why?

mike

C:\Tomcat 4.1\bin>shutdown.bat
Using CATALINA_BASE:   C:\Tomcat 4.1
Using CATALINA_HOME:   C:\Tomcat 4.1
Using CATALINA_TMPDIR: C:\Tomcat 4.1\temp
Using JAVA_HOME:   c:\j2sdk1.4.1_01
Catalina.stop: java.net.ConnectException: Connection refused: connect
java.net.ConnectException: Connection refused: connect
   at java.net.PlainSocketImpl.socketConnect(Native Method)
   at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
   at 
java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:
   at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
   at java.net.Socket.connect(Socket.java:426)
   at java.net.Socket.connect(Socket.java:376)
   at java.net.Socket.(Socket.java:291)
   at java.net.Socket.(Socket.java:119)
   at org.apache.catalina.startup.Catalina.stop(Catalina.java:581)
   at 
org.apache.catalina.startup.Catalina.execute(Catalina.java:402)
   at 
org.apache.catalina.startup.Catalina.process(Catalina.java:180)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccesso
java:39)
   at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMetho
sorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:324)
   at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)

_
Help STOP SPAM with the new MSN 8 and get 2 months FREE*  
http://join.msn.com/?page=features/junkmail

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


_
MSN 8 with e-mail virus protection service: 2 months FREE*  
http://join.msn.com/?page=features/virus

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





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


Re: cannot shut down

2003-03-06 Thread Lloyd A. Duke
I usually see this when tomcat is not running or tomat is in a state of 
not accepting connections. This could happen for variouus reasons. 
Usually it means that tomcat is either not yet accepting connections 
(durring startup. perhaps its hanging on some startup servlet) or has 
ceased to accept them (either during shut down or perhaps a 
irrecoverable error occured.



Michael Ni wrote:

i get this error when shutting down...does anyone know why?

mike

C:\Tomcat 4.1\bin>shutdown.bat
Using CATALINA_BASE:   C:\Tomcat 4.1
Using CATALINA_HOME:   C:\Tomcat 4.1
Using CATALINA_TMPDIR: C:\Tomcat 4.1\temp
Using JAVA_HOME:   c:\j2sdk1.4.1_01
Catalina.stop: java.net.ConnectException: Connection refused: connect
java.net.ConnectException: Connection refused: connect
   at java.net.PlainSocketImpl.socketConnect(Native Method)
   at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
   at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:
   at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
   at java.net.Socket.connect(Socket.java:426)
   at java.net.Socket.connect(Socket.java:376)
   at java.net.Socket.(Socket.java:291)
   at java.net.Socket.(Socket.java:119)
   at org.apache.catalina.startup.Catalina.stop(Catalina.java:581)
   at org.apache.catalina.startup.Catalina.execute(Catalina.java:402)
   at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccesso
java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMetho
sorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:324)
   at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)
_
Help STOP SPAM with the new MSN 8 and get 2 months FREE*  
http://join.msn.com/?page=features/junkmail

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





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


Re: Mime-Type

2003-03-03 Thread Lloyd A Duke
jsp typically when compiled and executed responds with html. So I 
believe you are looking for text/html..

Anthony Smith wrote:
I did not know where ask to else this question.

Is there a mime-type for a jsp? If so, what is it?

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





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


Re: Properties [DONE]

2003-02-26 Thread Lloyd A Duke
Why wouldnt :
	Properties properties = new Properties();
   	InputStream stream = 
context.getResourceAsStream("config.properties");
		
		properties.load(stream);

work?

Why create the new stream object when its there for the taking?



José Moreira wrote:
my code:

Properties properties = new Properties();

String path =
getClass().getClassLoader().getResource("config.properties").getPath().toStr
ing();
try {

FileInputStream file = new FileInputStream(path);

properties.load(file);

} catch (FileNotFoundException f) {

this.status = "nao abriu :"+path;

} catch (IOException e) {

this.status = path+" IOException";

} catch (NullPointerException n) {

this.status = path+" NullPointerException";

}

this.status = properties.getProperty("database");



---<*>--
José Moreira
Técnico de Informática | IT Technician

Vila Nova de Gaia, Portugal

E-Mail: [EMAIL PROTECTED]

MSN: [EMAIL PROTECTED]

ICQ: 136936120

IRC: ethernal (irc.ptnet.org)



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





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


Security for tomact 4.0.3

2003-02-26 Thread Lloyd A Duke
All,
I have been wrestling with this for a week, to no avail. 
I am trying to run tomcat with the security flag on. (Win2K)

I have added the following to my catilina.policy

grant codeBase 
"file:C:/dev/jakarta-tomcat-4.0.3/webapps/ROOT/WEB-INF/lib/site.jar" {
permission java.util.PropertyPermission 
"javax.xml.parsers.SAXParserFactory", "read";
permission java.util.PropertyPermission "false", "read";
permission java.net.SocketPermission "127.0.0.1:8080", 
"connect,resolve";
permission java.io.FilePermission "/home/-", "read,write";
permission java.io.FilePermission 
"\\home\\virtual\\site64\\fst\\var\\www\\html\\WEB-INF\\logs", "read,write";
};

I get the following from my dump of the security debugger.

policy:   codeBase 
file:C:/dev/jakarta-tomcat-4.0.3/webapps/ROOT/WEB-INF/lib/site.jar

policy:

policy:   (java.util.PropertyPermission 
javax.xml.parsers.SAXParserFactory read)

policy:   (java.util.PropertyPermission false read)

policy:   (java.net.SocketPermission 127.0.0.1:8080 connect,resolve)

policy:   (java.io.FilePermission /home/- read,write)

policy:   (java.io.FilePermission 
\home\virtual\site64\fst\var\www\html\WEB-INF\logs read,write)

policy:

access: access denied (java.io.FilePermission 
\home\virtual\site64\fst\var\www\html\WEB-INF\logs read)

java.lang.Exception: Stack trace

	at java.lang.Thread.dumpStack(Thread.java:997)

	at 
java.security.AccessControlContext.checkPermission(AccessControlContext.java:261)

	at 
java.security.AccessController.checkPermission(AccessController.java:399)

	at java.lang.SecurityManager.checkPermission(SecurityManager.java:545)

	at java.lang.SecurityManager.checkRead(SecurityManager.java:890)

	at java.io.File.exists(File.java:546)

	at java.io.File.mkdirs(File.java:978)

	at site.appobj.LogThread.(LogThread.java:30)

	at site.appobj.Logger.startup(Logger.java:52)

	at site.appobj.Logger.init(Logger.java:40)

	at site.appobj.Logger.init(Logger.java:23)

	at site.listener.ContextListener.startLogger(ContextListener.java:92)

	at 
site.listener.ContextListener.contextInitialized(ContextListener.java:50)

	at 
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3175)

	at 
org.apache.catalina.core.StandardContext.start(StandardContext.java:3378)

	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)

	at org.apache.catalina.core.StandardHost.start(StandardHost.java:614)

	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)

	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:343)

	at org.apache.catalina.core.StandardService.start(StandardService.java:388)

	at org.apache.catalina.core.StandardServer.start(StandardServer.java:506)

	at org.apache.catalina.startup.Catalina.start(Catalina.java:781)

	at org.apache.catalina.startup.Catalina.execute(Catalina.java:681)

	at org.apache.catalina.startup.Catalina.process(Catalina.java:179)

	at java.lang.reflect.Method.invoke(Native Method)

	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:243)

access: domain that failed ProtectionDomain 
(jar:file:C:/dev/jakarta-tomcat-4.0.3/webapps/ROOT/WEB-INF/lib/site.jar!/site/appobj/LogThread.class 
)
[EMAIL PROTECTED] (
 (java.io.FilePermission 
C:\dev\jakarta-tomcat-4.0.3\webapps\ROOT\WEB-INF\lib\site.jar read)
 (java.io.FilePermission C:\dev\jakarta-tomcat-4.0.3\webapps\ROOT\- read)
 (java.io.FilePermission 
C:\dev\jakarta-tomcat-4.0.3\webapps\ROOT\WEB-INF\lib\- read)
 (java.net.SocketPermission localhost:1024- listen,resolve)
 (org.apache.naming.JndiPermission jndi:/localhost/WEB-INF/classes/*)
 (org.apache.naming.JndiPermission jndi:/localhost/WEB-INF/lib/*)
 (org.apache.naming.JndiPermission jndi:/localhost/*)
 (java.lang.RuntimePermission stopThread)
 (java.util.PropertyPermission java.vendor read)
 (java.util.PropertyPermission java.specification.version read)
 (java.util.PropertyPermission line.separator read)
 (java.util.PropertyPermission java.class.version read)
 (java.util.PropertyPermission java.specification.name read)
 (java.util.PropertyPermission java.vendor.url read)
 (java.util.PropertyPermission java.vm.version read)
 (java.util.PropertyPermission os.name read)
 (java.util.PropertyPermission os.arch read)
 (java.util.PropertyPermission os.version read)
 (java.util.PropertyPermission java.version read)
 (java.util.PropertyPermission java.vm.specification.version read)
 (java.util.PropertyPermission java.vm.specification.name read)
 (java.util.PropertyPermission java.specification.vendor read)
 (java.util.PropertyPermission java.vm.vendor read)
 (java.util.PropertyPermission file.separator read)
 (java.util.PropertyPermission path.separator read)
 (java.util.PropertyPermission java.vm.name read)
 (java.util.PropertyPermission java.vm.specification.vendor read)
)



any idea why tomcat isnt applying these permissions?



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For addi

Re: catalina.policy grant codebase not working

2003-02-21 Thread Lloyd A Duke
I can see it being added in the log file as well...

log file.:

policy:

policy: Adding policy entry:

policy:   signedBy null

policy:   codeBase file:../webapps/ROOT/WEB-INF/lib/site.jar!/-

policy:

policy:   (java.security.AllPermission  )

policy:

Lloyd A Duke wrote:
Greetings,
I am running Tomcat 4.03 on Win2k
I have recently started to run it with the -security flag.

I have added the following to my catalina.policy file to test.

grant codeBase 
"file:${catalina.home}/webapps/ROOT/WEB-INF/lib/site.jar!/-" {
 permission java.security.AllPermission;
};

I have turned on the debugger.

It seems that my grant codeBase entry is not working.

from the debugger

...



access: access denied (java.net.SocketPermission localhost resolve)

java.lang.Exception: Stack trace

at java.lang.Thread.dumpStack(Thread.java:997)

at 
java.security.AccessControlContext.checkPermission(AccessControlContext.java:261) 

at 
java.security.AccessController.checkPermission(AccessController.java:399)

at java.lang.SecurityManager.checkPermission(SecurityManager.java:545)

at java.lang.SecurityManager.checkConnect(SecurityManager.java:1042)

at java.net.InetAddress.getAllByName0(InetAddress.java:559)

at java.net.InetAddress.getAllByName0(InetAddress.java:540)

at java.net.InetAddress.getByName(InetAddress.java:449)

at sun.net.www.http.HttpClient.(HttpClient.java:261)

at sun.net.www.http.HttpClient.(HttpClient.java:281)

at sun.net.www.http.HttpClient.New(HttpClient.java:293)

at 
sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:404) 

at site.util.AppCaller.run(AppCaller.java:34)

at java.lang.Thread.run(Thread.java:484)

access: domain that failed ProtectionDomain 
(jar:file:C:/dev/jakarta-tomcat-4.0.3/webapps/ROOT/WEB-INF/lib/site.jar!/site/util/AppCaller.class 
)
java.security.Permissions@xx (
 (java.util.PropertyPermission javax.sql.* read)
 (java.util.PropertyPermission java.vendor read)
 (java.util.PropertyPermission java.specification.version read)
 (java.util.PropertyPermission line.separator read)
 (java.util.PropertyPermission java.class.version read)
 (java.util.PropertyPermission java.specification.name read)
 (java.util.PropertyPermission java.vendor.url read)
 (java.util.PropertyPermission java.vm.version read)
 (java.util.PropertyPermission os.name read)
 (java.util.PropertyPermission os.arch read)
 (java.util.PropertyPermission java.naming.* read)
 (java.util.PropertyPermission java.home read)
 (java.util.PropertyPermission os.version read)
 (java.util.PropertyPermission java.version read)
 (java.util.PropertyPermission java.vm.specification.version read)
 (java.util.PropertyPermission jaxp.debug read)
 (java.util.PropertyPermission java.vm.specification.name read)
 (java.util.PropertyPermission java.specification.vendor read)
 (java.util.PropertyPermission java.vm.vendor read)
 (java.util.PropertyPermission file.separator read)
 (java.util.PropertyPermission path.separator read)
 (java.util.PropertyPermission java.vm.name read)
 (java.util.PropertyPermission java.vm.specification.vendor read)
 (java.lang.RuntimePermission accessClassInPackage.sun.beans.*)
 (org.apache.naming.JndiPermission jndi:/localhost/WEB-INF/classes/*)
 (org.apache.naming.JndiPermission jndi:/localhost/WEB-INF/lib/*)
 (org.apache.naming.JndiPermission jndi:/localhost/*)
 (java.io.FilePermission 
C:\dev\jakarta-tomcat-4.0.3\webapps\ROOT\WEB-INF\lib\site.jar read)
 (java.io.FilePermission C:\dev\jakarta-tomcat-4.0.3\webapps\ROOT\- read)
 (java.io.FilePermission 
C:\dev\jakarta-tomcat-4.0.3\webapps\ROOT\WEB-INF\lib\- read)
)

UGH...
I have tried explicitly adding Permissions. tried adding the specific 
class to the grant statement e.g.
file:${catalina.home}/webapps/ROOT/WEB-INF/lib/site.jar!/site/util/AppCaller.class 

declaring the jar file without the ! appended to it..
giving only teh webapps dir in the grant statement...
nothing seems to work...
any help??


-
To unsubscribe, e-mail: tomcat-user-unsubscribe@xx
For additional commands, e-mail: tomcat-user-help@xx





-
To unsubscribe, e-mail: tomcat-user-unsubscribe@xx
For additional commands, e-mail: tomcat-user-help@xx


catalina.policy grant codebase not working

2003-02-21 Thread Lloyd A Duke
Greetings,
I am running Tomcat 4.03 on Win2k
I have recently started to run it with the -security flag.

I have added the following to my catalina.policy file to test.

grant codeBase 
"file:${catalina.home}/webapps/ROOT/WEB-INF/lib/site.jar!/-" {
 permission java.security.AllPermission;
};

I have turned on the debugger.

It seems that my grant codeBase entry is not working.

from the debugger

...



access: access denied (java.net.SocketPermission localhost resolve)

java.lang.Exception: Stack trace

	at java.lang.Thread.dumpStack(Thread.java:997)

	at 
java.security.AccessControlContext.checkPermission(AccessControlContext.java:261)

	at 
java.security.AccessController.checkPermission(AccessController.java:399)

	at java.lang.SecurityManager.checkPermission(SecurityManager.java:545)

	at java.lang.SecurityManager.checkConnect(SecurityManager.java:1042)

	at java.net.InetAddress.getAllByName0(InetAddress.java:559)

	at java.net.InetAddress.getAllByName0(InetAddress.java:540)

	at java.net.InetAddress.getByName(InetAddress.java:449)

	at sun.net.www.http.HttpClient.(HttpClient.java:261)

	at sun.net.www.http.HttpClient.(HttpClient.java:281)

	at sun.net.www.http.HttpClient.New(HttpClient.java:293)

	at 
sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:404)

	at site.util.AppCaller.run(AppCaller.java:34)

	at java.lang.Thread.run(Thread.java:484)

access: domain that failed ProtectionDomain 
(jar:file:C:/dev/jakarta-tomcat-4.0.3/webapps/ROOT/WEB-INF/lib/site.jar!/site/util/AppCaller.class 
)
java.security.Permissions@xx (
 (java.util.PropertyPermission javax.sql.* read)
 (java.util.PropertyPermission java.vendor read)
 (java.util.PropertyPermission java.specification.version read)
 (java.util.PropertyPermission line.separator read)
 (java.util.PropertyPermission java.class.version read)
 (java.util.PropertyPermission java.specification.name read)
 (java.util.PropertyPermission java.vendor.url read)
 (java.util.PropertyPermission java.vm.version read)
 (java.util.PropertyPermission os.name read)
 (java.util.PropertyPermission os.arch read)
 (java.util.PropertyPermission java.naming.* read)
 (java.util.PropertyPermission java.home read)
 (java.util.PropertyPermission os.version read)
 (java.util.PropertyPermission java.version read)
 (java.util.PropertyPermission java.vm.specification.version read)
 (java.util.PropertyPermission jaxp.debug read)
 (java.util.PropertyPermission java.vm.specification.name read)
 (java.util.PropertyPermission java.specification.vendor read)
 (java.util.PropertyPermission java.vm.vendor read)
 (java.util.PropertyPermission file.separator read)
 (java.util.PropertyPermission path.separator read)
 (java.util.PropertyPermission java.vm.name read)
 (java.util.PropertyPermission java.vm.specification.vendor read)
 (java.lang.RuntimePermission accessClassInPackage.sun.beans.*)
 (org.apache.naming.JndiPermission jndi:/localhost/WEB-INF/classes/*)
 (org.apache.naming.JndiPermission jndi:/localhost/WEB-INF/lib/*)
 (org.apache.naming.JndiPermission jndi:/localhost/*)
 (java.io.FilePermission 
C:\dev\jakarta-tomcat-4.0.3\webapps\ROOT\WEB-INF\lib\site.jar read)
 (java.io.FilePermission C:\dev\jakarta-tomcat-4.0.3\webapps\ROOT\- read)
 (java.io.FilePermission 
C:\dev\jakarta-tomcat-4.0.3\webapps\ROOT\WEB-INF\lib\- read)
)

UGH...
I have tried explicitly adding Permissions. tried adding the specific 
class to the grant statement e.g.
file:${catalina.home}/webapps/ROOT/WEB-INF/lib/site.jar!/site/util/AppCaller.class

declaring the jar file without the ! appended to it..
giving only teh webapps dir in the grant statement...
nothing seems to work...
any help??


-
To unsubscribe, e-mail: tomcat-user-unsubscribe@xx
For additional commands, e-mail: tomcat-user-help@xx