Tomcat's session and memory management

2006-07-06 Thread Cameron
Hello

Would anyone know how to adjust the length of time/period tomcat's 
session is active? Is there a way to force session to clear when 
someone closes their browser?

Another question is how does one increase the memory available for 
tomcat (V4.1.31) in a windows environment running as a service.

Thank you.


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Firefox and servlet issues

2006-07-06 Thread Cameron
Hello

We have a servlet which uses org.jdom.output.XMLOutputter to update a file and
at the end of the servlet there is a redirect using response.sendRedirect().

The servlet works perfectly on IE but displays a blank screen on firefox upon
submission. There are no errors on tomcat.

Any ideas... Any suggestions most appreciated.




-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Tomcat, Timer and TimerTask question

2006-07-19 Thread Cameron
Hello

Just trying to schedule a batch email run using Timer and TimerTask framework on
Tomcat 4.1.31

Found the following example from http://www.javapractices.com/Topic54.cjp

Trying trying to test this scheduling mechanism first just by printing to
System.out first... (see below) 

It does not seem to run. Code compiles properly in eclipse.

Does tomcat require any libraries... There is no errors in tomcat either.


public final class schedEmailUser extends TimerTask {

public static void main (String[] args) {
TimerTask schedEmail  = new schedEmailUser();

Timer timer = new Timer();
Calendar date = Calendar.getInstance();
date.set(Calendar.DAY_OF_WEEK, Calendar.THURSDAY);
date.set(Calendar.HOUR, 12);
date.set(Calendar.MINUTE, 10);
date.set(Calendar.SECOND, 0);
date.set(Calendar.MILLISECOND, 0);
   
timer.scheduleAtFixedRate(new schedEmailUser(), date.getTime(), 
1000 * 60 *
60 * 24);
System.out.println("In main Sending email...");
timer.cancel();
  }

public void run(){
  System.out.println("In run Sending email...");
  }
} //end schedEmailUser


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tomcat, Timer and TimerTask question

2006-07-20 Thread Cameron
Thank you for all the responses.

I had worked out that it is not loaded or called hence does not run. I embedded
the same code to a servlet and it worked fine but in order to schedule this I
will use the  load it when the server starts.

Many thanks for all your suggestions.

Cameron


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



mod_jk + SSL

2007-04-07 Thread Cameron
I haven't really found any documentation on getting mod_jk to work together.

I have managed to get my apache server to provide an https connection to my
tomcat's server regular HTTP 8080. Is this the correct way to do it? Or can I 
connect to my tomcat server on port 8443?

I can live with this configuration for now, but I'd like to know if I'm doing 
it the "right way".

Thanks!

-Cameron

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Database Connection Error Cannot create PoolableConnectionFactory

2006-07-19 Thread Cameron Currie
FilterChain.access$0(ApplicationFilterChain.java:50)
at 
org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:156)
at java.security.AccessController.doPrivileged(Native Method)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:152)
at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at 
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at 
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:540)
at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at 
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at 
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)


** END NESTED EXCEPTION **

Any help would be greatly appreciated.

--
Cameron Currie
[EMAIL PROTECTED]

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Database Connection Error Cannot create PoolableConnectionFactory

2006-07-19 Thread Cameron Currie

Thanks for the quick replies.

Martin:
No luck with your advice. I'm not sure there's a problem with mysql
permissions, as I can log in with a mysql client from the local
machine and access the database as normal. The original command used
to set the permissions was 'GRANT ALL ON DB.* TO 'User'@'%' IDENTIFIED
BY 'password';'

Christopher:
I've tried using the IP address instead, unfortunately that didn't work.

Bob:
The entry in the hosts file is defined as you said.

For some reason tomcat can't connect to the database and create a
connection pool, even though a normal client can connect just fine. I
even wrote a small java program to connect using JDBC, in case that
was the problem. I used the same parameters given to tomcat and again,
it works just fine.

On 7/19/06, Bob Hall <[EMAIL PROTECTED]> wrote:

Cameron,

You wrote:

> I have a newly installed and configured Ubuntu
> server running
> Tomcat5.5 and Mysql 5.0. This server was created in
> an attempt to
> migrate from a Red Hat server in a similar
> configuration, running the
> exact same webapp. Most of the
> configuration/classpath differences
> between the two platforms have been ironed out.
>
> The Problem:
>
> When our webapp trys to connect to the database on
> localhost, an exception
>
> 'java.security.AccessControlException: access denied
> (java.net.SocketPermission localhost resolve)'
>
> is generated.
>

Looks like the OS is unable to resolve localhost.
Does the ubuntu server have the following in its
/ect/hosts file?

127.0.0.1localhost

-Bob

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--
Cameron Currie
[EMAIL PROTECTED]

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Database Connection Error Cannot create PoolableConnectionFactory

2006-07-20 Thread Cameron Currie

I haven't gotten it working yet, but I think David may be on the right
track. Here's what I did:

I changed my file at '/etc/tomcat5/policy.d/03catalina.policy' to
properly point to my connector.jar and also changed the permissions to
include:
permission java.net.SocketPermission "localhost", "connect,resolve";
permission java.net.SocketPermission "localhost:3306", "connect,resolve";

Alas, this did not work. I googled for information on Tomcat's
security manager and found this message (possibly from this very
mailing list?):
http://marc2.theaimsgroup.com/?l=tomcat-user&m=109912397815989&w=2

I also read through the tomcat security manager documentation. I found
a debug option to pass to tomcat (-Djava.security.debug=all). In order
to use it I started tomcat with startup.sh (as opposed to the
/etc/init.d/ script).

I saw no debugging information. But our webapps worked!

I assume starting tomcat this way does not start up the security
manager. Hopefully I can get the policy properly configured so that I
don't have to manually start up tomcat!

On 7/20/06, David Smith <[EMAIL PROTECTED]> wrote:

java.security.AccessControlException indicates you are running tomcat
with the security manager.  You'll need to edit your catalina.policy
file to allow this connection.  The policy file itself has a number of
examples, here's just one modified to your situation below:

grant codebase
"jar:file:${catalina.home}/common/lib/mysql-connector-java-3.14.jar!/-" {
permission java.net.SocketPermission "127.0.0.1:3306", "connect" ;
}

--David

Bob Hall wrote:

>Cameron,
>
>You wrote:
>
>
>
>>I have a newly installed and configured Ubuntu
>>server running
>>Tomcat5.5 and Mysql 5.0. This server was created in
>>an attempt to
>>migrate from a Red Hat server in a similar
>>configuration, running the
>>exact same webapp. Most of the
>>configuration/classpath differences
>>between the two platforms have been ironed out.
>>
>>The Problem:
>>
>>When our webapp trys to connect to the database on
>>localhost, an exception
>>
>>'java.security.AccessControlException: access denied
>>(java.net.SocketPermission localhost resolve)'
>>
>>is generated.
>>
>>
>>
>
>Looks like the OS is unable to resolve localhost.
>Does the ubuntu server have the following in its
>/ect/hosts file?
>
>127.0.0.1localhost
>
>-Bob
>
>__
>Do You Yahoo!?
>Tired of spam?  Yahoo! Mail has the best spam protection around
>http://mail.yahoo.com
>
>-
>To start a new topic, e-mail: users@tomcat.apache.org
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--
Cameron Currie
[EMAIL PROTECTED]

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Database Connection Error Cannot create PoolableConnectionFactory

2006-07-20 Thread Cameron Currie

Okay, using this blanket statement:

grant {
   permission java.net.SocketPermission "localhost", "resolve";
   permission java.net.SocketPermission "127.0.0.1:3306",
"connect,resolve";
};

The webapp works when tomcat is started normally. This is acceptable
while the machine is being used as a development server, but when it
goes live, I'd like the grant statement to be appropriately strict.
Anyone have suggestions for what to set as the codeBase?

I have tried, with no success:
codeBase "file:${catalina.home}/webapps/-"
codeBase "file:${catalina.home}/webapps/ROOT/-"
codeBase "file:${catalina.home}/common/lib/-"
codeBase "file:${catalina.home}/common/lib/mysql-connector-blah.jar"
codeBase "jar:file:${catalina.home}/common/lib/mysql-connector-blah.jar!/-"

On 7/20/06, Cameron Currie <[EMAIL PROTECTED]> wrote:

I haven't gotten it working yet, but I think David may be on the right
track. Here's what I did:

I changed my file at '/etc/tomcat5/policy.d/03catalina.policy' to
properly point to my connector.jar and also changed the permissions to
include:
permission java.net.SocketPermission "localhost", "connect,resolve";
permission java.net.SocketPermission "localhost:3306", "connect,resolve";

Alas, this did not work. I googled for information on Tomcat's
security manager and found this message (possibly from this very
mailing list?):
http://marc2.theaimsgroup.com/?l=tomcat-user&m=109912397815989&w=2

I also read through the tomcat security manager documentation. I found
a debug option to pass to tomcat (-Djava.security.debug=all). In order
to use it I started tomcat with startup.sh (as opposed to the
/etc/init.d/ script).

I saw no debugging information. But our webapps worked!

I assume starting tomcat this way does not start up the security
manager. Hopefully I can get the policy properly configured so that I
don't have to manually start up tomcat!

On 7/20/06, David Smith <[EMAIL PROTECTED]> wrote:
> java.security.AccessControlException indicates you are running tomcat
> with the security manager.  You'll need to edit your catalina.policy
> file to allow this connection.  The policy file itself has a number of
> examples, here's just one modified to your situation below:
>
> grant codebase
> "jar:file:${catalina.home}/common/lib/mysql-connector-java-3.14.jar!/-" {
> permission java.net.SocketPermission "127.0.0.1:3306", "connect" ;
> }
>
> --David
>
> Bob Hall wrote:
>
> >Cameron,
> >
> >You wrote:
> >
> >
> >
> >>I have a newly installed and configured Ubuntu
> >>server running
> >>Tomcat5.5 and Mysql 5.0. This server was created in
> >>an attempt to
> >>migrate from a Red Hat server in a similar
> >>configuration, running the
> >>exact same webapp. Most of the
> >>configuration/classpath differences
> >>between the two platforms have been ironed out.
> >>
> >>The Problem:
> >>
> >>When our webapp trys to connect to the database on
> >>localhost, an exception
> >>
> >>'java.security.AccessControlException: access denied
> >>(java.net.SocketPermission localhost resolve)'
> >>
> >>is generated.
> >>
> >>
> >>
> >
> >Looks like the OS is unable to resolve localhost.
> >Does the ubuntu server have the following in its
> >/ect/hosts file?
> >
> >127.0.0.1localhost
> >
> >-Bob
> >
> >__
> >Do You Yahoo!?
> >Tired of spam?  Yahoo! Mail has the best spam protection around
> >http://mail.yahoo.com
> >
> >-
> >To start a new topic, e-mail: users@tomcat.apache.org
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
>
>
> -
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


--
Cameron Currie
[EMAIL PROTECTED]




--
Cameron Currie
[EMAIL PROTECTED]

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



tomcat as a proxy via a proxy

2008-08-05 Thread Steve Cameron

Hello

I want to make use of a proxy jsp that takes a POST request and sends it on
another server, receives the request and passes it back to the browser.

The jsp is making use of the org.apache.commons.httpclient.HttpClient class.

However my Tomcat instance cannot retrieve the request from the second
server as it must send the request via a Proxy which requires
authentication.

I have tried adding the following options to the JAVA_OPTS in the
catalina.bat file.

-Dhttp.proxyHost= -Dhttp.proxyPort=8080 -DproxyUser=xxx
-DproxyPassword=xx

However I get a java.io.ConnectException "Connection timed out"

Has anyone else had more success??

Thanks

Steve Cameron
-- 
View this message in context: 
http://www.nabble.com/tomcat-as-a-proxy-via-a-proxy-tp18844302p18844302.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Servlet problem using normal url

2008-08-12 Thread Huntly Cameron
Hi guys,

I've run into a strange problem with redirecting from a servlet when using a
normal domain name (www.xyz.com)  Basically up until now I was just testing
my app using the http://locahost/ URL.  The servlet redirect
worked fine with with the page displaying fine. The URL would look something
like this:  http://localhost//.jsp

When I try run the servlet from the proper URL it redirects me to
www.xyz.com//.jsp but it comes up with a page not found
error.  If I then remove the web app name from the URL, the page works!  :-S

To do the redirect im using the following:
response.sendRedirect(response.encodeRedirectURL(".jsp"));

Is this a config issue with tomcat?  As I cant seem to figure out how to
change it so that it works with the web app name in the URL.

Any ideas?  Ive tried looking round the web, but haven't found much.

Thanks in advance to any advice

Huntly


Tomcat appears to be sending duplicate requests

2011-07-08 Thread Peter Cameron
I'm having an interesting problem which seems to be Tomcat-related and 
which occurs randomly under heavy load. I'd appreciate some advice/help.


I'm developing a Java web application and deploying to Tomcat 6.0.32. (I 
get the same behaviour with the latest Tomcat 7).


The web app uses Spring 3.05 and has a RESTful interface implemented 
with Jersey 1.8. It only runs on my machine and nothing else talks to it 
apart from a Java integration test which throws data at it.


The app is a "black box" which is interested in counting combinations of 
inputs from forms. Randomly, the counts in the database would be wrong 
-- never ever less than expected, but always one or two more than 
expected. In other words, it's not as if there is a race condition and 
updates are being overwritten since the counts are never less than they 
should be. The back-end is thoroughly thread-safe.


My test harness generates 10 batches of loads. Each batch is submitted 
concurrently, and each request within a batch is submitted serially with 
a 1/10 second delay. (The batch sizes are: 5372, 801, 3005, 637, 9311, 
313, 1024, 777, 412, 1201.)


Anyway, I incorporated the following diagnostics in my application:

o various statistics using JMX beans and atomic integer counts
o atomic integer request count in the test harness
o http header in each request containing the unique request count

These diagnostics show that the test harness sends out the correct 
number of requests but that the web app receives more requests than the 
test harness is sending. I put a BitSet into the Jersey resource 
endpoint (which receives each request), large enough for the total 
number of requests, and set the appropriate bit corresponding to the 
unique count I pass as an http header. Debugging shows that I sometimes 
receive more than one request with the same count.


Why is Tomcat sending duplicate requests? Is there some timeout that is 
silently happening under load and causing Tomcat to resend the request? 
Are there any JMX diagnostics I can look at/turn on for Tomcat? 
Something is sending those duplicate requests and it isn't me!



cheers,
Peter