session sendredirect or dispatcher.forward - problem

2003-07-31 Thread Munteanu Gabriel
Hi,

It's about sessions who disappear from one servlet to another.
I know that this has been discussed, but from what I have read
there was no good solution to this problem.
Here it goes:
I have apache 1.3.27 + mod_jk2 + tomcat 4.1.24. - on linux
I have one tomcat process runninng, one application, one context.

I have a servlet that in his doGet method works a little on the parameters
and then
response.sendredirect [ or dispatcher.forward - in this situation both have
the same effects] to another servlet.
I set some attributes in the first servlet and they disappear in the second
servlet - in fact the session is null
[I use request.getSession(false)].

After I read many messages on this subject, I tried to use
response.sendredirect(response.encodeRedirectURL(myservlet))
and it worked. BUT, in this second servlet I have other links to other
servlets. When I clicked on them, in the next servlets the session was gone
again.

Another trial was that I put it all on another linux, to a friend on my LAN.
He has apache 2.0.4x + mod_jk2 + tomcat 4.1.24.
It worked perfectly. - Also I noticed there was no need for
encodeRedirectURL

Then I installed tomcat 4.1.18 on my original linux, and also it worked in
the combination
I have apache 1.3.27 + mod_jk2 + tomcat 4.1.18. - on linux

So, I am sure that NO SERVLET OF MINE was to blame but the configurations of
the servers.

Can anybody tell me what configuration directive can be to blame for such
problems [in all the servers Apache, Linux, ...] ?

At what directives should I look in httpd.conf and server.xml?

Thank you in advance
Gabi


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



Re: how 2 start tomcat from ms-dos command prompt without creating a new window ?

2003-07-24 Thread Munteanu Gabriel
There is another solution that I use:
in my startup.bat i have a line like this:
call %EXECUTABLE% start %CMD_LINE_ARGS%
and I changed it in:
call %EXECUTABLE% run %CMD_LINE_ARGS%

and now it doesn't make another window, it remains in the one that starts
the process.

I hope it helps.

Gabi
P.S. this tip is in catalina.sh - try to read its command arguments.



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



Re: Urgent

2003-06-16 Thread Munteanu Gabriel
The book is to order and not to download for free.
Where is the URL to download it for free?

Gabi
- Original Message -
From: Ben Souther [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Monday, June 16, 2003 5:32 PM
Subject: Re: Urgent


www.coreservlets.com Is an excellent book for people starting out with JSP
and
servlets and is available for download (free) on the web.

Tomcat Kickstart by Sams is a great book for starting out as well.

I haven't looked at the documentation that ships with Tomcat in a while but
I
bet you could find some information there.



On Monday 16 June 2003 11:13 am, anup sinha wrote:
 Hello,
  This is Anup Kumar Here.I want to know how i will run both
servlet
 and JSP pages in tom cat 4.0. How i will configure server.xml and where.
 Thanks

 Anup Kumar

 SMS using the Yahoo! Messenger;Download latest version.



-
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]



tomcat linux apache error=horror

2003-06-05 Thread Munteanu Gabriel
i have apache 1.3.27 on linux[redhat 7.2]
I have java 1.4.1
i have installed tomcat 4.1.24
my apache conf looks like this:
-
LoadModule jk_modulemodules/mod_jk.so
AddModule mod_jk.c

JkWorkersFile conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogLevel info
JkMount /gabi/*.jsp worker1
JkMount /gabi/servlet/* worker1

--
I have workers.properties in conf folder:
--
# Define 1 real worker using ajp13
worker.list=worker1

# Set properties for worker1 (ajp13)
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009
worker.worker1.lbfactor=50
worker.worker1.cachesize=10
worker.worker1.cache_timeout=600
worker.worker1.socket_keepalive=1
worker.worker1.socket_timeout=300

-- It is all
in my server.xml i have added only the line to my webapp:
-
Context path=/gabi docBase=gabi debug=2/Context
-

I get the following errors, randomly when I brows the pages:

4 juin 2003 22:14:18 org.apache.jk.common.ChannelSocket processConnection
INFO: server has been restarted or reset this connection

or When I shut down the server - shutdown.sh:

ArrĂªt du service Tomcat-Standalone
4 juin 2003 22:48:40 org.apache.tomcat.util.net.PoolTcpEndpoint closeServerSocke
t
GRAVE: Caught exception trying to unlock accept.
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
at java.net.Socket.connect(Socket.java:452)
at java.net.Socket.connect(Socket.java:402)
at java.net.Socket.init(Socket.java:309)
at java.net.Socket.init(Socket.java:124)
at org.apache.tomcat.util.net.PoolTcpEndpoint.closeServerSocket(PoolTcpE
ndpoint.java:326)
at org.apache.tomcat.util.net.PoolTcpEndpoint.acceptSocket(PoolTcpEndpoi
nt.java:397)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java
:529)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
ool.java:619)
at java.lang.Thread.run(Thread.java:534)
4 juin 2003 22:48:40 org.apache.tomcat.util.net.PoolTcpEndpoint closeServerSocke
t
GRAVE: Caught exception trying to close socket.
java.lang.NullPointerException
at org.apache.tomcat.util.net.PoolTcpEndpoint.closeServerSocket(PoolTcpE
ndpoint.java:338)
at org.apache.tomcat.util.net.PoolTcpEndpoint.acceptSocket(PoolTcpEndpoi
nt.java:397)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java
:529)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
ool.java:619)
at java.lang.Thread.run(Thread.java:534)
4 juin 2003 22:48:40 org.apache.tomcat.util.net.PoolTcpEndpoint acceptSocket
ATTENTION: RĂ©initialisation du ServerSocket
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:169)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
at java.net.Socket.connect(Socket.java:452)
at java.net.Socket.connect(Socket.java:402)
at java.net.Socket.init(Socket.java:309)
at java.net.Socket.init(Socket.java:153)
at org.apache.jk.common.ChannelSocket.destroy(ChannelSocket.java:384)
at org.apache.jk.server.JkMain.stop(JkMain.java:308)
at org.apache.jk.server.JkCoyoteHandler.destroy(JkCoyoteHandler.java:179
)
at org.apache.coyote.tomcat4.CoyoteConnector.stop(CoyoteConnector.java:1
166)
at org.apache.catalina.core.StandardService.stop(StandardService.java:54
6)
at org.apache.catalina.core.StandardServer.stop(StandardServer.java:2225
)
at org.apache.catalina.startup.Catalina.start(Catalina.java:543)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)

Thanks in advance
Gabi


when I use a servlet too many times- error

2003-06-02 Thread Munteanu Gabriel
I have a servlet that generates images dynamically.
Examples of requests:
imgChanger?text=Hello
imgChanger?text=Beautiful
etc
I play with it about 10-20 times and after that, in IE, instead of
getting the image I am getting an img square[no image]
and tomcat says:

Jun 1, 2003 6:48:06 PM org.apache.jk.server.JkCoyoteHandler action
INFO: RESET




PreparedStatement Pool

2003-05-31 Thread Munteanu Gabriel
I want to make a PreparedStatementPool with all
my SQL queries[not all, because I noticed that not all of them is good to be prepared] 
my site will use. 
Anyway, I reailized that there are around 35 queries.
Now, I made a guess and I think 15 wil be used REALLY very frequently.
Also, I assume that there can be 20 simultaneous users on a query like one of these 15.
If I will make the Pool with 20 PreparedStatements objects for each query,
it means that there will be 15*20 = 300 objects, that will hold occupied 300 
connections.

I am sure[almost] that there will not be all of these 300 busy in the same moment.
So I want these PreparedStatements to use themselves a Connection Pool [say 50 conns].

The PROBLEM: There is no PreparedStatement.setConnection(), and I don't think I can 
move a PreparedStatement from a connection to another.

Is there a way of doing this? r some kind of a workaround?

Thank you in advance.

Gabi


Re: DB Connection

2003-05-28 Thread Munteanu Gabriel
Guys, this is very interesting discussion.
I have read all the posts.
I still have another problem.
What about VERY large Result Sets?
I have a portal with 1 000 000 records[books related].
When the user searches for romance, there are more than 200 000 records
returned.
I can't use CachedResultSet [I would have to hold all this in memory, in an
object registerd in the HTTPSession]
also I can't use the ArrayList.
I am also using a DB pool system and I want to return the connection.
Is there a solution? [better said an optimal solution].
If the ResultSet doesn't hold all the records in memory[RAM],
(setFetchSize(int) - sets how many rows to be brought into memory), where
is the rest? A concrete case:
select name from books - returns 850 000 records.
statement-setFecthSize(25);
the rest of 849975 records are left in the database?, on the hard-disk? or
the database is making all this resultset
internally, and itself uses RAM and some swap? Does anyone knows all this
internal action, how it is going on?

Comments, URLs appreciated.
Info: I use Postgresql if it counts.
In the case that I will have to not return the connection to the pool, and,
because ResultSet doesn't hold in memory all the records I would save it int
the HTTPSession, HOW AM I going to know when to release it and return the
connection to the pool?

Thank you very much in advance.


- Original Message -
From: Ralph Einfeldt [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Tuesday, May 27, 2003 11:01 PM
Subject: RE: DB Connection


It's a pretty common solution, you may also look for a cached ResultSet:

http://freshmeat.net/projects/crs/?topic_id=66
http://developer.java.sun.com/developer/earlyAccess/crs/ (Requires login)
http://www.javaworld.com/javaworld/jw-02-2001/jw-0202-cachedrow.html
http://jakarta.apache.org/commons/beanutils/api/org/apache/commons/beanutils
/RowSetDynaClass.html

 -Original Message-
 From: Jan Behrens [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, May 27, 2003 12:08 PM
 To: Tomcat Users List
 Subject: RE: DB Connection

 This leads me to the conclusion, that I have to copy the
 extracted data into an Array for further processing. Is
 that a reasonable approach or is there a better practice?


-
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]