Re: what is the upper limit of maximum heap memory for Tomcat with 32-bit JVM running on Red Hat Linux 4 (32-bit)

2009-07-23 Thread Alan Chaney


2. Your other 'workaround' is to install a 64 bit OS and a 64 bit JVM. 
Then you can have 7G+ for the JVM.


Actually, to be totally clear, you can have pretty much as much memory 
as you have physical ram in the machine. In your case that's 7G+


For more info on the 64bit JVM see 
http://java.sun.com/docs/hotspot/HotSpotFAQ.html#64bit_heap


Apparently RHEL 4 x64 supports up to 16GB and RHEL 5 claims 'unlimited'
but I'll bet no-one has actually tried it with 16 TB.






Regards

Alan Chaney



Li,Henry wrote:
My Tomcat is running on 32-bit Red Hat 4 (2.6.9-78.0.1.ELsmp), host 
server has 8G physical memory and 4 processors.

 java version 1.4.2  gcj (GCC) 3.4.6 20060404 (Red Hat 3.4.6-10)
I got java.lang.OutOfMemoryError
Current configuration: -Xms1024M -Xmx2304M
The host server has about 4.5G free memory. When I tried to increase 
-Xmx2304M to -Xmx3000M, I got this error:
Error occurred during initialization of VM, Could not reserve enough 
space for object heap

The maximum # I can reach is -Xmx2680M.
QUESTION: Is there an upper limit for -Xmx? What is the work around? 
How can I use my free memory on the server to

get rid of the OutOfMemoryError?

Thanks,
Henry








-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



!DSPAM:4a68f4e844863033718476!



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: what is the upper limit of maximum heap memory for Tomcat with 32-bit JVM running on Red Hat Linux 4 (32-bit)

2009-07-23 Thread Alan Chaney
You are using a 32 bit operating system and a 32 bit processor. To make 
more than 4GB of ram available you must ensure that you have PAE support 
enabled in your kernel (search Google for Physical Address Extension) 
which may mean re-compiling for RHEL 4 (see Red Hat). Your processor may 
not support it but I'd suspect that when you say 4 processors you 
probably mean 4 cores and I believe all 4 core Intel CPUs do support 
PAE. Re-reading your email I see that you say that you have 4.5G of free 
memory - how did you determine this? 'top'?



Even so, I cannot find any clear statement on the web that the 32 bit 
JRE will be able to address more than 4G even if you do have PAE 
enabled. I suspect not. Actually, 'suspect' is way too mild a term ... I 
would be completely astounded if you could...


Possible workarounds are:

1. Try running 2 JVMs ( when you have PAE enabled) - of course this may 
not work in your application (you'd have to have two Tomcat instances.)


2. Your other 'workaround' is to install a 64 bit OS and a 64 bit JVM. 
Then you can have 7G+ for the JVM.


Regards

Alan Chaney



Li,Henry wrote:

My Tomcat is running on 32-bit Red Hat 4 (2.6.9-78.0.1.ELsmp), host server has 
8G physical memory and 4 processors.
 java version 1.4.2  gcj (GCC) 3.4.6 20060404 (Red Hat 3.4.6-10)
I got java.lang.OutOfMemoryError
Current configuration: -Xms1024M -Xmx2304M
The host server has about 4.5G free memory. When I tried to increase -Xmx2304M 
to -Xmx3000M, I got this error:
Error occurred during initialization of VM, Could not reserve enough space for 
object heap
The maximum # I can reach is -Xmx2680M.
QUESTION: Is there an upper limit for -Xmx? What is the work around? How can I 
use my free memory on the server to
get rid of the OutOfMemoryError?

Thanks,
Henry




!DSPAM:4a68ee3b41041381456296!



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: The best place for implementing context specific behavior?

2009-06-25 Thread Alan Chaney

Andre

André Warnier wrote:

Pid wrote:


The Filter checks the domain name is suitable, /looks up a config object/
and drops it into the request attributes for use on the page.


Ha ! I believe that this is exactly what Jonathan is (or was originally) 
looking for.

Where is this config object, and when and how is it being initialised ?

One place to keep filter configuration information is as an attribute of 
the ServletContext. This can be obtained with the 
FilterConfig.getServletContext method. The FilterConfig object is a 
parameter of the doFilter method of the Filter. (See 
http://java.sun.com/javaee/5/docs/api/)


This works within any one web app.


I'm continuing for myself right now, just to learn how to do this 
correctly.
Suppose I do want to do something different in my (shared, common, 
whatever) webapp, depending on the Host: header of the request.
And suppose this different thing I want to do, is a bit heavy, so I 
don't want to do it all at each request, I want to do some of that work 
ahead of time, and re-use it for each request afterward.


But the requests come in unpredictable order, all to my same webapp, but 
one for apples.company.com, and the following one for 
bananas.company.com etc.
And when one comes in for bananas, I want to retrieve what I had 
earlier prepared for bananas, and not what I had prepared for lemons.
(In other words, I don't want a fruit salad, I want to enjoy each fruit 
separately).


You can write an object which handles the specific processing for each 
host and then create a Map as the attribute in the ServletContext using 
the host name as the key. At the start of each request in your Filter 
you could retrieve the object by using the host name as the key, do 
whatever host specific processing you need.


You can add a ContextListener in web.xml will will allow you to do any 
servlet startup/shutdown operations.


There are other ways, but the above should work.

Regards

Alan Chaney

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Reading POSTed data

2009-06-19 Thread Alan Chaney



Caldarale, Charles R wrote:

From: Christopher Schultz [mailto:ch...@christopherschultz.net]
Subject: Re: Reading POSTed data

The servlet spec is very clear about when the request is consumed to
fulfill a getParameter call and when the request is specifically /not/
consumed.


What I find problematic is that the spec gives no hint about how to process 
POST data that is not parameterized.  Lack of mentioning any alternative gives 
the impression that parameterization is the only way of handling it, whereas 
real-world practice is quite different.

 - Chuck

I have an application which extensively uses message data in POST 
requests so I was a bit concerned by your comment above.



However, P36 of my copy of the 2.4 servlet spec (sec SRV 4.1.1) says
If [the POST Form data conditions] are not met and the post form data 
is not included in the parameter set, the post data must still be 
available to the servet via the request object's input stream.


I don't want to appear picky, but that doesn't actually seem that 
problematic. If you don't set the content type as 
application/x-ww-form-urlencoded then you should be able to read it via 
the input stream


Regards

Alan Chaney





THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.


!DSPAM:4a3bf2e676342136417547!



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: new installation uid / pwd problem

2009-04-09 Thread Alan Chaney

Hi Ron



Ronald G. Belcher wrote:
I'm a newbie who just installed Tomcat 5.5.  Installation messages told 
me the userid was tomcat55.  When I attempted to view Status, Tomcat 
Administration, or Tomcat Manager from my browser, I was asked for a 
userid and pw.  Of course, not knowing the password, I was treated to a 
message that said Access to the requested resource has been denied.  
Now I can't seem to do anything to get past the error, not even 
rebooting and/or restarting Tomcat.  Help!  Ron


Please specify: tomcat version, jdk version, operating system version.

Did you install tomcat by downloading from the tomcat.apache.org site? 
or is it a linux distro version. If the latter, then probably best to 
install the proper tomcat.apache.org version. You won't get much help on 
this list unless you do...


To give you some guidance on your specific problem above

http://tomcat.apache.org/tomcat-5.5-doc/realm-howto.html

which will explain amongst other things that the 'default' security 
realm is controlled by a file called tomcat-users.xml in the 
$TOMCAT_HOME/conf directory.


You will need to edit that file and then restart tomcat. You will also 
need to read (most) of the documents carefully. I guess you've got the 
linux distro because it would be much better to start with the currrent 
release version (6.0) than 5.5


HTH

Alan Chaney





-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: apache/tomcat communication issues (502 response)

2009-04-08 Thread Alan Chaney

Hi Andre

André Warnier wrote:

feedly team wrote:
[...]

using netstat, i see a moderate number (~80) of tomcat's sockets in
the CLOSE_WAIT state, not sure if this is relevant.

Approximately, because I am not sure I have this really understood yet 
: a TCP CLOSE_WAIT state happens when the writing side of a TCP 
connection has finished writing and (nicely) closes its side of the 
socket to indicate the fact, but the reading side of the connection 
does not read what is left in the buffers, so there is still some data 
unread in the pipeline, and the reading side never closes the socket.
And now I'm stuck in my explanation, because I am not sure which side 
is seeing the CLOSE_WAIT... ;-)

I think that you are indicating one condition in which you can see a
CLOSE_WAIT but there are many others. I also think that the condition
you indicate is appropriate when the CLOSE_WAIT is observed at the
receiving end of a communication, but is possible for a socket to be in
this state when it has sent data as well, but of course there will be no
outstanding data to send.

More generally CLOSE_WAIT is the state in which a socket is left AFTER
the other end says its finished and BEFORE the application which is
using the socket actually closes the socket. The WAIT refers to the
operating system waiting for the application to finish using the socket.

I think a socket can be in a CLOSE_WAIT state without there being any
further data to read or write - literally just waiting for the calling
application to close it.

Having written socket handling code for both Java and C++ on  a variety
of platforms I don't think there is any particular reason why Java
should be better or worse (in fact, code which uses sockets in Java is
generally pretty easy.) I suspect that your observations may be affected
by local conditions eg one application is badly written but represents
a lot of your network activity, so its behavior is predominant in
conditioning your thinking. Or not! :)

regards

Alan Chaney



But anyway, it indicates a problem somewhere in one of the two 
applications, my guess being the reading one.
It should do more reads to exhaust the remaining data, get an 
end-of-stream, then close its side of the connection, but it never does.
There is apparently no timeout for that, so the OS can never get rid 
of that socket, which probably leaves a bunch of things hanging around 
and consuming resources that they shouldn't.
On one of our systems, I have occasionally seen this issue grow until 
the point where the system seemed unable to accept new connections.
Now whether that has any bearing on your particular issue, I don't 
know.  But it sure indicates a logical problem somewhere.


There is quite a bit on the subject on Google, of unequal quality.
If someone knows a more rigorous explanation, please go ahead.

I will still add a purely sibjective and personal note : from personal 
experience, this phenomenon seems to happens more frequently whith 
Java applications than with others, so I would guess that there might 
be something in the Java handling of sockets that makes it a bit 
harder to write correct socket-handling code.

A Java expert may want to comment on that too.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



!DSPAM:49dc6634305142136417547!






-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Can only view pages on localhost

2009-03-26 Thread Alan Chaney

Hi Joel



Joel wrote:

I am a new user of Tomcat.  In my test system I have pc's networked via
a wireless router.  The router assigns the IP address of 192.168.0.2 to the
machine that runs Tomcat.  When I run Tomcat using http://localhost/... or
http://192.168.0.2/... everything works fine when I work on the local
machine.  But when I attempt to view web pages from any other machine on the
network using http://192.168.0.2/... I get timed out.  
 
How should I configure Tomcat so that it accepts requests from other

machines -- not just localhost?
 
You don't mention operating system, tomcat version, jdk version - all of 
which would make it easier to help you.


However, one wild guess is that you have a firewall which is preventing 
the other networked machine(s) from accessing the tomcat instance.


HTH

Alan Chaney



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: not valid Tomcat installation

2009-03-21 Thread Alan Chaney

Sergey (and FYI Andre)

For each server Eclipse uses, you must create a new entry in the 
'Servers' folder.


I'm assuming that you are using eclipse 3.3+ with WTP (Web Tools 
Project) plugins.


One way to do it is as follows:

From main menu Window-Preferences
Select  'Server'
click on triangle to get the drop down list and then select
'Runtime Environment'

The select 'Add'

You will get a list, the first of which is 'Apache'
select Apache Tomcat v6.0
and then 'Next'
now you will be at a menu called 'Tomcat Server Specify the installation 
directory'


Use Browse to select the folder in which you installed Tomcat. It will
check to see that it has the right files in it.

You can specify the JRE that tomcat is run with below. You may want to 
use a different JRE than the one that you are running Eclipse with. For 
example, I start and run eclipse with a JDK1.5 but compile and run my 
applications with JRE from the 1.6 JDK.


You can have more than one tomcat server defined in eclipse. Its up to 
you to configure them using the Server properties page to ensure that 
they use different ports.


HTH - also see Eclipse Help

Regards

Alan Chaney









Sergey Livanov wrote:

no, I have only tc 6.0.18
CATALINA_HOME points to c:\tomcat

2009/3/21 André Warnier a...@ice-sa.com


2009/3/21 André Warnier a...@ice-sa.com

 Sergey Livanov wrote:

 I install Tomcat 6.0.18 in c:\tomcat.

When add the new server Eclipse writes that tomcat install directory is
not
correct.
It does not point to valid Tomcat installation.
What should I do ?

 I don't now Eclipse at all, but how does it normally find out the path
of


a Tomcat installation ?

  When I add a new server I specify a path where Tomcat installed

before.

Tc5.r  I installed without problems.

If you still have both Tomcats, Eclipse may get confused.
Is there by any chance a CATALINA_HOME variable defined, that points to
something else ?
(open a command window, type set and look)


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org





!DSPAM:49c50f9b246552009820482!



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: not valid Tomcat installation

2009-03-21 Thread Alan Chaney

Actually I missed the final step!!

Right click in the Servers panel and New-Server will let you add the 
server.


Then you can add web projects as required.

Regards

Alan


Alan Chaney wrote:

Sergey (and FYI Andre)

For each server Eclipse uses, you must create a new entry in the 
'Servers' folder.


I'm assuming that you are using eclipse 3.3+ with WTP (Web Tools 
Project) plugins.


One way to do it is as follows:

 From main menu Window-Preferences
Select  'Server'
click on triangle to get the drop down list and then select
'Runtime Environment'

The select 'Add'

You will get a list, the first of which is 'Apache'
select Apache Tomcat v6.0
and then 'Next'
now you will be at a menu called 'Tomcat Server Specify the installation 
directory'


Use Browse to select the folder in which you installed Tomcat. It will
check to see that it has the right files in it.

You can specify the JRE that tomcat is run with below. You may want to 
use a different JRE than the one that you are running Eclipse with. For 
example, I start and run eclipse with a JDK1.5 but compile and run my 
applications with JRE from the 1.6 JDK.


You can have more than one tomcat server defined in eclipse. Its up to 
you to configure them using the Server properties page to ensure that 
they use different ports.


HTH - also see Eclipse Help

Regards

Alan Chaney









Sergey Livanov wrote:

no, I have only tc 6.0.18
CATALINA_HOME points to c:\tomcat

2009/3/21 André Warnier a...@ice-sa.com


2009/3/21 André Warnier a...@ice-sa.com

 Sergey Livanov wrote:

 I install Tomcat 6.0.18 in c:\tomcat.
When add the new server Eclipse writes that tomcat install 
directory is

not
correct.
It does not point to valid Tomcat installation.
What should I do ?

 I don't now Eclipse at all, but how does it normally find out the 
path

of


a Tomcat installation ?

  When I add a new server I specify a path where Tomcat installed

before.

Tc5.r  I installed without problems.

If you still have both Tomcats, Eclipse may get confused.
Is there by any chance a CATALINA_HOME variable defined, that points to
something else ?
(open a command window, type set and look)


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org









-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



!DSPAM:49c515bf249199080218370!



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Vmware Server 2 web interface uses tomcat but hogs 8005 and 8009

2009-03-17 Thread Alan Chaney

Chris

Christopher Schultz wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Rainer,

On 3/17/2009 4:18 AM, Rainer Frey (Inxmail GmbH) wrote:

On Monday 16 March 2009 22:42:27 Christopher Schultz wrote:

Can you clarify this a bit?
There is no special management instance. VMWare Server is an application that 
runs on a regular host operating system instance (it installs linux kernel 
modules though, and probably also Windows drivers).


Interesting. This used to be called VMWare Workstation.

Rainer's right - there's Vmware Server and Workstation (and others, eg 
the GSX product range.) I've used Server 1 and workstation on several 
machines and several operating systems for four years. My annoyance was 
the configuration of Server 2. Server 1 came with a separate application 
(VMware console) that you could use to connect to both local and remote 
clients. Server 2 has replaced this with a web ui.


They (meaning this user 
on the VMWare community, who might or might not be associated with VMWare) 
say  not to run server software on that host operating system. I take that as 
a recommendation to dedicate a machine to one purpose only  (VM hosting in 
that case), which is  common practice in many production environments, but no 
strict requirement.


Yes, I accept I was a little frustrated at the time - my sentence was 
not intended to imply that Vmware had made the above statement, but more 
that I couldn't find any answer to the problem on their site.



Okay, this makes sense (not the recommendation, just the explanation).

What do you mean with the other end? I use VMWare Server 2 on Ubuntu 
(original tar.gz install from vmware.com), also found that it blocks the said 
ports, and simply changed the server.xml of the VMWare Tomcat.


And how did the client find it? If I missed how to do it, I apologize 
for wasting everybody's time but there is no mention in the docs, I 
could find nothing on Google and my experiments indicated that you need 
to change both client and server and I could only find the server 
configuration.



He still wants the web manager to work, and the /client/ expects to
connect on a certain port. If you change VMWare's server-side ports, the
client can no longer connect.


Correct. I still don't understand why Vmware didn't make this configurable.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Vmware Server 2 web interface uses tomcat but hogs 8005 and 8009

2009-03-16 Thread Alan Chaney
I've just wasted about a couple of hours sorting out an issue with 
Vmware server 2 and tomcat and I thought I'd pass it along, hoping to 
save someone else a small piece of frustration.


I've been setting up a new development workstation (CentOS 5.2) and 
switched to using vmware server 2 (because version 1 is now moribund).


Version 2 uses a web interface which is apparently 'served' from a local 
tomcat instance. Yay tomcat! However, in their infinite wisdom vmware 
have changed the default http and https ports from 8080 and 8443, but 
left the startup port at 8005 and the mod-jk port at 8009, and, what's 
more, not provided any way to change it.


I spent some time looking to see whether these were configurable, but I 
found nothing, apart from a rather snotty message on the vmware bulletin 
boards stating that they didn't think that you should run a server on 
the same platform as a vmware setup which is odd, because A. I do in 
production all the time and it works fine and B. haven't they heard of 
development environments? I don't know about other people but I have all 
sorts of servers running on my workstation when I'm testing and 
debugging things.


I found the vmware 'local' tomcat installation (6.0.16) and obviously 
you can edit the startup and mod-jk ports there, but then also obviously 
it stops working unless you can edit the 'other end' as it were and that 
doesn't appear possible. I hunted through all the available 
configuration files but the values must be hard-coded.


So it seems that you must reconfigure any other local tomcat(s) on the 
same machine to use (a) different startup port(s).


Hope that someone, someday, finds this helpful. I'd be interested if 
someone else finds out more about this.


Alan Chaney

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: help again... what means these errors?

2009-03-01 Thread Alan Chaney

Hi Andre

Totally agree with your comments with respect to the OP's first 
exception. However, they actually had two exceptions in their original 
email with completely different time stamps. The 2nd exception appears 
to be a HibernateException


01-Mar-2009 11:36:21 org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet HumanReadableLinksServlet threw
exception
org.hibernate.TransactionException: Transaction not successfully started
   at
org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:100)
   at


The cause of this is probably completely unconnected to a remote client 
disconnect. The error above is thrown under the following conditiions: 
(from

http://www.hibernate.org/hib_docs/v3/api/org/hibernate/TransactionException.html

Indicates that a transaction could not be begun, committed or rolled 
back. 


With the very limited information given it is iimpossible to infer the 
exact cause but I would suspect that likely possibilities are a severe 
resource contention on the database or possibly a transaction timeout.


The OP gave these two errors but didn't indicate whether they were 
happening repeatedly or just one offs. One further possibility is a 
poor network setup causing  failure to access the database and/or 
connection failures with the client. More information would be required 
to correctly diagnose the problem. I doubt very much that the problem or 
problems are directly connected with Tomcat - more likely the 
application or the system configuration.


Regards

Alan


André Warnier wrote:

Laura Bartolomé wrote:

Hi again...

We are going on findind errors and problems... and we wanna cry...


We certainly would not want that to happen, because then your messages 
here would get all mushy and more difficult to read.

And Tomcat would probably not care.


someone could explain what means these errors? The first:

01-Mar-2009 00:08:46 org.apache.catalina.core.StandardWrapperValve 
invoke

SEVERE: Servlet.service() for servlet HumanReadableLinksServlet threw
exception
java.net.SocketException: Connection reset by peer: socket write error
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(Unknown Source)
at java.net.SocketOutputStream.write(Unknown Source)

The above rather self-explanatory message (Connection reset by peer: 
socket write error) typically means what it says : the client (browser 
?) went away before the server could send a response to it.  That 
usually means :

either
a) the user clicked the stop or cancel button in the browser, 
before he received the answer to his request

or
b) the impatient user clicked on another link on the current page, 
causing the browser to interrupt the current connection to the server 
and load the new page, before the server could send the response to 
the previous request


The above 2 reasons probably cover at least 90% of the cases. It could 
be due to the application being so slow to answer, that the human user 
gets impatient and starts clicking all over.


c) some communication problem occurred between the client and the 
server, causing the TCP connection to be closed prematurely.
From personal experience, that may be due to some proxy or other 
in-between element, closing the connection because nothing happened on 
that connection for some time.


Anyway, with 100% certainty, it means that when the server was ready 
to send the answer to the client, it could not, because the connection 
with the client had been closed for some reason.





and the other:

01-Mar-2009 11:36:21 org.apache.catalina.core.StandardWrapperValve 
invoke

SEVERE: Servlet.service() for servlet HumanReadableLinksServlet threw
exception
org.hibernate.TransactionException: Transaction not successfully started
at


I am no specialist, but according to the above message, that seems to 
be something in the hibernate application, not something coming from 
Tomcat itself.  So you probably should ask in some hibernate forum 
what it means.




-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



!DSPAM:49aaa5fc82807785049143!




-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: help again... what means these errors?

2009-03-01 Thread Alan Chaney

Sorry, didn't see the end!

Alan


André Warnier wrote:

Alan Chaney wrote:

Hi Andre

Totally agree with your comments with respect to the OP's first 
exception. However, they actually had two exceptions in their 
original email with completely different time stamps. The 2nd 
exception appears to be a HibernateException


Yes, which I mentioned also in my answer.  You need to read to the end 
though...

;-)

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



!DSPAM:49aad1ae104581527717022!




-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: error while building tomcat 5.5

2009-02-28 Thread Alan Chaney
Do you have write permission to the following directory as the user you 
are using to do the build?


You may have to 'su' or 'sudo' or change the access permissions on 
/usr/share/java to allow the build script to write to it.


Regards

Alan Chaney

h iroshan wrote:

/usr/share/java/tomcat-native-1.1.12/tomcat-native.tar.gz
  



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: J2EE on Mac

2009-02-23 Thread Alan Chaney



Caldarale, Charles R wrote:



That was already specified: the OP wants to compile servlets; nothing beyond a 
JDK is needed.

 - Chuck

Everything said about J2EE, classpaths etc is perfectly correct.

However, the other thing the OP said was that they want to use Eclipse 
on a Mac. To build web applications with eclipse the best thing to do is 
to install the appropriate web development add-ons - we use the Web 
Standard Tools (WST) options.


This is best installed using the software updates option within Eclipse. 
After having done that and configured a local tomcat installation as a 
'Server' within Eclipse you are, as they say, good to go and all you 
need to do is to select a new Dynamic Web Project when creating a new 
project.


Eclipse then takes care of all the library and classpath issues.

There is no need to download or install anything other than a binary 
tomcat, eclipse and then, within that, eclipse WST (or the combined 
package in the first place.)


Let me just add that the above is an abridged summary to try to get the 
OP on the right path, not to start a long flame about the advantages and 
disadvantages of eclipse!


Regards

Alan Chaney




-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Fwd: J2EE on Mac

2009-02-23 Thread Alan Chaney

Mighty Tornado wrote:

Hi,

I installed Tomcat on my mac OS X and it's running. I also have Eclipse
Europa. Now I don't think I have J2EE installed - How do I do it?
I went to Sun's website and it gave me an archive with GlassFish which I
don't need.
Can somebody please tell me where I can download the latest J2EE for Mac?
What I need to do to compile servlets with it in Eclipse?

Thank you.


!DSPAM:49a24c91167621527717022!

  

Dear Mighty,

Re-reading your email again, you say that you installed Europa. AFAIK 
Europa comes with WTP installed. All you need to do is to download a 
tomcat release, configure that as a Server and then create a Dynamic Web 
Project. See the tutorials in the eclipse help. Works for Mac, PC, 
Linux, Solaris.


Regards

Alan Chaney

( a long time eclipse user with a major love-hate relationship with eclipse)

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Authenticating Users

2009-02-22 Thread Alan Chaney

Christopher Schultz wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Mark,
  

I was the OP on this one. Mark just made a couple of suggestions.


On 2/21/2009 4:06 PM, Mark Thomas wrote:
  

5. Patch DataSourceRealm

6. Make case sensitivity configurable and contribute your patch back to
the ASF.



7. Use securityfilter to write your realm, and not be tied to Tomcat.
  
Had a brief look at 'securityfilter' - however we actually do require 
container managed security as we have several applications. Other 
alternative as previously mentioined is acegi.



8. Many databases use case-insensitive string comparisons already.
Case-insensitive passwords (probably a bad idea!) 
Actually, in general, I agree that its a bad idea. However, each case 
has to be handled in the light of the actual users expectations.
In the case of this specific application the users are artists who are 
generally extremely computer naive. We commonly get support enquiries  
I can't log into my account EVEN THOUGH we have sent them their 
account names and passwords because they are not correctly capitalizing 
their usernames or passwords.


It is important to keep to keep the case of usernames because, as I 
said, they are artists, and the capitalization may have significance to 
them as part of their brand.


The information on the site is publically available after it has been 
published. There is no commercial or sensitive information on the site.




will work if you
aren't hashing them. If you are, you'll have to lowercase them or something.

  
Exactly. One problem for a general solution is that there are variations 
in the name of the 'lowercase' function between databases. So far, I've 
found that Postgres, MySQL and Oracle appear to support 'lower()' but 
M/SQL has it as tolower() (thanks again MS)





If you /are/ hashing them, you'll need to do a password migration where
anyone who changes their password gets it lowercased but passwords that
existed beforehand are still case-sensitive. You cannot avoid this, now
matter what your solution is.
  
In this specific case at the moment we aren't hashing them, but you 
raise a good general point about hashing which I'll have to think about.


Regards

Alan



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: How to close open connections after application stop?

2009-02-22 Thread Alan Chaney

Edoardo wrote

I have
  resultset.close();
  statement.close();
  connection.close();
in my code.

and
  connection = dataSource.getConnection();
seems very close to my
  ambiente = (Context) new InitialContext().lookup(java:comp/env);
  pool = (DataSource) ambiente.lookup(jdbc/myApp);
  Connection conn = pool.getConnection();
there are a lot of debug information in my code and seems that nothing 
is going wrong (no exceptions).


but... if you post that it means that I am doing something wrong.

Edoardo

I don't think so. Let me recap your problem:

When you undeploy an application from tomcat (using the DBCP pooling 
mechanism) you can't make STRUCTURAL changes to the database because it 
complains that connections are still in use.


This is exactly what one would expect. I've encountered the same 
problem. When an application finishes with a database connection it is 
returned to the pool. That's exactly what a connection pool is for!


As far as I can see by looking at the tomcat source code the connection 
pool is created at startup and remains active until TC shutdown. Once a 
connection has been obtained from the pool it may stay 'active' for the 
entire duration of the TC session (that is, from TC start to TC stop)


Obviously, depending upon your usage, it is possible for more than one 
application in the same container to be reusing the same connection 
pool. Your original post indicates that only one app. is using the database.


It seems to me that:

1. you could just shutdown tomcat! If this is a production site the best 
plan would be to write a script which renames the database and does 
whatever else you need, test it on a development machine and just find a 
'quiet' time to shutdown the site, update the db and restart.


2. Move the connection pool into your application. Thus shutting down 
the application would shutdown the pool.


3. As I assume you are using DBCP in Tomcat, carefully read the DBCP 
docs, configure your system so that you can directly access the POOLED 
connections, keep a list of ALL the connections you use and then shut 
them down at the end. This is fraught with difficulty.



Regards

Alan











-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Authenticating Users

2009-02-22 Thread Alan Chaney

Gregor Schneider wrote:

To the OP:

1. May I ask what database it is you're using?
  

Postgres - but a more general solution would be nice.

2- I'd go for the following solution:

Create a JSP-page accepting the credentials. The username should be
converted to uppercase. The password should be left as is so that
case-sensivity here is maintained.
  


That doesn't actually fit in with the Servlet CMS. I can easily decode 
the user name and password by your mechanism. However, then I have to 
rather extensively modify my code (covering 3 applications and 4 web 
services) to apply the credentials. What I was looking for was a way of 
extending what I already have.



Don't know if I'm missing something, but to me that looks like a walk
in the park.
  
See above. The problem is not decoding the password, but making sure 
that the container managed security mechanism is maintained.


So far, the best suggestions that I've had are:

1. Modify DataSourceRealm
2. Use secuirityfilter.

From my point of view, as I don't use hashed passwords at the moment 
the easiest thing to do is to modify the DataSourceRealm as suggested by 
Mark Thomas. However, I think that the ability to extend the login 
system to use either a user name or an email address would probably be 
useful for other people. I'll give it some thought.


Regards

Alan

















Rgds

Gregor
  



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Authenticating Users

2009-02-22 Thread Alan Chaney

Martin Gainty wrote:

Which specific attributes are you seeking that are not in DataSourceRealm?
Realm className=org.apache.catalina.realm.DataSourceRealm debug=99
   dataSourceName=jdbc/authority
   userTable=users userNameCol=user_name userCredCol=user_pass
   userRoleTable=user_roles roleNameCol=role_name/
http://tomcat.apache.org/tomcat-5.5-doc/realm-howto.html#DataSourceRealm

?
  

To summarize

I (or,actually my marketing dept')  have the following requirements.

1. password be case insensitive [I may be able to talk them out of this]
2. username be case insensitive.
3. email address can be used as a synonym for the user name.
4. Security managed by Tomcat CMS.

Mark T suggested that I modify DSR appropriately.
Chris Schultz pointed out correctly that it gets a bit more complicated 
if the pwd must be hashed.


I've looked at the code to DSR and it seems to me that the following 
would work.


1. add an 'alternative' userNameCol (eg altNameCol) and in the 
configuration as above point that at the email column.
2. in the code, IF the login fails using the 'user_name' then try it 
with the altNameCol.
3. to make things case insenstive simply convert the username to lower 
case and use a 'lower' function on the column value.
4. to make the thing a bit more flexible an additional boolean parameter 
'isCaseInsensitive' could be added to select the behavior has in 3. above.


Defaults could be chosen such that the current configuration setup still 
works (eg the default value for isCaseInsensitive is false)


Only real gotcha that I can see for making it database independent is 
that the function used to create lower case is not univerally 'lower()' 
(M/SQL appears to be toLower()) so it might be necessary to pass the 
string for the function name as an optional configuration parameter.


I realize that many people would advise against the idea of case 
insensitive passwords - however, despite my personal reservations I am 
willing to accept that in the case of this particular application the 
reduction in security is acceptable.


If hashed pwds are used then there are 3 solutions:

1. don't allow case insensitive passwords - only user names.
2. provide two columns one for lower case versions of the pwd.
3. convert all the existing password HASHES to the lower case equivalent,

but hashed passwords are not my principal concern

I've downloaded and built 6.0.18 and looked at the DSR code - doesn't 
look like a very big job to make the changes that I want so I may have 
go tomorrow. As I use 6.0.18 I can easily test it by just patching in 
the .class file for DataSourceRealm on my dev. system.


Regards

Alan










-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Authenticating Users

2009-02-21 Thread Alan Chaney

Hi

We have a site which has users log in to create/edit account 
information. Nothing unusual there. Currently this is implemented with a 
JDBCRealm and it all works OK.


However, we have a 'marketing requirement' to remove case sensitivity 
(but NOT case preservation) from user names and passwords. I cannot see 
anyway to do this directly with JDBCRealm or DataSourceRealm. Unless I'm 
missing something, the username and password provided to j_securitycheck 
are explicitly matched for case.


Additionally, we will shortly need to offer an alternative login 
mechanism - using either a login name or an email address in the same field.


So far, I can see the following options:

1. Implement a filter that 'sits around' the login form and translates 
case on password and username to lower case and create a lowercase 
'shadow' password table in my database. So, when a request is received 
for the 'secured' pages this would be fed through this filter. However, 
I don't think this will work, because I suspect that the security check 
is run BEFORE any filters that I have configured in web.xml.


2. Implement some java script to convert entered fields to lower case on 
the login form (GHASTLY!) Still doesn't fix the password thing.


3. Implement my own Realm - intercept the requests - identify the 
supplied string in the username field as an email address (or not), look 
up the user by email address in the database (which in my case must be 
unique). As I use PostgreSQL I can then write a 'like' query to case 
insensitively find matching user and password. Upside - it should work. 
Downside - I then have to add the resulting jar to $TOMCAT_HOME/lib on 
all my servers and update the MBean descriptor (which I don't completely 
understand how to do - advice?)


4. Possibly do something similar to 3 but with a JAAS.

Does anyone have any suggestions or comments? I'm perfectly OK with 
using Acegi - my only issue with that after a browse through the docs I 
don't see how I can meet my requirement of username/email and password 
case insensitive but case preserving without additional code for Acegi 
either. Obviously I can take that issue to the acegi/spring forums if 
acegi is the only solution (that is 1, 3, and 4. above won't work - 2. 
is out)


Thanks in advance

Alan Chaney







-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Authenticating Users

2009-02-21 Thread Alan Chaney


Mark Thomas wrote:


5. Patch DataSourceRealm (should just be a couple of changes to make the
checks case insensitive) and deploy your patched version to each of your
Tomcat instances. To do this you'd put your DataSourceRealm.class file
in CATALINA_HOME/lib/org/apache/catalina/realm

6. Make case sensitivity configurable and contribute your patch back to
the ASF. Providing it is database neutral, there is a good chance it
will be accepted for Tomcat 7 and maybe back-ported to Tomcat 6.

Mark

Ok Mark I'll have a go at 5. and 6. I'll report back in a few days.

Regards

Alan Chaney


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: [OT] Apache Tom Cat in a VM as VMWARE or Red Hat Virtualization

2009-02-19 Thread Alan Chaney



Christopher Schultz wrote:


Isn't xen basically dead? Or have rumors about its demise been greatly
exaggerated? I thought everyone was moving to kvm.

Tell that to Citrix? They made revenues of about $620M last year almost 
entirely based on Xen technology.


Still only a fraction of VMWare's t/o, though. ($1,9B)



Alan Chaney

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Apache Tom Cat in a VM as VMWARE or Red Hat Virtualization

2009-02-18 Thread Alan Chaney



I agree with Jorge - I run several Tomcats under VMware for both 
production and development.


However it is worth noting that if you use the appropriate vmware tools 
for your installation (vmware-guestd etc.) you get a significant 
performance boost on network accesses which may well be important for 
tomcat. (See vmxnet) YMMV.


Regards

Alan Chaney




Jorge Medina wrote:

There are no issues on running Tomcat in a VM. Tomcat is unaware of where it is 
running.

Performance depends on the host running your VM. If you compare a VM running application A on host H compared to application A running directly on host H, you will notice that running on the real server is faster. This is true for any application, not just Tomcat. 




-Original Message-
From: acacio costa [mailto:acaciofco...@yahoo.com.br] 
Sent: Wednesday, February 18, 2009 2:33 PM

To: users@tomcat.apache.org
Subject: Apache Tom Cat in a VM as VMWARE or Red Hat Virtualization

Hi,
 
Does anyone use Apache Tom Cat in a VM as VMWARE or Red Hat Virtualization?
 
i apreciate to know if you have issues and a tips to go on.
 
Other things to know, Performance comparative with a real server? as the same? better? 
What the parameters you perceive as better than other environment and what cause as you move Tom Cat to VM.
 
Thanks in advance,
 
Acacio Costa



  Veja quais são os assuntos do momento no Yahoo! +Buscados 
http://br.maisbuscados.yahoo.com

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



!DSPAM:499c67d762582136417547!



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: [OT] of the different methods to get a user-id

2009-02-16 Thread Alan Chaney

Chris,

I offer my opinions here as a real grey beard (literally). I certainly 
agree with you that people should have

a breath of skills allowing them to use the right tool at the right time.

However, notwithstanding the fact that the other day I worked out that I 
have actually used about 15 different programming languages in anger 
(that is, part of code used by other people) I have to admit that my 
occasional brush with Perl has been unrewarding (for both me and the 
language...)


My biggest problem is that I've never seen a little bit of typing as a 
big issue, but reading and trying to understand something a few 
weeks/months/years later is always fraught with difficulties. The main 
problem with perl is that I can never remember exactly what #...@!$% means 
whereas something like getUserPrincipal() works for me!


Regards

Alan Chaney


Christopher Schultz wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

André,

What the hell.. let's start a holy war?!

On 2/13/2009 10:25 AM, André Warnier wrote:
  

Their merit is all the greater since
they work in the obscure non-graphical background, they never get any of
the attention, and they have to share machines with some Java programs,
which means they get only the usage of a tiny fraction of the RAM and
CPU cycles, although they do most of the real work and have to do it
with a single thread each.



Hear, hear!

  

Even some of the old-school programmers, mostly in their later years,
succumb to the what-the-heck syndrome and come to appreciate the sense
of security and comfort provided by strongly-typed and rigidly
object-oriented languages



Heck, lots of folks on this list won't even use cron to schedule jobs.
Instead, they write web applications wrapped around Quartz because it's
just easier to deploy or some other such nonsense. IMHO, you either
have control of your production environment yourself (and can do
whatever you want) or you have an ops team with complete control of your
production environment (and they ought to be able to handle scary stuff
like scheduling cron jobs and running shell scripts) or you have no
control whatsoever and therefore do not have a production environment.
There, I said it. :p

On the other hand, seeing object-oriented perl really makes me queasy.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkmZ2FIACgkQ9CaO5/Lv0PDOQgCeJno3T9D2GnoWpTFswcvInUCn
zpcAnijMpytndgIfPe6knYmum47WOj56
=QFoD
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



!DSPAM:4999da4713771562881678!

  



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Tomcat Internal Buffering with Jython

2009-02-15 Thread Alan Chaney

Hi Prashant
The first question - which version of Tomcat? What operating sytem? What 
JVM? and in your case which version of Jython?


Secondly please could you clarify exactly how your web is structured?

My understanding from your first email is:

1. servlet is called with request containing a file (presumably 
mutlipart encoded?)
2. the file data is then fed into a python script running either using a 
java6 ScriptManager or similar.
3. and then what? Are you streaming the output from that file straigth 
into the PrintWriter/OutputStream of the HttpServeltResponse?

Or are you trying to save the file locally?

Regards

Alan Chaney


Prashant Golash wrote:

Hi Tomcat-Apache Gurus,
I have a web application where  from the front end user loads a file
and gives it as input to Java classes.The file is given as input to
a python script which converts it into some other format.
Here I have used the concept of jython.
The file is converting properly in the parent
directory of Tomat but with some of the data which is missed.The problem is
when I close the tomcat,then additional data is added to the converted file
which
completes the correct conversion.

I want to know whether some internal buffer of Tomcat is holding the extra
data.
If so how to retrieve it.

Sincerely,
Prashant golash


!DSPAM:4997ebf763341804284693!

  



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Tomcat Internal Buffering with Jython

2009-02-15 Thread Alan Chaney

Hi Prashant

So the exact problem is that after your jsp page is called and the data 
processed then the file is incomplete?
Presumably then you are using ordinary file I/O to write to this file? 
If that's the case, then I think the answer to your original question is 
No - no internal buffer of tomcat is holding the data


Tomcat's buffering is connected with processing servlet 
request/responses and it doesn't seem that you are using the response 
object to write your data to the output stream. I assume that you have 
checked that all of the data is being read from the request by some 
logging or debugging?


I would suspect that a file or stream is not being flushed/closed and 
that when tomcat is stopped this flushing is happening because the 
streams are being closed automatically.


Maybe you can create some unit tests which can help isolate this 
problem. It may be either in your file writing code or in the way you 
are using the jython libraries. Without seeing your code in detail its 
difficult to be more helpful. I'd guess that you could take your core 
logic and replicate the problem independently of tomcat.


One other point is that saving this file in the tomcat home directory 
doesn't seem particularly elegant. You could use the default work 
directory. I doubt that has any relevance to the problem


HTH

Alan

Prashant Golash wrote:

Hi Alan,
Below are the details for the versions and OS:

Tomcat Version : 6.0
OS : Windows XP
JVM : 1.6

The way web is structured is:

I have some precompiled python scripts which are actually compiled by jython
into java classes(Before deploying).
I have one python script which uses these precompiled python classes.Now I
am giving one file as
input to this python script and it internally produces the output file using
this input file.
This output file is saved locally in the parent directory of Tomcat.

There is one jsp page which takes input from the user and then passes the
request to Java class which actually
calls this Python script.

Note:The python script is actually called using the PythonInterpreter class
and all those Java and Jython integration techniques.

Sincerely,
Prashant golash

On Sun, Feb 15, 2009 at 10:02 PM, Alan Chaney
a...@compulsivecreative.comwrote:

  

Hi Prashant
The first question - which version of Tomcat? What operating sytem? What
JVM? and in your case which version of Jython?

Secondly please could you clarify exactly how your web is structured?

My understanding from your first email is:

1. servlet is called with request containing a file (presumably mutlipart
encoded?)
2. the file data is then fed into a python script running either using a
java6 ScriptManager or similar.
3. and then what? Are you streaming the output from that file straigth into
the PrintWriter/OutputStream of the HttpServeltResponse?
Or are you trying to save the file locally?

Regards

Alan Chaney


Prashant Golash wrote:



Hi Tomcat-Apache Gurus,
I have a web application where  from the front end user loads a file
and gives it as input to Java classes.The file is given as input to
a python script which converts it into some other format.
Here I have used the concept of jython.
The file is converting properly in the parent
directory of Tomat but with some of the data which is missed.The problem
is
when I close the tomcat,then additional data is added to the converted
file
which
completes the correct conversion.

I want to know whether some internal buffer of Tomcat is holding the extra
data.
If so how to retrieve it.

Sincerely,
Prashant golash






  

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org






!DSPAM:49984b33117283966023671!

  



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: starting and stoppping tomcat

2009-02-14 Thread Alan Chaney

I think you need to rethink your use cases here...

Exactly WHY do you need to start and stop tomcat from a button on a web 
page?

Or do you really need to enable/disable some kind of function?

Generally speaking servers don't expect to be started or stopped by 
their clients - well, ok, sometimes you can stop a service by a client 
but almost by definition you can't start a service from a client...


Typically tomcat provides a way of processing requests received from 
remote web clients and arranges for the requests to be processed by a 
web application. Your application may have state which can be controlled 
by the request. This shouldn't normally affect tomcat's normal operation.


HTH

Alan Chaney


paybackorfail wrote:

That's a good point, what if it was just an html page?


Mark Thomas-18 wrote:
  

paybackorfail wrote:


Hi, I have written a web application in netbeans using java and jsp, and
i am
hosting it on a server using tomcat, i need help on finding a way to
start
and stop the server by the user clicking a button on a jsp page, do i
have
to use the org.apache.catalina.ant.StartTask of the tomcat api? can
anyone
help?
  

If Tomcat is stopped, how is it going to handle a user clicking on a
button on a JSP page to start it?

Mark


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org






  



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: starting and stoppping tomcat

2009-02-14 Thread Alan Chaney
My earlier point was that you need to think about it in a slightly 
different way.


Starting and stopping the server is something that is normally done 
rarely and anyway, you can't start something that is not already started 
by using it to start itself!


What you should do is to add a boolean flag - a state variable to your 
servlet. You can set or clear this flag with your page button.


Use this flag to condition your database access - so when the timer 
event fires, it checks the state flag and then accesses the database.



Regards

Alan


paybackorfail wrote:

Hi, thanks for replying, my application will take some data from a website
and insert this data into a database and i schedule the application to do
this every hour using contextlistener and timertask as a java servlet. At
the moment it starts updating the database as soon as i upload the
application to the server, I need a way to shutdown the server so it will
stop updating the database


Alan Chaney wrote:

I think you need to rethink your use cases here...

Exactly WHY do you need to start and stop tomcat from a button on a web 
page?

Or do you really need to enable/disable some kind of function?

Generally speaking servers don't expect to be started or stopped by 
their clients - well, ok, sometimes you can stop a service by a client 
but almost by definition you can't start a service from a client...


Typically tomcat provides a way of processing requests received from 
remote web clients and arranges for the requests to be processed by a 
web application. Your application may have state which can be controlled 
by the request. This shouldn't normally affect tomcat's normal operation.


HTH

Alan Chaney


paybackorfail wrote:

That's a good point, what if it was just an html page?


Mark Thomas-18 wrote:
  

paybackorfail wrote:


Hi, I have written a web application in netbeans using java and jsp,
and
i am
hosting it on a server using tomcat, i need help on finding a way to
start
and stop the server by the user clicking a button on a jsp page, do i
have
to use the org.apache.catalina.ant.StartTask of the tomcat api? can
anyone
help?
  

If Tomcat is stopped, how is it going to handle a user clicking on a
button on a JSP page to start it?

Mark


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org




  


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org







-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Fun with the JVM crashing.

2009-02-06 Thread Alan Chaney

Hi Bill

My development workstation is a 64 bit Ubuntu 8.04. I've had numerous 
problems with SIGSEGV crashes when I run my applications under Eclipse 
3.3, but the same machine also runs the same applications from the same 
version(s) of tomcat (6.0.14,6.0.16 and 6.0.18) I found that what seemed 
to affect the thing the most was 'loading up' the JVM. My app is 
actually 5 different wars - I get the most problems when all of them are 
loaded.


I found it so frustrating that I've actually procured a 2nd 64 bit 
machine to try to see what common factors there are. For example, I was 
going to see if Eclipse 3.4 was better than 3.3.


I tried b4 thru b16 and it seems to have made no difference.

No real answer here, just me giving you some more background data.

Regards

Alan Chaney


Bill Davidson wrote:

I've submitted this to Sun a few times.  No response.  I was hoping
someone here might have an idea of what to look for.

Tomcat 6.0.18
RedHat 5.2Server
Sun JVM

#
# An unexpected error has been detected by Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x2b68e6a1db57, pid=10229, tid=1103006016
#
# Java VM: Java HotSpot(TM) 64-Bit Server VM (11.0-b16 mixed mode 
linux-amd64)

# Problematic frame:
# V  [libjvm.so+0x564b57]
#
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

---  T H R E A D  ---

Current thread (0x4bfe5c00):  JavaThread CompilerThread0 
daemon [_thread_in_native, id=10244, 
stack(0x41ae8000,0x41be9000)]


siginfo:si_signo=SIGSEGV: si_errno=0, si_code=1 (SEGV_MAPERR), 
si_addr=0x


.

Current CompileTask:
C2:2525  
com.myCompany.servlets.sales.blah.some.method(Lcom/myCompany/servlets/someClass;Lcom/myCompany/servlets/otherClass;Lcom/oreilly/servlet/ParameterParser;)V 
(425 bytes)


..

-

I'm wondering if that CompileTask is what's causing the problem.
I'm thinking that the JVM shouldn't be getting SIGSEGV's.




-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



!DSPAM:498b962676632009820482!



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: PostgreSQL vs MySQL with Tomcat

2009-01-19 Thread Alan Chaney
I stopped using MySQL when it was at version 4 because the transactional 
locking table (InnoDB) had different licensing restrictions than the 
rest of MySql (I'm not sure if this is true any longer.)


We switched to Postgresql (of comparable price!) and basically found it 
well-documented, reliable and fast (as long as you make sure to 'vacuum' 
it) Postgresql is under the BSD license which suited our needs better 
than the dual-licensing arrangement of MySQL. PGSQL has a very 
comprehensive set of features and I've not had any problems using it in 
conjunction with Hibernate.



MySQL 5 now has better transactional support than 4 - although I am 
personally sceptical of their reliance on 'atomic' locking - I don't 
quite see how that would work with long transactions and an optimistic 
locking strategy.


So, in the end you pays your money and you takes your choice (grin)

Alan Chaney


Terence M. Bandoian wrote:

I don't have a great deal of experience with Postgres but I have been
using MySQL since the days of mSQL and have found it to be fast,
reliable, easy to install on both Linux and Windows and straightforward
to administer.  It provides good support for the ANSI standard and the
documentation is good in identifying extensions to or deviations from
the standard.  All of the basic tools, from query analysis to command
line administration programs, are documented and function reliably. 
Statement syntax is very well documented.  Features include

localization, various character sets (UTF-8 and Unicode), data
encryption, client/server encryption, stored procedures, triggers,
transactions, APIs for a number of programming languages and support for
ODBC, JDBC and .NET.  Configurability is provided mainly through some
250+ system variables which may be set at startup (on the command line
or in the options file) or dynamically with the SET statement.  I have
been very pleased with its performance both administratively and as a
programmer and you can't beat the price.

-Terence M. Bandoian

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



!DSPAM:4974eae8230262136417547!



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Random Connection Closed Exceptions - Question to the code example

2009-01-19 Thread Alan Chaney

Hi Stefan

You don't need to repeat the stmt.close();conn.close() etc in the 'try' 
body. The 'finally' by definition is ALWAYS called and that is where you 
should do the tidy up...


Alan Chaney



Stefan Riegel wrote:
I guess I understood the point with the Random Connection Closed 
Exceptions Problem.


See at the end of 
http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html


As I understand, only the connection itself must be protected this way. 
The statement and ResultSet must not. Is the following, simplified code 
also correct?


  Connection conn = null;
  Statement stmt = null;
  ResultSet rs = null;
  try {
conn = ... get connection from connection pool ...
stmt = conn.createStatement(select ...);
rs = stmt.executeQuery();
... iterate through the result set ...


// SUPERFLUsOUS

rs.close();
stmt.close();
conn.close(); // Return to connection pool
conn = null;  // Make sure we don't close it twice

//SUPERFLUOUS



  } catch (SQLException e) {
... deal with errors ...
  } finally {
  try {
rs.close();
  } catch (SQLException e) {
// deal with errors
  }
  try {
stmt.close();
  } catch (SQLException e) {
// deal with errors
  }
if (conn != null) {
  try {
conn.close();
} catch (SQLException e) {
// deal with errors
}
  conn = null;
}
  }

Thanks.



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Random Connection Closed Exceptions - Question to the code example

2009-01-19 Thread Alan Chaney

Hi Stefan

I went and read the comments more carefully and it seems to me that the 
proposed solution is an attempt to avoid a race condition between 
issuing the 'close' in
one thread and then it being  closed again whilst its being used in 
another thread.


If the problem is closing it twice then I can't see why its not just 
closed in the 'finally' block, once for each thread.


If it is a concurrency problem then I suspect that the proposed solution 
in the docs isn't the right one anyway. I'd suspect that the problem is 
more to do with threads not seeing each others memory state properly. 
Isn't this is a case of a variable (in this case 'conn') actually being 
a reference to an object which is shared between threads?
Because of the JVM memory model it is possible for two threads not to be 
properly synchronized - see Doug Lea et.al and 'happens before' . 
Personally, I feel that the correct solution is to synchronize  access 
to the connection object when it is retrieved and closed.


I have to go out now and I don't have any more time to consider this 
today, but I'd be interested to hear other people's comments on this topic.


Regards

Alan Chaney


Stefan Riegel wrote:
Thanks Alan, just to make the thing really clear. You propose code 
like this:


public void execute() {
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
Context envContext = null;
try {
Context initContext = new InitialContext();
envContext = (Context) initContext.lookup(java:/comp/env);
DataSource ds = (DataSource) envContext.lookup(jdbc/swex);
conn = ds.getConnection();
stmt = conn.createStatement();
rs = stmt.executeQuery(some sql);
// iterate through the result set ...
} catch (SQLException e) {
e.printStackTrace();
} catch (NamingException e) {
e.printStackTrace();
} finally {
if (rs != null) {
try {
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
if (stmt != null) {
try {
stmt.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
if (conn != null) {
try {
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
if (envContext != null) {
try {
envContext.close();
} catch (NamingException e) {
e.printStackTrace();
}
}
}


For me this looks fine but I'm still confused, why they complicated 
things in the example of properly written code 
http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html? 



Hmm... frankly the code in the docs you refer to above seems odd to 
me... why repeat in the 'finally' something you've done in the 'try'?


I can see that setting the variables to null would ensure that all 
references were released and the objects were made candidates for garbage
collection but that could be done in the finally block anyway at some 
convenient point.


Obviously in your code you might not want to obtain and release the 
context for every JDBC operation - that would probably be done in some 
kind of start-up/shutdown code for your app, and of course your 
exception handling may need some more work depending upon the way you 
want to present the error
to your users, but I assumed that the issue you are concerned with is 
preventing resource leaks.


Any comments anyone else?

Regards

Alan




Do I miss some important point here?

Stefan


Alan Chaney schrieb:

Hi Stefan

You don't need to repeat the stmt.close();conn.close() etc in the 
'try' body. The 'finally' by definition is ALWAYS called and that is 
where you should do the tidy up...


Alan Chaney



Stefan Riegel wrote:
I guess I understood the point with the Random Connection Closed 
Exceptions Problem.


See at the end of 
http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html 



As I understand, only the connection itself must be protected this 
way. The statement and ResultSet must not. Is the following, 
simplified code also correct?


  Connection conn = null;
  Statement stmt = null;
  ResultSet rs = null;
  try {
conn = ... get connection from connection pool ...
stmt = conn.createStatement(select ...);
rs = stmt.executeQuery();
... iterate through the result set ...


// SUPERFLUsOUS

rs.close();
stmt.close();
conn.close(); // Return to connection pool
conn = null;  // Make sure we don't close it twice

//SUPERFLUOUS



  } catch (SQLException e) {
... deal with errors ...
  } finally {
  try

Re: Tomcat Beginner - Step 2!

2009-01-17 Thread Alan Chaney

Toriacht

Eclipse wst has a number of dfferent ways of working. It looks like you 
have selected the (default) way in which eclipse
creates its own internal copy of the webapps directory - in your case in 
the folder E:\\ ..\tmp1\service_demo.


What the error is saying is that as tomcat starts it can't find the doc 
base.


This is most likely for the following two reasons:

1. the directory really isn't writeable
2. more likely, you've managed to get eclipse out of sync with your project.

I suggest that you try the following:

Find the 'Server' tab (normally in one of the bottom panes)
Find the tomcat server - right click on in and select 'Clean' and then 
'Refresh'


This will rebuild the internal copy.

Try starting it again.

If this still doesn't work, then please provide the following:

The FULL startup display from the 'console' pane
Your web.xml

Thanks

Alan


Toriacht wrote:

Thanks guys...

I'm not sure if the following is an Eclipse or Tomcat issue. I have a simple
webservices demo written from tuorial. It appeared that teh server was
started up thru server staus window of eclips..console o/p etc but it never
appeared in task manager or the tomcat was not accessable thru a browser. On
closer inspection I found the following error..this happens when i try to
start the server thru eclipse..


SEVERE: Error starting static Resources 
java.lang.IllegalArgumentException: Document base C:\Documents and

Settings\Brian\workspace\ganymede\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\service_demo
does not exist or is not a readable directory 
at
org.apache.naming.resources.FileDirContext.setDocBase(FileDirContext.java:141) 

Any ideas? 


T

p.s. I have another thread on web services that ended up asking the same qn
as above. although it started out as a more generic question. I hope this
not against policy. I'll delete other thread if required.



Caldarale, Charles R wrote:
  

From: g f [mailto:gfo...@gmail.com]
Subject: Re: Tomcat Beginner - Step 2!

Change your port forwarding(virtual server) to forward port 80 (on the
outside) to port 8080 on the inside.
  

If your router/modem doesn't support port forwarding, change the
Connector port in conf/server.xml to use 80 rather than 8080.  You must
restart Tomcat whenever you make changes to the server.xml file.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org






  



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: File upload fails

2009-01-08 Thread Alan Chaney

How big is the file?

Connection reset is commonly caused by the the client dropping the 
connection. This could be because of connectivity problems - for 
example, issues with the clients ISP.


I have had problems with specific browsers over this as well (our site 
has dozens of large mpeg and jpeg uploads each day). The worst culprit 
proved to be Safari 3 on a Mac. Is the upload done with SSL?


I doubt that restarting the server makes any difference one way or the 
other. Why not get the client to test with a non-urgent file and a 
non-urgent time  when you have a chance to fault-find? Also, you may 
want to watch the upload with something like wireshark to see exactly 
what is happening and when.


Regards

Alan Chaney


javacle wrote:

pWe have a customer who uploads a file on a daily basis.
Usually it works, but about once every two weeks it fails with this error in
the log :
porg.apache.commons.fileupload.FileUploadException: Processing of
multipart/form-data request failed. Connection reset
pAfter restarting tomcat, sometimes three times, it eventually works.
Whether the restarting is significant or just the passage of time that
clears some other fault I dont know .. there is always a panic to get it
working

pThe customer is on the other side of the continent, but today she emailed
the file to me and I had the same error trying to upload her file from the
office the first time (i.e. same building as server). So that would seem to
eliminate long-distance network latency/timeout as a factor.

pNothing I am aware of has changed since the last time it worked, however
something may have changed in the network, or on the server, without being
noticed.

Any advice would be appreciated

tomcat 5.5, jre 1.4.2, Red Hat Enterprise Linux ES release 4 (Nahant) Kernel
2.6.9-5.ELsmp on an i686


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: File upload fails

2009-01-08 Thread Alan Chaney



javacle wrote:
The file is about 30Mbytes 
.. I get the same error uploading from the office on the same LAN as the

server.

Ok - not likely to be a problem with the remote connection, then.

What do you see in your browser when the upload fails? Have you got any 
browser debugging - if you are using Firefox you can easily add the 
'LiveHttpHeaders' plugin which I find very useful.


What happens inside your application following the upload? Is there a 
significant period of processing in the same thread as the servlet 
doGet? If so, its possible that your connection is timing out.


As you can simulate the problem in your office, what happens if you 
DON'T restart tomcat after you get the connection issue? If you just 
leave it for a little while can you then upload again?





Browser is (I think) always MSIE 6 .. but maybe sometimes Mozilla .. that's
something to check.
I will look into wireshark. 


Having a monitor on the connection will be useful. You should be able to 
install wireshark from your distro. I assume that as you are using MSIE 
then your dev. system is a PC? I develop on linux and don't know of any

particular network monitor to recommend.

HTH

Alan






Alan Chaney wrote:

How big is the file?

Connection reset is commonly caused by the the client dropping the 
connection. This could be because of connectivity problems - for 
example, issues with the clients ISP.


I have had problems with specific browsers over this as well (our site 
has dozens of large mpeg and jpeg uploads each day). The worst culprit 
proved to be Safari 3 on a Mac. Is the upload done with SSL?


I doubt that restarting the server makes any difference one way or the 
other. Why not get the client to test with a non-urgent file and a 
non-urgent time  when you have a chance to fault-find? Also, you may 
want to watch the upload with something like wireshark to see exactly 
what is happening and when.


Regards

Alan Chaney


javacle wrote:

pWe have a customer who uploads a file on a daily basis.
Usually it works, but about once every two weeks it fails with this error
in
the log :
porg.apache.commons.fileupload.FileUploadException: Processing of
multipart/form-data request failed. Connection reset
pAfter restarting tomcat, sometimes three times, it eventually works.
Whether the restarting is significant or just the passage of time that
clears some other fault I dont know .. there is always a panic to get it
working

pThe customer is on the other side of the continent, but today she
emailed
the file to me and I had the same error trying to upload her file from
the
office the first time (i.e. same building as server). So that would seem
to
eliminate long-distance network latency/timeout as a factor.

pNothing I am aware of has changed since the last time it worked,
however
something may have changed in the network, or on the server, without
being
noticed.

Any advice would be appreciated

tomcat 5.5, jre 1.4.2, Red Hat Enterprise Linux ES release 4 (Nahant)
Kernel
2.6.9-5.ELsmp on an i686

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org







-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Retrieve User Role

2009-01-08 Thread Alan Chaney

Hi Ben

You can get it from the request. In JSP you can access the request 
implict object to get the value of the 
HttpServletRequest#getRemoteUser() method ...


Returns the login of the user making this request, if the user has been 
authenticated, or null if the user has not been authenticated.


(quote from j2ee docs for HttpServletRequest)

The exact syntax to use depends upon whether or not you are using EL.
If you are using tags..
% String username = request.getRemoteUser() %

and in EL you can use the 'pageContext'. Try:

${pageContext.request.remoteUser}   /// I think... you may need to check.

and use as you see fit...

Alan


Ben Tomlinson wrote:

I have set up login security for some of the pages in my website.  I
have a JDBCRealm setup and working correctly.  But now I want to
change the layout of my pages (all jsp pages) according to the user
that is logged in.  How do I retrieve information about the user that
is actually logged in?  Mainly I want the user role or the user name
but I can't seem to get it from the session.  Any help would be
appreciated.

Ben

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



!DSPAM:49667e4a164556657853550!



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Single WAR to update multiple contexts

2009-01-07 Thread Alan Chaney

Sean

Wouldn't it be easier to have ONE webapp and determine the database 
from, for example, the URL its invoked with?


Its a little difficult to know exactly how you are doing things but 
instead of having /ctx1 /ctx2 /ctx3 and mapping each one to ctx1.war
why not have a filter in your setup which determines that its invoked 
with /ctx1 and passes a parameter to the actual servlet which selects 
the database you require? You could have one web app as ROOT and do it

that way.

Maybe you could explain further why you need 200 separate versions where 
the only difference is the name of the database?


Regards

Alan Chaney


Sean W wrote:

Greetings!

I have a single war packaged application that needs to have about 200 unique
context paths running (200 copies of the application running - each uses a
different database based on the context name).

I know how to deploy 1 context at a time, but how can I do this so that if I
want to update all these contexts to the next version, I can update them
all at the same time easily?

Any suggests are much appreciated. Thanks!
-Sean W





-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Hints on upgrading from 6.0.14 to 6.0.18 on production server

2008-12-29 Thread Alan Chaney

Hi

I have a 6.0.14 running with Apr 1.1.10 and I seem to be seeing 
instances of CVE-2007-6286: Tomcat duplicate request processing 
vulnerability


(64-Bit Server VM (build 1.6.0_03-b05, mixed mode)
(Centos 5.0 - Linux 2.6.18-8.el5  x86_64 )


The obvious thing to do is to upgrade from 6.0.14 to 6.0.18. Firstly, 
are there any changes in server.xml and web.xml in 6.0.18 that mean I 
can't just use the existing ones in the new installation.


My current installation has $TOMCAT_HOME pointing to /usr/local/tomcat

My intended upgrade sequence is:

1. opy down 6.0.18 and untar it int /usr/local/tomcat18 (after checking 
signatures)


2. copy over the jars that I have placed in the old $TOMCAT_HOME/lib (eg 
postgres jdbc jar) to /usr/local/tomcat18/lib


3. copy over my webapp wars from $TOMCAT_HOME/webapps to the new webapps 
folder.


4. as I am using jsvc to control tomcat, copy over the 'tomcat' file 
from the $TOMCAT_HOME ('tomcat' is actually a shell script which sets up
all the environment variables for jsvc.) jsvc is in 
/usr/lib/tcnative/jsvc so it should be unaffected by the move. However

I do need to copy over the $TOMCAT_HOME/bin/commons-daemon.jar.

5. stop the old server and rename its directory to /usr/local/tomcat.old

6. rename the directory of the new server to that of the current the new 
server.


7. restart the server.


Am I missing anything? What have I overlooked? I need this to go as 
smoothly as possible as there is quite a lot of traffic on this site.


Thanks in advance

Alan Chaney


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Hints on upgrading from 6.0.14 to 6.0.18 on production server

2008-12-29 Thread Alan Chaney

Or stop using APR...

but that in itself is quite a lot of work as I'll have to reconfigure my 
SSL.


Hmm...



Gregor Schneider wrote:

If I'm not mistaken, the APR has caused the bug, and 6.0.16 contains a
new version of the APR. Since this usually comes as a source, you'll
have to re-compile the APR.

Cheers

Gregor


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Sudden and unexpected exception at Tomcat startup

2008-12-28 Thread Alan Chaney

Hi Andre

Tomcat DOES in fact rewrite the tomcat-users.xml file during startup. 
This has been mentioned on this list several times as being insecure but 
the general opinion is that you should not be using the 
MemoryUserDatabaseRealm in production.


Actually, I found that not only does it rewrite it, but it also uses the 
current umask so that it is quite likely that the file will become 
world-readable. You should probably do what the gurus suggest and switch 
to a more robust realm (eg JDBC etc)


Here are some suggestions you have probably already tried:


What are the permissions on the /svr/www/tomcat/base/conf folder?

Are you sure that the user that tomcat runs as can write to that folder?

Have you checked that tomcat is running as the user that you expect?

Is it possible that there is a filing system error or even a disk error?




Regards

Alan Chaney


André Warnier wrote:

Hi.

Does someone have an idea of what is going as per the logfile 
catalina.out below ?

What is this IOException all about ?

This is a Tomcat 5.0.x under Suse Enterprise Linux 10.1, which had been 
working fine until now and suddenly logs this at startup.

This Tomcat runs under an IBM JVM 1.5.

Tomcat is started, as per the listening ports and the ps display I can 
see, but apparently the access to Tomcat (through Apache and mod_jk) 
does not work anymore (tells me : The server is temporarily unable to 
service your request due to maintenance downtime or capacity problems. 
Please try again later. )



Additional info :
- the directory /srv/www/tomcat5/base/conf/ is writeable by the user 
tomcat under which Tomcat is started.
- To my knowledge, the server.xml has not been changed since the 
previous succesful restart 2 days ago, and neither has tomcat-users.xml



server.xml (excerpts) :
...
!-- Editable user database that can also be used by
 UserDatabaseRealm to authenticate users --
Resource name=UserDatabase auth=Container
  type=org.apache.catalina.UserDatabase
   description=User database that can be updated and saved
/Resource
ResourceParams name=UserDatabase
  parameter
namefactory/name
valueorg.apache.catalina.users.MemoryUserDatabaseFactory/value
  /parameter
  parameter
namepathname/name
valueconf/tomcat-users.xml/value
  /parameter
/ResourceParams
...
(further under Engine and Host :)

  Realm className=org.apache.catalina.realm.UserDatabaseRealm
 debug=0 resourceName=UserDatabase/
...



catalina.out :

2008-12-28 13:21:58,543 [main] INFO 
org.apache.catalina.core.StandardService - Starting service Catalina
2008-12-28 13:21:58,545 [main] INFO 
org.apache.catalina.core.StandardEngine - Starting Servlet Engine: 
Apache Tomcat/5.0
2008-12-28 13:21:58,548 [main] WARN  org.apache.naming.NamingContext - 
Unexpected exception resolving reference
java.io.IOException: IOException writing to 
/srv/www/tomcat5/base/conf/tomcat-users.xml.new
at 
org.apache.catalina.users.MemoryUserDatabase.save(MemoryUserDatabase.java:495) 

at 
org.apache.catalina.users.MemoryUserDatabaseFactory.getObjectInstance(MemoryUserDatabaseFactory.java:98) 

at 
org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:129) 

at 
javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:316)

at org.apache.naming.NamingContext.lookup(NamingContext.java:791)
at org.apache.naming.NamingContext.lookup(NamingContext.java:151)
at 
org.apache.catalina.realm.UserDatabaseRealm.start(UserDatabaseRealm.java:252) 

at 
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1075)
at 
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)
at 
org.apache.catalina.core.StandardService.start(StandardService.java:480)
at 
org.apache.catalina.core.StandardServer.start(StandardServer.java:2313)

at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79) 

at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 


at java.lang.reflect.Method.invoke(Method.java:618)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425)
javax.naming.NamingException: IOException writing to 
/srv/www/tomcat5/base/conf/tomcat-users.xml.new

at org.apache.naming.NamingContext.lookup(NamingContext.java:803)
at org.apache.naming.NamingContext.lookup(NamingContext.java:151)
at 
org.apache.catalina.realm.UserDatabaseRealm.start(UserDatabaseRealm.java:252) 

at 
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1075)
at 
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)
at 
org.apache.catalina.core.StandardService.start

Re: Setting /WebContent as ROOT for an application

2008-12-13 Thread Alan Chaney
In Eclipse, assuming you have the WTP tools installed, you create a 
'Dynamic Web Project.'

This has a folder structure of which the essence is:

MyApp
   src
  com
   mypackage
   Abc.java
   build
  com
 mypackage
Abc.class
 
   WebContent

  index.html (or jsp or whatever)
  WEB-INF
 web.xml
 lib
a.jar
b.jar

In the above com.mypackage.Abc.java is your web application, and a.jar 
and b.jar are any runtime libraries that application requires (NOT stuff 
already in $TOMCAT_HOME/lib)


When you compile and run applications within eclipse it copies the 
WebContent structure to the webapps directory of its (internal) tomcat, 
and in WEB-INF creates a folder called classes and copies the contents 
of the 'build' folder their.


This normally happens automatically every time you start the server 
inside eclipse.


When you want to deploy the project to an external instance of tomcat 
(eg a production server) you right-click on the Export.. option in the 
project context menu and then select WAR (there's a suprise). The war 
file by default has the project name (in the above expample MyApp.war. 
This should be copied to the webapps folder of the tomcat instance and 
if you've stuck to the normal server.xml configuration it should deploy. 
It will be available at http://the.tomcat.instance:8080/MyApp/index.html 
(or jspt or whatever)


This is an incredibly brief summary of what is undoubtedly an obscure 
and complex process for the new-comer (been there.. done that...) and 
which sadly is not especially well EXPLAINED anywhere that I have found. 
There are some 'cookbook' type recipes on the web, which are often 
inconsitent.


Hope that helps

Alan Chaney (a daily eclipse user, but hardly an eclipse guru...)










Markus Schönhaber wrote:

Tom Blank:

  

The reason why I'm asking is, because I'm using eclipse and its
'dynamic web project' structure.



I'm no Eclipse user either, but AFAIR the folder Webapps is part of an
Eclipse Dynamic Web Project. And a project folder is not meant to be
simply copied to Tomcat's appBase (judging from your OP, it seems to me
that's what you've been doing).

You could, for example, export your project to a WAR file and deploy this.
Experienced Eclipse users may know of other/better ways of deployment.
You might consider asking in the appropriate Eclipse mailinglist/newsgroup.

Regards
  mks

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



!DSPAM:4943f4d3100632009820482!

  



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Session replication for JPetStore application in tomcat 6

2008-11-18 Thread Alan Chaney

Anupam

I think this is probably your problem. You create and save information 
in one node and then look to see if it is in the other node. It will 
only be there if you are independently synchronizing the database state, 
because, as you said in your previous emails, they are independent. The 
database state is nothing to do with the http session, you must manage 
that separately.


2) Is it necessary to make the petstore database on each of nodes clustered
for session replication to happen ?

  

Regards

Alan Chaney


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

2008-11-12 Thread Alan Chaney


André

André Warnier wrote:


(and what is PermGen ?)


No one else seemed to answer this. PermGen is the chunk of memory which 
is allocated to the JVM in which to hold the 'prototypes' of the class 
files used. For a large web app with lots of classes (NOT object) it is 
common to have to radically increase this over the default (which, from 
memory, is 64M, to 192M or even 256M to taste.)


It is possible to write a Java web application in such a way that during 
application reload some of the PermGen is not released. This is what we 
call a 'bug' but it can be difficult and frustrating to locate.


Try Googling -XX:MaxPermSize for more details.

Regards

Alan





-
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 Master for PHP Hosting?

2008-09-25 Thread Alan Chaney

Its called a 'web service'.

Make your tomcat application a web service. Use a php application to 
invoke it. Distribute the php applications to the php servers.


The php application has a user interface and generates the invocation 
request (probably as an xml file). Your 'MASTER' does the business logic 
and generates a reply, either as an xml file which you can use XSLT in 
php to render or some other form.


If you really wanted to get sophisticated you could write a tomcat 
application that generated most/all of the php against some 
specification and style the displayed pages with css.


There are, of course, numerous standards and implementations for web 
services. You could also make it an AJAX app if you wanted to.


HTH

Alan


Johnny Kewl wrote:

Does anyone know if there is anything like this already...

What I need (want to do) is turn TC into a Virtual PHP hosting system...

This is the idea... one can layout a html/PHP site in tomcat...
Then point that at distributed servers out there, and use the remote 
links in JSP, servlets etc.


And it just happens... ie those Virtual Sites are deployed to remote 
httpd servers and it all just works.


Then there could be intelligent processing, like a form submitted to a 
remote PHP site is processed by tomcat... there will be bridges but I 
havnt got that all thought thru yet...


Then the idea is that from the company you run TC... its the brain... 
but it now can take advantage of all the cheap hosting PHP sites out 
there...


A kind of load sharing system... that can make use of dumbed down 
hosting sites...

And one develops on tomcat as if it was all right there on your machine...

The thing I'm after is making a kinda TC MASTER...

I dont know what others find, but locally if I talk to hosting services 
and mention Tomcat... I get a Oh, that will cost more... like its 
rocket science or something...


So I want to put tomcats brain into PHP without giving the brilliant 
admin dude a cranial embolism.


I think intelligence can actually be made very light... and the plebs 
can do the heavy lifting...
So in the end... the home site is the brain... running a whole worker 
population out there.


... Anyway thats the idea... does anyone know if there is anything like 
this already?

... TC as a PHP god... sort of thing.

Thanks

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



!DSPAM:48db8629255436657853550!



-
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: Server Maintenance Across Timezones (global)

2008-09-17 Thread Alan Chaney

Hi Bill

Yes, we have the same problem and I've been working on ways to improve 
the situation. Unfortunately, I don't think there is an easy or simple 
solution - a lot will depend upon your application.


As far as the database side of it goes it seems to me that much of it is 
a question of making the 'live-update' a design requirement for any 
upgrades. You have to make it possible for the changes to the database 
to 'co-exist' and then update the live database independently of the 
application. When the new tables are ready, deploy your new application 
and (hopefully) go home smiling.


We tend to create DDL changes as SQL scripts - test them out on the 
development systems and then run them on the live site. Some examples

make it easier to see what I mean.

A 'simple' change might be just adding an extra field with a static 
default. Obviously easy - you just run the script, it adds the extra 
field, the old app. doesn't have any knowledge of it. You make sure the 
script correctly initializes the field. When the update app runs its there.


A more complex change is where a new field is required that may need to 
be derived from existing data. Since this data may be changing on the 
fly, you have to ensure consistency. The best way I've found for this is 
to create an 'update' transaction in your ORM code (or whatever you are 
using) that detects that the DDL state has changed and then runs an ACID 
initialization of the new field.


Once again, the testing of this update is a key part of your release 
testing strategy.


As for tomcat itself its rather going to depend whether you run 
clustered or not.


One method that I've used on unclustered systems is to configure the new 
system on a server instance on a different IP address on a system 
fronted by httpd, set up some redirects in httpd and just, as it were, 
'hup' from the old instance to the new instance.


This requires a DNS change, but any 'old' requests to the old server are 
redirected to the new server. After about 48 hours you should be able to 
shut down the old server.


However, we were able to catch an 'idle' period - you may not be able to 
do that and you'd have to ensure that any sessions active on the old 
server were correctly propagated to the new server.


I'd be interested to hear from people who have clustered solutions. Once 
again I suspect there may be problems with trying to sustain sessions 
across the upgrades.


Regards

Alan Chaney



Bill Davidson wrote:

My company's main webapp is used around the world (Europe, North America,
Australia, etc.).

We're using Tomcat as our app server and Oracle (10g) for our database.

When we want to do an upgrade, that usually involves DDL changes to the
database as well as corresponding changes to the webapp which means we
have to make our users log out so we can shut down the app, update the
DDL and restart the updated webapp.  The changes are interdependent.
It's all or nothing.

This was not a big problem when we were just doing business in the U.S.
We'd do upgrades late at night when nobody (or hardly anyone) was using
the system.  The problem now is that late at night here is middle of
the day in other places and downtime in the middle of the day is a real
problem.  Our customers use our app to run parts of their business so
downtime in the middle of the day is very very bad.  They understandably
don't like telling their customers: I'd like to help you but I need to
wait for the Americans to upgrade their systems.

I'm not sure how to deal with this.  I've been trying to think of a way
to use multiple servers and multiple databases but that seems like a
synchronization nightmare.  Losing data consistency is not an option.

I'm sure that plenty of others on this list have had to deal with this
problem.  Any suggestions?  How have others dealt with it?



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



!DSPAM:48d172ca19921381456296!



-
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: Intgrate Tomcat and PHP in winxp

2008-08-18 Thread Alan Chaney

Radhakrishna

The main issue here is that it is probably not worth doing. You would 
probably be better off investigating tuning apache and php. I assume 
that your existing installation uses mod_php? If so, the php and apache 
lists may be of help. httpd can be extensively tuned for memory 
footprint and performance.


Tomcat is a java application server. The cgi access method is a 
convenience for working with other types of application (non-java). If 
you use the cgi approach you will:


1. create an entirely new process for each request (very time consuming 
in both memory and cpu cycles)


2. be open to more security vulnerabilities. See 
http://www.php.net/manual/en/security.cgi-bin.php


Unless your server is serving predominantly java applications with a few 
 PHP apps your proposed approach will be slower, not faster, and more 
difficult to maintain.


As far as doing it 'step by step', IMHO this is an 'advanced' task and 
you should not be undertaking it until you fully understand all the 
implications for performance and security. As Tommy suggests, read and 
understand the documentation first.


Regards

Alan Chaney


Radhakrishnavangara wrote:

Hi Tommy,

That was really informative. But let me explain you the actual scenario. I
am using an application called phpESP ( a survey tool developed in PHP) and
running on Apache httpd. The application is running fine, but it is
consuming lot of memory space in the server. So we have decided to move the
application and deploy on a lighter application server. That's the reason we
have decided to deploy on Tomcat. So could you please let me know your
opinion on the same. 


Also i am a beginner to PHP and Tomcat. Also i have spend lot of time on
this and now i have to some how finish this task. Offline i will take your
guidance on understanding this technology. For now could you please explain
us with the step by step instruction on how to finish the same task.







Regards,
Radhakrishna





Tommy Pham wrote:

Hi Radhakrishna,

--- On Sun, 8/17/08, Radhakrishnavangara [EMAIL PROTECTED]
wrote:


From: Radhakrishnavangara [EMAIL PROTECTED]
Subject: Intgrate Tomcat and PHP in winxp
To: users@tomcat.apache.org
Date: Sunday, August 17, 2008, 3:24 PM
Hi,

Could you please let me know the step by step instructions
for integrating
Tomcat with PHP on Win XP. I have tried implementing
various methodologies
to integrate the same , but i could not achieve any
breakthrough on the
same. Below are some of the links to the articles which i
have referred.
Could you please go through the same and clarify me on this
issue. 


http://www.windowscomputer.com/node/3814
http://www.theasolutions.com/tutorials/tomcatphp.jsp
http://the-double-0-project.net/blog/?tag=tomcat
http://209.85.175.104/search?q=cache:szlV41sb9qwJ:uranus.im.chu.edu.tw/~dtchang/phpexplorer/html/download.php%3Ffn%3D..%252F..%252Fpub%252F.%252Fdownload%252Fapache_tomcat%252FRunning%2Bphp%2B5.x%2Bon%2Bwindows%2Busing%2Btomcat%2B4.x%2Bor%2B5.x%2B-%2BSimple%2BThoughts%2B-%2BJava%2Band%2BWeb%2BSoftware.pdf+angusman+tomcathl=enct=clnkcd=7gl=in
http://www.duminy.fr/blog/?p=22language=en

Thanks and Regards,
Radhakrishna
--
View this message in context:
http://www.nabble.com/Intgrate-Tomcat-and-PHP-in-winxp-tp19022523p19022523.html
Sent from the Tomcat - User mailing list archive at
Nabble.com.


IMO if you want to use PHP with Tomcat, it's best you read the
documentation for both products and their technology as it will help you
secure the server/platform and troubleshoot any problems that may arise
including application crashes and security breaches.
For PHP5: http://www.php.net/manual/en/
For Tomcat6: http://tomcat.apache.org/tomcat-6.0-doc/index.html
For Tomcat5.5: http://tomcat.apache.org/tomcat-5.5-doc/index.html

You can just go through the installation steps w/o doing the actual
installation to see what you have available.  Though I haven't tried this
method, I think you can run PHP as CGI in Tomcat.  You'll just have to
edit the web.xml in $CATALINA_HOME/conf folder and follow PHP's
instruction of installing as CGI.

The method I prefer and have tested to work (in Unix environment although
on Windows should be similar) is running Apache HTTPD server with PHP as a
mod and use the connector to connect to Tomcat.  If this method is used,
it's easier to implement other technologies later such Perl, Python and
Mono (for .Net) inside Apache HTTPD as mod-*.

But you may want to evaluate your needs and goals before choosing ;)

Regards,
Tommy

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



Re: Committing sendRedirect()

2008-07-29 Thread Alan Chaney

Tore

Your code below is written as though the 'out' was like writing data to 
a console. The processing in a servlet is part of a  request/response 
cycle, where the 'request' tells it what to do and the response is the 
reply.


Because of the nature of the request/response cycle you only get one 
chance at the reply. The javadocs for HttpServletResponse.sendRedirect 
make this clear.


If the response has already been committed, this method throws an 
IllegalStateException. After using this method the response should be 
considered to be committed and should not be written to.


In other words, in one servlet request/response cycle you get exactly 
one chance to issue a 'sendRedirect'. If you think this through you'll 
see that this is how it has to be:


Browser sends request to servlet
Servlet process request and sendsRedirect
Browser display response.

Your problem is that you are trying to generate a second response 
without a correspondng request. The first response is for the 'top 25' 
and the second is for 'all the rest', but by then you've already 
committed the response.


To achieve what I think you are trying to achieve would require you to 
create some mechanism where the lucene query results are processed in a 
separate thread and your application makes TWO requests - one for the 
first set of results and then one for the final set of results.


There are far too many different ways to do this to detail here - I hope 
this helps


Regards

Alan Chaney



Tore Eriksson wrote:

Hi everybody,

I have a problem with redirects in Tomcat 5.5.25. I am doing a Lucene
search and would like to send a redirect after finding the top 25 hits,
commit this response, and then continue processing the remaining hits.
The relevant parts of the doPost() code are as below:

final int PARTIAL_HITS = 25;

for (int i = 0; i  hits.length(); i++) {

  Document doc = hits.doc(i);
  String citation = doc.get(citation);

  /** Insert into table */
  try {
insertId.setInt(1, java.lang.Integer.parseInt(citation));
insertId.executeUpdate();
  }
  catch (SQLException e) {
out.sendError(500, Bad SQL insert:  + e);
  }
  catch (Exception e) {}

  if (i == PARTIAL_HITS) {
// Intermittant redirect
out.sendRedirect(resultUrl);
  }
}

insertId.close();

if (!out.isCommitted()) {
  // Final redirect
  out.sendRedirect(resultUrl);
}

My problem is that the intermittant redirect is not committed until the
function returns, which will take quite some time for some queries. I
have tried HttpServletResponse.flushBuffer() and other possible
variations. Any pointers would be most appreciated.

Tore
___
Tore Eriksson [tore.eriksson ad po.rd.taisho.co.jp]



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



!DSPAM:488e7ade203691909011899!



-
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: The type . . . is not visible

2008-05-23 Thread Alan Chaney
Er... shouldn't you be making K00, GenK00 and its constructor public? 
They will only be visible to classes in .../test/k00


As to tc loading generic classes - works fine for me on Java 5 and Java 6


Regards

Alan



Albretch Mueller wrote:

 Hi

 I need to check if the tc classloaders are able to load/reload generic classes.

 So I created two sample classes in /webapps/ROOT/WEB-INF/classes/test/k00:

package test.k00;

class K00{
 public int i0;
 public long l0;
}

 and

package test.k00;

import java.util.*;

// __
class GenK00{
 private String aS;
 public ArrayListK00 ALK00;
// __
 GenK00(String aS){
  this.aS = aS;
  ALK00 = new ArrayListK00();
 }
}

 which as you can see are in package test.k00

 Then I simply rearrange the welcome-file-list so that index.jsp is
loaded first and included some test code right before theline If
you're seeing this page ...

  p
Loading Generic classes:br/
[EMAIL PROTECTED] import=test.k00.*%
%
 K00 k0 = new K00();
 k0.i0 = 0;
 k0.l0 = 0L;
%
  /p

 However I am getting The type K00 is not visible kinds of errors

 How can I fix this error and make tc load the classes?

 Once the classes are loaded, would tc reload them if K00 is changed to, say:

class K00{
 public int i0;
 public String aS0;
}

 after you recompile it, or if a new class is dropped in this
directory, would tc load it?

 Thanks
 lbrtchx

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



!DSPAM:4836bd74309611909011899!



-
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: The type . . . is not visible

2008-05-23 Thread Alan Chaney

Chris

Actually if you look at the link the OP provided you can see where he 
was coming from/ going to... (sort of)



http://groups.google.com/group/comp.lang.java.programmer/browse_thread/thread/d739a953735e0beb/62a82237e403ab76?lnk=raot


He seems to be doing an experiment to try and do something that is much 
more easily done in many other ways. I think from reading the comments 
on the list he is a little confused as to what 'generics' actually are 
in Java. I think the tomcat aspect of it appears to be that he thinks 
that tomcat can't handle 'generic' classes. I don't know why.


Albrecht

Is your background in C++? You appear to be considering that generics 
are similar to templates in C++. They are not. They are simply a compile 
time convention in Java 5 and later to improve java's handling of typing 
  when using classes in a polymorphic way. As mentioned in the thread 
as above, compiled bytecode has no knowledge of the original generics. 
For further information I suggest that you read the Java Language 
Specification and the Java Virtual Machine spec both available on the 
Sun website.


The JSP compiler in tomcat 5.5 and later supports generic classes 
because it supports Java 5.



Regards

Alan



Christopher Schultz wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Alan,

Alan Chaney wrote:
| Er... shouldn't you be making K00, GenK00 and its constructor public?

...and maybe also importing them into the JSP? JSPs are not in a
package -- at least not a predictable one, so you need to import your
classes using the @page import=... @ directive.

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkg3IdgACgkQ9CaO5/Lv0PC6BgCfdoyd7YnCXxbTUdYbX6nZSB9P
DCkAmwUrSFpt/gtrKeHUgD6DftRvATs5
=wkSp
-END PGP SIGNATURE-

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



!DSPAM:483722cc60361572928584!



-
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: How to increase tomcat memory

2008-05-19 Thread Alan Chaney

You seem to be using linux. If you go:

ps alx | grep java

after you have started tomcat you should be able to find the invocation 
for tomcat. Please check to see whether or not the options you have 
specified below appear in that list and check very carefully that there 
is whitespace around the options. I would look for two things were I 
debugging this:


1. The option isn't being included in the tomcat java invocation

2. The option is corrupted (misspelt, incorrect spacing etc).

HTH

Alan Chaney


Tomás Tormo wrote:

Hi

   here it comes my question again... :D How to increase tomcat memory? 
I'm getting GC overhead limit exceeded.


I tried putting export JAVA_OPTS=-Xms256m -Xmx512m in setclasspath.sh 
file as well as putting CATALINA_OPTS=-server -Xms256m -Xmx512m in 
/etc/init.d/tomcat5.5 script file, but when I go to tomcat 
administration webpage and list the server status I always get Max 
memory: 113.81 MB.


Thank you very much



-
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: Redirect request to another Tomcat server

2008-05-15 Thread Alan Chaney

Liang

I don't understand what NIO has to do with it. The 
response.sendRedirect() is part of the servlet spec and what type 
connector you are using in Tomcat should have no effect on this. I'd 
appreciate it if someone would correct me here if I am wrong. As a 
matter of interest I use redirects extensively on tomcats with NIO, APR 
and the standard  connector and they all work ok.



As Johnny K correctly observed and as its name implies it sends a 
'redirect' 302 response to the browser. As also observed the 'session' 
is a UNIQUE relationship between the server and the browser. I think it 
would be helpful if the you actually clarified exactly the purpose of 
redirecting from one tomcat instance to another.


On another point from the your earlier message you talk of a 'refused 
session' being the reason for a redirect. AFAIKS a 'refused session' is 
no session at all. Maybe a better way of putting it is refusing to start 
a new session? Sending a redirect would allow a session to be created 
between the browser and the 2nd server. But it does sound suspiciously 
like load balancing to me... and of course there is the issue of making 
sessions sticky. So I would agree with Johnny and others as below, use 
something like mod_jk and a cluster.




Regards

Alan Chaney



Johnny Kewl wrote:

Liang,

I think whats bothering all of us, is that sometimes the concept itself 
is going wrong, and that what I think the other guys are asking.
As you can see, you now getting into cookie management and all that 
heavy stuff, and eventually maybe suicide ;)


If its load sharing, maybe think about putting it behind Apache and 
using a JK connector. I'm not sure if there or NIO issues there, maybe 
the other guys can comment... but if something like that is possible, 
then your servlets are standard and JK is watching sessions and doing 
all that for you.

Just a thought..

--- 


HARBOR: http://coolharbor.100free.com/index.htm
The most powerful application server on earth.
The only real POJO Application Server.

Only appearing once now in emails ;)
--- 




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



!DSPAM:482c8ec0298441572928584!



-
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: Streaming Video Media

2008-05-12 Thread Alan Chaney
My understanding is that you want your users to be able to *view* a 
streaming file but not download it to their file system?


Unfortunately there is no way to absolutely prevent this happening, 
because the data of the file MUST be transferred from the server to the 
browser to allow the end user to watch it.


There is no mechanism in tomcat or any other web server which can 
control what the user does with data when they have acutally got it in 
their browser.


The best thing that you can do is to try and avoid having the download 
link actually appear in the web page. This can be done by for example 
having a Flash player to play the video and writing ActionScript to make 
a specific request to your server using some kind of obfuscated URL. Of 
course, this mechanism will not stop someone with any understanding of 
HTTP and HTML from discovering the correct URL to use, but it will stop 
people just casually right-clicking on a link and downloading it.


The only other alternative is to employ some kind of DRM system, but I 
guess you don't want to go that way.


HTH

Alan Chaney



bperquku wrote:

thank you for your reply,
Actually my webapp uses a db authentication, but even registered users will
not have to download videos, only to see them.

thnx.



Александър Л. Димитров wrote:
Hi, 


Quoth bperquku:

Hi,
I installed Tomcat 6.0. I have sample webapp that streams's video
content.
Is it possible somke how to protect video from downloading

Simplest suggestion: why don't you just let the webapp authenticate the
user
against some user DB? If security isn't a concern there are even simpler
methods
(like, md5-hash the password and store it locally).
Query for it with a JS input dialog or an http form. If it's supposed to
be very
secure, use SSL on top.

Aleks

 





-
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: Multiple Hits to same JSP

2008-05-12 Thread Alan Chaney
If you have an apache server fronting this there are IP address 
controlled rate-limiting plug-ins like:


http://www.topology.org/src/bwshare/README.html

and

http://dominia.org/djao/limitipconn2.html

I have no experience of either of these.

HTH





Sameer Naik wrote:

We just had one more incident today, 3000 hits total in 5 minutes! User agent 
in MSIE 7.0. We have a load balancer and 3 apache servers behind it. Since 
Apache is logging the request in access, for sure, it is not generating flood 
itself. Then the culprit could be load balancer hardware, user's buggy browser 
or some proxy server in between.

From the access logs, the request seems to be coming from genuine users. User's 
are either closing there browsers (no hits for some period) or logging out and 
trying again. The same page works fine when they do that.

We are analyzing logs to come up with a pattern w.r.t. user agent.

We cannot pat ourselves for serving so many requests, because every such time, 
tomcat thread count (set to 100) maxes out (we get a page), each thread borrows 
DB connection from pool, DB cache size goes to 100 and due to a bug/feature in 
Oracle connection (round robin feature for checking out connection), each one 
never gets cleaned up. so that increases sessions on oracle database server.




had a similar experience when I run the FireBug extension in FireFox. 
but there was not as many as 500 requests more like 20 under some 
circumstances. 
/Per Jonsson 
Christopher Schultz skrev: 
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1 
Alan, 
Alan Chaney wrote:
| Have you checked to see whether or not they are real requests - that 
is,
| coming from the web. If they are there's nothing anyone on this list 
can
| do... 
Not entirely. It's possible to write a throttling filter that might be

able to reject some of these requests... the only question is if it is
even useful to do in the first place. The processing and memory
requirements might outweigh the benefits of rejecting the requests in
the first place. 
Since all responses are 200 (success), you might just smile, say hey,

it's great that my web server can handle so many responses so fast with
no errors and sit back and relax. 
- -chris 



- Original Message 
From: Sameer Naik [EMAIL PROTECTED]
To: users@tomcat.apache.org
Sent: Friday, May 9, 2008 2:07:30 PM
Subject: Multiple Hits to same JSP


Hi,

We are using Apache 2.0.53 + mod_jk 1.2.21 + tomcat 5.0.28 combination and 
seeing multiple hits to a single JSP file in quick succession, like 500 hits in 
a minute from same user ID and same IP address. Response code is 200 for all 
the requests. It is happening randomly from various user agents. Did anyone 
encounter such scenario? Can we log something in Apache logs to debug the 
issue? (We are already logging referrer, UA, byte range request values etc).

Thanks,
Sameer


Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile. Try it now.



  

Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ


!DSPAM:4828b47c210943033718476!



-
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: Multiple Hits to same JSP

2008-05-09 Thread Alan Chaney
Have you checked to see whether or not they are real requests - that is, 
coming from the web. If they are there's nothing anyone on this list can 
do...


Try monitoring you network with something like wireshark.

I have seen similar behavior - I think it may be from badly written 
spiders or feeble attempts to hack your site. If they are truly 
vindictive the only thing you can do is block them with a firewall.


Regards

Alan Chaney


Sameer Naik wrote:

Hi,

We are using Apache 2.0.53 + mod_jk 1.2.21 + tomcat 5.0.28 combination and 
seeing multiple hits to a single JSP file in quick succession, like 500 hits in 
a minute from same user ID and same IP address. Response code is 200 for all 
the requests. It is happening randomly from various user agents. Did anyone 
encounter such scenario? Can we log something in Apache logs to debug the 
issue? (We are already logging referrer, UA, byte range request values etc).

Thanks,
Sameer



  

Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ


!DSPAM:4824bdee28727785049143!



-
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 problem on a multiple CPU system

2008-05-04 Thread Alan Chaney

Hi Antoine

The thing to remember is that this is a system which has (at least) four 
main parts:


1. Tomcat
2. The operating system
3. A network connection
4. Your application

(and potentially)

5. A database (but you didn't mention that)

Here are some questions.

1. How do you make the connection to the servlet. Does the browser run 
on the same machine as the application?


2. Does you application create network traffic? If so, how many bytes 
are transferred to the browser? Each servlet thread will have to wait 
until the application has transferred all the data out.


3. What kind of disk activity does your application generate? Is it 
different when the app is running from the servlet?


Probably somewhere your servlet threads are sleeping waiting for a 
resource. You could do a thread dump to see what is happening (I don't 
use Windows so I can't remember how you do that with the Win setup)


In the end, you'll need to profile the system to work out where the 
bottlenecks are. You'll need to use network analysers and probably Java 
profilers to track down what's happening such as when packets are 
received, when the replies are generated and maybe profile what your 
app. is doing.


HTH

Alan Chaney




Gilbert, Antoine wrote:

Hi

 


I have a 2x quad core (8 cpu units) server.

 


If I start a java program and this one is launching (at the same time) 8
thread doing some CPU intensive jobs, all the CPU are used at 100%, and
that's what I'm expecting..

 


But, if I am using tomcat, and I call a servlet 8 times to process these
8 jobs, it take longer to execute these same 8 jobs and all the CPU are
not used at 100%, it's more like 30%...

 


Any idea about this problem or behavior ? I'm using Tomcat 5.5.17,
windows, JDK 1.6

 


Antoine



!DSPAM:481e1bf27941527717022!



-
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: MaxThreads - max. users ?

2008-04-30 Thread Alan Chaney

Like most things in complex network apps there is no simple answer.

MaxThreads refers to the number of simultaneous open HTTP network 
connections there can be. A connection is opened to enable the HTTP 
request response cycle (request from browser - server, response from 
server- browsers). This does not exactly translate into users because 
depending upon the page it is possible for the browser to make multiple 
simultaneous requests (images, text, javascript, css etc) for the same 
browser page.


'Sessions' in web server parlance refers to the ability whereby the 
server can track the state of a 'user conversation' which may spread 
across many pages. The identification of the user must be saved 
throughout this session if there are authentication issues involved - 
private pages, secure forms etc.


There is no direct relationship between the number of sessions and the 
number of active, open connections.


When estimating the capacity of a server you must work out the average 
page response time and then that will give you the number of users/hour.


The only real way that you can really determine the performance of a 
server is to measure it - there are simply too many interacations at a 
system level to make sense of any simple calculations.


A server set to handle 200 max connections with a response time of 200ms
can probably handle around about 1000 connections a second.

Factors to consider:

1. what kind of application? Simple file access or complex database?
2. the need for failover (clustering etc)
3. what kind of user interaction? (forms, simple page browsing?)


It should be noted that client interactions using 'ajax' techniques 
where the browser reconnects mid-page can actually cause a significant 
increase in server traffic. Once again, the only way to know is to 
experiment.


HTH

Alan Chaney






Stephanie Wullbieter wrote:

Hello,

on 
http://tomcat.apache.org/tomcat-5.5-doc/config/http.html


is for parameter MaxThreads written:

The maximum number of request processing threads to be created by this Connector, 
which therefore determines the maximum number of simultaneous requests that can be 
handled. If not specified, this attribute is set to 200.

Could You please tell me what exact a request is?

Does it mean that when I have e.g. MaxThreads=20, 100 users can use my webapp 
if only 20 of them at the same time request data from the webapp and the others 
drink coffee?

Is it the same when i have session based sso login?

Thank You kindly


-
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: R: How to close idle connections

2008-04-28 Thread Alan Chaney



David Smith wrote:



No, I have at most 20 idle connections, that's goes right, but my boss 
want

less idle connections to avoid to overload the database server. So there
isn't way to close an idle connection to remove the relative process?
If so, I will set maxIdle=2 and everyone will be happy (expecially 
me :)
 




I'll bet money the added, idle postgres connections are just sleeping 
while they wait for work.  Given idle connections contribute virtually 
no additional load, don't see his argument that idle connections 
contribute to a database overload.  If the minor increase in overhead 
due to sleeping threads actually overloads the database, you need to let 
your boss know the server hardware is way too frail for production use 
and needs to be upgraded.

--David

Agreed. I use postgres and with ps alx | grep postgres each connection 
shows as idle (when its not being used!) and consumes about 140k bytes 
of memory. On a modern server that can hardly be considered as any use 
at all!



Alan Chaney





Enrico Sasdelli wrote:


Thanks for reply,

 

I see you have maxIdle=20.  Do you have more that 20 connections 
sitting idle?  Is this really that much of a concern?  As long as the 
connections are released (closed) and returned to the pool, I don't 
see the problem.
  


No, I have at most 20 idle connections, that's goes right, but my boss 
want

less idle connections to avoid to overload the database server. So there
isn't way to close an idle connection to remove the relative process?
If so, I will set maxIdle=2 and everyone will be happy (expecially 
me :)



Thank you,
Enrico


 

The entire idea of a connection pool is the system keeps around a set 
of idle connections for borrow.  When you code get's a connection, it 
comes   
from the pool of idle connections and returned when you close the 
 

connection.  This speeds up your application by elliminating the 
overhead of contacting the server and constructing a new connection 
whenever you call for one.  The pool just grabs a pre-made one off 
the shelf for you.
  


 


--David
  


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



!DSPAM:4815ddca16721381456296!



-
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: R: How to close idle connections

2008-04-28 Thread Alan Chaney



Christopher Schultz wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

David,

David Smith wrote:
| I'll bet money the added, idle postgres connections are just sleeping
| while they wait for work.  Given idle connections contribute virtually
| no additional load, don't see his argument that idle connections
| contribute to a database overload.  If the minor increase in overhead
| due to sleeping threads actually overloads the database, you need to let
| your boss know the server hardware is way too frail for production use
| and needs to be upgraded.

It could be a memory issue, and perhaps with lots of connections from
different machines (maybe a clustered application and a single database
instance)... lots of connections == lots of memory allocated on the
server, even when the connections are idle.

- -chris


Chris,

but as in many resource allocation issues, its not the quiescent count 
that's important. If the OP has a *maximum* requirement for N x 100 
connections then its unlikely that the system could be so constrained as 
to worry about the limited number of idle connections. In other words, 
if you've allocated enough resource for the maximum expected load, then 
any less load should be easily accomadated. If you haven't you've 
probably got a problem...



Regards

Alan





-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkgWGZcACgkQ9CaO5/Lv0PCVVgCgiQHs4I8xJfbupkGXUHEBLgci
qmQAn3yNwIsnO4jzF/GobTZyzXp8fe17
=ma/c
-END PGP SIGNATURE-

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



!DSPAM:48161a6671411738514357!



-
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: Response time

2008-04-23 Thread Alan Chaney
One a similar vein, exactly how do you connect firefox to the server? 
Directly, or via some kind of network connection. If its a network, 
what's the bandwidth?


Alan Chaney


Christopher Schultz wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Bruno,

Bruno Matos wrote:
| I'm getting documents from lucene and creating a string with all the
| results with string buffer. The string creation takes 2 seconds and the
|
| outResponse.print(out.toString());
|
| takes 1 second. Closing the writer take no time at all, although I have
| to wait 2 minutes until the result shows in firefox. The same happens
| with solr, that should make something like that. The xml file, only has
| 300KB. Why I need to wait for so long?

Have you tried saving the 300kb XML file and then loading it off the
disk just to see how long the browser takes to render it? Perhaps it's
all on the client side...

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkgPX7YACgkQ9CaO5/Lv0PCBgACgjQG0lVaGNCWWNSXcmSXXxXUF
AS8AoLSBsz6vGtH6zfALFvI5W3GGgtwR
=2WzS
-END PGP SIGNATURE-

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



!DSPAM:480f6080289839080218370!



-
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: Response time

2008-04-23 Thread Alan Chaney
I do a lot of downloads of large files (several 10's of MB). Firefox 
seems to limit its transfer rate to about 100 kbps (that is, kilobits 
per sec). If you are using linux, try doing a 'wget' on the file instead 
of using a browser.


300,000 bytes is 2,400,000 bits (approx) so to take 2 minutes = 120 secs
implies a bit rate of 10,000 bits per sec. I don't for a moment believe 
that is a limitation of tomcat (I regularly stream continuously 40 
MBitsPerSec with hardly any CPU)


Here are various random thoughts:

1. Some kind of timeout (maybe DNS?)

2. Swapping (you say CPU = 100% what about memory usage?)

3. Some kind of lock contention.

HTH



Bruno Matos wrote:

Hello,

Tank you every one.

I connect to localhost and my CPU stays in 100% all the time.

Open directly the xml file take no time at all.

Alan Chaney wrote:
One a similar vein, exactly how do you connect firefox to the server? 
Directly, or via some kind of network connection. If its a network, 
what's the bandwidth?


Alan Chaney


Christopher Schultz wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Bruno,

Bruno Matos wrote:
| I'm getting documents from lucene and creating a string with all the
| results with string buffer. The string creation takes 2 seconds and 
the

|
| outResponse.print(out.toString());
|
| takes 1 second. Closing the writer take no time at all, although I 
have

| to wait 2 minutes until the result shows in firefox. The same happens
| with solr, that should make something like that. The xml file, only 
has

| 300KB. Why I need to wait for so long?

Have you tried saving the 300kb XML file and then loading it off the
disk just to see how long the browser takes to render it? Perhaps it's
all on the client side...

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkgPX7YACgkQ9CaO5/Lv0PCBgACgjQG0lVaGNCWWNSXcmSXXxXUF
AS8AoLSBsz6vGtH6zfALFvI5W3GGgtwR
=2WzS
-END PGP SIGNATURE-

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








-
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 is not rendering JSP content on Port 80

2008-04-22 Thread Alan Chaney



BeasC wrote:

My intent is to have an Apache + JK + Tomcat server that uses apache only to
service static web content and and sends all dynamic content to Tomcat (so
that it handles all the JSP).  I downloaded and installed Apache 2.2, Tomcat
6.0, and J2SE 1.5 (Becuase j2se 1.6 was buggy and giving problems).  When
initially configuring the server, I included the following lines in the
Apache HTTPD.conf file:

LoadModule jk_module modules/mod_jk-1.2.26-httpd-2.2.4.so



Apache 2.2 comes with mod_proxy as default. Either way, you must also 
configure apache to use either mod_jk or mod_proxy.


You are trying to do this by using the 'auto config' mechanism in tomcat.


and in Tomcat I included:

Listener className=org.apache.jk.config.ApacheConfig
 modJK=c:/apache/modules/mod_jk-1.2.26-httpd-2.2.4.so /

and

Listener className=org.apache.jk.config.ApacheConfig append=true
 forwardAll=false
 modJK=c:/apache/modules/mod_jk-1.2.26-httpd-2.2.4.so /

I personally have never used this and in the installations which I have 
with Apache 2.2. I use mod_proxy so others may be able to help you more 
here, but I still think that your problem is that your attempt to 
service static documents with apache is overlapping with your attempts 
to serve dynamic information from tomcat.


Have you checked that the workers.properties file is being created 
correctly? What does it have in it?


You have explicitly set forwardAll to false, which is OK, but it also 
means that you must configure apache NOT to look at the same folders 
that you are using for tomcat. See the comment about noRoot and 
forwardAll in the javadocs.


Warning: When false, some configuration in the web.xml may not be 
duplicated in Apache. Review the mod_jk conf file to see what 
configuration is actually being set in Apache.


It would help if you could give us your folder layout and how you
expect that to map to your url structure.





Basing most of the tutorials I have read about setting up this type of
servers, I thought this steps were sufficient to enable the server to work
in the above descirbed way.  It appears, however, that I am missing
something...  

Trouble with tutorials is that they are mainly created by people in 
their spare time and they can't possibly cover every variation and 
condition in a world where individual components of a project are 
released on their own timescales and to meet their own objectives. I 
always seem to find something doesn't quite work right when I try to do 
it by rote from a tutorial and I end up debugging it myself, just using 
the tutorial as a guide.




-Carl
 


Alan Chaney wrote:
The effect you are observing is because you have configured your setup 
to have the jsp files in the path of the document root for apache. 
Apache knows nothing about jsp files so it is just returning the source 
to you.


You have not specified O/S, JVM or Apache or Tomcat version.

You might like to read the tomcat documentation before going any further:

http://tomcat.apache.org/connectors-doc/ajp/ajpv13a.html

would be a good place to start if you intend to use apache + tomcat, 
together with


http://tomcat.apache.org/tomcat-6.0-doc/connectors.html

if you want to configure your version of tomcat to directly serve port 
80 and not use apache at all.


A 'tomcat only' installation working with port 80 can easily be 
configured in Windows using the control panel (or so I believe as I 
don't use Windows myself). For a linux setup there are some additional 
complications - see:


http://commons.apache.org/daemon/index.html

to avoid running tomcat as root.

Also you may find looking at archives of this list helpful.


If you can't find the answers in the above and generally,

http://tomcat.apache.org/connectors-doc/index.html

then maybe you could specify your system more clearly and I'm sure 
people will be able to give you more specific help.



Alan Chaney









BeasC wrote:

I can get Tomcat to render JSP content if I try to (for example) access
the
JSP installation examples using http://localhost:8080/examples/jsp  But
when
I try to try http://localhost/examples/jsp I get nothing but the raw html
code of the page (of a specific example).
I have an Apache - Tomcat server, and Apache is listening on port 80
(Which
is the default port used when accessing the server using its IP address.
Tomcat has the following code lines in its server.xml file, that I think
might serve as reference point to what I'm talking about:

Server port=8005 shutdown=SHUTDOWN

and

Connector port=8080 protocol=HTTP/1.1 
   connectionTimeout=2 
   redirectPort=8443 / 


Any help would be greatly appreciated.

-Carl

-
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

Re: Bending Jasper to My Will

2008-04-22 Thread Alan Chaney

Andy

I've followed this thread with a some interest because it ties up with 
some things I've done in the past. I think you are trying to use a 
technology in an inappropriate way to solve the wrong problem.


Correct me if I am wrong but you want to have a level of configuration 
which is more than just appearance.


You want to:

1. be able to add/remove features from a particular page
2. be able to reorder features

Is that correct?

The next thing which isn't clear to me is at who will choose the feature 
set. Is this going to be a runtime thing or a startup configuration 
thing? Will your end-users be able to configure things or will it be the 
result of specific programming work?


Alan Chaney



Andy Clark wrote:

Lucas wrote:
  To answer the original question, there is a 

  mechanism that Tomcat provides to handle the
  specific thing you want to achieve. The solution
  is very Tomcat specific, so I do not really
  recommend it, anyhow, if you really _need_to_have
  _this_ then the way to achieve it is the following:


[...]


Thanks for the suggestion but I think I am out
of luck because we're using a different web
container. Even though there's a ton of different
web containers, they all seem to use Jasper so
that's where I was attempting to tackle the
problem.

But, referring to your specific suggestion, I
wonder if there would be a problem. When I was
browsing the Jasper source, I noticed that it
caches the resolved JSP/tag files. Which means
that if I only change the resolution mechanism,
it won't work. Because unless I am also able to
modify the cache ID, then whichever source file
is resolved first for a specific JSP/tag, then
that one will be cached and be returned the next
time it's referenced, even if the user's skin is
different. (If that makes any sense.)


PS: This will make yous web app not 100% standard,

  and if you have to migrate this behavior to other
  web containers, it might get trickier, so be sure
  that you really need this.

Understood. Which is also why I'm hoping that
the Jasper developers would be open to patches
that allow it to be extended in this way.


Ahh, just one more thing, do not even try to

  modify Jasper itself unless you know what you
  are doing; Most people experimenting with

Jasper end up in nothing.


That way leads madness. Got it. :)

-AndyC

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



!DSPAM:480e21ea50971721312192!



-
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 is not rendering JSP content on Port 80

2008-04-21 Thread Alan Chaney
The effect you are observing is because you have configured your setup 
to have the jsp files in the path of the document root for apache. 
Apache knows nothing about jsp files so it is just returning the source 
to you.


You have not specified O/S, JVM or Apache or Tomcat version.

You might like to read the tomcat documentation before going any further:

http://tomcat.apache.org/connectors-doc/ajp/ajpv13a.html

would be a good place to start if you intend to use apache + tomcat, 
together with


http://tomcat.apache.org/tomcat-6.0-doc/connectors.html

if you want to configure your version of tomcat to directly serve port 
80 and not use apache at all.


A 'tomcat only' installation working with port 80 can easily be 
configured in Windows using the control panel (or so I believe as I 
don't use Windows myself). For a linux setup there are some additional 
complications - see:


http://commons.apache.org/daemon/index.html

to avoid running tomcat as root.

Also you may find looking at archives of this list helpful.


If you can't find the answers in the above and generally,

http://tomcat.apache.org/connectors-doc/index.html

then maybe you could specify your system more clearly and I'm sure 
people will be able to give you more specific help.



Alan Chaney









BeasC wrote:

I can get Tomcat to render JSP content if I try to (for example) access the
JSP installation examples using http://localhost:8080/examples/jsp  But when
I try to try http://localhost/examples/jsp I get nothing but the raw html
code of the page (of a specific example).
I have an Apache - Tomcat server, and Apache is listening on port 80 (Which
is the default port used when accessing the server using its IP address.
Tomcat has the following code lines in its server.xml file, that I think
might serve as reference point to what I'm talking about:

Server port=8005 shutdown=SHUTDOWN

and

Connector port=8080 protocol=HTTP/1.1 
   connectionTimeout=2 
   redirectPort=8443 / 


Any help would be greatly appreciated.

-Carl


-
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: Permissions of File Created by Tomcat

2008-04-20 Thread Alan Chaney

This is really a linux permissions issue.

How are you starting tomcat? with the $TOMCAT_HOME/bin/startup.sh or 
with jsvc or are you using an ubuntu startup script?


You don't say anything about the user who will run the java application.

Generally, the way to control the access permissions with which files 
are created in linux is to call 'umask' with the correct parameters. As 
mentioned before on this list umask is a shell command, so you must do 
it at the correct point or severely weaken the overall security of your 
installation.


You need to do the following:

1. decide which user or users will be executing tomcat and the java 
application.
2. If you decide that you need to have two separate users, then make 
them both in the same group.
3. Use umask in the tomcat startup script and/or the shell in which you 
run your application to set appropriate access permissions - GIYF


As an aside, if you are going to have two different processes writing 
these shared files you may also have to consider locking issues - maybe 
you have already done this.


Regards

Alan Chaney






Daniel J Hulme wrote:

Hi,

I'm running a WebService using Tomcat 5.5 on Ubuntu 7.10 with Axis2.

Files (and directories) are created by this service on a local directory:

/myfiles/

The permission of the new directories and files in this directory are:

Directories:'drwxr-xr-x 2 tomcat55 nogroup  4096'
Files:  '-rw-r--r-- 1 tomcat55 nogroup 10041'

The problem is, is I want to access (write) these files using, say, a java
application, it give me:

 java.io.FileNotFoundException: /myfiles/aDir/aFile.txt (Permission denied)

How can I either:

1.Gain write access to these files (without having to constantly change the
permissions in the command prompt, and without running my java application
with 'root' access).

2.Create the files/dirs from tomcat with 'write access'

3.Other

Thanking you in advance.

Daniel
  



-
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: Permissions of File Created by Tomcat

2008-04-20 Thread Alan Chaney

Hi Daniel

Really the issues are to do with the JVM and linux rather more than 
tomcat directly. I can't claim to be a linux guru but you should look at 
it in the following way Any application which runs on linux is 'owned' 
by a user. There two classifications - 'system' users and 'normal' 
users. System users have UIDs which are less than 1024 and can invoke 
privileged services. 'root' is a system (privileged) user.


One issue which often seems to confuse people is that the JVM is a 
program not an operating system. When you 'run tomcat' you are actually 
invoking java on the tomcat bootstrap.jar. See the javadocs 
http://tomcat.apache.org/tomcat-6.0-doc/api/index.html for more details.


My point here is that java is 'just another program' to linux, and all 
the permissions rules apply to the user invoking an application. You say 
that tomcat is now running as root (which is a BAD THING) which implies 
that you are:


a. logging in as root and starting tomcat
OR
b. letting tomcat be started by a sys init process.

One decision you must make is whether or not tomcat should be allowed to 
access privileged ports (eg port 80)
If so, then you should start tomcat using something like jsvc (see 
http://commons.apache.org/daemon/index.html)
which when properly configured will allow you to start an app as root, 
bind tomcat to port 80 and then switch to a 'tomcat' user. You can set 
umask permissions as appropriate in the startup script.


If you intend to run tomcat with its default port of 8080 (or any 
non-privileged port) things are a bit simpler. Create a user on your 
system (maybe 'mytomcat') and then simply start the tomcat 
./bin/startup.sh as this user by something like:


su mytomcat -c $JAVA_HOME/bin/startup.sh

from within the init script.

You can, of course, su to the user you are running the other java 
program as, then tomcat and your app will have the same user privileges 
- or you can create a tomcat group, make this the main group for your 
tomcat user, add it as another group to your 'application' user and set 
the appropriate umask (002) to allow group read/write (you must also set 
the directory permissions accordingly - set the 's' bit)


Please note that these are only pointers not a rigorous set of 
instructions. The reality is that if you want to do anything serious in 
linux you must learn ins and outs of 'bash' and this list is not really 
the place to do that.


HTH

Alan


Daniel J Hulme wrote:

Alan, this is very useful, thank you.

After a bit of Googling I decided to upgrade to Tomcat6 (apparently is has
less security ussies with Ubuntu). This means that the files/dirs are now
created (from the tomcat app) by 'root:root' (with the same permissions
described in my first post).

However, I still have the same problem. I'm running a java progam (not as
'root'), and need write access to these files. And I'm not allowed to run my
java app as 'root'.

I'm pretty new to linux, so your help (i.e. command examples) is much
appreciated.

Daniel



Alan Chaney wrote:
  

This is really a linux permissions issue.

How are you starting tomcat? with the $TOMCAT_HOME/bin/startup.sh or 
with jsvc or are you using an ubuntu startup script?


You don't say anything about the user who will run the java application.

Generally, the way to control the access permissions with which files 
are created in linux is to call 'umask' with the correct parameters. As 
mentioned before on this list umask is a shell command, so you must do 
it at the correct point or severely weaken the overall security of your 
installation.


You need to do the following:

1. decide which user or users will be executing tomcat and the java 
application.
2. If you decide that you need to have two separate users, then make 
them both in the same group.
3. Use umask in the tomcat startup script and/or the shell in which you 
run your application to set appropriate access permissions - GIYF


As an aside, if you are going to have two different processes writing 
these shared files you may also have to consider locking issues - maybe 
you have already done this.


Regards

Alan Chaney






Daniel J Hulme wrote:


Hi,

I'm running a WebService using Tomcat 5.5 on Ubuntu 7.10 with Axis2.

Files (and directories) are created by this service on a local directory:

/myfiles/

The permission of the new directories and files in this directory are:

Directories:'drwxr-xr-x 2 tomcat55 nogroup  4096'
Files:  '-rw-r--r-- 1 tomcat55 nogroup 10041'

The problem is, is I want to access (write) these files using, say, a
java
application, it give me:

 java.io.FileNotFoundException: /myfiles/aDir/aFile.txt (Permission
denied)

How can I either:

1.Gain write access to these files (without having to constantly change
the
permissions in the command prompt, and without running my java
application
with 'root' access).

2.Create the files/dirs from tomcat with 'write access'

3.Other

Thanking you in advance

Re: jsvc creates pid file owned by root

2008-04-12 Thread Alan Chaney

Hi Chris

Christopher Schultz wrote:

Are you sure you are changing the umask for the jsvc process? I wonder
if the umask is being re-set to something else when jsvc elevates itself
to root. You should ask the commons folks about how to do this with
jsvc, as this is really off-topic, here (but we'd love to hear the
I posted an answer to this a couple of days ago. I don't think the OP 
quite understands
that 'umask' is a *shell* command. Consequently if you have a shell 
script like 'tomcat' for jsvc or startup.sh
you must set the umask in the shell script because a new shell is 
created each time.


As I posted in my example, I set umask to 027 in my jsvc startup script 
and it works just fine. tomcat starts as root, binds to the ports and 
then switches to the 'tomcat' user. The pid file is owned by root (as it 
should be) and  files created by tomcat are '640' which is what I wanted.


Another point that I think the OP was confused about was that you *must* 
have root permission to bind to system ports in linux - so you must 
either start tomcat as root or with a script invoked by 'sudo'



You can also set umask in /etc/profile which will apply to all users - 
but probably not a good thing to do.


HTH

Alan



answer for the future).

Good luck,
- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkgA6g4ACgkQ9CaO5/Lv0PBGTwCeM+4lBoXTnwzHkeirmROqWfuC
co8AoJIEHbsD5gzfQxM8XNpwOeqrSdKf
=euMt
-END PGP SIGNATURE-

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



!DSPAM:4800eac534083966023671!




-
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: jsvc creates pid file owned by root

2008-04-11 Thread Alan Chaney
You shouldn't be messing about with the ownership of the PID file. It is 
created by jsvc at startup. If you use jsvc properly it will start as 
root, create the pid file, startup tomcat, allow tomcat to bind to ports 
80 and 443 and then switch to the user specified with -user switch.


When you install jsvc from the version which is part of the tomcat 
distribution it comes with a shell script called 'tomcat'


Here's an (edited) extract from my version.


.

# Set umask to avoid tomcat making tomcat-users.xml public readable
umask 027  # == 640

PID_FILE=/var/run/jsvc.pid

.

/usr/lib/tcnative/jsvc \
 -user $TOMCAT_USER \
 -home $JAVA_HOME \
 -Dcatalina.home=$CATALINA_HOME \
 -Dcatalina.base=$CATALINA_BASE \
 -Djava.io.tmpdir=$TMP_DIR \
 -Xmx512m \
 -XX:MaxPermSize=128m \
 -wait 10 \
 -pidfile $PID_FILE \
 -outfile $CATALINA_HOME/logs/catalina.out \
 -errfile '1' \
 $CATALINA_OPTS \
 -cp $CLASSPATH \
 org.apache.catalina.startup.Bootstrap






I set a lot of options in CATALINA_OPTS which are passed to the vm - for 
example my JMX switches, various application configuration properties.


I set the umask to 027 because that makes files read/write for tomcat 
and read-only for the tomcat group and read protected for the rest. This 
was because tomcat re-writes the tomcat-users.xml (which I happen to be 
using for the moment) at start up.



Gunnar Boström wrote:

Hi,
Answers to all of you who has responded.

I would be fine with 644 but I don't know how to set that.

see umask above


The file is owned by root so I'm not allowed to change it.



My umask is by default 0022 which should be okay. I tried to set the mask to
 but no change.

read about linux umask - you need to set it at the right point


I created a pid file with the correct permissions but as expected jsvc
ignored it.
You SPECIFY the pid file as a parameter to the startup of jsvc. -pidfile 
as above.


So this is what you do - assuming you are using a startup script like 
the provided 'tomcat':


1. Set an appropriate umask in the startup script
2. Set a pidfile location wherever you need it
3. start up tomcat

EITHER as root by going

./tomcat start


OR

sudo ./tomcat start if you want to stay as a normal logged in user.

You need to have your sudo permissions set of course - but that's 
another longer story.



The whole point of using jsvc is that it allows you to change user from 
a privileged user to a normal user because no-one should run a web 
server as root.


HTH




I was hoping that there were some undocumented switches in jsvc that I could
use.

Regards
Gunnar




-
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: Connection pooling again

2008-04-10 Thread Alan Chaney
Hmm. I think the answer here is one of resource starvation - the 
resource in this case being the CPU. It seems that  core of your test is


'Select * from table1'

Where is the database? Is it another application on the same box? What 
mechanism do you use to connect between the database and the app? (a 
pipe? tcp?) How big is 'table1'? How long does that select statement 
take? Why should anything else happen in the system until that select 
has finished?


Here's a guess. Look at a resource monitor and you will see that when 
you start your test the CPU goes to 100% and stays there.



I suspect that this is a case that you are queuing on processing the 
select statement in the database.


From a systems point of view the Java JVM on windows and linux is a 
*cooperative* multithreaded system. Connection pooling has nothing to do 
with concurrency. Its as someone said earlier a performance optimization 
to avoid the overhead of recreating the datasource each time you need it.


It you want to write a test which shows the connection pool being used 
CONCURRENTLY then you must write a concurrent test! For example, open 
the connection, sleep for a while, do something, sleep again and do 
something else and then close the connection. Turn on logging for the 
pool and watch concurrent requests being processed.


Alan Chaney



[EMAIL PROTECTED] wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Daad,

[EMAIL PROTECTED] wrote:
| No, my test is done with threads that connect using sockets. Server
| listen with ServerSocket and 30 Threads are started connecting to it.

Er... did you write your own server, or are you using Tomcat?



I'm using tomcat.


I'm sorry... all the evidence you have presented does not support your
conclusions. There are other ways to get a log file looking like the one
you posted.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkf9PnsACgkQ9CaO5/Lv0PBAPACfR8qL7tD33mFTWCdY99D6p8ic
shoAn3v0C49JvF2muOefUF5Q+QbBhVdD
=kLLa
-END PGP SIGNATURE-

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



!DSPAM:47fddbcd240221497319589!



-
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: stop apache web server for tomcat 6

2008-04-10 Thread Alan Chaney

something like:

sudo apt-get remove apache2

- if you have problems see the ubuntu users list

HTH




Angelo Chen wrote:

Hi,

I have a ubuntu server which has apache web server 2 pre - configured, it is
port 80, now I install tomcat 6 and I'd like to use port 80 as well, how can
i stop apache2 in this machine? i don't need apache 2. thanks.


-
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: Newbie: Question about first Servlet

2008-04-06 Thread Alan Chaney

Actually

ISO-8851-1 according to Google is a standard determining the moisture 
content of butter.



http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=35218


However, ISO-8859-1 is the Latin character set definition.

Probably ISO-8859-1 is more relevant. Anyway, you fixed it! Hope you 
have hours of fun learning servlet programming just like the rest of us...



Regards

Alan Chaney




Kurt L Harless wrote:

OK, figured it out.

I changed the Character Set to

?xml version=1.0 encoding=ISO-8859-1?

Instead of 


?xml version=1.0 encoding=ISO-8851-1 ?

I figured this out by using the tomcat.exe to start the service and saw the
dump message when it was trying to parse my xml file.

Is this not the valid way of coding this encoding?

-Original Message-
From: Kurt L Harless [mailto:[EMAIL PROTECTED] 
Sent: Saturday, April 05, 2008 10:14 PM

To: users@tomcat.apache.org
Subject: Newbie: Question about first Servlet

Greetings,

 


Specifics:

Window XP

TomCat 5.5

Java 1.6

 


Created webapp dirs under;

 


C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\

 


Called ch1\WEB-INF\classes

 


In WEB-INF at created a web.xml file with the following contents;

 


?xml version=1.0 encoding=ISO-8851-1 ?

web-app xmlns=http://java.sun.com/xml/ns/j2ee;

xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;

xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee

http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd;

version=2.4

servlet

servlet-nameChapter1 Servlet/servlet-name

servlet-classCh1Servlet/servlet-class

/servlet

servlet-mapping

servlet-nameChapter1 Servlet/servlet-name

url-pattern/Serv1/url-pattern

/servlet-mapping

/web-app

 


In the classes subdir to WEB-INF I compile the following java src
successfully

 


import javax.servlet.*;

import javax.servlet.http.*;

import java.io.*;

 


public class Ch1Servlet extends HttpServlet

{

public void doGet(HttpServletRequest request,
HttpServletResponse response)

throws IOException 


{

PrintWriter out = response.getWriter();

java.util.Date today = new java.util.Date();

out.println(html  +

body +

h1 align=centerHF\'s Chapter1
Server/h1 +

br + today + 

/body + 


/html);

}

}

 


I installed TomCat 5.5 as a windows server and can successfully launch
http://localhost:8080 http://localhost:8080/  and get the TomCat initial
page

Under this page I can select the link for TomCat manager and see under
applications an entry for /ch1

 


However, when I try to run  http://localhost:8080/ch1/Serv1
http://localhost:8080/ch1/Serv1 I get HTTP Status 404 - /ch1/Serv1

 


Anyone want to help a newbie?

 

 




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



!DSPAM:47f86177141196657853550!



-
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: How can I refresh tomcat in the java code?

2008-04-03 Thread Alan Chaney

.

Hi Guilherme

I can see that English isn't your first language and I have a lot of 
respect for anyone who is trying to work on technical things in a 
foreign language - I could never do it!


To help our communication I have tried to explain below what I think it 
is that you are trying to do. I may have misunderstood what it is that 
you are doing so I apologize if what I am saying is wrong.


I've joined this thread a bit late, but looking at the previous emails 
it seems to me that your need is that a user should be able to download 
a pdf file which has been generated by your server?


This is 'dynamic content'. The server responds to the request for a file 
by creating an OutputStream of pdf data



Your use case is that the user clicks on a link in a web page and the 
PDF file appears in their browser?


Here's what I would expect the sequence of events to be:

1. The user clicks on the link in the browser. The link has as its href 
for example www.mycompany/xyz.pdf


2. The browser generates an http GET request with the url 
www,mycompany/xzy.pdf and sends it out over the net.


3. Your container detects this request, looks up the appropriate servlet
in its web.xml and calls the HttpServlet 'doGet' method.

4. Your servlet responds to this request and generates the pdf in a 
temporary file.


5. You set any response headers that you need to set.

6. You read the temporary file as a byte InputStream and write this to 
the servlet OutputStream.


7. The container takes the data from the output stream and transmits 
across the wire back to the browser. It inserts any headers you have 
specified (and a few others) at the beginning.



8. You return from the doGet.


That's it. Done!



So the stream of data which is returned as the response to .../xyz.pdf 
IS the data you want displayed. You don't need to send a redirect to 
xyz.pdf because you have already responded to the request.


The exact point at which the container (Tomcat) starts to transmit data 
is up to the container. You can force it to send data by issuing a 
'flush'. However, once it has started to respond to the specific request 
you cannot issue things like a redirect. I'm simplifying a bit here.


Looking at your code there doesn't appear to be the doGet method - I 
assumed initially that you were calling your class from within the doGet

of a servlet. Is this the case?

Have you checked the tomcat logs? I would have expected the server to 
have thrown an exception when you attempted to send a redirect after you 
have already written data.







Guilherme Orioli wrote:

Didn't get it... it just doesn't work... what do I need to use instead of
the response.redirect ?

2008/4/2, Alan Chaney [EMAIL PROTECTED]:

You don't need the redirect. The response to the request IS the pdf file.

HTH


Guilherme Orioli wrote:


It just doesn't show the Download dialog on the screen when i click the
button...

2008/4/2, Guilherme Orioli [EMAIL PROTECTED]:


ok... here's what i'm doing... in system out, something like a pdf
file is
printed... itś probably there... just don't know how to show it from
the
button i'm clicking on:

public String geraReportBois(){
try{

//Generating the report
String caminho_arquivo = new File().getAbsolutePath() +
/workspace/safeTrace/WebContent/reports/cliente/frigorifico/;
String nome_arquivo = reportBois.jasper;
JasperReport jasperReport =
(JasperReport)JRLoader.loadObject(caminho_arquivo + nome_arquivo);
Map parameters = new HashMap();
parameters.put(Caminho, caminho_arquivo);
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport,
parameters, this.getRelatorioBois());


//--

//Exporting to File (outputStream)
ByteArrayOutputStream pdfStream = new ByteArrayOutputStream();
JasperExportManager.exportReportToPdfStream(jasperPrint, pdfStream);

HttpServletResponse response = (HttpServletResponse)
FacesContext.getCurrentInstance().getExternalContext().getResponse();
response.setContentType(application/pdf);
response.setHeader(Content-Disposition, inline;
filename=myPDF.pdf);
response.setContentLength(pdfStream.size());
try{
ServletOutputStream sos = response.getOutputStream();
pdfStream.writeTo(sos);
System.out.println(pdsStream - +pdfStream);
response.sendRedirect(myPDF.pdf);
sos.flush();
sos.close();
pdfStream.close();
pdfStream = null;
}catch(IOException e){
e.printStackTrace();
}
return ;

}catch(JRException e){
System.out.println(entrou no catch geraReportBois);

e.printStackTrace();
}
return null;
}









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




!DSPAM:47f4c55058681264652389!



-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL

Re: How can I refresh tomcat in the java code?

2008-04-03 Thread Alan Chaney

Chris

Very nicely put. The only thing that I'm not clear on is your comment 
about sending the data as a String. The OP is trying to return a pdf 
file, which is a byte stream. I'd worry about trying to wrap that in a 
String because of encoding issues.



You make a good point about two simultaneous requests breaking the app. 
The other issue is of course that Jasper isn't necessarily that quick at 
creating a report and the report generation is in line with the servlet 
request and response.


A more sophisticated solution would probably follow a pattern of:

1. Respond to request.
2. Schedule a process (thread) to create report.
3. Return from the request saying something like Your report is being 
prepared...
4. When the process in 2. is complete send an email saying please go to 
... to pick up your report.


You can then make a design decision as to whether or not you want the 
report generating process to allow multiple instances to run or not 
(probably not in most cases).


Another tweak is to cache the generated reports if they are unlikely to 
change frequently etc etc...


I've written systems that work this way. It may be that the OP was 
trying to do something like this.




Alan

Christopher Schultz wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Guilherme,

Guilherme Orioli wrote:
| Didn't get it... it just doesn't work... what do I need to use instead of
| the response.redirect ?

These good folks are telling you to do something differently than you
are currently doing it.

Right now you are trying to:

1. generate your content
2. write the content to a file on the disk
3. redirect the user to the newly-generated file on disk

Everyone is telling you to:

1. generate your content
2. write the content out to the ServletOutputStream directly
~   (not to System.out, nor to a FileOutputStream)

No disk file; no redirect. Each request re-generates the content and
sends it back to the client (browser) as the response to the original
request.

Let me lay it out for you. You currently have this code:

| try{
| ServletOutputStream sos = response.getOutputStream();
| pdfStream.writeTo(sos);
| System.out.println(pdsStream - +pdfStream);
| response.sendRedirect(myPDF.pdf);
| sos.flush();
| sos.close();
| pdfStream.close();
| pdfStream = null;
| }catch(IOException e){
| e.printStackTrace();
| }
| return ;

You should change it to:

try{
~ServletOutputStream sos = response.getOutputStream();
~pdfStream.writeTo(sos);
~sos.flush();
~sos.close();
~pdfStream.close();
} catch(IOException e) {
~e.printStackTrace();

~response.sendError(HttpServletResponse.INTERNAL_SERVER_ERROR,
~   e.getMessage());
}
return ;
/// ^^^ What is this?

I'm not sure why your method returns a String. There's no reason for it
to do so. Is this in a servlet? If it is, then you are going to run in
to trouble with the request and response objects being members of
the class. Two simultaneous requests will completely break your 
application.


You can simplify the code somewhat, as well as reducing the amount of
memory required to operate by eliminating your use of a
ByteArrayOutputStream. The only downside is that your servlet will not
be returning a Content-Length with the response (which isn't that big of
a deal).

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.8 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkf030UACgkQ9CaO5/Lv0PAZUgCdFrgxEz2Ni1O7TTxcEWqvYyXN
TzAAmwRB3Oau5Q4BMOr2/1YpamUXSyz+
=bmNA
-END PGP SIGNATURE-

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



!DSPAM:47f4dff582799080218370!



-
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 podcast server

2008-04-03 Thread Alan Chaney

Hi everybody

We've just put into service a set of web applications running under 
tomcat which works as a sophisticated podcast server.


We deliver several thousand podcasts a day of about 20MB to 70MB in 
size. Originally when we started we used an Apache server (because it 
worked... just...) However it was clear to me that this was a poor 
solution for large volumes of traffic -- and I was right!


So I have written a specialized http server which has the following 
features:


1. Adaptive rate-control algorithm which balances the load on a 
per-request basis to optimize the number of simultaneous requests to be 
serviced. The algorithm is 'pluggable'


2. Easy clustering of servers (no session state) to make it scalable.

3. Sophisticated logging to allow the easy generation of detailed 
reports on download activity.


4. JMX management.

5. A black-list scheme to mitigate badly written mulitmedia bots which 
can easily swamp a server.


6. A simple content management system to manage the import of media files.

Although it is originally designed for use with mp3 files, it should 
work with any large media files or data downloads.


The next stage of this project is to add a database controlled ad 
insertion facility which would insert sponsorship messages into the 
outgoing stream on a pre request basis.


We are considering making this an open source project. If people think 
that this would be of interest to them to use, or if they might like to 
join the project, then please email me off-list at the following 
(substitutions obvious)


alan  A + T  writingshow dot com

So far I have only deployed this on Tomcat, but it is just a set of 
standard servlet 2.5 wars and should work on other containers.


Currently it is running on a dual core opteron. Even at heavy loads the 
CPU utilization is low and it only needs about 100MB of heap to support 
100 simultaneous connections. (which could represent 7GB of download)


It is written using Spring and Hibernate (and a lot of other wonderful 
open source projects)



Regards

Alan Chaney









-
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: Threads

2008-04-03 Thread Alan Chaney
Actually another question is what is it in your application that NEEDS 
2500 threads? What does the application do? Is it 3rd party or in house?


Normally the creation of a thread is considered an expensive operation 
and typically one tries to avoid creating new threads all over the 
place. Hence thread pools as used by tomcat.




Peter Crowther wrote:

From: Stephen Caine [mailto:[EMAIL PROTECTED]
I have a process that generates hundreds of threads.  Running on Mac
OS X 10.5.2 Server, the thread count tops out at approximately 2500.
After which, the process is terminated.  The heap size is set to 1
gigabyte.  My question is how to increase the capacity of the JVM to
handle more threads.  Is the value of 2500 an absolute limit, or can
it be modified by setting the thread allocation, increasing heap size
or the use of another java option?


I'm not a Mac person, but... does the Mac JVM use native threads?  In which 
case, the 2500 (plus other threads) could be an OS limit that has changed in 
10.5.


If you have time, what causes a process to generate threads?


Calls to the API that generates a thread.  Next?

- Peter

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



!DSPAM:47f507bc127041839419991!



-
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: How can I refresh tomcat in the java code?

2008-04-02 Thread Alan Chaney

You don't need the redirect. The response to the request IS the pdf file.

HTH


Guilherme Orioli wrote:

It just doesn't show the Download dialog on the screen when i click the
button...

2008/4/2, Guilherme Orioli [EMAIL PROTECTED]:

ok... here's what i'm doing... in system out, something like a pdf file is
printed... itś probably there... just don't know how to show it from the
button i'm clicking on:

public String geraReportBois(){
try{

//Generating the report
String caminho_arquivo = new File().getAbsolutePath() +
/workspace/safeTrace/WebContent/reports/cliente/frigorifico/;
String nome_arquivo = reportBois.jasper;
JasperReport jasperReport =
(JasperReport)JRLoader.loadObject(caminho_arquivo + nome_arquivo);
Map parameters = new HashMap();
parameters.put(Caminho, caminho_arquivo);
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport,
parameters, this.getRelatorioBois());

//--

//Exporting to File (outputStream)
ByteArrayOutputStream pdfStream = new ByteArrayOutputStream();
JasperExportManager.exportReportToPdfStream(jasperPrint, pdfStream);

HttpServletResponse response = (HttpServletResponse)
FacesContext.getCurrentInstance().getExternalContext().getResponse();
response.setContentType(application/pdf);
response.setHeader(Content-Disposition, inline; filename=myPDF.pdf);
response.setContentLength(pdfStream.size());
try{
ServletOutputStream sos = response.getOutputStream();
pdfStream.writeTo(sos);
System.out.println(pdsStream - +pdfStream);
response.sendRedirect(myPDF.pdf);
sos.flush();
sos.close();
pdfStream.close();
pdfStream = null;
}catch(IOException e){
e.printStackTrace();
}
return ;

}catch(JRException e){
System.out.println(entrou no catch geraReportBois);

e.printStackTrace();
}
return null;
}






!DSPAM:47f3d27e207721697119596!



-
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: Top mail servers

2008-03-31 Thread Alan Chaney



Steffen Heil wrote:


It's very fast, relyable and flexible.


Agreed.


The configuration language is even turing complete...

Be aware, that it's initial configuration may be a huge step.
On debian/ubuntu you get a multi-file configuration by default, which is
good, if the package is updated.

However I found it more easy to do administration using a single-file
config. (you may start copying the auto-generated config from the multi-file
system to /etc/exim4/exim4.conf.)

Heartily agreed! I messed around with the multi-file administration 
scheme for 2 or 3 days and then decided that what I really needed was to 
understand how exim worked. Having done that, it was easier just to edit 
one file. Phil Hazel's book is very useful. After all, he wrote exim.


HTH

-
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: Top mail servers

2008-03-28 Thread Alan Chaney

Have you looked at exim? (www.exim.org).
sendmail is rather dated.

I have no experience of postfix.

I have set up two mailservers with exim. The documentation is thorough, 
but setting up a public production mailserver is not for the 
faint-hearted. Exim is supposed to be significantly easier to configure 
than sendmail.


You will also probably need a POP or IMAP server. I found dovecot to be 
very good. I also implemented a dspam spam filter. Not for beginners, 
but once you get it going properly it absolutely wipes all the noddy PC 
spam filters off the map.


Ubuntu has a 'distribution' of exim, dovecot, postfix etc. However, you 
will still need to understand how they work which is a far more 
time-consuming task than the actual physical installation.


HTH


Srivastava, Abhay wrote:

Folks,
I am in the process of hosting a site on Tomcat on Ubuntu. I will be
also running a mail server. As per your experience which are the top
mail servers? While googling I came to know these names :
 
Sendmail

Postfix
 
 
I would appreciate if you can give your inputs.
 
Thanks,

abhay


!DSPAM:47ed0b5181291562881678!



-
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: Checking tomcat metrics in a non-intrusive way

2008-03-27 Thread Alan Chaney
In the real world what network connections will exist between you and 
your real clients?


How many ports do you have on your server?

How fast are they?


How big are the pages being requested? Including images, css files etc?

If you have 500 concurrent users will you have 500 times the traffic on 
the wire? or will you have some intermediate caching? You talk of a db 
so it is unlikely that caching can be used to much effect.


If have (say) 100kbytes total per transfer x 500 = 50 MBytes for 500 
people each making one request. Unless you can guarantee a GB connection 
to them all the thing that's going to take the most time is the time to 
transfer that data over the wire.


50 Megbytes (I spell it out to be clear what I am talking about) is 400 
megabits If you have a 100 megabit connection to your clients then about 
5 s will of delay (latency) will have to be shared between your clients. 
Some will get less, some will get more latency


In the real world very few end users have even a 100 Mbit point to point 
connection to the server. If you factor in the 'down the wire' time for 
someone with a dodgy cable connection then a response time of 250 ms 
would be good for a given individual.


I have spent a lot of time recently tuning and examining the peformance 
of tomcat and I came to the conclusions:


1. On a modern machine it takes very little time indeed for tomcat to 
process an incoming request.
2. As the number of requests goes up the probability of issues with I/O 
outside of the 'control' of tomcat become prevalent.
3. In the real world with real applications its things like database 
access which dominate performance.
4. Users' network connections are probably a major peformance issue 
unless you have extremely good connections between the server and the 
clients.


You suggested earlier that you might have to use an alternative. Out of 
interest what alternatives are you considering?





wicket0123 wrote:

It matters to us because we are talking about response time of under 10ms for
500 concurrent users.  Our internal application metrics are in the
nano-seconds.  If the container adds a lot of overhead, we may want to
switch to other containers.

For scalability testing, our testing is done in a closed network.  All
machines are on same subnet, so we eliminate network being the bottleneck
here.  If anything, it will be either: client machine, server machine, app
code, DB.  No firewall or anything in between for initial test.

Basically, I used JMeter to run 500 concurrent users against our app.  The
response time shown by JMeter is the total response time.

total response time = network round trip + time spend on server

network round trip = time spend sending request + time spend receiving
response
time spend on server = time spend running container code + time spend
running app code + time spend talking to DB (include db round trip)

Let's take an example using my results,

JMeter reports that for 500 concurrent users making request to our
application, the average response time was 1 second.  That already broke our
SLA which is 15 milliseconds.

My questions that needs to be answered:

1) out of that 1 second, how much was due to network?
2) out of that 1 second, how much was spend running our application code?  I
got this, we have internal metrics
3) out of that 1 second, how much was spend running tomcat code?

this maybe a bit off track to the initial question, but those are the things
Im trying to answer.  I've been looking at tools like Manage Engine which
shows you average response time which they claim is time spend in tomcat. 
However, they only show down to the millisecond level.  And, if they're able

to show that, it means that they're calling some tomcat APIs.  I want to
know which APIs, so that I can write my own program to query them.













Christopher Schultz-2 wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Wicket,

wicket0123 wrote:
| Hi Charles,
|  Thanks for the reply.  JMeter doesn't help me here because the
response
| time includes network time.  The reason I'm looking into the tomcat API
is
| because i want a way to query tomcat for the numbers.  So, the metrics
I am
| after are:
|
| 1) How much time was spend in tomcat? no network

You can't get this information without a real profiler, which will, of
course, interfere with performance.

| 2) How much time was spend on the servlet?

The best you can do, here, is to write yourself a Filter (or Valve, I
suppose) and simply take timestamps. As with all instrumentation, taking
samples takes time. Rest assured that reading the system clock is /very/
fast. ;)

I suppose if you know the total response time and the servlet time, you
could simply subtract the servlet time to see how much Tomcat overhead
is in there. Does it really matter?

| 3) What is the overall average response time for a request when there
are X
| number of users active?

To me, this all comes down to /useful/ metrics. For instance: 

Tomcat 6 and placing jars in $CATALINA_HOME/lib

2008-03-26 Thread Alan Chaney
We are using tomcat 6.0.16 with a jdk 1.6. I have a number of web 
applications which use, for example, spring and hibernate. Is there any 
reason why these jars (and their dependencies) should not be placed in
$CATALINA_HOME/lib? It would save a lot of time uploading new releases 
of my own applications to my servers.


From my reading of the docs there could be a potential problem if there 
is a conflict between existing classes in the TC distribution and the 
jars I would put in the 'lib'. What's the recommended practice?


Thanks in advance.

Regards

Alan Chaney


-
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 6 and placing jars in $CATALINA_HOME/lib

2008-03-26 Thread Alan Chaney
You're right. I debated whether or not there was an argument that I 
should always use the same jars for each project so it didn't matter, 
but then I decided that there was bound to be some case where that 
wouldn't work for some unforeseen reason. Its best to keep each webapp 
independent. There are other solutions to the time of uploads.


Thanks


Caldarale, Charles R wrote:
From: Alan Chaney [mailto:[EMAIL PROTECTED] 
Subject: Tomcat 6 and placing jars in $CATALINA_HOME/lib


Is there any reason why these jars (and their dependencies) 
should not be placed in $CATALINA_HOME/lib?


The primary reason not to lump everything in one basket is webapp
independence, which the servlet spec encourages.  If you do put commonly
used jars in the lib directory, you're tying all your webapps to one
instance of those particular classes.  This can create problems with
versioning, should some of your apps migrate to newer levels of the
common libraries, and with reloading webapps, since those libraries may
retain references somewhere to objects of the webapp.

Given the price of disk and memory these days, along with automated
scripts to build your .war files, the only thing you'd really save on is
time to transfer an updated webapp.  Is that really a dominant factor,
given the drawbacks?

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

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



!DSPAM:47eab1f3292727785049143!



-
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: RESIDENTIAL MEMORY 100%

2008-03-26 Thread Alan Chaney

Caldarale, Charles R wrote:
From: karthikn [mailto:[EMAIL PROTECTED] 
Subject: Re: RESIDENTIAL MEMORY 100%


2) In Remote TOMCAT5523 /infinet/karthik/TOMCAT5523/bin
i inserted a new argument in  catalina.sh  as follows
export JAVA_OPTS=-Dcom.sun.management.jmxremote.port=8999 



I think you also need this:
   -Dcom.sun.management.jmxremote.ssl=false
  

You do - at least, it works for me!

However, there are two other issues  which I ran into.

1. A lot of linux installations have the 'localhost' setting something 
like this in /etc/hosts


127.0.0.1 localhost my.machine.com

Sun doesn't like this. You must explicitly set the 'outside' IP address 
so you end up with something like:


127.0.0.1 localhost
123.456.123.456 my.machine.com

That confused me for about a day until a lot of googling came up with 
the above answer. I could connect from linux to linux but not windows to 
linux.



Also see
   
http://blogs.sun.com/jmxetc/entry/troubleshooting_connection_problems_in_jconsole


and
   http://java.sun.com/j2se/1.5.0/docs/guide/management/faq.html

which has a lot of useful stuff for debugging jmx remote problems. And 
don't forget to check the firewall!


Regards

Alan Chaney






-
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: RESIDENTIAL MEMORY 100%

2008-03-25 Thread Alan Chaney
Firstly, you are only making 350M of your memory available to the 
application. xmx=350m means 350 megabtyes is reserved for the heap.



Secondly, that's probably not the issue!

You are correct in that you are running a 32 bit JVM. That's probably 
not the issue either but it means that most of the 6GB of RAM you said 
you had is not actually relevant.


Next. you keep saying that you are using netstat to look at your system. 
but the display below is that of 'top'. I'm not familiar with your Unix 
version so maybe netstat is different on your system. Neither netstat 
nor top are that much use for delving into linux memory issues, never 
mind about java issues. It is extremely difficult to correlate the way 
that linux uses memory to what is actually happening inside the JVM.


The next issue is that thousands of people all over the world use tomcat 
 and don't suffer from the problem that you are seeing, so it is most 
likely that the problem is with your application. I notice that you have 
535 process listed - that's an awful lot.


You need to investigate what is actually happening inside the 
application - the best way of doing that is to use either jconsole or a 
profiling tool. You are using java 6 which means that you can easily set 
up a jconsole session to display what is happening. If you use jconsole 
you will be able to check the real JVM memory usage over time and force 
a GC to see how much of that memory is actually held by a strong reference.


And of course what do the log files show? Are you getting out of memory 
errors? Are you getting RTEs?


Another thing to check is that is the system swapping? I notice that in 
the statistics below you don't show the swap usage. This is often a trap 
for the unwary.


HTH





karthikn wrote:

Hi

  is running a 64bit JVM.

JDK used is 32 bit probably by  running java -version on this Unix 11 
server



bash-3.2# ./java -version
java version 1.6.0.00
Java(TM) SE Runtime Environment (build 
1.6.0.00-jinteg_12_nov_2007_21_58-b00)
Java HotSpot(TM) Server VM (build 1.6.0.00 jinteg:11.12.07-21:02 PA2.0 
(aCC_AP), mixed mode)


This version is avaliable from HP Unix site
http://h18012.www1.hp.com/java/

As per HP site  64 bit is the version HP is distributing



I also have some more netstats report for last 4 hrs before we did the 
restart of the web container ( TOMCAT 5523)


Tue Mar 25 15:52:06 2008
System: voise1   Load averages: 
1.45, 2.23, 2.28

535 processes: 509 sleeping, 25 running, 1 zombie

Cpu states:

CPU   LOAD   USER   NICESYS   IDLE  BLOCK  SWAIT   INTR   SSYS
01.23   2.0%   0.0%   6.9%  91.2%   0.0%   0.0%   0.0%   0.0%
11.66   6.8%   0.0%   3.9%  89.3%   0.0%   0.0%   0.0%   0.0%
---     -  -  -  -  -  -  -  -
avg   1.45   4.9%   0.0%   4.9%  90.3%   0.0%   0.0%   0.0%   0.0%

Memory: 3894732K (1548140K) real, 7334992K (3049776K) virtual, 829420K 
free  Page# 1/36


CPU TTYPID USERNAME PRI NISIZE  RES STATETIME %  
WCPU%  CPU COMMAND
0pts/3 16406   root 152 20   2412M1218M run 103:21   
31.77 31.72   java
1   ?12779   root 152 24   282M 163M run   
2:27  9.90   9.88 xas
1   pts/4  8251 root 178 20   11608K  9628K run   
0:02  1.12   1.12 top
1   ?12733   root 152 24   79064K  29540K run 
3:28  1.06   1.05  voiseBLG
0   ?37root 152 20   8832K8832K run  
3:44  0.55   0.55 vxfsd



Over a period of  12 hrs the RES STAT reaches 2000M when CPU for java is 
100%


The web application refuses to display the main page,even though we have 
the GC configured

as

JAVA_OPTS=-server -Xms350m -Xmx350m -XX:+UseParallelGC -verbose:gc



with regards
Karthik


sterling wrote:

I am sorry, if this is the wrong list, for submitting questions
about apache on linux and router issues.
This problem generated from alcatel to zoom x6 router change.

Traceroute to webpage reports router address, but
webserver is at machine address on the same routed network.
Cannot see webpages on browser from outside or inside.
Thanks.
s.

 list, On Mon, 24 Mar 2008, Alan Chaney wrote:

 
   
| yes We have  used  -Xms or -Xmx  Configuration , since the system 
RAM is

| 6 GB
| as
|
| JAVA_OPTS=-server -Xms350m -Xmx350m -XX:+UseParallelGC -verbose:gc

So you have a 3.5GB heap. What are you filling it with? It's probably
not a memory issue if...
  

Actually the OP's heap appears to be 350M not 3.5G . I'm still wondering
what he does with the other 5 gigs. Also its not clear whether or not he
is running a 64bit JVM.

Alan


-
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: RESIDENTIAL MEMORY 100%

2008-03-25 Thread Alan Chaney



sterling wrote:
I am sorry, if this is the wrong list, for submitting questions 
about apache on linux and router issues.  
This problem generated from alcatel to zoom x6 router change.




'Fraid so. What's more you appear to be thread hijacking! This list is 
for tomcat, the apache java servlet container. If you have an issue with 
the Apache web server I suggest that you try


http://httpd.apache.org/userslist.html

 for more information, and maybe read 
http://www.catb.org/~esr/faqs/smart-questions.html





Traceroute to webpage reports router address, but 
webserver is at machine address on the same routed network. 
Cannot see webpages on browser from outside or inside.
Thanks. 
s. 


 list, On Mon, 24 Mar 2008, Alan Chaney wrote:




| yes We have  used  -Xms or -Xmx  Configuration , since the system RAM is
| 6 GB
| as
|
| JAVA_OPTS=-server -Xms350m -Xmx350m -XX:+UseParallelGC -verbose:gc

So you have a 3.5GB heap. What are you filling it with? It's probably
not a memory issue if...
Actually the OP's heap appears to be 350M not 3.5G . I'm still wondering 
what he does with the other 5 gigs. Also its not clear whether or not he 
is running a 64bit JVM.


Alan


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



Re: RESIDENTIAL MEMORY 100%

2008-03-25 Thread Alan Chaney



karthikn wrote:

Hi

Sorry for the dely, thx for the prompt reply

I was just looking into using Jconsole as u said,but since
the UNIX 11 server,does not have GUI,I probably would have to do some 
remote Jconsole for the same.


Can u please tell me  or provide me URL on how do i set up 
mbeans-descriptor.xml so the jconsole can be usaed for monitering  
remote JMX.


Tomcat documents do not say any thing about how  to achieve the same.

If you are using tomcat 5.5 or 6 you don't need to worry about the 
'mbeans-descriptor' stuff as tomcat already has JMX support built-in. I 
wasted a few hours before I realized that its all there for you.


To set up jconsole to remotely access a server is fiddly and depends a 
lot upon your local server configuration. I suggest that you google for:


jmx remote

The Sun site has all the information on jmx that you will need.

Also, study the comments in the 
$JAVA_HOME/jre/lib/management/*.properties files - its all there.


Once you have connnected by jmx you will be able to get lots of useful 
information about cpu usage and memory usage of the tomcat components.


If you want to add jmx support to your application then 'google is your 
friend'.


HTH




Spec

Os = Unix 11
jsdk = 1.6
Tomcat =5.5.23 version

thx in advance
with regards
karthik



Alan Chaney wrote:

Firstly, you are only making 350M of your memory available to the
application. xmx=350m means 350 megabtyes is reserved for the heap.


Secondly, that's probably not the issue!

You are correct in that you are running a 32 bit JVM. That's probably
not the issue either but it means that most of the 6GB of RAM you said
you had is not actually relevant.

Next. you keep saying that you are using netstat to look at your system.
but the display below is that of 'top'. I'm not familiar with your Unix
version so maybe netstat is different on your system. Neither netstat
nor top are that much use for delving into linux memory issues, never
mind about java issues. It is extremely difficult to correlate the way
that linux uses memory to what is actually happening inside the JVM.

The next issue is that thousands of people all over the world use tomcat
  and don't suffer from the problem that you are seeing, so it is most
likely that the problem is with your application. I notice that you have
535 process listed - that's an awful lot.

You need to investigate what is actually happening inside the
application - the best way of doing that is to use either jconsole or a
profiling tool. You are using java 6 which means that you can easily set
up a jconsole session to display what is happening. If you use jconsole
you will be able to check the real JVM memory usage over time and force
a GC to see how much of that memory is actually held by a strong 
reference.


And of course what do the log files show? Are you getting out of memory
errors? Are you getting RTEs?

Another thing to check is that is the system swapping? I notice that in
the statistics below you don't show the swap usage. This is often a trap
for the unwary.

HTH





karthikn wrote:
 

Hi

  is running a 64bit JVM.

JDK used is 32 bit probably by  running java -version on this Unix 11
server


bash-3.2# ./java -version
java version 1.6.0.00
Java(TM) SE Runtime Environment (build
1.6.0.00-jinteg_12_nov_2007_21_58-b00)
Java HotSpot(TM) Server VM (build 1.6.0.00 jinteg:11.12.07-21:02 PA2.0
(aCC_AP), mixed mode)

This version is avaliable from HP Unix site
http://h18012.www1.hp.com/java/

As per HP site  64 bit is the version HP is distributing



I also have some more netstats report for last 4 hrs before we did the
restart of the web container ( TOMCAT 5523)

Tue Mar 25 15:52:06 2008
System: voise1   Load averages:
1.45, 2.23, 2.28
535 processes: 509 sleeping, 25 running, 1 zombie

Cpu states:

CPU   LOAD   USER   NICESYS   IDLE  BLOCK  SWAIT   INTR   SSYS
01.23   2.0%   0.0%   6.9%  91.2%   0.0%   0.0%   0.0%   0.0%
11.66   6.8%   0.0%   3.9%  89.3%   0.0%   0.0%   0.0%   0.0%
---     -  -  -  -  -  -  -  -
avg   1.45   4.9%   0.0%   4.9%  90.3%   0.0%   0.0%   0.0%   0.0%

Memory: 3894732K (1548140K) real, 7334992K (3049776K) virtual, 829420K
free  Page# 1/36

CPU TTYPID USERNAME PRI NISIZE  RES STATETIME %
WCPU%  CPU COMMAND
0pts/3 16406   root 152 20   2412M1218M run 103:21
31.77 31.72   java
1   ?12779   root 152 24   282M 163M run
2:27  9.90   9.88 xas
1   pts/4  8251 root 178 20   11608K  9628K run
0:02  1.12   1.12 top
1   ?12733   root 152 24   79064K  29540K run
3:28  1.06   1.05  voiseBLG
0   ?37root 152 20   8832K8832K run
3:44  0.55   0.55 vxfsd


Over a period of  12 hrs the RES STAT reaches 2000M when CPU for java is
100%

The web application refuses to display the main page,even though we

Re: RESIDENTIAL MEMORY 100%

2008-03-24 Thread Alan Chaney




| yes We have  used  -Xms or -Xmx  Configuration , since the system RAM is
| 6 GB
| as
|
| JAVA_OPTS=-server -Xms350m -Xmx350m -XX:+UseParallelGC -verbose:gc

So you have a 3.5GB heap. What are you filling it with? It's probably
not a memory issue if...


Actually the OP's heap appears to be 350M not 3.5G . I'm still wondering 
what he does with the other 5 gigs. Also its not clear whether or not he 
is running a 64bit JVM.


Alan


-
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 on Leopard

2008-03-15 Thread Alan Chaney
I'd guess that you copied the text in the tutorial using an editor which 
converted it to an RTF

(Rich Text Format). The text you show in your email  is rtf markup.

The startup_tomcat file is a shell script which is setting the following 
environment variables


JAVA_HOME   - where you have installed our java sdk
JRE_HOME - the java runtime
CATALINA_HOME - the location of your tomcat files

You can set these 'by hand' by typing the lines in at the command line. 
Its better to set them in the .bashrc file.


Hope that helps



maxchoc wrote:
I'm trying to install Tomcat 6.0.16 on Leopard.  I'm following a tutorial on 
http://swetnam.wordpress.com/2007/12/15/installing-apache-tomcat-6-on-os-x/


I've gotten to the point of trying to start tomcat on my mac but when in the
Terminal, I get the following

sh-3.2# ./start_tomcat
./start_tomcat: line 1: {rtf1ansiansicpg1252cocoartf949cocoasubrtf270:
command not found
./start_tomcat: line 2: syntax error near unexpected token `}'
./start_tomcat: line 2: `{\fonttbl\f0\fswiss\fcharset0 Helvetica;}'

What am I missing?

Thanks

marlene

  



-
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: Does tomcat support multicores

2008-02-28 Thread Alan Chaney
XP Home only supports one core - however, that would hardly be an OS for 
a production web server (grin)


XP Professional is limited to 2 cpus

I would suspect that the OPs factors were related to IO Bandwidth or
running out of threads as suggested earlier. I've found that a modern 
multicore machine doesn't actually spend very much time processing the 
Tomcat stuff at all.



Caldarale, Charles R wrote:
From: Christopher Schultz [mailto:[EMAIL PROTECTED] 
Subject: Re: Does tomcat support multicores


| Doesn't XP limit itself to two cores?

I don't think so.


I'm sure some versions of XP are limited to two CPUs, since that was a
concern when HyperThreading was all the rage.  It may be just the Home
edition, rather than Pro.  I know the Windows Server versions (different
license than XP) all support at least four CPUs.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

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



!DSPAM:47c72002262671410093335!



-
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: How to make Tomcat do not use /dev/random?

2008-02-26 Thread Alan Chaney
Problems with /dev/random relate to waiting to generate enough entropy 
after restart of the OS. Does this slow start up happen only after the 
machine has been restarted or does it happen every time Tomcat is 
started? If the latter, then it is unlikely to be associated with 
/dev/random and much more likely to

be something like an unresolved IP address causing a network timeout.

As Juha suggests, get a thread dump and work out exactly what the 
problem is.



Mohamed Mohamedin wrote:

Dear All,

 


I am facing a problem with tomcat which make it start very slowly. I found
while searching that Tomcat reading from /dev/random to get random numbers
may be the cause. So I am asking How to prevent that? Or if there is another
cause please tell me.

 


Thanks a lot

 




!DSPAM:47b837c3258241839419991!



-
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: OT: java memory question -Xmx2048m

2008-02-25 Thread Alan Chaney
For some reason Linux always calls 64 bit OSes 'AMD' - in fact, the sun 
64 bit AMD version works fine on modern 64 bit Intel CPUs. The confusion 
comes because there was an older 64 bit design from Intel called the 
'Itanium' which was intended for servers and had a completely different 
instruction set. The Xeon family and the E64 family are all compatible 
with the 'AMD' 64 bit JVM



You say DELL 2590 - do you mean DELL 2950? The 2950 is takes Intel Xeon 
processors which will work with the so-called 'AMD' JVM.


Hope that helps

Regards

Alan Chaney


Dave wrote:

I installed Linux FC6 64-bit on the machine DELL 2590(I think it is INTEL type 
CPU). But JVM 64-bit is only available for AMD and SPARC.  Is the SUN not 
support INTEL?
   
  Thanks, Dave


David Delbecq [EMAIL PROTECTED] wrote:
  En l'instant précis du 25/02/08 13:51, Dave s'exprimait en ces termes:

Our Linux(FC) machine has 8G physical memory and 12G swap size. I am using JDK 
1.5. I tried to set the Java option -Xmx to set max heap size for best 
performance, the allowed max heap size is 2048M . Does that mean that the JVM 
can not use all the physical memory (8G) ? Thanks.
Dave


-
Never miss a thing. Make Yahoo your homepage.

The maximum memory the JVM can use depends on the maximum size of 
continuous memory segment the OS you run on allows you to reserve.
On 32 bits linux, it's about 2G (that is 4G minus memory area reserved 
for kernel, minus memory area used by libraries minus other thingies jvm 
might use). To get more you will need a 64bits JVM + a 64 bits OS. Note 
it's a limitation of hardware architecture and OS more than a limitation 
of JVM.


PS: if you plan to swap-out 12G of datas, i hope your disks are fast :)




-
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: NIO connector under heavy load drops incoming requests?

2008-02-25 Thread Alan Chaney
Actually I've seen something like this. I'm under a lot of pressure to 
get something out so I haven't investigated it further, but what seemed

to be happening is that if the client slowed down the NIO connector was
throwing a SocketTimeout. I tried messing about with the timeout 
settings but couldn't get the problem to go away, so I just switched 
back to the blocking I/O for the moment which works OK. This is 6.0.16.


My usage is quite different - I am delivering a small number of some 
very large files and the requests per minute is limited by the available 
network bandwidth. Its on my list to characterize the problem more fully.


Regards

Alan


Emile Litvak wrote:

Hello everyone,

 


We have a high load environment where we are running tomcat 5.5.15
successfully. We are interesting in reducing the system CPU load and
switching to Tomcat 6 with NIO, but so far have run into a few issues.
After trying out the patch Filip recommended

(http://svn.apache.org/viewvc?view=revrevision=618420) we did get
further (our CPUs were not pegged any more and exceptions went away),
but it appears that about 2/3rds of the requests are being dropped. I
was going to file a bug, but I thought I'd post it first to see if
anyone has any ideas.

 


We have many tomcat servers running 5.5.15. I took one of the machines,
and put 6.0.16 on it, patched it. Each server gets around 3K requests a
minute during the time window when I saw doing my experiments. Using
6.0.16 regular HTTP connections, I do get around 3K requests per minute
that we process. With NIO, we only see around 1.2K per minute. Here are
the two connector configurations.

 


Regular config

Connector port=8000

   maxThreads=500 minSpareThreads=25
maxSpareThreads=75

   enableLookups=false redirectPort=443
acceptCount=100

   compression=on 

   compressionMinSize=2048 

   noCompressionUserAgents=gozilla, traviata 


   compressableMimeType=text/html,text/xml

   connectionTimeout=0 disableUploadTimeout=true 


   maxHttpHeaderSize=8192 /

 


NIO config

Connector port=8000
protocol=org.apache.coyote.http11.Http11NioProtocol
acceptorThreadCount=4

   maxThreads=500 minSpareThreads=25
maxSpareThreads=75

   enableLookups=false redirectPort=443
acceptCount=100

   compression=on 

   compressionMinSize=2048 

   noCompressionUserAgents=gozilla, traviata 


   compressableMimeType=text/html,text/xml

   connectionTimeout=0 disableUploadTimeout=true 


   maxHttpHeaderSize=8192 /

 


I tried to tune various NIO parameters and had no luck. I can only
assume that acceptors turn away some requests for some reason without
passing them down to the worker threads. Or that I have mis-configured
something.

 


Here are some interesting threads

 


A worker thread

http-8000-exec-20
52   TIMED_WAITING  2000


.omited

javax.servlet.http.HttpServlet.service(690)


javax.servlet.http.HttpServlet.service(803)


org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(290)


org.apache.catalina.core.ApplicationFilterChain.doFilter(206)


org.apache.catalina.core.StandardWrapperValve.invoke(233)


org.apache.catalina.core.StandardContextValve.invoke(175)


org.apache.catalina.authenticator.AuthenticatorBase.invoke(433)


org.apache.catalina.core.StandardHostValve.invoke(128)


org.apache.catalina.valves.ErrorReportValve.invoke(102)


org.apache.catalina.valves.AccessLogValve.invoke(568)


org.apache.catalina.core.StandardEngineValve.invoke(109)


org.apache.catalina.connector.CoyoteAdapter.service(286)


org.apache.coyote.http11.Http11NioProcessor.process(879)


org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.proce
ss(719)


org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(2080)


java.util.concurrent.ThreadPoolExecutor$Worker.runTask(885)


java.util.concurrent.ThreadPoolExecutor$Worker.run(907)


java.lang.Thread.run(619)


 


Idle worker thread

http-8000-exec-1
21   TIMED_WAITING  5000
[EMAIL PROTECTED]
aa65fe  -1   41-1   17   -1

sun.misc.Unsafe.park(-2)


java.util.concurrent.locks.LockSupport.parkNanos(198)


java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.aw
aitNanos(1963)


java.util.concurrent.LinkedBlockingQueue.poll(395)


java.util.concurrent.ThreadPoolExecutor.getTask(944)


java.util.concurrent.ThreadPoolExecutor$Worker.run(906)


java.lang.Thread.run(619)


 


NIO endpoint


http-8000-ClientPoller
20   RUNNABLE   37000
-1   285   -1   8-1

sun.nio.ch.EPollArrayWrapper.epollWait(-2)


sun.nio.ch.EPollArrayWrapper.poll(215)


sun.nio.ch.EPollSelectorImpl.doSelect(65)


sun.nio.ch.SelectorImpl.lockAndDoSelect(69)


sun.nio.ch.SelectorImpl.select(80)



Re: Help getting MySQL connected to Tomcat

2008-02-24 Thread Alan Chaney

[EMAIL PROTECTED] wrote:
Thanks for the help. I still don't have this working completely, but 
tomcat is now working.


I tested mysql and it is using tcp/ip. mysql -h 127.0.0.1 -u javauser 
-p works fine.
Also the MSQLAdmin program shows it is connecting to the correct port 
3306





   Context init = new InitialContext();

   Context ctx = (Context) init.lookup(java:comp/env);

   DataSource ds = (DataSource) ctx.lookup(jdbc/CurrencyDB);
In the previous posts, you have used jdbc/TestDB in your resource 
defintion. I presume you have changed id?


 Resource name=jdbc/TestDB auth=Container type=javax.sql.DataSource

  maxActive=100 maxIdle=30 maxWait=1

  username=javauser password=javadude 
driverClassName=com.mysql.jdbc.Driver

  url=jdbc:mysql://localhost:3306/javatest/

/Context



-
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: Apache2 adn/or Tomcat6?

2008-02-22 Thread Alan Chaney
Or as I mentioned in a recent email, you can run something like jsvc and 
set the user to 'tomcat' which allows you to bind to the port and then

changes the user.

Regards

Alan


Mark H. Wood wrote:

I must've missed the place in the documentation where it explains how
to get Tomcat to start as root, then drop privileges after opening
listening sockets on low-numbered ports that are only accessible by
root, like Apache HTTPD does.

On most Unix-alikes, you have to choose:

o  tell people to use port 8080 or whatever nonprivileged port you
   configured;

o  use a packet-mangling firewall rule to remap port 80 to port 8080
   or whatever;

o  place a proxy (such as Apache HTTPD) in front of Tomcat to forward
   port 80 traffic;

o  run Tomcat as root, allowing buggy app.s to make arbitrary changes
   anywhere on your server.

If I ever have time to do something about that, I'll be sure to submit
a patch.





!DSPAM:47bf361642361264652389!


-
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: Apache2 and tomcat5.5

2008-02-20 Thread Alan Chaney
If you are running on Linux you may have problems using a 'plain' tomcat 
installation pointing at port 80. This is a system port and reserved for 
privileged access. You must


1. use some kind of redirection such as iptables and leave the tomcat 
mapping at 8080


OR

2 you must run tomcat as root THIS IS VERY BAD DON'T DO THIS

OR

3. use something like jsvc and set the 'user' to tomcat after starting 
up as root. jsvc will start as root and bind to the port and then

switch to the non-privileged tomcat user for normal operation.


Regards

Alan Chaney



Hassan Schroeder wrote:

On Wed, Feb 20, 2008 at 12:57 PM, elvberg [EMAIL PROTECTED] wrote:


 I've added to D-Link router Virtual Server List
 Name Private IP Protocol  Schedule
 87.227.4.194 192.168.0.135  TCP 80/80 always
 87.227.4.194 192.168.0.135  TCP 8084/8084 always


Why did you feel the need to change this, if you were able to connect
to the instance of httpd before?

And what's the 8084 for?

But as already suggested, make sure that Tomcat's actually running
and can be accessed locally; if not, check your startup logs.



-
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: deploy/undeploy probs with 6.0.14

2008-02-17 Thread Alan Chaney

I've seen the following causes:

1. Application not shutting down properly because threads still running.
2. Application holding on to system resources (files, database) (really 
another version of 1.)


Try stopping the app using the manager and checking that the log says 
that the app is undeployed properly. Then do a kill -3 (if on linux)
to view the stack trace. Or you can use JConsole to look at what threads 
are running with JMX.



Regards

Alan


Holger Burde wrote:

Hi;

I have some problems to deploy/undeploy a jsf 1.2 application to tomcat 
6.0.15. The usual way does not  work.


To undelpoy i have to

1 from tomcat manager stop the app
2 undeploy (if i use list apps after that step the app is still listed - 
the myapp dir in webapps is still there)

3 restart tomcat (now the app is gone from webapps)


Sometimes i even have to repeat step 2-3 two times. deploying the app 
without  restarting tomcat never worked but has to

(required for this project).

Deploying is similar hard  - mostly i need a tomcat restart because if i 
drop it or deploy via tomcat manager the app does not start correctly 
(state false / deployment error).


The application is about 21MB - the tomcat conf is pretty normal (almost 
unchanged).


Two simple hello world testapps i wrote work as expceted. they deploy / 
undeply as expected.


The application itself works ok if one gets beyound this hurdle.

Any hints or tips were to look for to solve that problem are welcome !

PS The webapp was build with netbeans6 / jsf 1.2  and tomcat 6.0.14 used 
for development


hb


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



!DSPAM:47b83e3c260821041662902!



-
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: managing user uploads best practices

2008-02-11 Thread Alan Chaney

Totally agree with everything brien says below.

I also run a web site with a large number of media objects. I've been 
involved in filing system and media projects for many years both in 
research and production capacity.


The slight increase in complexity of the solution to maintain the media 
objects outside the database is completely offset by the huge 
improvement in performance of the database.


Also it is particularly worth stressing the backup advantages. If you 
have 10,000 users (not a large number these days) each with 5 images 
and/or one podcast you are going to have very, very large monolithic 
database backups which are either going to be in a binary form and thus 
very opaque or simply huge as sql dumps unless you separate the binary data.


Another advantage is that it allows you to have a very scalable media 
server. The media server does not have to participate in the session. 
You can have a number of independent media servers who simply download 
files identified by an ID. The media server(s) don't have to be on the 
same box, platform or even in the same building. The issues of 
clustering simply go away (a media download is a single operation and 
thus does not benefit from clustering.) If you are running a large 
number of concurrent downloads, you only need a trivial load balancing

front end server to direct requests at the media servers. If you require
authentication to restrict access to the media then you may have a bit 
more work to do but it is not too difficult.


So if you have a site with a lot of media, you can tune the application 
component to be small and responsive and the media delivery components 
to be simple and fast and optimizied for continuous download.






brien colwell wrote:

On the topic of DB versus filesystem for media, I prefer storing media
in a filesystem and meta data in a DB. The advantages of storing large
binary files outside of the DB are

* Reduce contention in the DB -- it's doing so much
* You have more control with a filesystem where your data goes -- e.g.
you can have a disk for one type of data, and another disk for a
different type
* Filesystems are optimized to stream out data ... which I think makes sense

That first point is really key. If you're serving data to a UI from
the same database you're storing large files into, the whole
experience is going to suffer. The best article I've read on this
topic is

http://mysqldatabaseadministration.blogspot.com/2008/01/i-will-not-blob.html

The main scale issue I'm careful of is how many files I put per
directory. For large amounts of files, I sometimes link directories
into trees. I might be a little paranoid about this, but it seems to
scale well.

In terms of backup and security, I think a FS is easier to manage --
e.g. chmod and rsync on a cron job -- though you'll have to write more
code and scripts. You also have to be careful of things like shell
injection if you're running shell commands from your webserver.


Anyway, hope that gives some help. I was also confused with this when
I started writing DB backed apps.



On Feb 9, 2008 4:58 PM,  [EMAIL PROTECTED] wrote:

Thanks for the suggestions!

I like using the database for storage for it's easy maintenance and security, 
but marshalling a lot of binary data (like a large image library) adds a bit of 
overhead to the application.

I'll look into pursuing a storage directory external to the webapp.



 -- Original message --
From: Johnny Kewl [EMAIL PROTECTED]

---
HARBOR: http://coolharbor.100free.com/index.htm
The most powerful application server on earth.
The only real POJO Application Server.
Making the Java dream come true.
---
- Original Message -
From: [EMAIL PROTECTED]
To: users@tomcat.apache.org
Sent: Friday, February 08, 2008 11:13 PM
Subject: managing user uploads best practices

Yes... outside.
Its been a long long time now, vaguely remember struggling with Apache
uploader then eventually getting all to work...
Anyway... what I did is store the files in an Apache httpD folder, so I
could spy on the uploads, and they available for viewing again.
And whats cool is because Apache is also the load balancer in my case... can
have lots of TC's doing their thing.
I was making a kind of wiki thing for an estate agency... thats how I did
it way back when...



What's the current wisdom on managing user uploaded files to a web app
that's
deployed via a WAR?

In other words, when the WAR is updated, the directory containing uploaded
files
would be wiped out.

Do people save uploaded files outside of the web app root directory?
Security
issues with this?
Do people not use auto-expanding WAR files and manage the deployment by
hand?
Do you not include the directory for uploaded files in the WAR (but create
it at
runtime) and then trust that the 

Re: Application Realm in Tomcat

2008-02-07 Thread Alan Chaney
If you purpose is to find the roles in the database wouldn't it be 
better just to query the database? What kind of realm are you using?
If its something like the 'memory' realm then you can just read the 
file. If its a RDBM then a few lines of JDBC code or the use of a 
persistence manager would work.



Regards

Alan


Tim Funk wrote:
Via the spec - you can't query all the roles a user has. But you can say 
request.isUserInRole(rolename)


If you *need* access to the realm, things start to get ugly. You need to 
 start coding against Tomcat internal specific classes.


-Tim

maux wrote:
Hi, I am doing a Java code. This code have to access to the realm that 
an application in Tomcat is using, after that the code have to access

to that realm and look for the roles that exist in that database.


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



!DSPAM:47ab5f13234141497319589!



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



mbeans-descriptor.dtd

2008-01-30 Thread Alan Chaney

Hi

Where can I find the mbeans-descriptor.dtd?

The documentation mentions a 'fulldocs' download but I can't seem to 
find that.


Thanks in advance

Alan Chaney

-
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: mbeans-descriptor.dtd

2008-01-30 Thread Alan Chaney

Bill Barker wrote:

Got it, thanks very much!

For Tomcat 6, you can get it at 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/modeler/


For earlier Tomcat versions, you can get from common-modeler at 
http://commons.apache.org/downloads/download_modeler.cgi.
  



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

2008-01-29 Thread Alan Chaney

Unfortunately I think it is way more complicated than this.

I think that Mladen Turk's article has a lot of very useful information 
about configuring Tomcat and I congratulate him on putting it together. 
However, I've spent some time recently working on some performance 
issues and I think that for any given installation you must consider a 
number of factors.


These include:

1. The time it takes to prepare the data for delivery.

2. The way available resources are combined in the delivery of this data.

1. The database

Where a database or some other persistence mechanism is involved the
performance of the database can easily overwhelm almost all other 
considerations.


Is the database local or remote? If local, the time taken transferring 
results from the database to the business layer may not be that 
significant but the cpu time and disk I/O spent running the query will 
immediately reduce the resources available and thus increase the 
response time of web requests.


If remote then it is easy for the database to become a bottleneck for 
requests. Also the time transferring the data over the network becomes 
more significant and it is arithmetically added to the AART unless the 
data can be 'preread' and cached.


How well designed are the queries? Are they subject to issues such as 
badly designed indexes which mean that as the data set grows query 
processing time responds exponentially? Has the object design been 
tested for performance - an ORM solution can save a lot of time in 
development but add significant 'hidden' costs. [Please note, I think 
ORMs are a great idea and always use them where possible but like all 
technology they have their drawbacks!]



2. The mix of the need for resources by the application.

Issues to consider here include:

Are sessions required, and the size of the session. This can also 
significantly impact clustered performance. It may be better to keep 
keys for information in the session and re-read the data rather than 
read data once at the beginning of the session.


What processing is required in the business/web layer to structure the 
information? Is there significant XML processing (which can be very time 
intensive?) Is there significant EL processing on a page (which can be 
much slower than 'raw' java')


My experience is that the only way to really assess the overall 
performance of a system is to instrument the system extensively and then 
monitor it in action. Doing this will sometimes reveal bottlenecks which 
you just didn't consider. Of course even then you must be careful of 
'the Heisenberg effect'.


One final point. In Mladen Turk's example he assumes that the full 
bitrate bandwidth of an Ethernet connection is available for useful 
data. From previous experience I have seen that the overhead of the 
protocol and framing information reduce the 100 Mbps to more like 70 
Mbps which would change his max of 625 concurrent requests to about 440.


Another network related issue is that actually most client 'last hop' 
connections are considerably slower than 100 Mbps. Where TCP/IP is 
involved the thread which is actually writing to the network interface 
will block until the *client* has read all the data and indicated that 
the transmission is successfully completed.


In conclusion I think that if you apply two simple formulae to the 
design of a Tomcat based web application you may be shocked and 
surprised at the actual results unless you have very carefully analysed 
your design and investigated the factors which affect performance.


Regards

Alan



Andrew Hole wrote:

Hello

I read an interesting document from Mladen Turk (with whom I want to speak
directly, but I don't know direct contact) that there is a formula to
calculate the number of concurrent request:
http://people.apache.org/~mturk/docs/article/ftwai.html

Calculating Load

When determining the number of Tomcat servers that you will need to satisfy
the client load, the first and major task is determining the Average
Application Response Time (hereafter AART). As said before, to satisfy the
user experience the application has to respond within half of second. The
content received by the client browser usually triggers couple of physical
requests to the Web server (e.g. images). The web page usually consists of
html and image data, so client issues a series of requests, and the time
that all this gets processed and delivered is called AART. To get most out
of Tomcat you should limit the number of concurrent requests to 200 per CPU.

So we can come with the simple formula to calculate the maximum number of
concurrent connections a physical box can handle:

  500
Concurrent requests = ( -- max 200 ) * Number of CPU's
AART (ms)

The other thing that you must care is the Network throughput between the Web
server and Tomcat instances. This introduces a new variable called Average
Application Response Size 

  1   2   >