Re: More helpful reporting of exceptions in JSPs

2005-10-12 Thread Darryl L. Miles

Tim Fennell wrote:


I've posted my patch for Jasper/Tomcat at the following location:
http://www.tfenne.com/jasper/

The page has a brief overview, a download link and  "before and  
after" screenshots so you can get an idea for what exactly the patch  
does before you decide to patch your own environment.  If you give it  
a shot and have any problems and/or suggestions for improving it  
please let me know - but please read the readme first ;)



Excellent addition.  Maybe once you have got an initial around of 
feedback for users of the latest 5.0.x and 5.5.x you might like to post 
it up on Tomcat Bugzilla 
http://issues.apache.org/bugzilla/enter_bug.cgi?product=Tomcat%205 and 
attach the patch.


Darryl


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



Re: serving content from outside the context

2005-10-12 Thread Darryl L. Miles

John Laughton wrote:


Hi, I hope this is the right mailing list for this question

I am using tomcat 5.0.28
I have a simple web app and want to serve up some images in the jsp 
pages, but the images are outside the context


The HTTP statement looks like




The web app is under /usr/local/tomcat/webapp/family
On the browser it only shows "thumb image" as it cannot get to the 
hyperlink http://xx.xx.xx.xx/data/webData/family/DSC01183.JPG

(IP shown as xx.xx.xx.xx for security)

I have read a lot about tomcat and figure there must be a way to 
configure server.xml and/or web.xml to allow this to work, but cannot 
see it ?


It is possible ?


Are you wanting TC to serve the static files or do you use AJP connector 
and Apache.  The easiest way to serve files from outside is to let 
Apache serve them and configure up AJP connector, then mount the entire 
content or just *.jsp pages to TC.


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



Re: Database connections aren't being released...

2005-10-06 Thread Darryl L. Miles

Richard Road Runner wrote:


I am not sure that this is a Tomcat issue, but we are not sure what exactly is 
causing our problem.

We are running Tomcat 5.0.27.  We are using the most recent jconn2.jar driver 
to connect to a Sybase SQL Anywhere Studio 7 database via JDBC.

Over a period of time, the number of connections to the database continues to 
increase far beyond the possible number of users.  The only way to close the 
connections is to restart the database server.


 


Are you using DBCP ?

I have an issue with 5.5.9 and DBCP shipped with it I found 2 weeks 
ago.  I would describe my problem as DBCP is not "reusing database 
connections when it should" but it instead creates a new one, until the 
SQL server has too many connections (or your DBCP hits upper parameter 
limits).


With TC and MySQL I can confirm this by logging my database handle close 
and watching what happens with "SHOW PROCESSLIST" sql command on the 
server.   Each request needs 1 database connection and the logging 
should confirm it returns (releases) the connection back to DBCP pool.  
I have followed this path with the debugger and got inside DBCP to prove 
the release takes place.


I had put down the problem and just configured up my DBCP parameters to 
expire old connections as fast as possible and up the maximum limits.  
This wont work for me in production, maybe I switch to C3P0 connection 
pooling at that time.


Its just so difficult to help out and nail the problem with TCs 
refactored and repackaged DBCP, I would very much appreciate an SDK 
version of the full TC package that includes all source in the JARs.  I 
am doing a CVS build.xml now, but I think this will be for 5.5.12, I 
just need to work out how to fix the version for a 5.5.9 release and 
compare the two trees to maybe try and nail this one, or at least 
confirm the blame here is with DBCP.


--
Darryl L. Miles



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



Re: cannot setup JNDI with MySQL

2005-10-06 Thread Darryl L. Miles


"localhost" has special meaning to the MySQL command line tool, this 
uses the Unix Domain socket for transport, like /tmp/mysql.sock this 
does not work with Java I don't believe there is any API to access Unix 
Domain sockets.


Confirm:

mysql -h localhost -u username -ppassword database

AND

mysql -h 127.0.0.1 -u username -ppassword database


both work.. the first uses Unix Domain sockets the 2nd TCPIP socket, 
same as the Java JDBC driver uses.  Maybe "netstat -ton | grep 3306"  
can help you find where MySQL is connected with TCPIP.  If you can't 
find it you need to look at my.cnf from mysql's var direction, maybe 
/opt/mysql/var/my.cnf and check you DONT have "skip-networking" set.  
Then check for "port=" and "bind=" values if its running on the 
non-standard settings than INADDR_ANY:3306.




My question, in my (5.5.9) $CATALINE_HOME/common/lib I have:

commons-el.jar
jasper-compiler.jar
jasper-compiler-jdt.jar
jasper-runtime.jar
jsp-api.jar
mysql-connector-java-3.1.10-bin.jar
naming-factory-dbcp.jar
naming-factory.jar
naming-resources.jar
servlet-api.jar

But you also have:
commons-collections-3.1.jar
commons-dbcp-1.2.1.jar
commons-pool-1.2.jar

I am having problems with "naming-factory-dbcp.jar" I'm not sure which 
base version it is for a start and it does not seem to re-use the 
connections in the pool.  Is it possible to override the version shipped 
with TC adding a few files and changing the class path in the  
to the official Apache one ?


Do you know which version of DBCP is shipped with TC 5.5.9 ?


Thanks

Darryl

--
Darryl L. Miles



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



Re: Tracking Datasource Connection Usage?

2005-10-06 Thread Darryl L. Miles

Rob Hills wrote:




I started getting exceptions saying no connections were available on my JDBC
datasource  (org.gjt.mm.mysql.Driver).  The pool was definitely large enough
to handle the load.  So it appears that I'm not freeing the all the
connections as I should.  I noticed that I did not have the
'removeAbandoned' flag set on the Resource tag.  Changing that has
apparently fixed the out of connections problem.  But I really want to clean
up the code and fix it the right way.  I've got the close() statements in
place.  But obviously, I'm missing some of them somewhere.  Is there any
process for logging/tracking allocating and freeing connections (and absence
thereof.), available connections, etc?  Or are there any methods I can call
to give me this type of debug info?  What's the recommended way to debug
this?
   



There have already been useful tips on debugging, but I've found that 
the most common way to chew up connections is to not put the code 
that frees the conneciton inside a finally {} block.  If you don't free the 
connection in a finally {} block, it may not be freed if an exception 
occurs.


 

My understanding of finally is that it's ALWAYS executed, (even if 
something in any block (try or catch) does a return statement).  So I 
would say "finally" is good practice to close both Statement handles and 
Database Connection handles.  My first mistakes were in not closing 
statement handles this leaves resources open on handles that affect how 
the database connection can be reclaimed.  I was used to closing the 
database connection and expecting the open statement or resultset to be 
mopped up right away.  But if you think about it for a moment these 
resources might also be open on the SQL server through the connection 
and the GC takes a while to reclaim.


try {
// code 1
} catch(FooException e) {
// code 2
} finally {
// code 3
}
// code 4

No exception execution is: code1 + code3 + code4 + end_of_func
Caught FooException: code1 + code2 + code3 + return
Uncaught Exception: code1 + code3 (thrown to callee)

This is confirmed in my Just Java 2 (6th Edn) page 215.


On another matter I am using Apache DBCP and am finding that it does not 
seem to use the pooled connections, it always created a new connection 
to the MySQL server, even if there are a number of already existing free 
connection.  I am using a JNDI binding so the auth credentials should be 
working.  I am still in development with the application.




I too had to add extra flags in to get a stage connection pooler but 
believe there is something broken in DBCP that stops is re-using 
connections like it should.  This has simply covered over the problem.  
Maybe we can get together and compare notes, any ideas how to enable 
verbose logging of DBCP so I can confirm the application is doing what 
it should ?


I am using Hibernate3 have confirmed everytime that my servlet filter is 
closing the session and thus returning the connection back to DBCP like 
it should, the connection from MySQL "SHOW PROCESSLIST" are still 
connected and thus in the pool.  But the next servlet request always 
opens a new connection, when I dont think it should, it should use the 
one already in the pool.



Darryl


--
Darryl L. Miles



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



DBCP problems with Hibernate

2005-09-13 Thread Darryl L. Miles

Jason Bell wrote (under Re: Source code for naming-factory-dbcp.jar ?):

naming-factory-dbcp.jar 
 


Have a look at Commons DBCP.
http://jakarta.apache.org/commons/dbcp/

Hope this helps.
 


Yes thanks.

I've a problem, that with Hibernate 3.0.5 and TC 5.5.9 using DBCP I am 
quickly seeing exhaustion of connections.  With the default settings I 
can see 4 active connections with "SHOW PROCESSLIST" under MySQL.


I've managed to trace the code path from Hibernate during close of 
handle back into TCs DBCP code, so the close is being called.



How do you go about enabling DEBUG / TRACE output of DBCP under TC ?


Does anybody know of a TC 5.5.9 distibution in SDK form, that is with 
source and class files in the jars to help debugging this sort of 
problem, I've attempted to rename and attach source files in Eclipse to 
see whats going on but have found the line numbers out of sync.



How do you find out exactly which version of DBCP TC ships with ?



FYI my META-INF/context.xml:




Thanks

Darryl

--
Darryl L. Miles



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



Re: where to place the /META-INF/context.xml file?

2005-09-09 Thread Darryl L. Miles

Ben Wong wrote:


"A /META-INF/context.xml file can be used to define Tomcat specific 
configuration..."
 


MyWebApp/META-INF/context.xml


or inside your MyWebApp.war as:

META-INF/context.xml


--
Darryl L. Miles



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



Re: Tomcat/JVM hangs in session.getAttribute / HashMap.get()

2005-09-06 Thread Darryl L. Miles


It seems possible to be that one user simply pressing the reload button 
a few times quickly while the same page is not yet loaded can cause sync 
problems to his own session; and you can't control the user.


Err... does anybody have a replacement class for HttpServlet ?  A simple 
access wrapper class would only protect co-operative users of it, a 
replacement for HttpServlet would protect all users and persist across 
requests.


It seems like the general case needs to use one, while only performance 
optimized case would be able to make do with the current one.


While I agree developers should have access to low level classes to get 
raw performance, I don't agree that the normal case should expose such a 
basic design error.  HTTP is designed to specifically allow simultaneous 
requests to be processed at the same time.


With a replacement class for HttpServlet you'd be better of using a 
ReadWriteLock to protect access, which allows for threading of the 
common read access case.


Tut, tut.


Arup Vidyerthy wrote:


I have been watching this thread with interest.

Does this mean that all session.setAttribute() and session.getAttribute()
should always be synchronised (for instance, inside a servlet or struts
action) provided the same hashmap is accessed by say more than one
servlet/struts action?
 



--
Darryl L. Miles



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



Source code for naming-factory-dbcp.jar ?

2005-09-06 Thread Darryl L. Miles


Where is the source code that makes up the JAR naming-factory-dbcp.jar 
it does not appear to be inside:


jakarta-tomcat-5.5.9-src.tar.gz

--
Darryl L. Miles



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



Re: Pre-compiled JSPs?

2005-09-06 Thread Darryl L. Miles


What you see looks like normal jasper name mangling of generated pages.

You use: http://myserver:8080/RichardsApp/DoSomething.jsp


I presume there is also a generated mapping entry, that you may have 
overlooked:



 RichardsApp.DoSomething_jsp
 /DoSomething.jsp


Richard Burman wrote:


Hi Nicolas,

Thanks for your reply, I really appreciate your help. I'm not sure I
fully understand your solution. I see now that the webXmlFragment
provides a convenient way to generate the XML needed for the Servlets
but that have bizarre names.

Let's say I have a jsp:
/RichardsApp/DoSomething.jsp

Running Jasper at it provides a java file:
/RichardsApp/DoSomething_jsp.java

Then the Servlet definition would be:

 RichardsApp.DoSomething_jsp
 RichardsApp.DoSomething_jsp


The way to reference my JSP used to be:
http://myserver:8080/RichardsApp/DoSomething.jsp

What would the new reference be?
http://myserver:8080/RichardsApp/DoSomething_jsp
or
http://myserver:8080/RichardsApp/DoSomething

Have I missed something obvious?

Thanks for your help!
Richard.
 



--
Darryl L. Miles



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



Re: Do URL query strings with semi-colons work with TC ?

2005-09-06 Thread Darryl L. Miles


http://ppewww.ph.gla.ac.uk/~flavell/www/formgetbyurl.html Not sure what 
authorative basis this has, but it did turn up from NCSA based CGI 
specifications of yesteryear.


Maybe the MIME specification for application/x-www-form-urlencoded 
wherever that is (cant find it either).



It must be noted that a URL like this is valid syntax:

http://www.mydomain.com/pathseg1;foo=bar/pathseg2;foo=bar2/pathseg3;foo=bar3;foo=bar33?query=value

How the receiving HTTP server interprets the path is unspecified, and I 
don't think its mandatory for a HTTP server to support path params at 
any level.  Since JSESSIONID is being used I would say that only the 
last path parameters should be picked up and made available to the 
target servlet and an error given out to path params no part of the last 
segment (so no one tries to use them, leaving the door open for their 
implementation later in a server that would support some usage), that 
make these path params eligable for pickup:


foo=bar3
foo=bar33

As for precedence / override with tranditional query strings, i.e. 
should the namespaces be collsapse. sigh another issue to head scratch.


Darryl


Jon Wingfield wrote:

Aye. It just states for that, amongst others, amphersand and 
semi-colon are reserved characters within the query string.


This got me looking coz I assumed that the structure of the http get 
query string was defined somewhere in rfc rather than just a convention.


I found a few resources saying it was recommended to support ";" as a 
delimiter;
http://www.w3.org/TR/1999/REC-html401-19991224/appendix/notes.html#h-B.2.2 



But I also found the likely candidate in TC that does the parsing of 
the query string:
http://cvs.apache.org/viewcvs.cgi/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/http/Parameters.java?rev=1.15&view=markup 



Just for my peace of mind does anyone know where the "standard" use of 
amphersand to delimit name-value pairs in a http get query string is 
defined?


Jon

Darryl L. Miles wrote:



http://www.faqs.org/rfcs/rfc2396.html section 3.3 seems to be the 
best reference so far.


This RFC only specifies correct URI syntax, it does not mandate how 
that URI is used under any scheme (like "http:") is to be used.


Darryl L. Miles wrote:

The reference you cite http://www.faqs.org/rfcs/rfc2616.html (el al) 
maybe you could also cite the section I should look at.  A simple 
search for "param" or "semi" yeilds no related results.  I have 
spent an hour looking into the issue over the weekend and found the 
specification that covers the URI scheme for "http:" from this angle 
it seems to leave the part after the ? to denote the start of a 
query string vague.  Which lead me to a presumption that it was HTTP 
server dependant on its interpretation, since for example the CGI.pm 
modules changed over from & to ; as the standard param delimiter 
with generated URLs, providing the resulting URL talks back to 
itself (the CGI.pm module) all will be well in the world but if it 
links to a TC server then there would appear to be a problem.





--
Darryl L. Miles



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



Re: Do URL query strings with semi-colons work with TC ?

2005-09-06 Thread Darryl L. Miles


http://www.faqs.org/rfcs/rfc2396.html section 3.3 seems to be the best 
reference so far.


This RFC only specifies correct URI syntax, it does not mandate how that 
URI is used under any scheme (like "http:") is to be used.



Darryl L. Miles wrote:

The reference you cite http://www.faqs.org/rfcs/rfc2616.html (el al) 
maybe you could also cite the section I should look at.  A simple 
search for "param" or "semi" yeilds no related results.  I have spent 
an hour looking into the issue over the weekend and found the 
specification that covers the URI scheme for "http:" from this angle 
it seems to leave the part after the ? to denote the start of a query 
string vague.  Which lead me to a presumption that it was HTTP server 
dependant on its interpretation, since for example the CGI.pm modules 
changed over from & to ; as the standard param delimiter with 
generated URLs, providing the resulting URL talks back to itself (the 
CGI.pm module) all will be well in the world but if it links to a TC 
server then there would appear to be a problem.




--
Darryl L. Miles



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



Re: Do URL query strings with semi-colons work with TC ?

2005-09-05 Thread Darryl L. Miles


I'm not trying to encode semi-colon into QS.  I'm trying to use 
semi-colon as a replacement for & or rather & when correctly encoded 
into a HTML document.  On the basis that it makes the documents smaller 
and the code easier to write.  I have been left with the impression they 
are directly substitutable from various references around the internet.  
But your comments imply otherwise.



I'd be happy to lookup "path params" in the same way I do for query 
string params with a call:


value = request.getPathParameter(name);

Can I do this ?


Conceptually what is the difference between "path params" and "query 
string params" ?



I'd need to better understand when QS params should be used and path 
params can be used, with relation to cachability properties of the 
resulting resource, i.e. the external impact of resources using & 
verses ;



The reference you cite http://www.faqs.org/rfcs/rfc2616.html (el al) 
maybe you could also cite the section I should look at.  A simple search 
for "param" or "semi" yeilds no related results.  I have spent an hour 
looking into the issue over the weekend and found the specification that 
covers the URI scheme for "http:" from this angle it seems to leave the 
part after the ? to denote the start of a query string vague.  Which 
lead me to a presumption that it was HTTP server dependant on its 
interpretation, since for example the CGI.pm modules changed over from & 
to ; as the standard param delimiter with generated URLs, providing the 
resulting URL talks back to itself (the CGI.pm module) all will be well 
in the world but if it links to a TC server then there would appear to 
be a problem.



Thanks for your response.


Jon Wingfield wrote:

In a URL the semi-colon indicates the start of path parameters (as 
opposed to the normal query parameters) as defined in rfc2616 (HTTP1.1 
spec) et al.

Thus, you can't tell tomcat to use it as a query string delimiter.
JSESSIONID is a well known path parameter for Servlet 2.2+ Containers.

To use a semi-colon within a url you'll need to url encode it as %3B
To use it in the way you want you'll have to encode and parse the 
query string yourself.


HTH,

Jon

Darryl L. Miles wrote:



I swear I had application code working that was using semi-colons to 
delimit query string parameters.  I'm sure I've also seen TC append a 
";JSESSIONID=" at the end of the URL.


But my own application code written like:

String val = request.getParameters("name");

Yeilds: val="value;name2=foobar";


Is there an additional option to allow semi-colon usage, instead of 
&  ?


Running TC 5.5.9

Thanks.





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

.




--
Darryl L. Miles



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



Do URL query strings with semi-colons work with TC ?

2005-09-04 Thread Darryl L. Miles


I swear I had application code working that was using semi-colons to 
delimit query string parameters.  I'm sure I've also seen TC append a 
";JSESSIONID=" at the end of the URL.


But my own application code written like:

String val = request.getParameters("name");

Yeilds: val="value;name2=foobar";


Is there an additional option to allow semi-colon usage, instead of &  ?

Running TC 5.5.9

Thanks.

--
Darryl L. Miles



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



request.getServletPath() changes during request lifecycle, BUG or Specified behaviour ?

2005-08-27 Thread Darryl L. Miles


At the start of my HttpServlet class code:

request.getServletPath() = "/myServlet"

But then my HttpServlet code runs a MVC pattern and decides to forward 
off to a JSP page "/someDir/myPage.jsp" so inside any tag's inside that 
JSP page now get:


request.getServletPath() = "/someDir/myPage.jsp"

Which is just plain wrong.  Can anyone confirm if this correct behaviour ?


It seems pretty ludicrious that the request object is meant to be 
associated with the original request, so I would expect it to remain 
constant (unless my app overides it), like how we got here is pretty 
important stuff throughout the whole lifetime of a request.


The forwarding methodology JSP uses seems to be more related to the 
response part, as-in the path "/someDir/myPage.jsp" is a forwarding 
action that is being carried out in the response part.



To work around this sillyness:

I have added code into my HttpServlet like 
'request.setAttribute("getHttpRequestPath", request.getServletPath())' 
so that the original HttpRequest information can be preserved throughout 
the whole request lifecycle.


--
Darryl L. Miles



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



Markup Character Entities attr="<&">" BUG ?

2005-08-18 Thread Darryl L. Miles


The following example JSP page seems to be interpreted incorrectly.

<%@ page language="java" contentType="text/html; charset=UTF-8" 
pageEncoding="UTF-8"%>


<%@ taglib prefix="g" uri="http://domain.com/taglibs/generic-0.1"; %>


TAG GENERIC PAGE


attrFour="<&">"/>< <Tag Here




logged calls to setDymanicAttribute() showing the 3 arguments passed.

DEBUG 10:22:40,279 (GenericTag.java:setDynamicAttribute:47)  -null attrOne 1
DEBUG 10:22:40,285 (GenericTag.java:setDynamicAttribute:47)  -null attrTwo 2
DEBUG 10:22:40,287 (GenericTag.java:setDynamicAttribute:47)  -null 
attrThree <&">
DEBUG 10:22:40,298 (GenericTag.java:setDynamicAttribute:47)  -null 
attrFour <&">


It seems the " is correctly converted into " but other character 
entities are not.  It is my understanding that all markup file parsing 
should follow through the order of:


* characterize file from its encoding type (UTF-8, etc...)
* tokenize character stream looking for character entities and 
substitute what they represent (no matter where they are in the file), 
any substituted character may not be used as tokens that delimit markup 
elements in the next step

* now parse the markup in the resulting file

For performance reasons it probably doesn't happen exactly like that.  I 
am expecting output like:


null attrThree <&">
null attrFour <&">


I also notice that it seems common place to use JSP tags like this:

" width="10"/>

Is the above recursivly reliable like this:  "/>"/>








I appreciate the former maybe done as lazy short hand, but it appears to 
break something else which is a stronger binding standard.  There must 
be many possible alternative approaches in JSP to this problem that 
won't conflict with other elements of all the standards that come info play.


Is it possible to force a purist approach to this problem and switch off 
this mode to get back a reliable behaviour (even if it does seem like I 
have to take the long way around) call this idealized behaviour if you will.


Ultimatly our JSP authoring tools will be powerful enough to 
automatically hide complex tag constructs like this and allow us to see 
at a glance the representation we most like to see but really whats 
saved in the raw file maybe the unrolled purist version.


--
Darryl L. Miles



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



Re: virtual host and JkMount with jk1.2.14

2005-08-16 Thread Darryl L. Miles

Danico Lee wrote:

i got tomcat5, apache1.3 and jk1.2.14.  i'm very confused with 
JkMount. in my http.conf, i have:



ServerName our_server
DocumentRoot "${tomcat_home}/webapps/test1"
JkAutoAlias ${tomcat_home}/webapps
JkMount /test1/* worker1


Are you sure the "${tomcat_home}" works in Apache.  Try putting the full 
path name there.


I've never thought the httpd.conf undergoes any substitution expansion 
before parsing, let alone also have substitution expansion work within a 
quoted string literal as well.



--
Darryl L. Miles



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



Re: Tomcat5 / war file deployment: symlink problem

2005-08-16 Thread Darryl L. Miles

Alan Cooper wrote:

I have a tomcat5 installation running on a RHEL ES3 box which I am 
having some issues with.


I have a symlink back to an images directory which is outside the 
context. This works fine and I can read the images etc.


The problem occurs when I redeploy the context through the manager 
webapp: when the context is removed. the removal script seems to 
follow the symlinks, thus deleting my images directory.


Any suggestions on how to avoid this?


If they are part of the web-app then they should be inside the WAR in 
the first place.  The idea of the WAR is that its a self-contained 
COMPLETE web-application with no (few) external dependancies.


If they are an external repository your web-app can look into and work 
with, then you need to define some level of logical seporation in your 
web-app (like an API).  This maybe as simple as defining a property 
key/value with the absolute path to the top-level directory of the 
repositorory then making all file access to it resolve the system path 
before using it.  By doing that you can now move your images out of the 
web-app WAR file area and put them anywhere.  This is only useful if 
your servlets want file access to the repository but it sounds like you 
want HTML access to "images/foobar.gif" so they can be served directly.


--
Darryl L. Miles



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



Re: How to automatically start tomcat 5.5.9 under linux using local user

2005-08-16 Thread Darryl L. Miles

Duong BaTien wrote:


I set tomcat 5.5.9 running in port 8080 so it can be started without
using the root user. However, when I start tomcat using linux rc.local
at system start up (/apps/tomcat-5/bin/startup.sh), it seems that the
tomcat instance is started under root.

Question: Where do i set the user that starts tomcat instance via Redhat
 


Fedora Core start up?
 



READ: http://jakarta.apache.org/tomcat/tomcat-5.5-doc/setup.html

Check out the "-user " argument to "jsvc" which may not be so 
well documented.



For non-root running check out "jsvc" bundled with Tomcat:

Extracted TC to /opt/jakarta-tomcat-5.5.9

# To run it as java service need to build jsvc
cd $CATALINA_HOME/bin
tar -zxvf jsvc.tar.gz
cd jsvc-src
autoconf
JAVA_HOME="/opt/jdk1.5.0_04"
export JAVA_HOME
sh ./configure
make
cp jsvc ..
cd ..

# Create a system user for tomcat
/usr/sbin/groupadd  -g 155 jakarta
/usr/sbin/useradd -u 155 -g jakarta -s /sbin/nologin jakarta

# Fix all the permissions on the $CATALINA_HOME with
chown jakarta. -R $CATALINA_HOME

# This bit below you can put into your own startup script for TC and 
call each time

JAVA_HOME="/opt/jdk1.5.0_04"
export JAVA_HOME
PATH="$JAVA_HOME/bin:$PATH"
export PATH

CATALINA_HOME=/opt/jakarta-tomcat-5.5.9
export CATALINA_HOME

cd $CATALINA_HOME
   ./bin/jsvc -Djava.endorsed.dirs=./common/endorsed -cp 
./bin/bootstrap.jar \

   -outfile ./logs/catalina.out -errfile ./logs/catalina.err \
   -pidfile "./logs/jsvc.pid" \
   -user jakarta \
   org.apache.catalina.startup.Bootstrap





Maybe you create a script in /etc/init.d/mytomcat that works the same 
way at the others in there ?  Then symlink from each useful runlevel 
/etc/rc.d/rc[345].d/mytomcat -> /etc/initd.d/mytomcat, use 
/sbin/runlevel to see which you are at already.


Maybe you are lazy and simply add a few lines to /etc/rc.local ?


Eitherway should do the trick.

--
Darryl L. Miles



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



Re: Virtual Hosting with WAR files

2005-08-16 Thread Darryl L. Miles

Charles Meier wrote:



If I understand this setup correctly, you would be running one 
instance of Tomcat for all of your
virtual hosts.  This has the disadvantage that if one virtual host 
needs to be restarted, you will need

to restart Tomcat for all of your virtual hosts.

An alternative is to let Apache handle the virtual hosts and run 
multiple instances of Tomcat --
one instance per virtual host.  This requires multiple mod_jk 
instances, each communicating
across a unique port with an instance of Tomcat.  Each Tomcat should 
be deployed to its own
home dir w/ its own CATALINA_HOME pointing to that directory and with 
each Tomcat
given its own start/stop.sh script that sets CATALINA_HOME.  This is 
more complex to
set up, and I'm not sure how many separate Tomcats this can handle, 
but it does allow you

to have something like:


Maybe this is realistic in your hosting setup, but it would be absurd in 
mine.  The fact you are concerned that VirtualHost changing on the fly 
is an issue suggests you might have a great many VirtualHosts in the 
first place and to give each one their own JVM would be absurd.


As each JVM gets more and more use they will eat up system resources 
that it wont necessarly be given back to the system.  Each Apache 
instance will end up with a AJP socket open to each TC it would multiply 
up the socket usage, memory usage.


All so that you dont have to restart TC for VirtualHost changes.  I 
would much sooner write the code in TC (if its not already been done) to 
allow  level configuration changes to take place at runtime.



--
Darryl L. Miles



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



Re: Apache/Tomcat integration - Update

2005-08-16 Thread Darryl L. Miles


Do you have a line in Apache:

NameVirtualHost *:80

I dont think ServerName should have the port number after it.  This and 
ServerAlias are Host: header matching values.




I suspect your only remaining problem now is to get Apache and 
Tomcat to see the same website document roots for the same URLs.  
This maybe a problem if you are using deployed WARs since tomcat 
can and will delete the directory from under apache during the 
deployment process.


How do you mean "TC can and will delete the directory from under 
Apache"? Which directory do you mean? At this point, I am only trying 
to view the WARs bundled with TC. I am starting TC before Apache with 
the apps already deployed (so far).


I suggest you learn more about the exact nature of the "deployment 
procedure" from an packed WAR to an unpacked WAR that goes in within TC.



--
Darryl L. Miles



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



Re: Apache/Tomcat integration - What am I doing wrong?

2005-08-16 Thread Darryl L. Miles

Kyle wrote:



But I have not yet managed to get 
www.host.domain.com/-examples/ to work 
without returning a 500 Error.




First is it apache or tomcat that is returning the 500 ?



I'll leave the 500 question till I can be certain of the answer. I 
thought it could only be Apache. Will however ensure now.


Then breaking the ServerName and ServerAlias configuration in apache 
(restarting apache inbetween) 



Not certain I understand what you mean here. Break them ... ?? Do you 
simply mean give the default VHost a diff. name to the general 
ServerName directive above?



I mean when you are stuck and don't know.  Somethings are easier to 
deliberatly break the configuration and observe the result (i.e. where 
the error shows up now).   Since you are trying to work out if the 500 
is being produced directly from Apache or is a response apache is just 
relaying that really came from Tomcat.  It smells like apache to me, but 
until you can prove it you wont really know.


You need to confirm that requests for the vhost are being correctly 
routed into the VirtualHost section of the apache config.  If they are 
not then there is no sense looking at the JkMount configuration yet.  So 
if you have logging setup in apache both in the global config 
/usr/local/apache/log/access_log and in the  section to 
/tmp/foobar/someother/file/access_log then depending upon which file the 
request gets logged will confirm to you that Apache is correctly 
configured and working for vhost operation and the  
section your JkMount's are in it indeed coming into play.




JkMount  /admin/*  ajp13Wkr

This will pass-thru apache everything for the webapp to TC.


I would revise your JkMount to look like:

The multiple jkMount Directives are auto-generated by Tomcat. I could 
revise. I just thought it best to just leave them. I suspect they are 
so that IF I were to put any static content in those directories, 
Apache would pick it up instead.


Yes.  But in the situation you are in, setting up "/admin/*" should make 
Apache bounce the request off Tomcat if it was not table to serve the 
content itself.  I am not at all sure what the order of preceedence is 
with mixing "Alias", "JkMount" or if the file itself it found in the 
document root.


Once you have that established you can then work on your JkMount 
settings and Tomcat.  Have you checked out, understood and implement 
the information in 
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/host.html#Host+Name+Aliases 
?


Interesting question. Read it, I have.

It is not however clear to me as to whether or not TC _MUST_ have a 
_Different_ "VirtualHost Name" than the default VHost name in Apache 
or whether it should be the same. And then whether or not an Alias can 
or cannot be the same as some other name for that same machine.


Does this mean effectively there should be 3 different names for the 
same machine to function in this manner? I.e.

The "ServerName" directive in httpd.conf
The "ServerName" for the default VHost AND
yet ANother different defaultHost/Host name for Tomcat

Different No.  The idea is that you can service some content via Apache 
directly (maybe this is also PHP or Perl) and other content via 
Apache+Tomcat.  Apache is always in control, if the request is not 
forwarded to Tomcat then you will see the usual Apache like responses (404).


So if you want to a single hostname in the URL then you need to 
configure both Apache (ServerName/ServerAlias) and Tomcat ( / 
) to responsd to the same hostname.



I suspect your only remaining problem now is to get Apache and Tomcat 
to see the same website document roots for the same URLs.  This maybe 
a problem if you are using deployed WARs since tomcat can and will 
delete the directory from under apache during the deployment process.


So far, I am only trying to view the examples and default admin app.s 
that come bundled with TC. If I understand you correctly here, you are 
effectively saying that the auto-conf file generated by TC is not up 
to the job and I should dump it in favour of manual inline config.


No...  I'm not saying that I have no idea your Apache configuration was 
auto-generated by TC.  I'm just offering you a methodoligy to observe 
some change in behaviour so you can work through the problem yourself.




--
Darryl L. Miles



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



Re: Apache/Tomcat integration - What am I doing wrong?

2005-08-16 Thread Darryl L. Miles
dex.jsp  ajp13Wkr
JkMount /admin/host/hosts.jsp  ajp13Wkr
JkMount /admin/saved.jsp  ajp13Wkr
JkMount /admin/server/server.jsp  ajp13Wkr
JkMount /admin/resources/dataSource.jsp  ajp13Wkr

..

###
# with lots more mappings as generated by tomcat. #
###

# Static files
Alias /jsp-examples "/opt/jakarta-tomcat-5.5.9/webapps/jsp-examples"


Options Indexes FollowSymLinks
DirectoryIndex index.jsp index.html index.htm
Order allow,deny
Allow from all



# Deny direct access to WEB-INF and META-INF
#

AllowOverride None
deny from all



AllowOverride None
deny from all


JkMount /jsp-examples/security/protected/j_security_check  ajp13Wkr
JkMount /jsp-examples/*.jsp  ajp13Wkr
JkMount /jsp-examples/forward/one.jsp  ajp13Wkr
JkMount /jsp-examples/tagplugin/foreach.jsp  ajp13Wkr
JkMount /jsp-examples/dates/date.jsp  ajp13Wkr
JkMount /jsp-examples/jsp2/tagfiles/panel.jsp  ajp13Wkr



---

WHAT am I doing wrong please?



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





--
Darryl L. Miles
M: 07968 320 114


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



Re: Virtual Hosting with WAR files

2005-08-16 Thread Darryl L. Miles


in $CATALINA_BASE/conf/server.xml merge these settings:




 foo.com




 




 




 




Ensure the 3 sets of "webapps" and "work" directories are writable by 
the userid your JVM is running as.



Mahesh S Kudva wrote:

I have setup Tomcat+Apache2+mod_jk. I have 3 application in war files 
namely flie1.war, file2.war and file3.war. To deploy, I just put them in 
the deploy folder and access then using the urls:

http://foo.com/file1
http://foo.com/file2
http://foo.com/file3
This works perfectly for me. I want to change this to simple urls as 
follows:

http://file1.foo.com
http://file2.foo.com
http://file3.foo.com

I have also read the notes on Virtual hosting: 
http://jakarta.apache.org/tomcat/connectors-doc-

archive/jk2/jk2/vhosthowto.html

Even though I am not able to configure Tomcat to connect to the war files 
as requested. How do I configure tomcat to connect to the correct war 
file as requested?


Any help will be appreciated.



--
Darryl L. Miles



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



400 No Host matches server name BLAH

2005-08-15 Thread Darryl L. Miles


With Jakatra/5.5.9 I'm having trouble settings up a  that has its 
appBase="" setup outside of the usual $CATALINA_BASE directory tree.

Tomcat is running as userid "jakarta", file permissions are all fine and my web 
application auto-deploys sucessfully from a WAR within the alternate appBase="" directory 
tree.

But when I do HTTP request to my simple /index.jsp file I get the HTTP error "400 No 
Host matches server name test.foobar.com"

If I try and access my page as /MyROOT/index.jsp that works, but the META-INF/context.xml 
has a configuration that tries to setup this application as the default context 
(path="").

I believe I'm doing all the correct things to make this work.

I would also like to alias two (or more) contexts to the same web-app.  The default 
(path="") being just one of them.  I would like this to be possible from within the WAR 
file, but it appears only one  is allowed inside META-INF/context.xml as its the outer 
document tag for that file.  What do others thing, if it would be useful for TC to implement a TC 
specific extension that simply searched for META-INF/tomcat-context.xml that would facilitate the 
multiple  creation from WAR deployment.

Your help appreciated.



# telnet localhost 8080
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
GET /index.jsp HTTP/1.0
User-Agent: Wget/1.9.1
Host: test.foobar.com
Accept: */*
Connection: Keep-Alive
Pragma: no-cache

HTTP/1.1 400 No Host matches server name test.foobar.com
Server: Apache-Coyote/1.1
Date: Tue, 16 Aug 2005 03:45:20 GMT
Connection: close

Connection closed by foreign host.











# cat /opt/jakarta-tomcat-5.5.9/conf/Catalina/test.foobar.com/MyROOT.xml


   



# cd /opt/test.foobar.com && find tomcat
tomcat
tomcat/webapps
tomcat/webapps/MyROOT
tomcat/webapps/MyROOT/index.jsp
tomcat/webapps/MyROOT/WEB-INF
tomcat/webapps/MyROOT/WEB-INF/web.xml
tomcat/webapps/MyROOT/WEB-INF/classes
tomcat/webapps/MyROOT/WEB-INF/classes/test
tomcat/webapps/MyROOT/WEB-INF/classes/test/Klass.java
tomcat/webapps/MyROOT/WEB-INF/classes/test/Klass.class
tomcat/webapps/MyROOT/META-INF
tomcat/webapps/MyROOT/META-INF/context.xml
tomcat/webapps/MyROOT/META-INF/MANIFEST.MF
tomcat/webapps/MyROOT.war
tomcat/work
tomcat/work/MyROOT
tomcat/work/MyROOT/tldCache.ser

# ls -lad tomcat tomcat/webapps tomcat/work tomcat/webapps/MyROOT.war 
drwxrwxr-x  4 jakartajakarta 4096 Aug  3 12:31 tomcat

drwxrwxr-x  3 ftpuserjakarta 4096 Aug 16 04:39 tomcat/webapps
-rw-rw-r--  1 ftpuserjakarta 2251 Aug 16 04:39 tomcat/webapps/MyROOT.war
drwxrwxr-x  3 jakartajakarta 4096 Aug 16 04:39 tomcat/work

# ps uax | grep jsvc
root 22427  0.0  0.0  1600  536 ?Ss   Aug08   0:00 jsvc.exec 
-Djava.endorsed.dirs=./common/endorsed -classpath 
:/opt/jakarta-tomcat-5.5.9/bin/bootstrap.jar:/opt/jakarta-tomcat-5.5.9/bin/commons-logging-api.jar
 -Dcatalina.base=/opt/jakarta-tomcat-5.5.9 
-Dcatalina.home=/opt/jakarta-tomcat-5.5.9 
-Djava.io.tmpdir=/opt/jakarta-tomcat-5.5.9/temp -outfile ./logs/catalina.out 
-errfile ./logs/catalina.err -pidfile ./logs/jsvc.pid -user jakarta -Xmx2048M 
-Xms512M -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager 
org.apache.catalina.startup.Bootstrap start
jakarta  22428  0.0  1.1 2353532 86788 ? Sl   Aug08   3:05 jsvc.exec 
-Djava.endorsed.dirs=./common/endorsed -classpath 
:/opt/jakarta-tomcat-5.5.9/bin/bootstrap.jar:/opt/jakarta-tomcat-5.5.9/bin/commons-logging-api.jar
 -Dcatalina.base=/opt/jakarta-tomcat-5.5.9 
-Dcatalina.home=/opt/jakarta-tomcat-5.5.9 
-Djava.io.tmpdir=/opt/jakarta-tomcat-5.5.9/temp -outfile ./logs/catalina.out 
-errfile ./logs/catalina.err -pidfile ./logs/jsvc.pid -user jakarta -Xmx2048M 
-Xms512M -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager 
org.apache.catalina.startup.Bootstrap start




--
Darryl L. Miles



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



Re: data push

2005-08-12 Thread Darryl L. Miles

Patrick Thomas wrote:


Your remark about POJOs being part of the API prompted me to chime in
-- William pretty much gave you the general answer, that Tomcat
doesn't seem to be the best way to go for this (because everything is
passed via http).

Maybe HTTP is the transport protocol for a messaging framework that runs 
on top.  I don't know enough about all the different intra-JVM 
mechanisms I've head of CORBA, RMI over IIOP, EJB Remote, XML-RPC, and a 
dozen more related protocols.  Some are too raw or not a framework, some 
cover multiple levels of the same problem.  A more featureful 
Application Server (like JBoss) can already do EJB Local/Remote call 
design patterns out of the box, I don't (think I) need JBoss and 
everything it is.  I suppose what throwing in the air is the question:


Is there a web resource that details each of the common intra-JVM 
communication mechanisms thats in place for their pro's con's, 
everything from memory consumption, runtime speed, security policies, 
programming interface, easy of setting up how to future proof remotable 
API usage so it remains compatible and extensible at the same time.  
Then what contracts does each of these mechanisms provide to the 
applications that use them.


HTTP could be a big part of a push or pull data mechanism or it maybe 
implemented outside of HTTP with raw sockets and another wire protocol, 
in this case it would be a JAR file that sides outside of tomcat itself 
and my application which is running in the same JVM as TC would use it 
independatly of TC.


Your serializing objects idea is a little too raw for my use, I'm 
looking for something with a more reliable contract and wider community 
testing than a roll your own TCPIP stack approach.



--
Darryl L. Miles



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



Re: data push

2005-08-11 Thread Darryl L. Miles

Paul Wallace wrote:


Thanks Len,
And what of other protocols? Are sockets then required? What are
some other protocols that might be used to push/pull data? (off Tomcat I
know ;))

Paul.

 

I'm interested in the answer to this too.  What terms do I stick into 
google to find generic socket based communication systems between 
isolated JVMs ?   Protocols, Frameworks, something that will slot in 
with TC but not as raw as HTTP I want the API to be a POJO as possible 
but with a open / setup / work / close cycle.


Idealy I'm really after a multiplexing (read as single socket) messaging 
framework that can deliver command / event like objects to a remote JVM 
for processing then return the appropiate reponse object and have 
multiple events outstanding all in different states with any sized payload.


--
Darryl L. Miles



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



Re: HELP: Tomcat 5.5.9 with jsvc as low priviledges user on Linux fails in Bootstrap

2005-08-02 Thread Darryl L. Miles

MC Moisei wrote:

java.io.FileNotFoundException: 
/usr/local/tomcat/tomcat_home/conf/tomcat-users.xml.new (Permission 
denied)

at java.io.FileOutputStream.open(Native Method)


This smells like its calling for write access to the DIRECTORY  
/usr/local/tomcat/tomcat_home/conf/  (not the file)


Unless you have a left over file that is actually called 
conf/tomcat-users.xml.new from a previous execution of TC that did not 
complete the edit and rename.  In which case I think you need to delete 
the conf/tomcat-users.xml.new file (after you've ensured you have a 
valid and working conf/tomcat-users.xml file itself).



FYI - I run jsvc too and have not seen this problem with 5.5.9.

jsvc.exec -Djava.endorsed.dirs=./common/endorsed -classpath 
:/opt/jakarta-tomcat-5.5.9/bin/bootstrap.jar:/opt/jakarta-tomcat-5.5.9/bin/commons-logging-api.jar 
-Dcatalina.base=/opt/jakarta-tomcat-5.5.9 
-Dcatalina.home=/opt/jakarta-tomcat-5.5.9 
-Djava.io.tmpdir=/opt/jakarta-tomcat-5.5.9/temp -outfile 
./logs/catalina.out -errfile ./logs/catalina.err -pidfile ./logs/jsvc.pid
-user jakarta -Xmx2048M -Xms512M 
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager 
org.apache.catalina.startup.Bootstrap start


--
Darryl L. Miles



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



Re: TC5.5.9 Linux - shutdown port 8005 not bound BUG?

2005-08-02 Thread Darryl L. Miles


FYI - From TC bugzilla.  So I added "-pidfile jsvc.pid" to my execution 
and am not killing the jsvc process not the JVM itself.


--- Additional Comments From [EMAIL PROTECTED]  2005-08-02 03:51 ---
This is by design.  With jsvc, you are supposed to shutdown Tomcat by:
 kill -TERM `cat $PIDFILE`

As a result, jsvc doesn't tell Tomcat to listen on port 8005.


--
Darryl L. Miles



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



Re: TC5.5.9 Linux - shutdown port 8005 not bound BUG?

2005-08-01 Thread Darryl L. Miles

Peter Crowther wrote:

From: Darryl L. Miles [mailto:[EMAIL PROTECTED] 
Subject: TC5.5.9 Linux - shutdown port 8005 not bound BUG?
I've never had TC bind itself to 127.0.0.1:8005 to allow correct 
shutdown to occur.
   



[...]

 


$ netstat -tanp | grep 80
tcp0  0 :::127.0.0.1:8009   
:::*LISTEN  4621/jsvc.exec
   



There it is, on 8009 not 8005.

 


Should I file this as a bug ?
   



Depends - have you changed your server.xml at all?
 


Sorry yes... 8009 is the apj13 port (was figuring you'd guess).

My apache is using it locally I have added address="127.0.0.1" for ajp13 
so its not exposed externally.



--
Darryl L. Miles



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



TC5.5.9 Linux - shutdown port 8005 not bound BUG?

2005-08-01 Thread Darryl L. Miles


I've never had TC bind itself to 127.0.0.1:8005 to allow correct 
shutdown to occur.  I've always had to kill the TC JVM.


I use JSVC to be able to get a non-root userid.  Does this affect how 
the shutdown port works ?


My startup command line:

./bin/jsvc -Djava.endorsed.dirs=./common/endorsed -classpath 
:/opt/jakarta-tomcat-5.5.9/bin/bootstrap.jar:/opt/jakarta-tomcat-5.5.9/bin/commons-logging-api.jar 
-Dcatalina.base=/opt/jakarta-tomcat-5.5.9 
-Dcatalina.home=/opt/jakarta-tomcat-5.5.9 
-Djava.io.tmpdir=/opt/jakarta-tomcat-5.5.9/temp -outfile 
./logs/catalina.out -errfile ./logs/catalina.err -user jakarta -Xmx2048M 
-Xms512M 
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager 
org.apache.catalina.startup.Bootstrap start


$ netstat -tanp | grep 80
tcp0  0 :::127.0.0.1:8009   
:::*LISTEN  4621/jsvc.exec
tcp0  0 :::127.0.0.1:8080   
:::*LISTEN  4621/jsvc.exec



Should I file this as a bug ?

--
Darryl L. Miles



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



Re: Placing a LifecycleListener in my server.xml

2005-07-27 Thread Darryl L. Miles

Mark Benussi wrote:


Thanks Darryl

I have followed this guide but don't know how to add the modify the
server.xml I attached to reflect this. Also are you saying I should put the
class that implements the listener in the server/classes?

I am fine with this but wasn't sure if it would all get loaded together as
the class is a Singleton that the rest of my code talks to and need to be
sure it will have access to the same class instance in the JVM.

 


From the example you quoted right at the top there is:

[...SNIP...]




[...SNIP...]

So you just add your:
  


To confirm location grep "jar -tvf tomcat-foobar.jar" from 
$CATALINA_HOME/servers/lib for mbeans/ServerLifecycleListener.class.


As for ensuring the SAME instance of the Singleton is found, maybe you 
must put it into $CATALINA_HOME/common/lib not server/lib!  Please read 
up on the differencies for clarification.


It is my understanding that only the Tomcat Application Server itself 
loads classes from $CATALINA_HOME/servers/* and that all librarys in 
$CATALINA_HOME/common/* are available to both the AS and the WEBAPP 
contexts.  Just make sure you dont override the class by also installing 
it into the WEB-INF/* area.


If this does not work maybe JNDI is the only way, that is bind the 
instance to a JNDI path at the first lifecycle event then all the 
webapps can lookup and use it  (if simplistic class loading does not work).


I have not used this method before as I found other ways to do what I 
needed, I wanted to deploy the listener within my webapp.




-Original Message-----
From: Darryl L. Miles [mailto:[EMAIL PROTECTED] 
Sent: 27 July 2005 12:10

To: Tomcat Users List
Subject: Re: Placing a LifecycleListener in my server.xml


Sorry did not read properly..

Have you tried:

for JARs:  $CATALINA_HOME/server/lib or $CATALINA_HOME/common/lib
for .class: $CATALINA_HOME/server/classes or $CATALINA_HOME/common/classes


From: http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/context.html

*Lifecycle Listeners*

   If you have implemented a Java object that needs to know when this
   *Context* is started or stopped, you can declare it by nesting a
   *Listener* element inside this element. The class name you specify
   must implement the |org.apache.catalina.LifecycleListener|
   interface, and it will be notified about the occurrence of the
   coresponding lifecycle events. Configuration of such a listener
   looks like this:


 ...
 
 ...


   Note that a Listener can have any number of additional properties
   that may be configured from this element. Attribute names are
   matched to corresponding JavaBean property names using the standard
   property method naming patterns.

 



--
Darryl L. Miles



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



Re: Placing a LifecycleListener in my server.xml

2005-07-27 Thread Darryl L. Miles


Sorry did not read properly..

Have you tried:

for JARs:  $CATALINA_HOME/server/lib or $CATALINA_HOME/common/lib
for .class: $CATALINA_HOME/server/classes or $CATALINA_HOME/common/classes


From: http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/context.html

*Lifecycle Listeners*

   If you have implemented a Java object that needs to know when this
   *Context* is started or stopped, you can declare it by nesting a
   *Listener* element inside this element. The class name you specify
   must implement the |org.apache.catalina.LifecycleListener|
   interface, and it will be notified about the occurrence of the
   coresponding lifecycle events. Configuration of such a listener
   looks like this:





 ...
 
 ...

   





   Note that a Listener can have any number of additional properties
   that may be configured from this element. Attribute names are
   matched to corresponding JavaBean property names using the standard
   property method naming patterns.






Mark Benussi wrote:

Thanks Darryl but I need to implement a LifecycleListener. You have 
implemented a ServletContextListener which only gets called when the 
Content is started. I need to know when its finished, which is why I 
am using a LifecycleListener which should be placed in the server.xml


Original Message Follows
From: "Darryl L. Miles" <[EMAIL PROTECTED]>
Reply-To: "Tomcat Users List" 
To: Tomcat Users List 
Subject: Re: Placing a LifecycleListener in my server.xml
Date: Wed, 27 Jul 2005 11:47:17 +0100

Mark Benussi wrote:


Anyone have any ideas where on earth I put my class that implements the
LifecycleListener (In a jar in my WEB-INF/lib) as I don't seem to have a
context in my server.xml.



The context is in WEB-INF/web.xml

as its a webapp specific listener, NOT a global server thing.

See my article http://www.hibernate.org/301.html as an example (when 
used with hibernate)


--
Darryl L. Miles



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



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

.




--
Darryl L. Miles



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



Re: Placing a LifecycleListener in my server.xml

2005-07-27 Thread Darryl L. Miles


Sorry did not read properly..

Have you tried:

for JARs:  $CATALINA_HOME/server/lib or $CATALINA_HOME/common/lib
for .class: $CATALINA_HOME/server/classes or $CATALINA_HOME/common/classes


From: http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/context.html

*Lifecycle Listeners*

   If you have implemented a Java object that needs to know when this
   *Context* is started or stopped, you can declare it by nesting a
   *Listener* element inside this element. The class name you specify
   must implement the |org.apache.catalina.LifecycleListener|
   interface, and it will be notified about the occurrence of the
   coresponding lifecycle events. Configuration of such a listener
   looks like this:





 ...
 
 ...

   





   Note that a Listener can have any number of additional properties
   that may be configured from this element. Attribute names are
   matched to corresponding JavaBean property names using the standard
   property method naming patterns.






Mark Benussi wrote:

Thanks Darryl but I need to implement a LifecycleListener. You have 
implemented a ServletContextListener which only gets called when the 
Content is started. I need to know when its finished, which is why I 
am using a LifecycleListener which should be placed in the server.xml


Original Message Follows
From: "Darryl L. Miles" <[EMAIL PROTECTED]>
Reply-To: "Tomcat Users List" 
To: Tomcat Users List 
Subject: Re: Placing a LifecycleListener in my server.xml
Date: Wed, 27 Jul 2005 11:47:17 +0100

Mark Benussi wrote:


Anyone have any ideas where on earth I put my class that implements the
LifecycleListener (In a jar in my WEB-INF/lib) as I don't seem to have a
context in my server.xml.



The context is in WEB-INF/web.xml

as its a webapp specific listener, NOT a global server thing.

See my article http://www.hibernate.org/301.html as an example (when 
used with hibernate)


--
Darryl L. Miles



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



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

.




--
Darryl L. Miles
M: 07968 320 114


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



Re: setting -Xss option and its impact on servlet threads

2005-07-27 Thread Darryl L. Miles


Peddireddy Srikanth wrote:


 1) what is the default stack size for Sun JVM on windows (Win 2003
to be more specefic)??
 


Dont know.


 2) Will this setting affect both normal threads and the servlet
threads created by tomcat?? or only normal threads?
 

I believe there is a 1:1 corelation between all Java application 
threads, be they Servlet or normal threads.  That is to say a Servlet 
thread uses exactly 1 Java thread.


 3) If I set that to, say 128K , and if some of my thread (servlet 
or  normal) needed more stack space than this in any case what happens

(obvious answer for this would be that thread execution would fail but
I want to know it from some one who experienced it)
 


Are you able to change the stack size on a per Java Thread basis?

If the underlying JVM uses kernel level threads and stack arrangement in 
a 1:1 fashion (unlikely from the observations I've seen), an unmapped 
page/area is usualy left at the end of the stack space if this is 
touched (read or write) the application will get a terminal signal and 
the entire JVM forced to exit just like it would accessing any other bit 
of invalid memory.


However as JVM is a sandbox and it can know the amount of stack space a 
method needs before its invoked it is completely possible for it to be 
able to check/test its virtual Java stack has enough space left in the 
CPU instruction stack as there does not need to be 1:1 to the Java 
execution stack.  Its possible for a JVM to implement its Java code 
execution stack completely within the operating system heap area.


I dont believe Java in general needs a large java execution stack as all 
arrays are implemented as object allocations that come from the heap.  
So its not like the C language where you can have a few Kb byte array on 
a whim, in Java it just has to store the pointers to that array as a 
local variable in the java execution stack.



I would be very interested to understand how Sun's JVM application stack 
works and its interactions with OS level threads,  stacks and address 
space applications.


With platform level threads there is a clear trade off with thread stack 
size and number of available threads, amount of available heap and 
number of library / file mappings (when working with 32bit CPUs at 
least).  They all squeeze each other for their bit of address space but 
in Java this does not seem to be the case so much.


--  
Darryl L. Miles




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



Re: Placing a LifecycleListener in my server.xml

2005-07-27 Thread Darryl L. Miles

Mark Benussi wrote:


Anyone have any ideas where on earth I put my class that implements the
LifecycleListener (In a jar in my WEB-INF/lib) as I don't seem to have a
context in my server.xml.
 


The context is in WEB-INF/web.xml

as its a webapp specific listener, NOT a global server thing.

See my article http://www.hibernate.org/301.html as an example (when 
used with hibernate)


--
Darryl L. Miles



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



Re: Ports 8005 8009 8080 in default Tomcat 4.x installation.

2005-07-21 Thread Darryl L. Miles


127.0.0.1:8005 : Shutdown port, I've not seen this working in TC in a 
while.  You are meant to be able to connect and send the shutdown 
password with EOL and it instructs TC to shutdown gracefully.  Other 
method of doing the same include installing the TC admin webapp and 
doing the same thing from the frontend.


127.0.0.1:8009 AJP/1.3 (Apache J Protocol) Connector port.  This is used 
to connect Tomcat to another webserver, for example with Apache Httpd 
you would install mod_jk in the httpd and it would connect to TC on this 
port.  There are also other connectors for IIS that use this common wire 
protocol to comunicate.  I believe this wraps the HTTP request response 
with other control information in a more machine readable format than 
making TC re-parse the entire HTTP request and also can convery SSL 
security info if mod_ssl is in use.


publicIP:8080 HTTP Webserver.  This is a direct HTTP server 
implementation Coyote inside TC, this allows TC to act as a standalone 
webserver without the need for Apache/IIS.


Leon Pu wrote:


After lauching Tomcat with the default ports setting in
conf/server.xml. I use netstat to check the opening ports, but I only
found 8080 port is using.

What's the exact usage of preceding three ports?
 




--
Darryl L. Miles



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



Re: Max thread/session timeouts

2005-07-21 Thread Darryl L. Miles

Kenneth Litwak wrote:


 We're running an application on Tomcat that often hits the limit of
150 threads.  Can someone with experience changing this value give me
advice on it?  How big can you make this number?  How much extra memory
do I need if I say change it to, say, 500?  Thanks.
 

I take it you know the 150 is the default limt in the config/server.xml 
and this can be upped towards you operating system platform maximum.


A ball park of your applications memory needs @150 threads is better 
chcked by simply looking at the paged in size while under that load (the 
RSS size in "ps uaxw" under Unix).  You can't expect us to guess exactly 
how much more memory you need from the information you've given, I mean 
you've not told us if you already have 8Gb of RAM installed or just 32Mb 
for us to at least take a guess at the answer.


Maybe the Java VM -Xss is a useful option to look at, but I think 
providing you are not hitting your upper limit on a single process 
memory usage (into the 3/4Gb realm on 32bit) for a high number of 
threads then it will make little difference.  As I believe stack space 
just like other application memory is paged in as its used and reducing 
the stack space to a lower limit than your application need will just 
make it crash.


--
Darryl L. Miles



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



Re: IE-Page not found problem

2005-06-14 Thread Darryl L. Miles

Mark Leone wrote:

The point is that IE is not providing the resource to the user *the 
first time* because there is a no-cache directive associated with it. 
IMO there is noting in the HTTP spec that even hints that this is how 
the no-cache directive is to be used. If IE needs to temporarily store 
the resource in order to provide it to the user, and a no-cache header 
is present, then it should find a way to give it to the user without 
caching it (which of course is not the same thing as temporarily 
storing it for spooling purposes), instead of refusing to let the user 
see it the first time the server sends it, and then hiding behind the 
HTTP spec to justify a poor implementation.


I think the end result speaks for itself. What possible use could a 
no-cache directive have if it means that user agents can't even give 
the resource to the user the first time it's requested? If this is 
really what the spec means, then every non-cacheable resource on the 
web is a self-licking ice-cream cone. Probably tastes great, but no 
one will ever really know. All the other user agent implementers seem 
to have interpreted the spec appropriately, without failing to give 
the users the resource the server explicitly provided to them.



Maybe IEs implementation existed before HTTP 1.1 and before the 
"no-store" option was introducted, which seems to clarify the matter of 
what isn't allowed to be stored to disk, there is nothing else in the 
specififcation that mandates the user-agent or cache can not (in the 
process of serving the orginary request) store it to disk (if the 
implementation needs to).   From the HTTP spec point of view caching is 
"just an observable concept", I make this statement to disconnect it 
from the presumption it has anything to do with storing to disk or not.


I agree with you on what possible use could no-cache be within IE if 
implemented their way.


I've worked with dynamic HTML for quite a few years and can't remember 
stumbling over this problem, what is the simplest server response that 
triggers this problem in IE ?



Darryl


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



Re: IE-Page not found problem

2005-06-13 Thread Darryl L. Miles


Mark Leone wrote:

It's a silly problem. I ran in to it a while back, and it really 
mystified me until I found the bug write-up. Tomcat is doing the right 
thing, but MS has declared that IE is working "as designed" in this. 
FWIW, the HTTP spec is clear that the no-cache behavior applies to 
HTTP intermediaries, not user agents.



"the HTTP spec is clear that the no-cache behavior applies to HTTP 
intermediaries, not user agents."


Are you really sure ?

I have always understood the HTTP 1.1, "Cache-Control no-cache" response 
header to be able to control both intermediaries and user agent caching 
activities.


The specification does not talk in terms of user agent caches and 
intermediary caches it only talks in terms of caching operations (for 
the large part) with a few additional directives to target shared-public 
and/or private cache behaviour.


As there is no differenciation between shared-public and private caches 
when it comes to the "no-cache" directive, all caches must revalidate 
the request before subsequent reuse, this means an If-Modified-Since is 
an allowed type of request to the server, but since most non-static 
Tomcat/Perl/CGI/WhateverTechnology do not handle If-Modified-Since 
request directives anyway.  A new page is generated and a 200 response 
given, the net effect is no observable caching effect.  The important 
point of "no-cache" is your HTTP client must ask the server before you 
re-use your cached object, its upto the server to then say "No!  Here 
use this instead".


This does not help you with your IE problem thats just bad handling of 
the response.


Darryl




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