Wim Folkerts

Greenhorn
+ Follow
since Mar 10, 2010
Wim likes ...
jQuery Tomcat Server Java
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Wim Folkerts

Hello Gendhe,

A couple of days ago I managed to get a .zip download working where .xls files are added to the .zip archive. The .xls file are not written to the filesystem which saves you a FileInputStream implementation and a ByteInputStream that needs to iterate. The logic is quite simple and might be useful for you. Btw I'm using the
to generate the Excel sheet. Below in short the idea:


Hope this helps,
Wim
10 years ago
The requirements are indeed not very clear. I assume Ten Jones wants to return the zipoutputstream. Doing this you may want to use the ServletOutputStream. See below a quick example


Hope this helps,
Wim
10 years ago
The best approach I think is make a backup of you current Java project (i.e. static/dynamic) and create a new project. It indeed looks like the project cannot be found. Do you have a webserver specified in Eclipse? This because compiled resources are put into a different dir that the project sources are put.

Regards,
Wim
10 years ago
Hmm you could be right...

Anyway share the knowlegde, I guess this site is very useful.

Groet,
Wim
10 years ago
Hi Bob,

When you add new new antry to the .zip archive it's normal you close the entry when you wrote to the ouputstream. The Zipoutputstream is created before that. You get something like:


Hope this helps,
Wim Folkerts
10 years ago
Hello all,

We have been migrated a couple of months ago to the DBCP (Apache's Database Connectiong Pooling) setup for creating database connections (http://commons.apache.org/dbcp/configuration.html). We had a long period of testing in order to be sure the change in configuration would work. This week we've implemented the DBCP migration and the first errors came...

1. First of all we did not specify the maxWait attribute (default indefinitely) and then after 5 hours running the application just freezes.

2. So based on the topic "Intermittent dB Connection Failures" on the site http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html we changed it to maxWait="15000". However then we got the below error after about 3 hours:

java.util.NoSuchElementException: Timeout waiting for idle object
at org.apache.tomcat.dbcp.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:958)
at org.apache.tomcat.dbcp.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:96)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)



I've defined the JDBC resource in my <TOMCAT_6_HOME>\conf\context.xml as below:


Upon looking at the "Tomcat Web Application Manager" at about 15 session are active daily, so that is not a high workload for the DBCP configuration. Also connections are closed in the finally clause.

Can anyone advice how to overcome the above described errors?

Thanks in advance

Wim
I've just solved this issue thanks to another post...

This problem is a result of 'stale' connections that generates an error when the application tries to retrieve an invalid connection from the pool. You can simply solve this by change the resource setup in your context.xml:


Don't forget to specify a valid validation query.
Hello,

I've just changed the DBCP configuration and after I wait a day, I didnt get the issue I previously had. Once in 30 minutes it checks for max 3 connections if it is still valid. If no, it will be removed from the pool which solves the stale connection problem. Below a part of this testOnBorrow config:

So it looks like this issue has been resolved!
Thanks Jelle, I'll look into those properties.

I configured the DBCP properties in that way that abandoned connections are removed and logged, see below:
Hello,

We've been migrated to the DBCP connection setup of Apache via JNDI lookup and use the connection setup like described on the site:
http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html

The reason of this migration is because the existing OracleConnectionPoolDataSource object (oracle.jdbc.pool.OracleConnectionPoolDataSource) was not thread safe. See explanation on the site:
http://forums.sun.com/thread.jspa?threadID=288273&messageID=1135172&forumID=48

The DBCP implementation solved this problem, but now I facing the following issue; I run the webapplication without any problem. However the next day I suddenly have the following error:

After refresh:

After the next refresh:

When I refresh the site again, I got the web application back again.

We're using the following configuration:
- Tomcat 6.0.14
- JDK 1.6.0_14
- The ojdbc14.jar, ojdbc14dms.jar and orai18n.jar (from Oracle 10g) are in the %TOMCAT_HOME%/lib folder

Can anyone help me with this issue?

Regards Wim
Hello,

This morning I put the sessionID in the loggin information of Apache. I found out the session ID is never just in any request meaning it will stay inactive while the session will not validate at all.
Maybe there is a problem with the garbage collection? I am not able to reproduce this problem on my development or acceptance environment.

Can anyone help me with this?

Thanks,

Wim
12 years ago
Back again.. Currently the server.xml has the (default) line:


You can simply change the value of the pattern property (see: http://tomcat.apache.org/tomcat-5.5-doc/config/valve.html):


The "%S" is displaying the sessionID. Let's see if we can find some "lost" sessions on production.
12 years ago
Thanks Tim for the advice.
I'm now using the sysdeo plugin which work fine too and yes the logging now also works local. I cost me some time because I did not set the JAVA_HOME environment variabele I'll check if it is possible to have the sessionID added in the access_log and let you know. Although I don't think these requests are causing the problem that sessions do not time out. This because I also found out that sessions where expired when I'm trying to use the application again. Maybe a problem with the garbage collection or something?
12 years ago
Ok, I've just uncommented the line in the server.xml and now I get logging info. I get debug info like:
134.146.136.24 - - [12/Mar/2010:08:46:14 +0100] "GET /scripts/eds3_1.js HTTP/1.1" 304 -

Next I've cleaned the tomcat work folder just to be sure.

But how can I use this debug info for my session problem?
12 years ago
That's me back again. This seems to be a known bug in Eclipse but I managed to solve this by doing the below:


The following error message in Eclipse:

An error has occurred. See error log for more details.
Could not initialize class org.eclipse.wst.server.ui.internal.provisional.UIDecoratorManager

is a known bug.

There is no official solution, but people are reporting luck if they start Eclipse in the Java EE perspective and with the Servers tab visible.



Anyway the server is running now. As I did not specify the CATALINA_HOME I put this in my environment variables: C:\Program Files\Apache Software Foundation\Tomcat 6.0

However I don't get any logging info in the tomcat ..\logs directory. Did I forget something? This is what the Tomcat reference guide is saying:


Absolute or relative pathname of a directory in which log files created by this valve will be placed. If a relative path is specified, it is interpreted as relative to $CATALINA_HOME. If no directory attribute is specified, the default value is "logs" (relative to $CATALINA_HOME).

12 years ago