How can I limit the number of instance my servlet can server concurrently?

2006-04-04 Thread Meryl Silverburgh
Is it possible to limit Tomcat to just handle 10 concurrently request
to my servlet?
for all others (11 and onward), it will queue them up, and serve them
only when one of the currently-serving request is done?

Thank you.

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



Datasource configuration for Oracle 9i in Tomcat 5.5

2006-04-04 Thread Thanigaivel_Murugan
Hi,

 

I do not know how to configure datasource in Tomcat 5.5 for Oracle 9i. I
tried like this...

 

1. Server.xml configuration:

 

!-- Global JNDI resources --

  GlobalNamingResources

 

!-- Test entry for demonstration purposes --

Environment name=simpleValue type=java.lang.Integer
value=30/

 

Resource name=jdbc/myoracle auth=Container

  type=javax.sql.DataSource
driverClassName=oracle.jdbc.driver.OracleDriver

 
url=jdbc:oracle:thin:@TESTSERVER:1521:TESTDB

  username=scott password=tiger maxActive=20
maxIdle=10

  maxWait=-1/

 

  /GlobalNamingResources

 

2. Test.jsp

 

Context initContext = new InitialContext();

Context envContext  =
(Context)initContext.lookup(java:/comp/env);

DataSource ds =
(DataSource)envContext.lookup(jdbc/myoracle);

Connection conn = ds.getConnection();

 

Output:

 

javax.servlet.ServletException: Cannot create JDBC driver of class ''
for connect URL 'null'

 

Can anyone knows the solution?

 

- Regards

  Thanigai

 



DISCLAIMER:
This email (including any attachments) is intended for the sole use of the 
intended recipient/s and may contain material that is CONFIDENTIAL AND PRIVATE 
COMPANY INFORMATION. Any review or reliance by others or copying or 
distribution or forwarding of any or all of the contents in this message is 
STRICTLY PROHIBITED. If you are not the intended recipient, please contact the 
sender by email and delete all copies; your cooperation in this regard is 
appreciated.


tomcat one more then one CPU

2006-04-04 Thread Walter Botman
Hello, 

Can we configure tomcat in a way that it uses more then one CPU? 
It seems to use only one CPU ? 

We are using the following: 
- Sun Fire v240 (with 2 CPU's) 
- Solaris 8 (including patches) 
- tomcat 5.5.7 
- Java 1.5.0 

Thanks 

Walter 


Re: Rephrased: Maximum number of simultaneous HTTP connections

2006-04-04 Thread Tomas Klockar
It is always possible to build an applet. It should be able to do the 
networking the right way, and I just tested a small program that just 
forks n threads in java. the thread sleeps for 10s then print something. 
3000 of these threads took 655 MB on  freeBSD box, and only little cpu.


regards,

/Tomas

Rajeev Jha wrote:
I think everybody on the list here agrees that http is not the right 
sort of thing for a chat  application. And most  of the IM/chat  
applications  do not  run on  http  anyway. opening the sockets 
directly for such an application is better/easier any day.

rant
However,  people do demand  an  HTTP  end point to  existing 
applications. The big attraction is avoiding any client software, you 
just need a browser.

so finally it is about the availability of an end point in most cases.
/rant

Thanks

Darryl L. Miles wrote:


Tp wrote:



Well, that's a good question. The outcome of this thread might be 
just that. But it would have been nice to use existing software 
infrastructure.


Maybe look at the IRC protocol ?   Has existing infrastructure, 
heritage and eco-system.


http://www.irchelp.org/irchelp/rfc/
http://www.irchelp.org/irchelp/ircd/

The outline of the protocol is one persistent connection per client, 
there are a handful of server implementations to choose from which 
have been optimized to handle in the region of ~1 socket 
connections per server generally using few threads (certainly not one 
thread per connection).  You can scale the system with hooking up 
servers (daisy chain).  The protocol has been around a bit longer 
than HTTP and serves a completely different purpose more fitting with 
your requirements.  The only bad point is no real high-availability 
plan from the clients perspective (you may loose a fragment of a 
conversation during server migration), but the server implementations 
have stood the test of time and are on the whole quite stable.


Maybe you are trying to use a jumbo jet to fly to the moon with HTTP.





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



Re: how to control lifetime of JSessionID cookie in Tomcat 5.5

2006-04-04 Thread Leon Rosenberg
I think you mixing things up. The http session isn't designed to run
forever. The session ends as soon as the user closes his browser.
If you want to have some kind of direct login, you should just set
your own cookie, evaluate this cookie in your first servlet/jsp/action
or filter and login the user properly. Trying to prolong the session
duration is surely not the right way to do it.

regards
Leon

On 4/4/06, Andrew E. Davidson [EMAIL PROTECTED] wrote:
 Hi



 I am trying to figure out how to set up my application so that users are
 only forced to log on every couple of day. Sort of like my.yahoo.com. If you
 click remember my id you can close/restart you browser and not have to log
 back in again.



 Here is part of my web.xml file



 session-config



   !-- the session time out is set so that they can



 be idle for about 1.5 days



   --



   session-timeout2160/session-timeout



 /session-config



 I think the problem that that the jsessionid cookie is not being created
 correctly. When I looked at the cookie in my browser, I noticed that Expires
 was set to at end of session. Any one know how I can configure this?



 I guess I could create a filter, to get the cookie and call setMaxAge(), how
 ever its seems like I should not being writing this kind of code



 Any help would be greatly appreciated



 Andy








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



about maxProcessors attribute

2006-04-04 Thread Iratxe Etxeberria Sainz-Ezquerra






Hi!
I am reviewing my apache-tomcat configuraction, trying to tunning the 
performance.
I use AJP/1.3 connector between apache and tomcat 5.0.28.
I have the default value for maxProcessors attibute (20). In apache I have 
maxclients to 150 value. Does someone know how works it exactly? One processors 
by each request from apache to tomcat, I suposse..
Is there any way to know how many processors are running in the machine? Thanks 
in advance
 Iratxe



-
Iratxe Etxebarria Sainz-Ezkerra
Soporte Web
External Global Services
Tfno: 946 584 773 / 628 717 375





-

- Este mensaje y los documentos que, en su caso, lleve anexos, pueden contener 
informacion confidencial. Por ello, se informa a quien lo reciba por error que 
la informacion contenida en el mismo es reservada y su uso no autorizado esta 
prohibido legalmente, por lo que en tal caso le rogamos que nos lo comunique 
por la misma via , se abstenga de realizar copias del mensaje o remitirlo o 
entregarlo a otra persona y proceda a borrarlo de inmediato.

- Mezu honek eta erantsita dituen agiriek (baldin baditu) isilpeko informazioa 
izan dezakete. Hori dela eta, hutsegite baten ondorioz jasotzen duenak jakin 
beza bertan dagoen informazioa ezkutukoa dela eta legeak galarazi egiten duela 
berori baimenik gabe erabiltzea.

- Aquest missatge i els documents que, donat el cas, portin annexes, poden 
contenir informacio confidencial. Per aquest motiu, se n'informa a qui el rebi 
per error que la informacio continguda es reservada i que el seu us no esta 
legalment autoritzat.

- Esta mensaxe e os documentos que, no seu caso, leven anexos, poden conter 
informacion confidencial. Por isto, informase a quen o reciba por erro que a 
informacion contida no mesmo e reservada e o seu uso non autorizado. Esta 
prohibido legalmente.

- This message together with any documents attached may contain confidential 
information. You are informed that if you should receive it by mistake, the 
information it contains is reserved and its use is not authorised. It is 
legally prohibited. If you have received this message by mistake, please let us 
know as soon as possible by e-mail. Do not make any copies of the message, nor 
send it or give it to anybody else. Please delete it right away.

Re: Servlet action is not available

2006-04-04 Thread Martin Gainty
Red--
I am re-posting the question to tomcat-users with request to display contents 
of jndi.properties..
Thanks,
Martin--
- Original Message - 
From: Craig McClanahan [EMAIL PROTECTED]
To: Struts Users Mailing List user@struts.apache.org
Sent: Monday, April 03, 2006 9:40 PM
Subject: Re: Servlet action is not available


On 4/3/06, red phoenix [EMAIL PROTECTED] wrote:

 Mr Craig,
I  configure a JNDI in Tomcat5.5.12 like you tell me,like follows:

 Context path= docBase=/jsp-examples debug=5 reloadable=true
 crossContext=true
 Resource name=jdbc/bb1 auth=Container type= javax.sql.DataSource
 
 maxActive=100 maxIdle=30 maxWait=1 username=administrator
 password=123 driverClassName=sun.jdbc.odbc.JdbcOdbcDriver
 url=jdbc:odbc:SMS/
 /Context

 Then I call this JNDI in a JSP file,the JSP file is follows:

 [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED]@page 
 import=java.sql.*%
 [EMAIL PROTECTED] [EMAIL PROTECTED] import=javax.sql.DataSource%
  [EMAIL PROTECTED] [EMAIL PROTECTED] import=javax.naming.*%
 html
 body
 %
 try{
   Context initCtx=new InitialContext();
   System.out.println(ok);
   DataSource db = (DataSource)initCtx.lookup(java:comp/env/jdbc/bb1);
   System.out.println(db=+db);
   Connection conn = db.getConnection();
   System.out.println(conn=+conn);
   Statement stmt = conn.createStatement();
   ResultSet rs = stmt.executeQuery (SELECT * FROM abc);
   out.println(User-list+br);
   while(rs.next()){
out.print(rs.getString(1)+br);
   }
   rs.close();
   stmt.close();
   conn.close();
 }catch(Exception e){
   out.print(e);
 }
 %
 /body
 /html



 javax.naming.NameNotFoundException: Name jdbc is not bound in this Context

 Why?
 Any idea will be appreciated!


This error implies there is something wrong with your configuration, and
that the registration of the resource did not get completed successfully.
In my experience, there's usually a stack trace in the Tomcat logs that says
why it didn't get processed.   You might also want to add a call to:

e.printStackTrace();

inside your exception handler to see where the error is actually coming
from.

I don't use Tomcat 5.5 much myself (primarily 5.0) so I can't help you much
more than that ... best bet would be to ask questions on the Tomcat user
mailing list.

Craig

Best regards,


 On 4/4/06, Craig McClanahan [EMAIL PROTECTED] wrote:
 
  On 4/3/06, red phoenix [EMAIL PROTECTED] wrote:
  
   My Struts is 1.2.9,and tomcat is 5.5.15,and JDK is 1.5,I want to use
   Struts
   Datasource,my database is Microsoft Access 2000,and I have configured
  ODBC
   datasource in windows,when I run it, it raise follows error:
   type Status report
   message Servlet action is not available
   description The requested resource (Servlet action is not available)
 is
   not
   available.
 
 
  Servlet action is not available almost always means that some
 exception
  was thrown as the Struts action servlet was first initialized.  The
  exception will be logged in one of the Tomcat log files
  ($CATALINA_HOME/logs/*).
 
  In your particular case, the most likely problem is trying to use the
  Struts
  data source.  This functionality was deprecated in Struts 1.1, and was
  removed in Struts 1.2.  You should use the JNDI data sources provided by
  your container (Tomcat) instead.  There is pretty reasonable
 documentation
  on the Tomcat web site for how to set this stuff up, which applies to
 all
  webapps, not just Struts based ones.
 
 
 
 
 http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html
 
  Historical note -- the only reason Struts 1.0 supplied a data source
  implementation in the first place was that, six years ago, most servlet
  containers did not support JNDI based resource access.  Now that they
  (essentially) all do support JNDI, that is the recommended mechanism for
  managing data sources.
 
  Craig
 
 




cluster prblem

2006-04-04 Thread Amila Suriarachchi
hi,
I created a tomcat cluster (using tomcat 5.5.15 and jdk 1.5.0_06 in linux)
with two nodes,
by uncommenting the existing cluster element in server.xml and changing the
tcplisten ports.

And I created a web application to test the cluster (put and entry
distributable/ in web.xml).
Then I deployed the application in both servers and started the servers.

When I see the logs there are no errros and every things seems to be ok.

Then I access the application of one server, and see the nummber of sessions
of that application
in both servers using tomcat manager. Here I found that both nodes have
sessions and according to
my application i think that session is being replicated.

But when i check the catalina.out it has following exception.
SEVERE: TCP Worker thread in cluster caught 'java.io.IOException: Connection
reset by peer' closing channel
java.io.IOException: Connection reset by peer
at sun.nio.ch.FileDispatcher.read0(Native Method)
at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:21)
at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:233)
at sun.nio.ch.IOUtil.read(IOUtil.java:206)
at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:207)
at org.apache.catalina.cluster.tcp.TcpReplicationThread.drainChannel
(TcpReplicationThread.java:125)
at org.apache.catalina.cluster.tcp.TcpReplicationThread.run(
TcpReplicationThread.java:69)

And also
In my web application I have a class which implements the
HttpSessionActivationListener, HttpSessionBindingListener and Serializable
interfaces.
and I store an instance of this class as an attribute of the httpSession.
In this case I think the sessionWillPassivate and sessionDidActivate should
be called when the session
is replicated across different jvms. But it seems this does not happens.
(i.e. it does not print my log messages)

can someone explain this,

amila.


Re: PHP Servlet Fails in Tomcat 5.5.15-SOLVED

2006-04-04 Thread Nikola Milutinovic
Hi all.

Just one opinion, if it hasn't been said before. Do not mix Java and PHP.

PHP is inherently thread un-safe. Basically the PHP code itself is, AFAIK, OK
(thread safe), but all those myriads of 3rd-party libraries providing needed
functionality to the myriads of PHP extensions can, and some are thread
un-safe.

In case you haven't noticed, most decent Linux distros disable multi-threaded
MPMs in Apache, if you enable PHP in them. Well, if Apache feels unsafe with
PHP around, how should you feel in Tomcat?

I can understand why you would want to run PHP, a lot of freeware projects out
there were written in PHP. Or, should I be more precise, in PHP+MySQL glued
together. Perhaps you cannot afford to rewrite it all. But sometimes, it is
worth it.

Decision remains yours, but I would run PHP separately from TC, if at all
possible.

Nix.

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

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



jdk1.5, tomcat 5.5.9 and jsp compilation

2006-04-04 Thread CUCKSON, Nick, GBM
I've a problem compiling jsp's against jdk1.5. I've searched the archives,
google, tomcat docs etc but found no help on my specific issue although I
can see anumber of people have had problems with generics support.

I've changed to the Ant compiler and copied the ant.jar to common/lib, added
the compiler parameters to conf/web.xml to enable 1.5 compilation.

I still get a message saying that generics are not supported and I should
change the -source 1.4 to -source 1.5.

I've looked through the ant docs and this appears to be related to the javac
tag in build.xml, but I'm not sure where to put this tag in the context of a
tomcat installation. I've looked through the tomcat docs on jasper (how-to)
but I believe I've removed the dependency on japser so I dont think this is
relevant, although it does mention using the 'javac' argument with
catalina.sh. I've tried this with no success, but it's quite possible I
didn't configure this properly as I'm not sure where catalina.sh is called
from. I've looked through the .sh files but it's not clear.

To sum up, I would like to know how to configure '-source 1.4' to '-source
1.5' or am I barking up the wrong tree?

thanks


***
The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered 
Office: 36 St Andrew Square, Edinburgh EH2 2YB. 
Authorized and regulated by the Financial Services Authority 
 
This e-mail message is confidential and for use by the 
addressee only. If the message is received by anyone other 
than the addressee, please return the message to the sender 
by replying to it and then delete the message from your 
computer. Internet e-mails are not necessarily secure. The 
Royal Bank of Scotland plc does not accept responsibility for 
changes made to this message after it was sent. 

Whilst all reasonable care has been taken to avoid the 
transmission of viruses, it is the responsibility of the recipient to 
ensure that the onward transmission, opening or use of this 
message and any attachments will not adversely affect its 
systems or data. No responsibility is accepted by The Royal 
Bank of Scotland plc in this regard and the recipient should carry 
out such virus and other checks as it considers appropriate. 
Visit our websites at: 
http://www.rbos.com
http://www.rbsmarkets.com 
***


Re: [OT] Better JSP Performance with Opteron

2006-04-04 Thread Nikola Milutinovic
--- Leon Rosenberg [EMAIL PROTECTED] wrote:

 Ok, my fault,
 read page and java in one sentence - map to Java Page - Java
 Server Page. Must be a circuit error in the brain.
 Anyway, does it mean, that a proper configured JVM on an opteron
 processor, will be significantly faster? Could be very interesting for
 caches...
 
 Leon
 
 On 4/3/06, Rainer Jung [EMAIL PROTECTED] wrote:
  Using large pages to eliminate TLB misses has nothing to do with the
  size of the objects. From the view of the operating system java heap is
  just a huge and continuous chunk of memory. Anything what's inside is
  managed by the JVM. But whenever the JVM needs to access an adress it
  needs to make an address calculation as described in the article. Once
  the needed adress translation tables do not fit into the TLB,
  performance gets bad. Since Java often uses a large and continuous heap
  it's a very good candidate for using large pages, saving entries in the

Hmmm, Im not sure about this.

I do agree that a page size too small will make a heavy use of CPU/OS internal
structures, resulting in poor performance. OTOH, using a page size too big
results in degradation of effectiveness of that processes working set. Suppose
a whole block of 1 MB was out of the TLB or swapped out. Operating on a
relatively small, well grouped memory region, would result in the whole 1 or 2
MB of memory be introduced into the active set, instead of just those smaller
pages.

Of course, having portions of your memory collect dust, could be a sign of poor
programming, memory leaks and what not. You mileage may vary. Setting a page
size to 2 MB may be a bit extreme. If it can be set to just one process and
dynamically, or at least at startup, that would be coll. Somehow, I doubt this
level of flexibility exists. You may spead up your JVM, but slow down the rest
of the system. Again, YMMV. This should be put to a test.

Nix.

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

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



Re: How can I limit the number of instance my servlet can server concurrently?

2006-04-04 Thread Rhino
Just a guess but couldn't you accomplish this by setting up your servlet to 
use a connection pool and then limiting the connection pool to 10 threads 
maximum?


--
Rhino

- Original Message - 
From: Meryl Silverburgh [EMAIL PROTECTED]

To: users@tomcat.apache.org
Sent: Tuesday, April 04, 2006 2:42 AM
Subject: How can I limit the number of instance my servlet can server 
concurrently?



Is it possible to limit Tomcat to just handle 10 concurrently request
to my servlet?
for all others (11 and onward), it will queue them up, and serve them
only when one of the currently-serving request is done?

Thank you.

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


--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.3.4/299 - Release Date: 31/03/2006




--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.3.4/299 - Release Date: 31/03/2006


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



GET FORM Encoding Test JSP

2006-04-04 Thread Allistair Crossley
Hi,

The following JSP presents a well-known problem found all over the web 
regarding GET form submissions not encoding form parameters properly. The issue 
does not exist with POST. 

I have read just about every article on the web about this issue, and the below 
JSP incorporates all of the solutions. 

However, it still does not work and I wonder having seen a few suggestions that 
this could be the fault of Tomcat, whether there is any truth in this, since an 
equivalent ASP test does not exhibit the issue.

I have used the below JSP test with both a SetCharacterEncodingFilter in front, 
and without (this is also catered for by the request.setCharacterEncoding 
call). 

Everything reads UTF-8 except when you submit the word Amélie into the form, 
the output is broken. Interestingly, the QENC string which converts the 
request.getParameter to UTF-8 fixes the string. This is impracticle I would 
have thought and should be converted by Tomcat given the request encoding which 
is correctly set.

My question - is this a Tomcat bug, a Tomcat caveat, or my own silly fault?

Thanks, Allistair

== snip ==

%@ page language=java import=java.util.* pageEncoding=UTF-8%
%@ page language=java contentType=text/html;charset=UTF-8 %
% request.setCharacterEncoding(UTF-8); %
html
  head
titleForm Encoding Test with - Amélie/title
META HTTP-EQUIV=Content-Type CONTENT=text/html; charset=UTF-8
  /head
  body
pSubmit the form with bAmélie/b/p
prequest.getCharacterEncoding() : %= request.getCharacterEncoding() 
%/p
presponse.getCharacterEncoding() : %= response.getCharacterEncoding() 
%/p
p
%
String q = request.getParameter(q);
String qenc = ;
if (q != null) {
qenc = new String(request.getParameter(q).getBytes(), 
UTF-8);
} else {
q = ;
}
%
form method=get action=/jsp/enctest/index.jsp 
accept-charset=UTF-8
input name=q type=text value=%= q % /
input type=submit value=Go /
/form
pnew String(request.getParameter(q).getBytes(), UTF-8) : %= qenc 
%/p
  /body
/html


FONT SIZE=1 FACE=VERDANA,ARIAL COLOR=BLUE 
---
QAS Ltd.
Registered in England: No 2582055
Registered in Australia: No 082 851 474
---
/FONT FONT SIZE=1 FACE=VERDANA,ARIAL COLOR=BLACK 
Disclaimer:  The information contained within this e-mail is confidential and 
may be privileged. This email is intended solely for the named recipient only; 
if you are not authorised you must not disclose, copy, distribute, or retain 
this message or any part of it. If you have received this message in error 
please contact the sender at once so that we may take the appropriate action 
and avoid troubling you further.  Any views expressed in this message are those 
of the individual sender.  QAS Limited has the right lawfully to record, 
monitor and inspect messages between its employees and any third party.  Your 
messages shall be subject to such lawful supervision as QAS Limited deems to be 
necessary in order to protect its information, its interests and its 
reputation.  

Whilst all efforts are made to safeguard Inbound and Outbound emails, QAS 
Limited cannot guarantee that attachments are virus free or compatible with 
your systems and does not accept any liability in respect of viruses or 
computer problems experienced.
/FONT


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



Error Message when classes are put in shared-Folder

2006-04-04 Thread starki78
Hello!


I've classes within a web-application on tomcat-5 and everything works fine.

Then I put these classes to the shared folder, I get this error:


java.lang.NullPointerException

org.apache.struts.taglib.TagUtils.retrieveMessageResources(TagUtils.java:1161)
org.apache.struts.taglib.TagUtils.message(TagUtils.java:1024)
org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:224)

org.apache.jsp.jsp.index_jsp._jspx_meth_bean_message_0(index_jsp.java:180)
org.apache.jsp.jsp.index_jsp._jspService(index_jsp.java:70)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


When I copy the package to the standard shared-Folder and I get this exception
These are the lines of the struts-framework where the error occurs:

 MessageResources resources =
retrieveMessageResources(pageContext, bundle, false);



Can someone give me a hint if I can do something against this error?

Nice greetings Starki


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



RE: Tomcat tag question

2006-04-04 Thread MW Mike Weiner \(5028\)
Well that was my thought as well, just wasn't sure how to go about that.
Any hints?

Thanks
Michael Weiner 


This e-mail and any attachments may contain confidential information
that is legally privileged. The information is solely for the use of the
intended recipient(s); any disclosure, copying, distribution, or other
use of this information is strictly prohibited. If you have received
this e-mail in error, please notify the sender by return e-mail and
delete this message. Thank you.

-Original Message-
From: John Powers [mailto:[EMAIL PROTECTED] 
Sent: Monday, April 03, 2006 4:17 PM
To: Tomcat Users List
Subject: RE: Tomcat tag question

Or use a filter to append that meta tag onto any response that is
html...

-Original Message-
From: Darryl L. Miles [mailto:[EMAIL PROTECTED]
Sent: Monday, April 03, 2006 2:38 PM
To: Tomcat Users List
Subject: Re: Tomcat tag question

MW Mike Weiner (5028) wrote:
 Dear List readers
  
 Sorry to bother you with what is most likely a silly question, but i 
 have been googling, and found no real answers and was hoping you might

 know. I am doing another Tomcat project and to that end, i need to get

 tomcat to behave in a certain way, namely i need tomcat to add an html

 tag to each page requested, like so:
  
 meta name=agmips value=1.963752
  
 where the value is a box identified (bad# good# bad# good# bad# good#)
-
 672 in this case, actually i would LOVE to be the hostname of the box,

 but can be anything really - even static if it cant be done
dynamically.
 Is this possible? And if so, would you mind sharing the trick with
this
 newbie?
   

Hmm... Isn't this a job for JSP.  Rename your index.html to index.jsp
and add a new first line of:

%@ page language=java %


Then insert this into the point you want the page output to change:

meta name=agmipsvalue=%=request.getServerName()%


Best of luck,
 

-- 

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]





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



Re: how to control lifetime of JSessionID cookie in Tomcat 5.5

2006-04-04 Thread Filip Hanik - Dev Lists
that is correct, yahoo for example will not store anything on the 
server, they just store a cookie on the client.


Filip


Leon Rosenberg wrote:

I think you mixing things up. The http session isn't designed to run
forever. The session ends as soon as the user closes his browser.
If you want to have some kind of direct login, you should just set
your own cookie, evaluate this cookie in your first servlet/jsp/action
or filter and login the user properly. Trying to prolong the session
duration is surely not the right way to do it.

regards
Leon

On 4/4/06, Andrew E. Davidson [EMAIL PROTECTED] wrote:
  

Hi



I am trying to figure out how to set up my application so that users are
only forced to log on every couple of day. Sort of like my.yahoo.com. If you
click remember my id you can close/restart you browser and not have to log
back in again.



Here is part of my web.xml file



session-config



  !-- the session time out is set so that they can



be idle for about 1.5 days



  --



  session-timeout2160/session-timeout



/session-config



I think the problem that that the jsessionid cookie is not being created
correctly. When I looked at the cookie in my browser, I noticed that Expires
was set to at end of session. Any one know how I can configure this?



I guess I could create a filter, to get the cookie and call setMaxAge(), how
ever its seems like I should not being writing this kind of code



Any help would be greatly appreciated



Andy










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



RE: cluster prblem

2006-04-04 Thread Tim Lucia
I have seen the same behavior, but only under considerable load.  Changing
the replication strategy to 

  Sender
className=org.apache.catalina.cluster.tcp.ReplicationTransmitter
replicationMode=fastasyncqueue
keepAliveTimeout=-1/

makes it go away.  I can confirm that application does not seem to suffer
from the 'exception' below, although it is disconcerting to some
management-types to see these exceptions in the logs.

Tim

-Original Message-
From: Filip Hanik - Dev Lists [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 04, 2006 9:25 AM
To: Tomcat Users List
Subject: Re: cluster prblem

Hi Amila, what you see below is not an actual error, although it seems to
be.
What happens is that you have keepalive set to the default value, so the
sending node will close it socket, and the receiving node will get an error
like this.
In future versions this has been reduced to info or warning, so you can
safely ignore this.

Filip

Amila Suriarachchi wrote:
 hi,
 I created a tomcat cluster (using tomcat 5.5.15 and jdk 1.5.0_06 in 
 linux) with two nodes, by uncommenting the existing cluster element in 
 server.xml and changing the tcplisten ports.

 And I created a web application to test the cluster (put and entry 
 distributable/ in web.xml).
 Then I deployed the application in both servers and started the servers.

 When I see the logs there are no errros and every things seems to be ok.

 Then I access the application of one server, and see the nummber of 
 sessions of that application in both servers using tomcat manager. 
 Here I found that both nodes have sessions and according to my 
 application i think that session is being replicated.

 But when i check the catalina.out it has following exception.
 SEVERE: TCP Worker thread in cluster caught 'java.io.IOException: 
 Connection reset by peer' closing channel
 java.io.IOException: Connection reset by peer
 at sun.nio.ch.FileDispatcher.read0(Native Method)
 at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:21)
 at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:233)
 at sun.nio.ch.IOUtil.read(IOUtil.java:206)
 at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:207)
 at 
 org.apache.catalina.cluster.tcp.TcpReplicationThread.drainChannel
 (TcpReplicationThread.java:125)
 at org.apache.catalina.cluster.tcp.TcpReplicationThread.run(
 TcpReplicationThread.java:69)

 And also
 In my web application I have a class which implements the 
 HttpSessionActivationListener, HttpSessionBindingListener and 
 Serializable interfaces.
 and I store an instance of this class as an attribute of the httpSession.
 In this case I think the sessionWillPassivate and sessionDidActivate 
 should be called when the session is replicated across different jvms. 
 But it seems this does not happens.
 (i.e. it does not print my log messages)

 can someone explain this,

 amila.

   


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



Re: cluster prblem

2006-04-04 Thread Amila Suriarachchi
ok thankx for reply,

What a about not calling methods of HttpSessionActivationListener listner.
I set an object (of which class implements the
HttpSessionActivationListener) as an
attribute of the session. i think when this session being migrated conatiner
should call
these methods

amila.


RE: Datasource configuration for Oracle 9i in Tomcat 5.5

2006-04-04 Thread Farrow, Marc
You have the datasource defined globally.  You will need to add a resource
link to your context that you wish to use it.  The contexts cannot see it by
default.

Example:

Context ...
ResourceLink global=jdbc/myoracle name=jdbc/myoracle
type=javax.sql.DataSource/
/Context

-Original Message-
From: Thanigaivel_Murugan [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 04, 2006 4:07 AM
To: users@tomcat.apache.org
Subject: Datasource configuration for Oracle 9i in Tomcat 5.5

Hi,



I do not know how to configure datasource in Tomcat 5.5 for Oracle 9i. I
tried like this...



1. Server.xml configuration:



!-- Global JNDI resources --

  GlobalNamingResources



!-- Test entry for demonstration purposes --

Environment name=simpleValue type=java.lang.Integer
value=30/



Resource name=jdbc/myoracle auth=Container

  type=javax.sql.DataSource
driverClassName=oracle.jdbc.driver.OracleDriver


url=jdbc:oracle:thin:@TESTSERVER:1521:TESTDB

  username=scott password=tiger maxActive=20
maxIdle=10

  maxWait=-1/



  /GlobalNamingResources



2. Test.jsp



Context initContext = new InitialContext();

Context envContext  =
(Context)initContext.lookup(java:/comp/env);

DataSource ds =
(DataSource)envContext.lookup(jdbc/myoracle);

Connection conn = ds.getConnection();



Output:



javax.servlet.ServletException: Cannot create JDBC driver of class ''
for connect URL 'null'



Can anyone knows the solution?



- Regards

  Thanigai





DISCLAIMER:
This email (including any attachments) is intended for the sole use of the
intended recipient/s and may contain material that is CONFIDENTIAL AND
PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or
distribution or forwarding of any or all of the contents in this message is
STRICTLY PROHIBITED. If you are not the intended recipient, please contact
the sender by email and delete all copies; your cooperation in this regard is
appreciated.


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



RE: Tomcat tag question

2006-04-04 Thread John Powers
Here is a quick smattering to do what you want; this is the dofilter for
the cclass you'll write that extends filter.  You'll want to append
stuff at the end... play with it a little and you'll get the idea pretty
quick.You can alter anything in the body.. but for your case, just
add your meta tag to the end. 




public void doFilter(ServletRequest request, ServletResponse
response, FilterChain chain) throws IOException, ServletException {


HttpServletRequest req = (HttpServletRequest) request;
HttpServletResponse res = (HttpServletResponse)
response;


CharResponseWrapper wrapper = new
CharResponseWrapper((HttpServletResponse)response);
chain.doFilter(request, wrapper);


CharArrayWriter caw = new CharArrayWriter();
String body =
wrapper.toString();
StringBuffer newBody = new
StringBuffer();
caw.write(newBody.toString());


response.setContentLength(caw.toString().length());

response.getWriter().write(caw.toString());
response.getWriter().close();
}



-Original Message-
From: MW Mike Weiner (5028) [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 04, 2006 8:05 AM
To: Tomcat Users List
Subject: RE: Tomcat tag question

Well that was my thought as well, just wasn't sure how to go about that.
Any hints?

Thanks
Michael Weiner 


This e-mail and any attachments may contain confidential information
that is legally privileged. The information is solely for the use of the
intended recipient(s); any disclosure, copying, distribution, or other
use of this information is strictly prohibited. If you have received
this e-mail in error, please notify the sender by return e-mail and
delete this message. Thank you.

-Original Message-
From: John Powers [mailto:[EMAIL PROTECTED] 
Sent: Monday, April 03, 2006 4:17 PM
To: Tomcat Users List
Subject: RE: Tomcat tag question

Or use a filter to append that meta tag onto any response that is
html...

-Original Message-
From: Darryl L. Miles [mailto:[EMAIL PROTECTED]
Sent: Monday, April 03, 2006 2:38 PM
To: Tomcat Users List
Subject: Re: Tomcat tag question

MW Mike Weiner (5028) wrote:
 Dear List readers
  
 Sorry to bother you with what is most likely a silly question, but i 
 have been googling, and found no real answers and was hoping you might

 know. I am doing another Tomcat project and to that end, i need to get

 tomcat to behave in a certain way, namely i need tomcat to add an html

 tag to each page requested, like so:
  
 meta name=agmips value=1.963752
  
 where the value is a box identified (bad# good# bad# good# bad# good#)
-
 672 in this case, actually i would LOVE to be the hostname of the box,

 but can be anything really - even static if it cant be done
dynamically.
 Is this possible? And if so, would you mind sharing the trick with
this
 newbie?
   

Hmm... Isn't this a job for JSP.  Rename your index.html to index.jsp
and add a new first line of:

%@ page language=java %


Then insert this into the point you want the page output to change:

meta name=agmipsvalue=%=request.getServerName()%


Best of luck,
 

-- 

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]





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

RE: How to setup Tomcat as a service on W2K3 with special arguments

2006-04-04 Thread Stuart, Steven G (SStuart) [Contractor]
HI all,
sorry the copy paste, put both lines in one.   I will try that
again.I did try putting it into the Java Options section, however it
is not a Java Option.Here are the 2 lines again.

 Set JAVA_OPTS=-Xms384m -Xmx768m -Djava.awt.headless=true

E:\Apache\Tomcat 5.0\bin\catalina.bat start -config E:\Apache\Tomcat
5.0\dsis_webapps\dsis_server.xml

The First line I have in,  it is the second line, mainly pointing to a
different xml file then normal.

Thanks,
Steven Stuart


-Original Message-
From: Tim Lucia [mailto:[EMAIL PROTECTED] 
Sent: Monday, April 03, 2006 6:16 PM
To: 'Tomcat Users List'
Subject: RE: How to setup Tomcat as a service on W2K3 with special
arguments

Put one argument per line in the Java tab of the service configuration.

Tim


-Original Message-
From: Stuart, Steven G (SStuart) [Contractor]
[mailto:[EMAIL PROTECTED]
Sent: Monday, April 03, 2006 8:59 PM
To: users@tomcat.apache.org
Subject: How to setup Tomcat as a service on W2K3 with special arguments

To Whomever It may concern:
  I am trying to setup Apache Tomcat 5.0.0.28 to start at startup.

I have figured out how to change the first line, of the batch file to
start up automatically, but not the second.   Can someone please help
me.

Here is the original Batch file, used to start Tomcat manually.  It is
only 2 lines

Set JAVA_OPTS=-Xms384m -Xmx768m -Djava.awt.headless=true
E:\Apache\Tomcat 5.0\bin\catalina.bat start -config E:\Apache\Tomcat
5.0\dsis_webapps\dsis_server.xml

The first line I know how to set and have done so.   However I do not
know how to place this second line in.   I am pretty sure it would go
into the Startup Tab of Configure Tomcat and most likely in the
arguments section.However everything I have put in there does not
allow the tomcat service to start.

Please let me know what and how I should add this in.

Thanks,
Steven Stuart



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



[OT] AIX filtering Explorer?

2006-04-04 Thread Tremal Naik
Hi everybody,
I marked this message as OT because it may not pertain to Tomcat, even
if I presume so.

I have a problem with a Jboss/Tomcat 5.5 installed on an IBM AIX
machine. The application redirects user requests to an encrypted
channel at login:

1) The browser sends an unsecure request.
2) the request is redirected to a secure channel

I have no problem with Firefox, while IE looks as if it get lost. The
secure request does not arrive on the tomcat server. Where did it go?
I've put a proxy in the middle so I'm pretty sure the connect request
is made on the correct URL.

The application works fine on a windows environment.

Did anyone experience anything similar?

--
TREMALNAIK

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



Re: Request Entity Too Large with mod_jk and SSL Client Certs

2006-04-04 Thread Seth Milder

Bill Barker wrote:
Seth Milder [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]



Hi list,

I am seeing this in the logs when posting to a particular URL:

[Mon Apr 03 14:52:06 2006] [13089:15648] [debug]
ajp_get_endpoint::jk_ajp_common.c (2131): acquired connection cache slot=0
[Mon Apr 03 14:52:06 2006] [13089:15648] [error]
ajp_marshal_into_msgb::jk_ajp_common.c (490): failed appending the SSL
certificates
[Mon Apr 03 14:52:06 2006] [13089:15648] [info]
ajp_service::jk_ajp_common.c (1662): Creating AJP message failed,
without recovery
[Mon Apr 03 14:52:06 2006] [13089:15648] [debug]
ajp_done::jk_ajp_common.c (2074): recycling connection cache slot=0 for
worker ajp13
[Mon Apr 03 14:52:06 2006] [13089:15648] [info]  jk_handler::mod_jk.c
(1978): Aborting connection for worker=ajp13


It is then I receive the apache error about the Request Entity Too
Large. Interestingly enough, this only occurs with Firefox and not
MSIE. Is there a setting for this somewhere?




Probably not.  The problem is that AJP/1.3 only allows a maximum of 8Kb to 
be sent in a given packet.  For the Request packet this has to include all 
of the Request headers, as well as the SSL variables.  I'm guessing (since 
you say you are doing a POST), that the referer URL is very long, and that 
FireFox is adding just a bit more than MSIE to push it over the edge.


If it's possible for you to hack your copy of the mod_jk code, then putting 
something like:

jk_dump_buff(l, __FILE__, __LINE__, ajp_marshal_into_msgb,
 JK_LOG_LEVEL_TRACE, ssl_cert, msg);

at line 490 of jk_ajp_common.c, and configuring your log-level to trace will 
give you the info to see what is wrong.  And feel free to post the results 
to the list:  Myself and at least a couple of other people can parse what 
the data in an AJP/1.3 message is.




Thanks for your help. It turns out that the referer for this page is 
indeed HUGE! I turned off referer sending in Firefox and this fixed 
it. I will talk to my vendor about using POST instead of GET. Maybe this 
will fix it!



Best,

Seth

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



RE: [OT] AIX filtering Explorer?

2006-04-04 Thread Sheets, Jerald
Do you have a web proxy in your environment?  That would be transparent,
or hand-configured.

Jerald Sheets
Systems Administrator
The Weather Channel Interactive

 
 

-Original Message-
From: Tremal Naik [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 04, 2006 12:40 PM
To: Tomcat Users List
Subject: [OT] AIX filtering Explorer?

Hi everybody,
I marked this message as OT because it may not pertain to Tomcat, even
if I presume so.

I have a problem with a Jboss/Tomcat 5.5 installed on an IBM AIX
machine. The application redirects user requests to an encrypted channel
at login:

1) The browser sends an unsecure request.
2) the request is redirected to a secure channel

I have no problem with Firefox, while IE looks as if it get lost. The
secure request does not arrive on the tomcat server. Where did it go?
I've put a proxy in the middle so I'm pretty sure the connect request is
made on the correct URL.

The application works fine on a windows environment.

Did anyone experience anything similar?

--
TREMALNAIK

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


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



Tomcat Clusters, private network for replication, and Oracle 8i JDBC driver

2006-04-04 Thread Tim Lucia
I have a 3-node cluster, running on Linux.  All 3 boxes are identical.

Eth0 - A class B network address - The 'public' interface for web traffic
(public in that it goes back out through httpd to the internet)

Eth1 - A class C network address - The 'private' interface for replication.
I.e.

Receiver
 
className=org.apache.catalina.cluster.tcp.ReplicationListener
tcpListenAddress=192.168.x.y
tcpListenPort=4009
tcpSelectorTimeout=100
tcpThreadCount=6/

Tomcat clustering all works fine.  The problem comes when I request a
connection from the connection pool to an Oracle 8i data source, like the
following:

  Resource
name=jdbc/dbname
type=javax.sql.DataSource
driverClassName=oracle.jdbc.driver.OracleDriver
url=jdbc:oracle:thin:@hostname.company.com:1521:dbname
username=user
password=password
validationQuery=SELECT COUNT(*) FROM DUAL
initialSize=10
defaultCatalog=dbname
maxIdle=20
maxWait=5000
maxActive=50/

If I have the private network enabled for replication, then the Oracle thin
driver insists on trying to connect through this interface first.  This
happens on a class A network (10.0.x.y) as well as a class C network
(192.168.10.y).  It also happens if the OS happens to be W2K.  It will take
5 seconds and time out, and the connect through the class B address.  With
10 data sources (on Oracle) I get a connection pool startup time of 50+
seconds (minimum).

If I turn off the class C (or class A) private network and replicate on my
class B network, this problem does not happen.

Can anybody explain to me why this is the case?  Has anyone else seen this?
Has anyone else got this working as expected?

Should I even bother trying to keep the replication traffic on a private
network?  The boxes have 4 gig connections and so it seems like I should be
able to make use of the other 3.

Thanks,
Tim

P.s. Yes I know Oracle 8i pre-dates modern man and is no longer supported.
I'm on a long-range plan to move to MySQL.


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



Connecting Apache 2.2 and Tomcat 5.5.16

2006-04-04 Thread Erik Gulliksen \(maillist\)
Hi there =)

I've been trying to figure out how to get my Tomcat 5.5.16 to play with an
Apache 2.2. (and Linux)
I'm new to configuring these applications and seem to get lost in the
documentation.

mod_jk, mod_jk2 (same as jk2?), mod_proxy, mod_proxy_balancer, mod_proxy_ajp
APR, AJP etc. and my head starts spinning.. :o\

Well basically what I though was to set up an Apache server and more then
one Tomcat servers with some load balancing. Am I wrong if I have the
impression that Apache is the way to go with 128bit SSL and as the front end
for load balancing?
Everything else should be handled by Tomcat, even static content I think.

(Thinking of some hardware SSL offloader if Apache don't handle it all that
well. Too bad they are not free too ;)

First of all giving my wishes, what connection type should I use?

Then how to write the proper configuration settings for my Tomcat and Apache
versions?

And last, how much load can an Apache server and Tomcat server expect to
handle of request/sec?

Happy for any response, or links to some easy to step by step guides. 

Thanks in advance!

Regards,
Erik


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



PostgreSQL access via JNDI

2006-04-04 Thread Mark Slater
I've been trying to get PostgreSQL set up to be accessed through JNDI  
in Tomcat 5.5.x. I found the docs page describing it, jndi- 
datasource-examples-howto.html, and followed the example there, but  
it still doesn't work. I'm trying to provide access to PostgreSQL for  
use by both JDO and JCR in my web-apps.


Here's the Resource definition I'm using:

Resource name=jdbc/whisper_db
auth=Container
type=javax.sql.Datasource
driverClassName=org.postgresql.Driver
url=jdbc:postgresql://127.0.0.1:5432/my_db
username=---
password=---
maxActive=10
maxIdle=100
maxWait=3000 /


In my application's META-INF/context.xml, I have the following  
ResourceLink:


ResourceLink
global=jdbc/whisper_db name=jdbc/whisper_orm  
type=javax.sql.Datasource /


In my application's WEB-INF/web.xml, I have the following resource- 
env-ref:


resource-env-ref
descriptionWhisper's Database/description
resource-env-ref-namejdbc/whisper_orm/resource-env-ref-name
resource-env-ref-typejavax.sql.Datasource/resource-env- 
ref-type

/resource-env-ref


Depending on where I put the Resource definition, I get different  
errors.


If I put it in the web-app's META-INF/context.xml, or in $TOMCAT_HOME/ 
conf/context.xml, my JDO implementation complains:
NestableRuntimeException: There was an error duing JNDI lookup  
of the name java:comp/env/jdbc/whisper_orm.


Caused by: javax.naming.NameNotFoundException: Name jdbc is not  
bound in this Context


If I put it in $TOMCAT_HOME/conf/server.xml, in the  
GlobalNamingResources section, I get:


2006-04-04 11:58:27,866 ERROR  
[org.apache.catalina.mbeans.GlobalResourcesLifecycleListener] -  
Exception processing Global JNDI Resources

javax.naming.NamingException: Cannot create resource instance
at  
org.apache.naming.factory.ResourceFactory.getObjectInstance 
(ResourceFactory.java:132)
at javax.naming.spi.NamingManager.getObjectInstance 
(NamingManager.java:304)
at org.apache.naming.NamingContext.lookup(NamingContext.java: 
792)
at org.apache.naming.NamingContext.lookup(NamingContext.java: 
152)
at  
org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans 
(GlobalResourcesLifecycleListener.java:138)
at  
org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans 
(GlobalResourcesLifecycleListener.java:143)
at  
org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans 
(GlobalResourcesLifecycleListener.java:108)
at  
org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.lifecycleEve 
nt(GlobalResourcesLifecycleListener.java:80)
at  
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent 
(LifecycleSupport.java:119)
at org.apache.catalina.core.StandardServer.start 
(StandardServer.java:693)
at org.apache.catalina.startup.Catalina.start(Catalina.java: 
551)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke 
(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke 
(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start 
(Bootstrap.java:275)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java: 
413)


I'm assuming these errors are related, and that whatever is causing  
the NamingException is the same fundamental problem causing the  
NameNotFoundException in the context-based configuration. My problem  
is that I can't figure out what it is. The driver for the database  
(postgresql-8.1-405.jdbc3.jar) is in $TOMCAT_HOME/common/lib/, and  
I've also tried adding commons-dbcp-1.2.1.jar and commons- 
pool-1.2.jar alongside it (even though the docs say that shouldn't be  
necessary), but get the same errors.


Is there any logging that I can turn on that will tell me the WHY  
Tomcat Cannot create resource instance? Or am I doing something  
obviously stupid with my Resource definition? Or could it be  
something else entirely?


Any suggestions would be really helpful.

Thanks!

Mark

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



Re: Connecting Apache 2.2 and Tomcat 5.5.16

2006-04-04 Thread Bernie Durfee

mod_jk, mod_jk2 (same as jk2?), mod_proxy, mod_proxy_balancer, mod_proxy_ajp
APR, AJP etc. and my head starts spinning.. :o\


From what I understand, as of Apache 2.2, the mod_jk project no longer applies. Instead, the mod_proxy module is a 
generic way to proxy from Apache HTTPD to other servers. So for Tomcat, the mod_proxy_ajp module will proxy from Apache 
HTTPD directly to Tomcat using the AJP protocol. This is much simpler than ever, here is how I do it for one of my 
servers...


VirtualHost 12.34.56.78:80
  ServerName my.server.com

  ProxyPreserveHost On
  ProxyPass / ajp://12.34.56.78:8009/
/VirtualHost

...which passes all requests for my.server.com to Tomcat, with an AJP connector 
listening on port 8009...

Connector address=12.34.56.78
   port=8009
   protocol=AJP/1.3
   enableLookups=false
   minSpareThreads=20
   maxSpareThreads=100
   maxThreads=200
   connectionTimeout=6
/

...it's very simple now, no workers.properties or crazy mod_jk directives. In fact mod_proxy_ajp is included with Apache 
2.2.



Well basically what I though was to set up an Apache server and more then
one Tomcat servers with some load balancing. Am I wrong if I have the
impression that Apache is the way to go with 128bit SSL and as the front end
for load balancing?


I have it set for SSL, which still uses the exact same proxy diretives, since the proxying is done using AJP after 
Apache does all the SSL protocol stuff. Again, very simple. As for load balancing, I believe this would be handed by 
some additional mod_proxy directives.


Bernie

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



Filter Help!

2006-04-04 Thread Matthew J. Vincent

Hello everyone,

If this is not the right place to post this could you please let me know 
where.  I have searched the forums and Google and cannot find an answer.


I have a Servlet filter that checks to see the content length of the 
request.


long contentLength = request.getContentLength();

If contentLength is greater than some configurable size, I would like to 
stop the request and send back a response saying that the request is to 
large.


This is being used for a file upload   Everything is working, except it 
seems like the ENTIRE request (or file) is sent BEFORE my redirect is 
happening.


My logs are showing the correct information at the appropriate times, 
but the entire request is being processed before I can send a request 
back. 

Is there a way to immediately cut off the request and return a 
response?  Is there a better way to do this?


Request Size Filter: REQUEST LENGTH=401458785
Request Size Filter: CONTENT TYPE=multipart/form-data; 
boundary=---85421569618919

Request Size Filter: REQUEST = /jaxpathwi/imageAction.do
Request Size Filter: REFERER = 
http://deva2231:8080/jaxpathwi/imageAction.do?dispatch=setupmouseKey=1diagnosisKey=1

Request Size Filter: Request is to be filtered and checked for size
Request Size Filter: REQUEST LENGTH [401458785] = ALLOWABLE CONTENT 
LENGTH [500]

Request Size Filter: NOT Allowing request
Request Size Filter: Redirecting to - 
http://deva2231.8080/jaxpathwi/imageAction.do?dispatch=setupmouseKey=1diagnosisKey=1


I have posted a modified version of my code to show you.

Thanks!

Matt

code
package filters;

import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class RequestSizeFilter implements Filter {
  
   public static final String REDIRECT = redirect;

   public static final String LENGTH = length;
  
   private FilterConfig filterConfig = null;

   private static boolean bInitialized = false;
   private String strRedirectURL = null;
   private long lContentLength = -1l;
   private boolean bRedirect = false;

 
   public void init(FilterConfig config)

   throws ServletException {
   this.filterConfig = config;
   ServletContext servletContext = filterConfig.getServletContext();
  
   String strRedirect = filterConfig.getInitParameter(REDIRECT);

   String strLength = filterConfig.getInitParameter(LENGTH);
  
   if ((strLength != null)  (strLength.length()  0)) {

   bInitialized = true;
   }

   // configure the redirect URL
   if ((strRedirect != null)  (strRedirect.length()  0)) {
   strRedirectURL = new String(strRedirect);

   // configure redirect or forward
   bRedirect = strRedirect.startsWith(HTTP://) ||
   strRedirect.startsWith(HTTPS://) ||
   strRedirect.startsWith(http://;) ||
   strRedirect.startsWith(https://;);
   } else {
   bRedirect = true;
   }
  
   // configure the content length

   try {
   lContentLength = Long.parseLong(strLength);
   } catch (NumberFormatException nfe) {
   bInitialized = false;
   nfe.printStackTrace();
   }
   }
  
   public void destroy() {

   this.filterConfig = null;
   }
  
   public void doFilter(ServletRequest request, ServletResponse response,

FilterChain chain)
   throws IOException, ServletException {
  
   long lRequestLength = request.getContentLength();
  
   log(REQUEST LENGTH= + lRequestLength);
 
   String strRequestURI = 
((HttpServletRequest)request).getRequestURI();
   String strReferer = 
((HttpServletRequest)request).getHeader(Referer);
  
   log(REQUEST =  + strRequestURI);

   log(REFERER =  + strReferer);
  
   String strURL = strReferer;

   if ((strRedirectURL != null)  (strRedirectURL.length()  0)) {
   strURL = strRedirectURL;
   }
  
  
   if (lRequestLength = lContentLength) {

   if(bRedirect) {
   HttpServletResponse httpResponse = 
(HttpServletResponse)response;

   httpResponse.sendRedirect(strURL);
   } else {
   RequestDispatcher dispatcher =
   
filterConfig.getServletContext().getRequestDispatcher(strURL);

   dispatcher.forward(request, response);
   }
   } else {
   chain.doFilter(request, response);   
   }

   }
  
   private void log(String strMessage) {

   if (strMessage != null) {
   StringBuffer sb = new StringBuffer(Request Size Filter: );
   sb.append(strMessage);
   this.filterConfig.getServletContext().log(sb.toString());
   System.out.println(sb.toString());
   sb = null;
   }
   }
}
/code




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

Re: Servlet action is not available

2006-04-04 Thread Richard Schilling
Do you want to display the contents of the file jndi.properties?  Why 
not just read the file contents using a File object and and output each 
line?



Richard Schilling
Cognition Group, Inc
Seattle, WA

Martin Gainty wrote:

Red--
I am re-posting the question to tomcat-users with request to display contents 
of jndi.properties..
Thanks,
Martin--
- Original Message - 
From: Craig McClanahan [EMAIL PROTECTED]

To: Struts Users Mailing List user@struts.apache.org
Sent: Monday, April 03, 2006 9:40 PM
Subject: Re: Servlet action is not available


On 4/3/06, red phoenix [EMAIL PROTECTED] wrote:


Mr Craig,
  I  configure a JNDI in Tomcat5.5.12 like you tell me,like follows:

Context path= docBase=/jsp-examples debug=5 reloadable=true
crossContext=true
   Resource name=jdbc/bb1 auth=Container type= javax.sql.DataSource

maxActive=100 maxIdle=30 maxWait=1 username=administrator
password=123 driverClassName=sun.jdbc.odbc.JdbcOdbcDriver
url=jdbc:odbc:SMS/
   /Context

Then I call this JNDI in a JSP file,the JSP file is follows:

[EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED]@page 
import=java.sql.*%
[EMAIL PROTECTED] [EMAIL PROTECTED] import=javax.sql.DataSource%
 [EMAIL PROTECTED] [EMAIL PROTECTED] import=javax.naming.*%
html
body
%
try{
 Context initCtx=new InitialContext();
 System.out.println(ok);
 DataSource db = (DataSource)initCtx.lookup(java:comp/env/jdbc/bb1);
 System.out.println(db=+db);
 Connection conn = db.getConnection();
 System.out.println(conn=+conn);
 Statement stmt = conn.createStatement();
 ResultSet rs = stmt.executeQuery (SELECT * FROM abc);
 out.println(User-list+br);
 while(rs.next()){
  out.print(rs.getString(1)+br);
 }
 rs.close();
 stmt.close();
 conn.close();
}catch(Exception e){
 out.print(e);
}
%
/body
/html



javax.naming.NameNotFoundException: Name jdbc is not bound in this Context

Why?
Any idea will be appreciated!




This error implies there is something wrong with your configuration, and
that the registration of the resource did not get completed successfully.
In my experience, there's usually a stack trace in the Tomcat logs that says
why it didn't get processed.   You might also want to add a call to:

e.printStackTrace();

inside your exception handler to see where the error is actually coming
from.

I don't use Tomcat 5.5 much myself (primarily 5.0) so I can't help you much
more than that ... best bet would be to ask questions on the Tomcat user
mailing list.

Craig

Best regards,



On 4/4/06, Craig McClanahan [EMAIL PROTECTED] wrote:


On 4/3/06, red phoenix [EMAIL PROTECTED] wrote:


My Struts is 1.2.9,and tomcat is 5.5.15,and JDK is 1.5,I want to use
Struts
Datasource,my database is Microsoft Access 2000,and I have configured


ODBC


datasource in windows,when I run it, it raise follows error:
type Status report
message Servlet action is not available
description The requested resource (Servlet action is not available)


is


not
available.



Servlet action is not available almost always means that some


exception


was thrown as the Struts action servlet was first initialized.  The
exception will be logged in one of the Tomcat log files
($CATALINA_HOME/logs/*).

In your particular case, the most likely problem is trying to use the
Struts
data source.  This functionality was deprecated in Struts 1.1, and was
removed in Struts 1.2.  You should use the JNDI data sources provided by
your container (Tomcat) instead.  There is pretty reasonable


documentation


on the Tomcat web site for how to set this stuff up, which applies to


all


webapps, not just Struts based ones.






http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html


Historical note -- the only reason Struts 1.0 supplied a data source
implementation in the first place was that, six years ago, most servlet
containers did not support JNDI based resource access.  Now that they
(essentially) all do support JNDI, that is the recommended mechanism for
managing data sources.

Craig











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



Re: Tomcat Clusters, private network for replication, and Oracle 8i JDBC driver

2006-04-04 Thread Filip Hanik - Dev Lists
interesting, you might wanna play around with the route table and add 
some static routes for how you want your traffic to flow.


Filip

Tim Lucia wrote:

I have a 3-node cluster, running on Linux.  All 3 boxes are identical.

Eth0 - A class B network address - The 'public' interface for web traffic
(public in that it goes back out through httpd to the internet)

Eth1 - A class C network address - The 'private' interface for replication.
I.e.

Receiver
 
className=org.apache.catalina.cluster.tcp.ReplicationListener

tcpListenAddress=192.168.x.y
tcpListenPort=4009
tcpSelectorTimeout=100
tcpThreadCount=6/

Tomcat clustering all works fine.  The problem comes when I request a
connection from the connection pool to an Oracle 8i data source, like the
following:

  Resource
name=jdbc/dbname
type=javax.sql.DataSource
driverClassName=oracle.jdbc.driver.OracleDriver
url=jdbc:oracle:thin:@hostname.company.com:1521:dbname
username=user
password=password
validationQuery=SELECT COUNT(*) FROM DUAL
initialSize=10
defaultCatalog=dbname
maxIdle=20
maxWait=5000
maxActive=50/

If I have the private network enabled for replication, then the Oracle thin
driver insists on trying to connect through this interface first.  This
happens on a class A network (10.0.x.y) as well as a class C network
(192.168.10.y).  It also happens if the OS happens to be W2K.  It will take
5 seconds and time out, and the connect through the class B address.  With
10 data sources (on Oracle) I get a connection pool startup time of 50+
seconds (minimum).

If I turn off the class C (or class A) private network and replicate on my
class B network, this problem does not happen.

Can anybody explain to me why this is the case?  Has anyone else seen this?
Has anyone else got this working as expected?

Should I even bother trying to keep the replication traffic on a private
network?  The boxes have 4 gig connections and so it seems like I should be
able to make use of the other 3.

Thanks,
Tim

P.s. Yes I know Oracle 8i pre-dates modern man and is no longer supported.
I'm on a long-range plan to move to MySQL.


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



RE: Tomcat Clusters, private network for replication, and Oracle 8i JDBC driver

2006-04-04 Thread Tim Lucia
I did change the metric on Windows when I first discovered this.  It made no
difference.  Why would I *need* to add static routes -- when my machine's
primary IP is 172.25.x.y and the database server is likewise 172.25.x.z?  I
can't explain why *ONLY* the Oracle driver insists on trying the wrong path.

Pinging the db server by name does not cause a 5 second delay, nor does
telnet, ssh, wget, ... 

Confused,
Tim 

-Original Message-
From: Filip Hanik - Dev Lists [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 04, 2006 3:49 PM
To: Tomcat Users List
Subject: Re: Tomcat Clusters, private network for replication, and Oracle 8i
JDBC driver

interesting, you might wanna play around with the route table and add some
static routes for how you want your traffic to flow.

Filip

Tim Lucia wrote:
 I have a 3-node cluster, running on Linux.  All 3 boxes are identical.

 Eth0 - A class B network address - The 'public' interface for web 
 traffic (public in that it goes back out through httpd to the 
 internet)

 Eth1 - A class C network address - The 'private' interface for
replication.
 I.e.

 Receiver
  
 className=org.apache.catalina.cluster.tcp.ReplicationListener
 tcpListenAddress=192.168.x.y
 tcpListenPort=4009
 tcpSelectorTimeout=100
 tcpThreadCount=6/

 Tomcat clustering all works fine.  The problem comes when I request a 
 connection from the connection pool to an Oracle 8i data source, like 
 the
 following:

   Resource
 name=jdbc/dbname
 type=javax.sql.DataSource
 driverClassName=oracle.jdbc.driver.OracleDriver
 url=jdbc:oracle:thin:@hostname.company.com:1521:dbname
 username=user
 password=password
 validationQuery=SELECT COUNT(*) FROM DUAL
 initialSize=10
 defaultCatalog=dbname
 maxIdle=20
 maxWait=5000
 maxActive=50/

 If I have the private network enabled for replication, then the Oracle 
 thin driver insists on trying to connect through this interface first.  
 This happens on a class A network (10.0.x.y) as well as a class C 
 network (192.168.10.y).  It also happens if the OS happens to be W2K.  
 It will take
 5 seconds and time out, and the connect through the class B address.  
 With 10 data sources (on Oracle) I get a connection pool startup time 
 of 50+ seconds (minimum).

 If I turn off the class C (or class A) private network and replicate 
 on my class B network, this problem does not happen.

 Can anybody explain to me why this is the case?  Has anyone else seen
this?
 Has anyone else got this working as expected?

 Should I even bother trying to keep the replication traffic on a 
 private network?  The boxes have 4 gig connections and so it seems 
 like I should be able to make use of the other 3.

 Thanks,
 Tim

 P.s. Yes I know Oracle 8i pre-dates modern man and is no longer supported.
 I'm on a long-range plan to move to MySQL.


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



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



Re: How to run a thread on app startup --- SOLVED

2006-04-04 Thread Bruce McGuire

Hello.

My thanks to everyone for their assistance. The ServletContextListener 
works just fine to run my thread in the background when tomcat starts up 
and closes.


Thanks very much.

Bruce.

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



SV: Connecting Apache 2.2 and Tomcat 5.5.16

2006-04-04 Thread Erik Gulliksen \(maillist\)
Thanks! This sounds promising :D

I guess I need to figure out what modules I need to load etc.
It seems like my Apache installation don't have any
mod_proxy_ajp.so (or what the name is). 

I think I'll need to fiddle with my server and see what else is running. 

For my contect I have a feeling I would need these modules;
  - mod_proxy
  - mod_proxy_ajp
  - mod_proxy_balancer
  - mod_ssl

Anything else I need to set up? (And if so, why?)

My plan was to remove as much modules etc. as possible.

-Erik


-Opprinnelig melding-
Fra: Bernie Durfee [mailto:[EMAIL PROTECTED] 
Sendt: 4. april 2006 21:10
Til: Tomcat Users List
Emne: Re: Connecting Apache 2.2 and Tomcat 5.5.16

 mod_jk, mod_jk2 (same as jk2?), mod_proxy, mod_proxy_balancer,
mod_proxy_ajp
 APR, AJP etc. and my head starts spinning.. :o\

 From what I understand, as of Apache 2.2, the mod_jk project no longer
applies. Instead, the mod_proxy module is a 
generic way to proxy from Apache HTTPD to other servers. So for Tomcat, the
mod_proxy_ajp module will proxy from Apache 
HTTPD directly to Tomcat using the AJP protocol. This is much simpler than
ever, here is how I do it for one of my 
servers...

VirtualHost 12.34.56.78:80
   ServerName my.server.com

   ProxyPreserveHost On
   ProxyPass / ajp://12.34.56.78:8009/
/VirtualHost

...which passes all requests for my.server.com to Tomcat, with an AJP
connector listening on port 8009...

Connector address=12.34.56.78
port=8009
protocol=AJP/1.3
enableLookups=false
minSpareThreads=20
maxSpareThreads=100
maxThreads=200
connectionTimeout=6
/

...it's very simple now, no workers.properties or crazy mod_jk directives.
In fact mod_proxy_ajp is included with Apache 
2.2.

 Well basically what I though was to set up an Apache server and more then
 one Tomcat servers with some load balancing. Am I wrong if I have the
 impression that Apache is the way to go with 128bit SSL and as the front
end
 for load balancing?

I have it set for SSL, which still uses the exact same proxy diretives,
since the proxying is done using AJP after 
Apache does all the SSL protocol stuff. Again, very simple. As for load
balancing, I believe this would be handed by 
some additional mod_proxy directives.

Bernie


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



Re: How can I limit the number of instance my servlet can server concurrently?

2006-04-04 Thread Leon Rosenberg
I suppose yes, using the singlethreaded model and 10 servlet instances.
Though, what is the purpose of this limitation, maybe there are better
ways to solve it?

regards
Leon

On 4/4/06, Meryl Silverburgh [EMAIL PROTECTED] wrote:
 Is it possible to limit Tomcat to just handle 10 concurrently request
 to my servlet?
 for all others (11 and onward), it will queue them up, and serve them
 only when one of the currently-serving request is done?

 Thank you.

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



Re: How can I limit the number of instance my servlet can server concurrently?

2006-04-04 Thread Leon Rosenberg
On 4/4/06, Rhino [EMAIL PROTECTED] wrote:
 Just a guess but couldn't you accomplish this by setting up your servlet to
 use a connection pool and then limiting the connection pool to 10 threads
 maximum?

I think that assuming a DB behind each and every webapp is kindof
risky. Or what kind of connection pool you are speaking about?




 --
 Rhino

Leon

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



If-Range bug in DefaultServlet?

2006-04-04 Thread Duncan McGregor

Hi

I've been making If-Range requests to Tomcat (5.5.16) and it seems  
not to be sending back content when the request and current ETags  
don't match.


RFC 2616 section 14.27 says

If the entity tag given in the If-Range header matches the current  
entity tag for the entity, then the server SHOULD provide the  
specified sub-range of the entity using a 206 (Partial content)  
response. If the entity tag does not match, then the server SHOULD  
return the entire entity using a 200 (OK) response.


Am I doing something wrong, or is the servlet behaviour not as it  
SHOULD be?


Thanks in anticipation

Duncan McGregor

The following testcase shows the current behaviour:

import java.io.IOException;

import junit.framework.TestCase;

import org.apache.commons.httpclient.Header;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.methods.GetMethod;

import com.enterprisedt.net.ftp.FTPClient;

public class TomcatIfRangeTest extends TestCase {

protected HttpClient httpClient;
protected GetMethod getMethod;
private FTPClient ftpClient;

@Override
public void setUp() throws Exception {
httpClient = new HttpClient();
ftpClient = new FTPClient();
ftpClient.setRemoteHost(localhost);
ftpClient.setControlPort(2122);
ftpClient.connect();
ftpClient.login(user, user);
}

public void testIfRange() throws Exception {
upload(contents, delme.txt);
assertEquals(HttpStatus.SC_OK, get(http://localhost:8080/ 
zirisEdge/public/delme.txt));

String etag = headerValue(ETag);
assertEquals(contents, responseBody());

assertEquals(HttpStatus.SC_PARTIAL_CONTENT,
get(http://localhost:8080/zirisEdge/public/delme.txt;,
If-Range, etag,
Range, bytes=1-3
));
assertEquals(etag, headerValue(ETag));
assertEquals(ont, responseBody());

upload(new contents, delme.txt);
assertEquals(HttpStatus.SC_OK,
get(http://localhost:8080/zirisEdge/public/delme.txt;,
If-Range, etag,
Range, bytes=1-3
));
assertFalse(etag.equals(headerValue(ETag)));
assertEquals(new contents, responseBody());
  // FAILS as responseBody is 
}

protected int get(String url, String...headerValues) throws  
HttpException, IOException {

getMethod = new GetMethod(url);
for (int i = 0; i  headerValues.length; i += 2) {
getMethod.addRequestHeader(headerValues[i], headerValues 
[i +1]);

}
return httpClient.executeMethod(getMethod);
}

protected String responseBody() throws IOException {
return getMethod.getResponseBodyAsString();
}

protected String headerValue(String headerName) {
Header header = getMethod.getResponseHeader(headerName);
return header != null ? header.getValue() : null;
}

protected void upload(String contents, String path) throws  
Exception {

ftpClient.put(contents.getBytes(), path);
Thread.sleep(5000); // TODO - is this a cache timeout?
}


}


 
 


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



Re: jdk1.5, tomcat 5.5.9 and jsp compilation

2006-04-04 Thread Leon Rosenberg
I can vague remember issues about tomcat 5.5.x which came out with the
jdt from eclipse which had no support for 1.5. I maybe also be
completely wrong here.
Are you talking about precompiling jsps before deployment, or
production-compile during runtime?
Have you tried the 5.5.16?

regards
Leon

On 4/4/06, CUCKSON, Nick, GBM [EMAIL PROTECTED] wrote:
 I've a problem compiling jsp's against jdk1.5. I've searched the archives,
 google, tomcat docs etc but found no help on my specific issue although I
 can see anumber of people have had problems with generics support.

 I've changed to the Ant compiler and copied the ant.jar to common/lib, added
 the compiler parameters to conf/web.xml to enable 1.5 compilation.

 I still get a message saying that generics are not supported and I should
 change the -source 1.4 to -source 1.5.

 I've looked through the ant docs and this appears to be related to the javac
 tag in build.xml, but I'm not sure where to put this tag in the context of a
 tomcat installation. I've looked through the tomcat docs on jasper (how-to)
 but I believe I've removed the dependency on japser so I dont think this is
 relevant, although it does mention using the 'javac' argument with
 catalina.sh. I've tried this with no success, but it's quite possible I
 didn't configure this properly as I'm not sure where catalina.sh is called
 from. I've looked through the .sh files but it's not clear.

 To sum up, I would like to know how to configure '-source 1.4' to '-source
 1.5' or am I barking up the wrong tree?

 thanks


 ***
 The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered 
 Office: 36 St Andrew Square, Edinburgh EH2 2YB.
 Authorized and regulated by the Financial Services Authority

 This e-mail message is confidential and for use by the
 addressee only. If the message is received by anyone other
 than the addressee, please return the message to the sender
 by replying to it and then delete the message from your
 computer. Internet e-mails are not necessarily secure. The
 Royal Bank of Scotland plc does not accept responsibility for
 changes made to this message after it was sent.

 Whilst all reasonable care has been taken to avoid the
 transmission of viruses, it is the responsibility of the recipient to
 ensure that the onward transmission, opening or use of this
 message and any attachments will not adversely affect its
 systems or data. No responsibility is accepted by The Royal
 Bank of Scotland plc in this regard and the recipient should carry
 out such virus and other checks as it considers appropriate.
 Visit our websites at:
 http://www.rbos.com
 http://www.rbsmarkets.com
 ***



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



Re: Tomcat Clusters, private network for replication, and Oracle 8i JDBC driver

2006-04-04 Thread Filip Hanik - Dev Lists
that sure does sound strange, you'd need a network sniffer to see what 
it tries to do

maybe oracle technet will have more info.

Filip

Tim Lucia wrote:

I did change the metric on Windows when I first discovered this.  It made no
difference.  Why would I *need* to add static routes -- when my machine's
primary IP is 172.25.x.y and the database server is likewise 172.25.x.z?  I
can't explain why *ONLY* the Oracle driver insists on trying the wrong path.

Pinging the db server by name does not cause a 5 second delay, nor does
telnet, ssh, wget, ... 


Confused,
Tim 


-Original Message-
From: Filip Hanik - Dev Lists [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 04, 2006 3:49 PM

To: Tomcat Users List
Subject: Re: Tomcat Clusters, private network for replication, and Oracle 8i
JDBC driver

interesting, you might wanna play around with the route table and add some
static routes for how you want your traffic to flow.

Filip

Tim Lucia wrote:
  

I have a 3-node cluster, running on Linux.  All 3 boxes are identical.

Eth0 - A class B network address - The 'public' interface for web 
traffic (public in that it goes back out through httpd to the 
internet)


Eth1 - A class C network address - The 'private' interface for


replication.
  

I.e.

Receiver
 
className=org.apache.catalina.cluster.tcp.ReplicationListener

tcpListenAddress=192.168.x.y
tcpListenPort=4009
tcpSelectorTimeout=100
tcpThreadCount=6/

Tomcat clustering all works fine.  The problem comes when I request a 
connection from the connection pool to an Oracle 8i data source, like 
the

following:

  Resource
name=jdbc/dbname
type=javax.sql.DataSource
driverClassName=oracle.jdbc.driver.OracleDriver
url=jdbc:oracle:thin:@hostname.company.com:1521:dbname
username=user
password=password
validationQuery=SELECT COUNT(*) FROM DUAL
initialSize=10
defaultCatalog=dbname
maxIdle=20
maxWait=5000
maxActive=50/

If I have the private network enabled for replication, then the Oracle 
thin driver insists on trying to connect through this interface first.  
This happens on a class A network (10.0.x.y) as well as a class C 
network (192.168.10.y).  It also happens if the OS happens to be W2K.  
It will take
5 seconds and time out, and the connect through the class B address.  
With 10 data sources (on Oracle) I get a connection pool startup time 
of 50+ seconds (minimum).


If I turn off the class C (or class A) private network and replicate 
on my class B network, this problem does not happen.


Can anybody explain to me why this is the case?  Has anyone else seen


this?
  

Has anyone else got this working as expected?

Should I even bother trying to keep the replication traffic on a 
private network?  The boxes have 4 gig connections and so it seems 
like I should be able to make use of the other 3.


Thanks,
Tim

P.s. Yes I know Oracle 8i pre-dates modern man and is no longer supported.
I'm on a long-range plan to move to MySQL.


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



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



Re: How can I limit the number of instance my servlet can server concurrently?

2006-04-04 Thread David Rees
On 4/3/06, Meryl Silverburgh [EMAIL PROTECTED] wrote:
 Is it possible to limit Tomcat to just handle 10 concurrently request
 to my servlet?
 for all others (11 and onward), it will queue them up, and serve them
 only when one of the currently-serving request is done?

If you are only using one servlet per Tomcat instance, then yes you
can do this pretty easily by limiting the number of threads for your
connector.

Otherwise, this is something best implemented in the servlet itself
(and is pretty easy to do).

-Dave

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



Re: tomcat one more then one CPU

2006-04-04 Thread David Rees
On 4/4/06, Walter Botman [EMAIL PROTECTED] wrote:
 Can we configure tomcat in a way that it uses more then one CPU?
 It seems to use only one CPU ?

 We are using the following:
 - Sun Fire v240 (with 2 CPU's)
 - Solaris 8 (including patches)
 - tomcat 5.5.7
 - Java 1.5.0

There isn't anything special that needs to be done with Tomcat to use
more than one CPU, it's a function of the JVM and threading. The Sun
JVM should use as many CPUs as are available, but keep in mind that
each thread the JVM spawns can only use one CPU at a time.

Since Tomcat is multithreaded, each request goes to a thread and will use a CPU.

I'm not familiar with running Java on Sun, but I would recommend that
you make sure you're running the latest version and check for any OS
specific JVM settings which may influence threading.

-Dave

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



Re: Tomcat Clusters, private network for replication, and Oracle 8i JDBC driver

2006-04-04 Thread Darryl L. Miles



Just a thought, you are using IP addresses for replication.  But 
hostname for Oracle, have you checked out local DNS issues with the 
jdbc:oracle:thin:@hostname.company.com:1521:dbname ?  Check the IP 
address records are correctly setup, and everyone listed is connectable 
and working.  Check all your local DNS caching servers are operational.  
However for DNS issues I would expect ping/ssh to be affected too.


Can you configure an IP address in the JDBC connection string ?

Do you have 2 default routes setup on your clustered boxes ?  You do not 
say in your original mail which directly connected network eth0 is on, I 
now read it as 172.25.x.y from your follow up.  What does your routing 
table look like.


One reason why the oracle driver uses eth0 over eth1 is that when the 
JDBC client opens the socket to connect it is not bound to any specific 
interface.  Where as with replication I'd guess the tcpListenAddress 
forces which physical card it will use.  Normal then the socket is 
auto-bound (within the kernel) it will choose the default address of the 
physical interface closest to the host (or gateway - if nto directly 
connected).


Have you setup any interface aliasing that might confuse the kernel.  
For example you have IP addresses in overlapping subnets on two physical 
interfaces in the same host ?


When the JDBC client does get connected to the SQL server, what does 
'netstat' show for the IP addresses of that connection ?  Is it using 
the  172.25.x.y: -- 172.25.x.z :1521 as you expect ?


--
Darryl L. Miles



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



Re: Filter Help!

2006-04-04 Thread Mark Thomas
Matthew J. Vincent wrote:
 Hello everyone,
 
 If this is not the right place to post this could you please let me know
 where.  I have searched the forums and Google and cannot find an answer.

Why not just set maxPostSize on the connector and let Tomcat do this
for you?

Mark


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



Re: [REPOST] Tomcat 5.5.15 - HTTPS hanging and intermittent Page Cannot be Displayed problems

2006-04-04 Thread Remy Maucherat
On 4/3/06, Markus Schönhaber [EMAIL PROTECTED] wrote:
 Richard Mundell wrote:
  In 5.5.15 we switched to using the (ever-so-well-documented) APR native
  library so I suspect it's the OpenSSL code in the APR library which is
  causing the problem.

 First thing I'd try is to update to tomcat-native 1.1.2. This fixes an issue
 where sometimes the response was corrupted. And while you're at it: update to
 Tomcat 5.5.16 too.
 Chances are that this will help.

We found a logical explanation for certain SSL request hang issues,
which look similar to these ones, and the problem should now be fixed.
The patch is here:
http://svn.apache.org/viewcvs?rev=391288view=rev

--
x
Rémy Maucherat
Developer  Consultant
JBoss Inc
x

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



Redirecting Root Servlet

2006-04-04 Thread Khawaja Shams
Hello,
I would like the default application path to send a redirect to our
homepage (a site that is not running on tomcat). I tried editing
index.jspinside the ROOT folder, but I found out that this particular
page is
precompiled at build time and will not get recompiled if any changes are
made.  Is there a quick fix to put a redirect in the root application so
that it sends you to a different page.  For example
http://myTomcatInstance:8080/
should redirect to
http://www.google.com

Is it possible to do this without creating another application and giving it
the ROOT context? I am using Tomcat 5.5.15.  Thanks in advance for your
help.

Regards,
Khawaja Shams


RE: Redirecting Root Servlet

2006-04-04 Thread Richard Mundell

Delete 'index.jsp' and place an 'index.htm' file in the ROOT directory
containing your redirect. If you look in web.xml (in the Tomcat conf
directory) you'll be able to configure the order of 'welcome' pages that
Tomcat will serve if the user browses to the root of your web server.

Richard
___
Richard Mundell
The Roberts Group
Market Data Expertise that FITS.
www.trgrp.com


-Original Message-
From: Khawaja Shams [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 04, 2006 7:19 PM
To: Tomcat Users List
Subject: Redirecting Root Servlet

Hello,
I would like the default application path to send a redirect to our
homepage (a site that is not running on tomcat). I tried editing
index.jspinside the ROOT folder, but I found out that this particular page
is precompiled at build time and will not get recompiled if any changes are
made.  Is there a quick fix to put a redirect in the root application so
that it sends you to a different page.  For example
http://myTomcatInstance:8080/ should redirect to http://www.google.com

Is it possible to do this without creating another application and giving it
the ROOT context? I am using Tomcat 5.5.15.  Thanks in advance for your
help.

Regards,
Khawaja Shams



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



virtual hosts on tomcat 5.0.28

2006-04-04 Thread Jeanne Case
I have been trying to create a virtual host with tomcat 5.0.28 to no 
avail.  I have read all the docs. read the Wiki. and still no joy.


I must be missing something very fundamental and obvious to long time 
users of tomcat that is not obvious to me.


I was hoping to leave up the manager and admin page and then have the 
server respond to a dns name for my reall web app. Am I completely naive?


I tried the following:

http://wiki.apache.org/tomcat/CreateVirtualHosts?action=diff

Which is:
0. create ${catalina.home}/www/appBase , ${catalina.home}/www/deploy, 
and ${catalina.home}/conf/Catalina/www.myhostname.com


1. add a host entry in the server.xml file

  Host appBase=www/appBase name=www.myhostname.com/

2. Create the the following file under 
conf/Catalina/www.myhostname.com/ROOT.xml


?xml version=1.0 encoding=UTF-8?
Context
path=/
docBase=www/deploy/mywebapp.war
reloadable=true antiJARLocking=true
/Context

Add any parameters specific to this hosts webapp to this context file

3. put your war file in ${catalina.home}/www/deploy

When tomcat starts, it finds the host entry, then looks for any context 
files and will start any apps with a context

__-

I tried this from 
http://www.straker.co.nz/shadoblog/index.cfm?mode=entryentry=381058E3-E855-60B6-D7E9C4B07755BEBA


 Host name=127.0.0.3 debug=0 appBase=webapps/shadomx7 
unpackWARs=true autoDeploy=true

Aliasrhyswilliams/Alias
Context path= docBase= debug=1/

Valve className=org.apache.catalina.valves.AccessLogValve
directory=logs prefix=home_access_log. suffix=.txt
pattern=common resolveHosts=false/
/Host

Of course changing the names to fit my app.

Still no joy.

Does anybody have an idea what a newbie is doing wrong?

Thanks,
J. Case




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



Apache/1.3.33 - mod_jk/1.2.15 - tomcat 5.0.28 loses connection?

2006-04-04 Thread Kurt Overberg


Gang,

  I have a somewhat heavily loaded tomcat application that uses a 
fairly standard Apache 1.3.33 / mod_jk 1.2.15 / tomcat 5.0.28 set up.  I 
am doing load balancing in the mod_jk, going to 2 RedHat 2.6.9 boxes 
that run the tomcats.  The load is split evenly across the two tomcat 
boxes.   The site processes anywhere between 400,000 and 700,000 JSP 
pages per day.   I've included the configuration files at the bottom of 
this message.


Usually, the site runs great.  No problems whatsoever (well, my code 
occasionally crashes, but that's to be expected).  But once in awhile, 
my mod_jk seems to suddenly start to lose connections to my tomcats. 
mod_jk.log sees this:


[Tue Apr 04 18:23:35 2006] [info]  ajp_process_callback::jk_ajp_common.c 
(1384): Connection aborted or network problems
[Tue Apr 04 18:23:35 2006] [info]  ajp_service::jk_ajp_common.c (1731): 
Receiving from tomcat failed, because of client error without recovery 
in send loop 0
[Tue Apr 04 18:23:35 2006] [info]  service::jk_lb_worker.c (711): 
unrecoverable error 400, request failed. Client failed in the middle of 
request, we can't recover to another instance.
[Tue Apr 04 18:23:35 2006] [info]  jk_handler::mod_jk.c (1841): Aborting 
connection for worker=loadbalancer
[Tue Apr 04 18:23:35 2006] [info]  ajp_process_callback::jk_ajp_common.c 
(1384): Connection aborted or network problems
[Tue Apr 04 18:23:35 2006] [info]  ajp_service::jk_ajp_common.c (1731): 
Receiving from tomcat failed, because of client error without recovery 
in send loop 0
[Tue Apr 04 18:23:35 2006] [info]  service::jk_lb_worker.c (711): 
unrecoverable error 400, request failed. Client failed in the middle of 
request, we can't recover to another instance.
[Tue Apr 04 18:23:35 2006] [info]  jk_handler::mod_jk.c (1841): Aborting 
connection for worker=loadbalancer
[Tue Apr 04 18:23:35 2006] [info]  ajp_process_callback::jk_ajp_common.c 
(1384): Connection aborted or network problems
[Tue Apr 04 18:23:35 2006] [info]  ajp_service::jk_ajp_common.c (1731): 
Receiving from tomcat failed, because of client error without recovery 
in send loop 0
[Tue Apr 04 18:23:35 2006] [info]  service::jk_lb_worker.c (711): 
unrecoverable error 400, request failed. Client failed in the middle of 
request, we can't recover to another instance.
[Tue Apr 04 18:23:35 2006] [info]  jk_handler::mod_jk.c (1841): Aborting 
connection for worker=loadbalancer



...when this happens, my Apache scoreboard fills up with threads in the 
W state.  All new requests seem to get stuck in this state.  Quickly, 
the apache fills up and new requests are locked out.  If I look at my 
tomcat logs, I see that processing has slowed and stopped.  One 
interesting thing is that if I kill and restart my apache, the tomcat 
logs go crazy with output, as if killing the apache somehow unsticks 
them.


Is something running out of sockets?  If I had to guess, I'd say that it 
feels like mod_jk can't receive the data back from the tomcats, but 
thats just a hunch.  I've seen the apache mod_jk config page which seems 
to have a bunch of different parameters for dealing with stuck 
tomcats, but I'm unsure of which one to use, because I don't really know 
whats happening or what the problem is.  I've found other posts on the 
web that list similar problems, but haven't seen any Oh this is the 
problem and this is the simple solution.  I haven't yet dug in with 
netstat to see what's going on network-wise, I'm hoping there some 
magical bullet configuration parameter that will help.  C'mn 
magic bullet!!


Thanks for any insight you can provide!


/kurt




Appropriate configs:

My Apache is set to 1024 simultaneous connections and the JkMounts are 
configured properly.  I have my maximum number of file descriptors 
(sockets) set to 65535 on all machines.


Tomcat AJP connector configs on machines tc1 and tc2

Connector port=8089 protocol=AJP/1.3 maxThreads=400 
maxProcessors=0 minSpareThreads=25 maxSpareThreads=75 
enableLookups=false redirectPort=8593/




workers.properties config

worker.list=tc1-w1,tc2-w1,status,loadbalancer
# tomcat 1 on host tc1
worker.tc1-w1.host=192.168.1.254
worker.tc1-w1.port=8089
worker.tc1-w1.type=ajp13
worker.tc1-w1.lbfactor=8

# tomcat 1 on host tc2
worker.tc2-w1.host=192.168.1.247
worker.tc2-w1.port=8089
worker.tc2-w1.type=ajp13
worker.tc2-w1.lbfactor=8

# status and loadbalancer workers
worker.status.type=status
worker.loadbalancer.type=lb
worker.loadbalancer.balanced_workers=tc1-w1,tc2-w1






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



Re: about maxProcessors attribute

2006-04-04 Thread Bill Barker
Since MaxClients is so big, I'm assuming that you have a pre-fork MPM 
Apache.

In this case, you are strongly recommended to have maxProcessors = 
MaxClients, since each client will have it's own connection to a processor. 
If you include something like connectionTimeout=6, then the Tomcat 
processors will eventually die off if the Apache child doesn't get any 
requests for awhile.  Mostly useful if you are running an older Linux 
kernal.

I think that the /manager/status Servlet for 5.0.x includes this 
information.  However, since it's at most the number of Apache children, you 
should be able to approximate it via:
  $ ps -ef | grep httpd | wc -l



Iratxe Etxeberria Sainz-Ezquerra [EMAIL PROTECTED] wrote in 
message news:[EMAIL PROTECTED]






Hi!
I am reviewing my apache-tomcat configuraction, trying to tunning the 
performance.
I use AJP/1.3 connector between apache and tomcat 5.0.28.
I have the default value for maxProcessors attibute (20). In apache I have 
maxclients to 150 value. Does someone know how works it exactly? One 
processors by each request from apache to tomcat, I suposse..
Is there any way to know how many processors are running in the machine? 
Thanks in advance
 Iratxe



-
Iratxe Etxebarria Sainz-Ezkerra
Soporte Web
External Global Services
Tfno: 946 584 773 / 628 717 375





-

- Este mensaje y los documentos que, en su caso, lleve anexos, pueden 
contener informacion confidencial. Por ello, se informa a quien lo reciba 
por error que la informacion contenida en el mismo es reservada y su uso no 
autorizado esta prohibido legalmente, por lo que en tal caso le rogamos que 
nos lo comunique por la misma via , se abstenga de realizar copias del 
mensaje o remitirlo o entregarlo a otra persona y proceda a borrarlo de 
inmediato.

- Mezu honek eta erantsita dituen agiriek (baldin baditu) isilpeko 
informazioa izan dezakete. Hori dela eta, hutsegite baten ondorioz jasotzen 
duenak jakin beza bertan dagoen informazioa ezkutukoa dela eta legeak 
galarazi egiten duela berori baimenik gabe erabiltzea.

- Aquest missatge i els documents que, donat el cas, portin annexes, poden 
contenir informacio confidencial. Per aquest motiu, se n'informa a qui el 
rebi per error que la informacio continguda es reservada i que el seu us no 
esta legalment autoritzat.

- Esta mensaxe e os documentos que, no seu caso, leven anexos, poden conter 
informacion confidencial. Por isto, informase a quen o reciba por erro que a 
informacion contida no mesmo e reservada e o seu uso non autorizado. Esta 
prohibido legalmente.

- This message together with any documents attached may contain confidential 
information. You are informed that if you should receive it by mistake, the 
information it contains is reserved and its use is not authorised. It is 
legally prohibited. If you have received this message by mistake, please let 
us know as soon as possible by e-mail. Do not make any copies of the 
message, nor send it or give it to anybody else. Please delete it right 
away. 




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



Diagnosing DBCP JDBC connection leak using removeAbandoned parm

2006-04-04 Thread Richard Mixon
Bear with me, I'll try to make this short, but want to give enough
info/background that it makes sense. Basically we are a bit confused by the
output of the DBCP logAbandoned parameter. Any help is appreciated.

Environment: We are using Tomcat 4.1.18 (for now), MySQL 4.0.18, Java
1.5.0_04-b05, all running under Linux kernel 2.4.22-1.2115.nptlsmp on a dual
Xeon dedicated server.

Anyway, we determined that we had a connection leak when our application
froze today. We obtained a thread dump and it showed that everyone of the
Tomcat threads that were running application code, were waiting to get a
connection from the DBCP pool.

Each process looked something like this in the thread dump:

  Thread-171 daemon prio=1 tid=0x8a88a528 nid=0x46e9 in Object.wait()
[0x9559f000..0x955a0700]
at java.lang.Object.wait(Native Method)
- waiting on 0x4a08cb78 (a
org.apache.commons.dbcp.AbandonedObjectPool)
at java.lang.Object.wait(Object.java:474)
at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(Unknown
Source)
- locked 0x4a08cb78 (a org.apache.commons.dbcp.AbandonedObjectPool)
at
org.apache.commons.dbcp.AbandonedObjectPool.borrowObject(AbandonedObjectPool
.java:117)
- locked 0x4a08cb78 (a org.apache.commons.dbcp.AbandonedObjectPool)
at
org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.ja
va:110)
at
org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:3
12)
at com.acme.Connector.CreateConnection(Connector.java:56)
at com.acme.OpenMailData.insert(OpenMailData.java:282)
at com.acme.trackopenmail.doPost(trackopenmail.java:127)
at com.acme.trackopenmail.doGet(trackopenmail.java:65)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:260)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:191)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
java:170)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172
)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:174)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:261)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:360)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:632)
at
org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:590)
at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:707)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
a:530)
at java.lang.Thread.run(Thread.java:595)

So, we decided to change our removeAbandonedTimeout to 60 (from the default
of 300 seconds) and also to supply the parameter logAbandoned=true for DBCP.

So far, this seems to have helped the situation, but we realize that the
real problem is that connections are not being properly closed and this is
only giving us a bit of breathing room.

The good news is that we immediately started seeing 

Re: PostgreSQL access via JNDI

2006-04-04 Thread Amila Suriarachchi
On 4/5/06, Mark Slater [EMAIL PROTECTED] wrote:

 I've been trying to get PostgreSQL set up to be accessed through JNDI
 in Tomcat 5.5.x. I found the docs page describing it, jndi-
 datasource-examples-howto.html, and followed the example there, but
 it still doesn't work. I'm trying to provide access to PostgreSQL for
 use by both JDO and JCR in my web-apps.

 Here's the Resource definition I'm using:

  Resource name=jdbc/whisper_db
  auth=Container
  type=javax.sql.Datasource
  driverClassName=org.postgresql.Driver
  url=jdbc:postgresql://127.0.0.1:5432/my_db


this is a postgres problem rather than tomcat problem.
try here jdbc:postgresql://localhost:5432/my_db (or template1)

if you want to access the database giving 127.0.0.1 you have to put
an entry in pg_hda.conf file.



 username=---
  password=---
  maxActive=10
  maxIdle=100
  maxWait=3000 /


 In my application's META-INF/context.xml, I have the following
 ResourceLink:

  ResourceLink
  global=jdbc/whisper_db name=jdbc/whisper_orm
 type=javax.sql.Datasource /

 In my application's WEB-INF/web.xml, I have the following resource-
 env-ref:

  resource-env-ref
  descriptionWhisper's Database/description
  resource-env-ref-namejdbc/whisper_orm/resource-env-ref-name
  resource-env-ref-typejavax.sql.Datasource/resource-env-
 ref-type
  /resource-env-ref


 Depending on where I put the Resource definition, I get different
 errors.

 If I put it in the web-app's META-INF/context.xml, or in $TOMCAT_HOME/
 conf/context.xml, my JDO implementation complains:
  NestableRuntimeException: There was an error duing JNDI lookup
 of the name java:comp/env/jdbc/whisper_orm.
  
  Caused by: javax.naming.NameNotFoundException: Name jdbc is not
 bound in this Context

 If I put it in $TOMCAT_HOME/conf/server.xml, in the
 GlobalNamingResources section, I get:

 2006-04-04 11:58:27,866 ERROR
 [org.apache.catalina.mbeans.GlobalResourcesLifecycleListener] -
 Exception processing Global JNDI Resources
 javax.naming.NamingException: Cannot create resource instance
  at
 org.apache.naming.factory.ResourceFactory.getObjectInstance
 (ResourceFactory.java:132)
  at javax.naming.spi.NamingManager.getObjectInstance
 (NamingManager.java:304)
  at org.apache.naming.NamingContext.lookup(NamingContext.java:
 792)
  at org.apache.naming.NamingContext.lookup(NamingContext.java:
 152)
  at
 org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans
 (GlobalResourcesLifecycleListener.java:138)
  at
 org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans
 (GlobalResourcesLifecycleListener.java:143)
  at
 org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans
 (GlobalResourcesLifecycleListener.java:108)
  at
 org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.lifecycleEve
 nt(GlobalResourcesLifecycleListener.java:80)
  at
 org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent
 (LifecycleSupport.java:119)
  at org.apache.catalina.core.StandardServer.start
 (StandardServer.java:693)
  at org.apache.catalina.startup.Catalina.start(Catalina.java:
 551)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke
 (NativeMethodAccessorImpl.java:39)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke
 (DelegatingMethodAccessorImpl.java:25)
  at java.lang.reflect.Method.invoke(Method.java:585)
  at org.apache.catalina.startup.Bootstrap.start
 (Bootstrap.java:275)
  at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:
 413)

 I'm assuming these errors are related, and that whatever is causing
 the NamingException is the same fundamental problem causing the
 NameNotFoundException in the context-based configuration. My problem
 is that I can't figure out what it is. The driver for the database
 (postgresql-8.1-405.jdbc3.jar) is in $TOMCAT_HOME/common/lib/, and
 I've also tried adding commons-dbcp-1.2.1.jar and commons-
 pool-1.2.jar alongside it (even though the docs say that shouldn't be
 necessary), but get the same errors.

 Is there any logging that I can turn on that will tell me the WHY
 Tomcat Cannot create resource instance? Or am I doing something
 obviously stupid with my Resource definition? Or could it be
 something else entirely?

 Any suggestions would be really helpful.

 Thanks!

 Mark

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




Moving from Tomcat 4.1 to Tomcat 5.5 - issues?

2006-04-04 Thread Richard Mixon
We are about to move an application from Tomcat 4.1 to Tomcat 5.5.

We are already running Tomcat 4.1 under Sun java 1.5 on 32-bit Linux on dual
Xeon processors with 4GB of memory.

Can anyone else comment on what we should expect as far as changes in
stability and performance?

Also, I am wondering if anyone has had problems moving a non-WAR webapp
from 4.1 to 5.5. The applications is a sort of Content Management System and
is not deployed as a WAR file - changing it at this point is simply not
practical because of all of the content files that are in the webapp
directory. Instead the application is build, using ant of course, including
pre-compiling the JSP's - the end result is a set of jar files. These are
then copied into the test or production environment.

Thanks in advance - Richard


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



Re: PostgreSQL access via JNDI

2006-04-04 Thread Amila Suriarachchi
On 4/5/06, Mark Slater [EMAIL PROTECTED] wrote:
 
  I've been trying to get PostgreSQL set up to be accessed through JNDI
  in Tomcat 5.5.x. I found the docs page describing it, jndi-
  datasource-examples-howto.html, and followed the example there, but
  it still doesn't work. I'm trying to provide access to PostgreSQL for
  use by both JDO and JCR in my web-apps.
 
  Here's the Resource definition I'm using:
 
   Resource name=jdbc/whisper_db
   auth=Container
   type=javax.sql.Datasource 


S should be capital  as well  DataSource

 driverClassName=org.postgresql.Driver
   url=jdbc:postgresql://127.0.0.1:5432/my_db


 this is a postgres problem rather than tomcat problem.
 try here jdbc:postgresql://localhost:5432/my_db (or template1)

 if you want to access the database giving 127.0.0.1 you have to put
 an entry in pg_hda.conf file.



  username=---
   password=---
   maxActive=10
   maxIdle=100
   maxWait=3000 /
 
 
  In my application's META-INF/context.xml, I have the following
  ResourceLink:
 
   ResourceLink
   global=jdbc/whisper_db name=jdbc/whisper_orm
  type=javax.sql.Datasource  /
 
  In my application's WEB-INF/web.xml, I have the following resource-
  env-ref:
 
   resource-env-ref
   descriptionWhisper's Database/description
   resource-env-ref-namejdbc/whisper_orm/resource-env-ref-name
 
   resource-env-ref-typejavax.sql.Datasource/resource-env-
  ref-type
   /resource-env-ref
 
 
  Depending on where I put the Resource definition, I get different
  errors.
 
  If I put it in the web-app's META-INF/context.xml, or in $TOMCAT_HOME/
  conf/context.xml, my JDO implementation complains:
   NestableRuntimeException: There was an error duing JNDI lookup
  of the name java:comp/env/jdbc/whisper_orm.
   
   Caused by: javax.naming.NameNotFoundException: Name jdbc is not
  bound in this Context
 
  If I put it in $TOMCAT_HOME/conf/server.xml, in the
  GlobalNamingResources section, I get:
 
  2006-04-04 11:58:27,866 ERROR
  [org.apache.catalina.mbeans.GlobalResourcesLifecycleListener] -
  Exception processing Global JNDI Resources
  javax.naming.NamingException: Cannot create resource instance
   at
  org.apache.naming.factory.ResourceFactory.getObjectInstance
  (ResourceFactory.java:132)
   at javax.naming.spi.NamingManager.getObjectInstance
  (NamingManager.java:304)
   at org.apache.naming.NamingContext.lookup(NamingContext.java:
  792)
   at org.apache.naming.NamingContext.lookup (NamingContext.java:
  152)
   at
  org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans
  (GlobalResourcesLifecycleListener.java:138)
   at
  org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans
  (GlobalResourcesLifecycleListener.java:143)
   at
  org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans
  (GlobalResourcesLifecycleListener.java:108)
   at
  org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.lifecycleEve
  nt(GlobalResourcesLifecycleListener.java:80)
   at
  org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent
  (LifecycleSupport.java:119)
   at org.apache.catalina.core.StandardServer.start
  (StandardServer.java:693)
   at org.apache.catalina.startup.Catalina.start(Catalina.java:
  551)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke
  (NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke
  (DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.apache.catalina.startup.Bootstrap.start
  (Bootstrap.java:275)
   at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:
  413)
 
  I'm assuming these errors are related, and that whatever is causing
  the NamingException is the same fundamental problem causing the
  NameNotFoundException in the context-based configuration. My problem
  is that I can't figure out what it is. The driver for the database
  (postgresql-8.1-405.jdbc3.jar ) is in $TOMCAT_HOME/common/lib/, and
  I've also tried adding commons-dbcp-1.2.1.jar and commons-
  pool-1.2.jar alongside it (even though the docs say that shouldn't be
  necessary), but get the same errors.
 
  Is there any logging that I can turn on that will tell me the WHY
  Tomcat Cannot create resource instance? Or am I doing something
  obviously stupid with my Resource definition? Or could it be
  something else entirely?
 
  Any suggestions would be really helpful.
 
  Thanks!
 
  Mark
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 



Re: Apache/1.3.33 - mod_jk/1.2.15 - tomcat 5.0.28 loses connection?

2006-04-04 Thread Mladen Turk

Kurt Overberg wrote:



[Tue Apr 04 18:23:35 2006] [info]  ajp_process_callback::jk_ajp_common.c 
(1384): Connection aborted or network problems
[Tue Apr 04 18:23:35 2006] [info]  ajp_service::jk_ajp_common.c (1731): 
Receiving from tomcat failed, because of client error without recovery 
in send loop 0
[Tue Apr 04 18:23:35 2006] [info]  service::jk_lb_worker.c (711): 
unrecoverable error 400, request failed. Client failed in the middle of 
request, we can't recover to another instance.
[Tue Apr 04 18:23:35 2006] [info]  jk_handler::mod_jk.c (1841): Aborting 
connection for worker=loadbalancer


This means exactly what it says. The client has closed it's part
of connection in the middle of the request, thus Tomcat is responding
with 400 (Bad Request).

If you wish to get rid of those messaged rise the JkLogLevel to error.

Regards,
Mladen.


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



Tomcat triggers ServletRequestListener twice per request...

2006-04-04 Thread N G
Hi,

I have a regular HTML page and a ServletRequestListener. For some
reason Tomcat invokes requestInitialized and requestDestroyed twice
for every client request.
In other words:
requestInitialized
requestDestroyed
requestInitialized
requestDestroyed

Could someone explain to me why this is happening? I have NO Filters
or MVC going on here. Just a regular HTML page.

--
Thanks,
NG

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



Re: [REPOST] Tomcat 5.5.15 - HTTPS hanging and intermittent Page Cannot be Displayed problems

2006-04-04 Thread Markus Schönhaber
Remy Maucherat wrote:
 We found a logical explanation for certain SSL request hang issues,
 which look similar to these ones, and the problem should now be fixed.
 The patch is here:
 http://svn.apache.org/viewcvs?rev=391288view=rev

Ah, good to know.

Regards
  mks

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



Re: jdk1.5, tomcat 5.5.9 and jsp compilation

2006-04-04 Thread mylene
It could be ant...

  javac srcdir=${src}
 destdir=${build}
 fork=java$$javac.exe
 source=1.5 -
  /

(see the Ant manual at http://ant.apache.org/manual - core tasks - javac)

Success,

Mylène

On 4/4/06, CUCKSON, Nick, GBM [EMAIL PROTECTED] wrote:
 I've a problem compiling jsp's against jdk1.5. I've searched the archives,
 google, tomcat docs etc but found no help on my specific issue although I
 can see anumber of people have had problems with generics support.

 I've changed to the Ant compiler and copied the ant.jar to common/lib, added
 the compiler parameters to conf/web.xml to enable 1.5 compilation.

 I still get a message saying that generics are not supported and I should
 change the -source 1.4 to -source 1.5.

 I've looked through the ant docs and this appears to be related to the javac
 tag in build.xml, but I'm not sure where to put this tag in the context of a
 tomcat installation. I've looked through the tomcat docs on jasper (how-to)
 but I believe I've removed the dependency on japser so I dont think this is
 relevant, although it does mention using the 'javac' argument with
 catalina.sh. I've tried this with no success, but it's quite possible I
 didn't configure this properly as I'm not sure where catalina.sh is called
 from. I've looked through the .sh files but it's not clear.

 To sum up, I would like to know how to configure '-source 1.4' to '-source
 1.5' or am I barking up the wrong tree?

 thanks


 ***
 The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered 
 Office: 36 St Andrew Square, Edinburgh EH2 2YB.
 Authorized and regulated by the Financial Services Authority

 This e-mail message is confidential and for use by the
 addressee only. If the message is received by anyone other
 than the addressee, please return the message to the sender
 by replying to it and then delete the message from your
 computer. Internet e-mails are not necessarily secure. The
 Royal Bank of Scotland plc does not accept responsibility for
 changes made to this message after it was sent.

 Whilst all reasonable care has been taken to avoid the
 transmission of viruses, it is the responsibility of the recipient to
 ensure that the onward transmission, opening or use of this
 message and any attachments will not adversely affect its
 systems or data. No responsibility is accepted by The Royal
 Bank of Scotland plc in this regard and the recipient should carry
 out such virus and other checks as it considers appropriate.
 Visit our websites at:
 http://www.rbos.com
 http://www.rbsmarkets.com
 ***




--
Mylene

Books just wanna be FREE! See what I mean at:
http://bookcrossing.com/friend/mylene

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