Should a missing jsp:include target cause TC to throw an exception or HTTP error code?

2005-10-21 Thread Steve Kirk

TC 5.5.9
WinXP SP2
JDK 1.5.0_02-b09

My webapp framework is based around my own Invoker servlet, which response
to every request via a generic JSP build page.  This build page itself
includes other files, as shown in this snippet:

" />

"
/>

Each request to the webapp is received by a servlet, which forwards to the
JSP snippetted above to render the response, and the JSP decides which JSPFs
to assemble to customise the response layout according to the request.

This all worked fine.  Then I accidentally omitted 2 JSP fragment files from
the war file when reorganising my code - the files referred to in lines 1
and 3 above.  I would expect that to cause a runtime exception of some sort
if the target files don't exist. (Right?)  However, no exception is thrown.
The build page (that calls the jsp:includes) just carries on and assembles
the rest of the page, omitting the files that it can't find.  Hm.  Sort
of nice that it doesn't complain, but also sort of worrying.

Having had a brief look at the TC source, I focused on the source code of
org.apache.jasper.servlet.JspServlet:279, which appears to show that if the
jsp:include file cannot be found at the specified URI, then TC will return
an HTTP 404 status code in this situation, if I am understanding it
correctly:

// snippet from JspServlet#serviceJspFile

if (null == context.getResource(jspUri))
{
response.sendError(HttpServletResponse.SC_NOT_FOUND, jspUri); //
this is the line in the stacktrace
return; // to calling JspServlet#service() method
}

But, the weird thing is, my current TC server does not appear to do that.
Each page is returned with a SC of 200.  No exceptions logged at all.  The
only defect is that the response pages don't include the two JSPF files.

I'm concerned that I have done something to the config of my webapp that is
suppressing the error somehow. But I also realise that I might have
misinterpreted what I have read of the TC source files.

So I have two questions please:

Q1: have I understood correctly, that TC should throw an exception or HTTP
SC if it can't find a jsp:include file when processing a JSP?

Q2: what might I have done that could suppress this sort of error?

There is more to this problem, but I won't post the next chapter because the
answers to Q1 and Q2 might change what is relevant for me to post.

Thanks.



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



RE: HTTP 500 Error.

2005-10-26 Thread Steve Kirk
the key lines to look at more closely at these:

java.lang.ClassCastException
org.apache.jsp.errorpage_jsp._jspService(errorpage_jsp.java:103)
...
org.apache.jsp.preview_jsp._jspService(preview_jsp.java:135)

(esp the latter), and: 
"note The full stack trace of the root cause is available in the Apache
Tomcat/5.0.27 logs"

I would take a look at the logs for more info then look at the lines in the
_jsp.java files mentioned in the stacktrace above.  These "_jsp.java" files
are the java source files defining the servlets that TC automatically
converts your JSPs into.  You should be able to recognise from there where
the error is in your JSP source.  You will find the files in this folder:

%catalina_home%/work/[engine-name]/[host-name]/[webapp-name]/org/apache/jsp/

where [engine-name] and [host-name] are usually "catalina" and "localhost"
unless you have changed them in %catalina_home%/conf/server.xml

> -Original Message-
> From: cory ng [mailto:[EMAIL PROTECTED] 
> Sent: Monday 24 October 2005 18:47
> To: users@tomcat.apache.org
> Subject: HTTP 500 Error.
> 
> 
> Hello! I know this is a general error and I tried
> numerous scenarios of registering and unregistering
> componenets and dlls and restarts of the tomcat apache
> service. I tried changing some code in some jsp files.
> The error is referring to a jasper exception and a
> class cast exception. Attached is the error I receive
> int he web site word for word. I googled for answers
> but I'n not seeing anything related. If anyone has
> encountered or seen this before. Can you please point
> me in the right direction. This error is generated
> when I click on a print preview button to display a
> report. I will investigate more. Any information will
> be appreciated. Thank you. 
> 
> 
>   
> __ 
> Yahoo! FareChase: Search multiple travel sites in one click.
> http://farechase.yahoo.com
> 



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



RE: problem in getting database connection from remote machine using JNDI

2005-10-26 Thread Steve Kirk
at the risk af asking the obvious, does the database "myDB" exist on the
remote server at the same port number, and with the same username and pw as
on the local server, and if so, does it have any IP address filters that
forbid remote mysql client connections?

> -Original Message-
> From: rahul [mailto:[EMAIL PROTECTED] 
> Sent: Monday 24 October 2005 15:26
> To: Tomcat Users List
> Subject: problem in getting database connection from remote 
> machine using JNDI
> 
> 
> Hi all,
> 
> I am using tomcat JNDI for getting databse connection in my 
> application
> 
> For this I have created a context.xml file in myAPP/META-INF
> which looks like this:
> 
> 
>   privileged="true" crossContext="true">
> type="javax.sql.DataSource" maxActive="30" maxIdle="10" 
> maxWait="6000"
>   username="user" password="password"
>   driverClassName="com.mysql.jdbc.Driver"
>   url="jdbc:mysql://localhost:3306/myDB" removeAbandoned="true"
>   autoReconnect="true"
>   validationQuery="select now()"
>   factory="org.apache.commons.dbcp.BasicDataSourceFactory"/>
> 
> 
> 
> This works absolutely fine. But when I try to connect to a 
> remote database
> by changing url in above
> file to "jdbc:mysql://192.168.5.65:3306/myDB" my application fails
> It creates following exception while retrieving a connection:
> org.apache.tomcat.dbcp.dbcp.SQLNestedException:
> Cannot create PoolableConnectionFactory (Unknown database 'myDB')
> 
> 
> code I have written for fetching connection is:
> 
> 
>Context ctx = (Context) new InitialContext()
>  .lookup("java:comp/env");
>if (ctx == null)
>{
> throw new Exception("No context available");
>} else
>{
> dataSource = (DataSource) ctx.lookup("jdbc/icontact");
> Connection connection = dataSource.getConnection();
>}
> 
> 
> can anybody help?
> 
> 
> thanks in advance
> --RahulJoshi
> 
> 
> 
> 



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



RE: Remote deployments in Tomcat 5.5.9

2005-10-26 Thread Steve Kirk

I am using TC 5.5.9 on WinXP Pro here, but AFAIK the config is the same on
Solaris.

Your remote server needs to have the manager webapp installed and enabled.
It is installed in TC as standard (at least it is in 5.5.9, which I am
using).  However it ships disabled for security reasons so before the
manager webapp works, you need to create a user in conf\tomcat-users.xml
which has the manager role.  You also need to make sure that there is a
realm configured in server.xml to read tomcat-user.xml - again this is
configured in the standard install.  without this, the manager webapp will
not run.

//example content of conf/tomcat-users.xml

  
  


Once you have done that, you can access the webapp through the URI
"/manager/html/", and remote client PCs with the joebloggs/secret
credentials should be able to deploy webapps on the server.

> -Original Message-
> From: Nehal Sangoi [mailto:[EMAIL PROTECTED] 
> Sent: Saturday 22 October 2005 10:18
> To: 'Tomcat Users List'
> Subject: Remote deployments in Tomcat 5.5.9
> 
> 
> 
> Hi,
> 
> I am currently implementing Tomcat 5.5.9 on solaris10. I need 
> to know the
> configuration details of manager deployer, that can be used to deploy
> webapps on remote tomcat hosts. I have written an ant build 
> script. But that
> is doing only a deployment and onto local machine itself.
> 
> Please guide me doing this. Also, i am a newbie to Tomcat 
> technology :))
> 
> 
> Thanks,
> Nehal
> 
> 
> -
> 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: Tracking

2005-10-26 Thread Steve Kirk

Charles, I don't know of a way to have TC clear up conns for you, but you
really should clear up connections explicitly.  To some extent DBCP will
clear up "abandoned" connections (to which you had a variable reference,
which goes out of scope when you have finished processing the request), but
this is bad style rally and you should not rely on it.

The "standard" way to clear up connections is to use a try/catch/finally
structure in your code.

eg
(I'm assuming that you are using DBCP)

Connection c = MyClass.getConnection(); // or however you get a conn from
the pool
try
{
// use the connection to do whatever
}
catch(Exception e)
{
// handle exceptions
}
finally
{
c.close();
}

> -Original Message-
> From: Charles P. Killmer [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday 25 October 2005 21:05
> To: Tomcat Users List
> Subject: Tracking
> 
> My bigger problem is that I am using Connection pooling.  And 
> if I don't
> close every connection when I am down with it, the server stops
> responding.  Restart Tomcat and everything is back to normal. 
>  Is there
> a setting to have Tomcat close all connections for me when a request
> finishes?



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



RE: How to create a website in apache-tomcat-5.5.12

2005-10-26 Thread Steve Kirk
Two things:

1. you need to deploy your webapp as the ROOT webapp on the server.  there
is a standard ROOT webapp that ships with TC, you can just replace that if
you want to, examine that to see how to configure it, look especially at the
%catalina_home%/webapps/ROOT/WEB-INF/web.xml config file.

2. you need to edit %catalina_home%/conf/server.xml so that TC listens on
port 80 rather than 8080, to do that you need to edit this line (from the
standard file on TC 5.5.9):


your webapp is then at the URI of "/" rather than "/myDomain" so it's URL
will be whatever the server name is, e,g, www.myservername.com .
Configuring the domain name is outside the scope of TC config - you need to
get your ISP to config nameserver entries for that.

> -Original Message-
> From: A.Mohan [mailto:[EMAIL PROTECTED] 
> Sent: Monday 24 October 2005 05:08
> To: users@tomcat.apache.org
> Subject: How to create a website in apache-tomcat-5.5.12
> 
> 
> Hi All 
>   Im new to this group . 
> i had some doubts regarding my subject(mail)
>  
> i had developed a web application named myDomain under webapps dir
> So far my development i used to call the application in tomcat 
> like http://localhost:8080/myDomain
> Now i want it to be deployed in www server so that i can call 
> it simply
> www.myDomain.com that is also tomcat server.
>  
> What could i do for it , simply i want to create a domain in tomcat 
> how can i create , i struggled to found out the soln 
>  help me out -- please
>  
> Thanks 
> Mohan
>  
>  
>  
> 
>   
> -
>  Yahoo! FareChase - Search multiple travel sites in one click.  
> 



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



RE: DBCP connection leak after undeploy

2005-10-26 Thread Steve Kirk

Your code and config below look fine to me, conns seem to be returned OK to
pool as you say.  Sounds to me like the pool itself leaves the database with
hanging conns in the pool when it goes down.

When you say "If I deploy/undeploy several times" do you stop and restart TC
between undeploy and redeploy?  If so, might be worth trying to see whether
the problem still happens if you stop and restart TC cleanly rather than
redeploying the webapp while TC is running?  Might help narrow down the
cause slightly.  Might be worth reporting to bugzilla?

> -Original Message-
> From: Bogdan Calmac [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday 26 October 2005 02:18
> To: users@tomcat.apache.org
> Subject: DBCP connection leak after undeploy
> 
> 
> I've written a simple web application consisting of a servlet which
> does a select from a table and displays the result. It is then
> packaged as a war and deployed using the tomcat ant task. After
> executing the servlet, it is undeployed using the ant task again.
> stdout confirms that the webapp is deployed and undeployed without
> errors. The problem is that the connection to the DB is left open even
> after undeploy.
> 
> Software used:
>  - tomcat 5.5.9 on Windows
>  - DBCP connection pool
>  - MSSQL server
> 
> The datasource is defined in META-INF/context.xml with:
> 
>type="javax.sql.DataSource"
>maxActive="5" maxIdle="2" maxWait="1"
>username="sa" password="sa"
>driverClassName="net.sourceforge.jtds.jdbc.Driver"
>url="jdbc:jtds:sqlserver://localhost/pubs"/>
> 
> and then referenced in WEB-INF/web.xml with:
> 
>   
>   DB Connection
>   jdbc/default
>   javax.sql.DataSource
>   Container
>   
> 
> The code accessing the database is:
> 
> private long getTitlesCount() {
>   Connection conn = null;
>   Statement stmt = null;
>   ResultSet rs = null;
>   try {
> InitialContext cxt = new InitialContext();
> DataSource ds = (DataSource) cxt.lookup(
> "java:/comp/env/jdbc/default" );
> conn = ds.getConnection();
> stmt = conn.createStatement();
> rs = stmt.executeQuery("select count(*) from titles");
> if (rs.next())
>   return rs.getLong(1);
> 
>   }
>   catch(Exception e) {
> System.out.println("Failed to retrive title count 
> from the DB.");
> e.printStackTrace();
>   }
>   finally {
> if (rs != null) try { rs.close(); } catch (Exception e) {}
> if (stmt != null) try { stmt.close(); } catch (Exception e) {}
> if (conn != null) try { conn.close(); } catch (Exception e) {}
>   }
>   return -1;
> }
> 
> 
> If I deploy/undeploy several times, the number of leaked connections
> is incremented with 1 each time.
> 
> If I execute the servlet several times, the number of connections
> remains constant, which confirms that the servlet releases the
> connection properly.
> 
> My guess is that the datasource is not tied to the webapp and it is
> not notified/released when the webapp is undeployed.
> 
> -
> 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: Error: Cannot get a connection, pool exhausted

2005-10-26 Thread Steve Kirk

how many concurrent requests are you handling?  you have configured 
> maxActive
> 100
so as soon as 100 concurrent conns are reached, you will exhaust the pool.

If you do not have as many as 100 concurrent conns, then it is likely that
your servlet calls are not returning conns to the pool after they have
finished using them.  Make sure that your servlets' doPost() and doGet()
methods include a call to the Connection#close() method before they return,
whether or not an error occurred.  This returns connections to the pool, for
use by other threads using the pool.  The best place to call the close()
method is in a finally() block.

> -Original Message-
> From: KUMAR, NANDA [AG-Contractor/1000] 
> [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday 26 October 2005 16:13
> To: users@tomcat.apache.org
> Subject: Error: Cannot get a connection, pool exhausted
> 
> 
> Frequently we were getting "Cannot get a connection, pool 
> exhausted" error
> on production. I know in our application, we are closing the 
> connection
> after each connection. Here is our context.xml parameters and 
> values. We set
> maxActive connection to 100. Please let me know what we are 
> doing wrong or
> if you need more information.
> 
> 
>  workDir="work\Catalina\localhost\test">
> 
> 
>   
> url
> jdbc:oracle:thin:@test.com:1521:test
>   
>   
> password
> test123
>   
>   
> maxActive
> 100
>   
>   
> maxWait
> 1
>   
>   
> driverClassName
> oracle.jdbc.driver.OracleDriver
>   
>   
> username
> test
>   
>   
> maxIdle
> 30
>   
> 
> 
> 
> Thanks
> Kumar
> 
> 
> 
> --
> ---
> This e-mail message may contain privileged and/or 
> confidential information, and is intended to be received only 
> by persons entitled to receive such information. If you have 
> received this e-mail in error, please notify the sender 
> immediately. Please delete it and all attachments from any 
> servers, hard drives or any other media. Other use of this 
> e-mail by you is strictly prohibited.
> 
> 
> All e-mails and attachments sent and received are subject to 
> monitoring, reading and archival by Monsanto. The recipient 
> of this e-mail is solely responsible for checking for the 
> presence of "Viruses" or other "Malware". Monsanto accepts no 
> liability for any damage caused by any such code transmitted 
> by or accompanying this e-mail or any attachment.
> --
> ---
> 
> 
> -
> 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: getPageContext returns null

2005-10-26 Thread Steve Kirk

not sure about use of PageContext, never used it.

... or about the "correct" way to pass info from servlet to jsp (if there
even is one), but if it helps, I use this approach and it works well:

// in the servlet's doPost()
request.setAttribute(MyConstants.MY_OBJECT_CONSTANT_NAME, myObject);
request.getRequestDispatcher("blah.jsp").forward(request, response);

// in the JSP
Object myObject = request.getAttribute(MyConstants.MY_OBJECT_CONSTANT_NAME);

> -Original Message-
> From: Michael Neel [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday 26 October 2005 16:12
> To: users@tomcat.apache.org
> Subject: getPageContext returns null
> 
> 
> Hi,
> 
> Quick overview, I'm setting some variables in the session from my
> servlet to be used in my JSP/JSTL page.  Everything is fine if a JSP
> page is called before the servlet, but a call to the servlet first
> results in JspFactory.getPageContext to return null.
> 
> To reproduce, I restart the Tomcat server, clear the session cookies
> from the client, and go to the servlet URL directly.
> 
> I found this bug report which is the problem exactly: 
> http://issues.apache.org/bugzilla/show_bug.cgi?id=3752
> 
> If i go to a jsp page after starting the server, any JSP page, then go
> to the servlet url directly everything works as expected.  Like the
> bug poster, if this is a no-no I'm curious why the factory and the
> call to create the context throw no exceptions.  I'm more curious
> though as to what the correct way is for passing information from
> servlet to jsp.
> 
> Mike
> 
> A stripped down version of the code in question:
> 
>   RequestDispatcher dispat = null;
>   
>   JspFactory factory = JspFactory.getDefaultFactory();
>   PageContext pageContext = this.factory.getPageContext( 
> this, request, response,
>   null, false, JspWriter.DEFAULT_BUFFER, true);
> 
>   // expected URL is something like /AppName/SevrletName/45
>   // path_info is '/45'
>   String id = request.getPathInfo().substring(1);
>   
>   // *snipping* sql-setup to look up 'id'
>   ResultSet rs = sql.executeQuery();
>   if(rs != null) {
>   rs.next();
>   String title = rs.getString("title");
>   String preamble = rs.getString("preamble");
> 
>   pc.setAttribute("title", title, 
> PageContext.REQUEST_SCOPE);
>   pc.setAttribute("preamble", preamble, 
> PageContext.REQUEST_SCOPE);
> 
>   dispat = 
> getServletContext().getRequestDispatcher('page1.jsp');
>   }
>   else {
>   pc.setAttribute("errorMessage", "ID was not found",
> PageContext.REQUEST_SCOPE);
>   dispat = 
> getServletContext().getRequestDispatcher('error.jsp');
>   }
> 
>   factory.releasePageContext(ps);
> 
>   dispat.forward(request, response);
> 
> -
> 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: ? xmlValidation Attribute -- What's it Mean ?

2005-10-26 Thread Steve Kirk

I believe (although am not 100% sure because I haven't tried it myself) that
xmlValidation="true" means that TC's XML parser should check all XML against
the DTD defined in each XML source.  With xmlValidation="false", it will
check that the xml is "well-formed" but not that it is "valid".

See these refs:
http://www.w3.org/TR/REC-xml/#dt-valid
http://www.w3.org/TR/REC-xml/#dt-wellformed

So I think (?) that if you set xmlValidation="true", you must include a DTD
link in each XML source.  If you do not have one, this might be why you are
getting a stacktrace.  The reason for the long stacktrace is that the
parsing is done by a generic parser bundled into TC, so the TC authors
cannot control the call stack, or when exceptions are thrown or the
exception messages - they simply wrap them with a higher level exception as
appropriate.  If it helps, I have reported a similar issue where I thought
that TC's wrapping exception message could be made clearer to users.

Not sure about Xerces 2.2 but ISTR that there is some issue with a change to
the XML parser that ships with TC, this issue is mentioned in 5.5.x release
notes so that might be worth a look up
http://tomcat.apache.org/tomcat-5.5-doc/RELEASE-NOTES.txt  . See also "XML
Parsers and J2SE 1.4" at bottom of
http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html - this might
be relevant?

> -Original Message-
> From: Bob Bronson [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday 26 October 2005 04:24
> To: tomcat-user@jakarta.apache.org
> Subject: ? xmlValidation Attribute -- What's it Mean ?
> 
> 
> Hi all,
> 
> I'm using TC 5.5.12.
> 
> Please look at this snippet from the server.xml that is distributed 
> with TC:
> 
>   
> unpackWARs="true" autoDeploy="true"
> xmlValidation="false" xmlNamespaceAware="false">
> 
> 
> Can anyone tell me what the 'xmlValidation' attribute on 
>  is for? 
> Obviously it has something to do with "XML validation" but 
> what XML? Is 
> it the corresponding web.xml? And how does the 'xmlNamespaceAware' 
> attribute fit in? Every web.xml I've ever seen uses the default 
> namespace?
> 
> And what's the comment about the Xerces 2.2 parser? I'm using 
> Sun's JDK 
> 1.5.0. Does that use Xerces internally?
> 
> When I set the 'xmlValidation' attribute to 'true' I get a big stack 
> trace. One would think it might be appropriate to offer a nice error 
> message describing the problem.
> 
> I've looked at the latest TC documentation for  and it makes no 
> mention of the 'xmlValidation' attribute:
> http://tomcat.apache.org/tomcat-5.5-doc/config/host.html
> 
> Can someone please explain these two attributes? My web.xml 
> is getting 
> unwieldy and I'd like to start validating it.
> 
> Thanks very much.
> 
> --
> Bob Bronson 
> 
> 
> 
> -
> 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: Should a missing jsp:include target cause TC to throw an exception or HTTP error code?

2005-10-26 Thread Steve Kirk

I got no reply to my first post (below), maybe I was too wordy, so here's a
short version of the Q:

If I include a JSP fragment within another JSP page like this:



but the file "test.jsp" does not exist, should TC throw an Exception? Or
maybe an HTTP 404?

I have a case like this where TC ignores the include altogether, wondering
why no error reported by TC.

> -Original Message-----
> From: Steve Kirk [mailto:[EMAIL PROTECTED] 
> Sent: Friday 21 October 2005 18:57
> To: 'users@tomcat.apache.org'
> Subject: Should a missing jsp:include target cause TC to 
> throw an exception or HTTP error code?
> 
> 
> 
> TC 5.5.9
> WinXP SP2
> JDK 1.5.0_02-b09
> 
> My webapp framework is based around my own Invoker servlet, 
> which response to every request via a generic JSP build page. 
>  This build page itself includes other files, as shown in 
> this snippet:
> 
>"_begin.jsp" %>" />
>   
>"_end.jsp" %>" />
> 
> Each request to the webapp is received by a servlet, which 
> forwards to the JSP snippetted above to render the response, 
> and the JSP decides which JSPFs to assemble to customise the 
> response layout according to the request.
> 
> This all worked fine.  Then I accidentally omitted 2 JSP 
> fragment files from the war file when reorganising my code - 
> the files referred to in lines 1 and 3 above.  I would expect 
> that to cause a runtime exception of some sort if the target 
> files don't exist. (Right?)  However, no exception is thrown. 
>  The build page (that calls the jsp:includes) just carries on 
> and assembles the rest of the page, omitting the files that 
> it can't find.  Hm.  Sort of nice that it doesn't 
> complain, but also sort of worrying.
> 
> Having had a brief look at the TC source, I focused on the 
> source code of org.apache.jasper.servlet.JspServlet:279, 
> which appears to show that if the jsp:include file cannot be 
> found at the specified URI, then TC will return an HTTP 404 
> status code in this situation, if I am understanding it correctly:
> 
> // snippet from JspServlet#serviceJspFile
> 
>   if (null == context.getResource(jspUri))
>   {
>   
> response.sendError(HttpServletResponse.SC_NOT_FOUND, jspUri); 
> // this is the line in the stacktrace
>   return; // to calling JspServlet#service() method
>   }
> 
> But, the weird thing is, my current TC server does not appear 
> to do that.  Each page is returned with a SC of 200.  No 
> exceptions logged at all.  The only defect is that the 
> response pages don't include the two JSPF files.
> 
> I'm concerned that I have done something to the config of my 
> webapp that is suppressing the error somehow. But I also 
> realise that I might have misinterpreted what I have read of 
> the TC source files.
> 
> So I have two questions please:
> 
> Q1: have I understood correctly, that TC should throw an 
> exception or HTTP SC if it can't find a jsp:include file when 
> processing a JSP?
> 
> Q2: what might I have done that could suppress this sort of error?
> 
> There is more to this problem, but I won't post the next 
> chapter because the answers to Q1 and Q2 might change what is 
> relevant for me to post.
> 
> Thanks.
> 



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



RE: Error: Cannot get a connection, pool exhausted

2005-10-26 Thread Steve Kirk
java.sql.PreparedStatement pstmt = null;
>   
>   try
>   {
> // vector to hold result data set 
> java.util.Vector yearList = new java.util.Vector();
> 
> // get connection
> conn = getConnection();
> 
> pstmt = conn.prepareStatement(yearQueryCommand());
> pstmt.setString(1, teamId);
> 
> // execute query
> rs = pstmt.executeQuery();
> 
> // There can be multiple records.
> while (rs.next())
> {
>   yearList.addElement(rs.getString(1));
> 
> }
> 
> rs.close();
>   
> pstmt.close();
>   
> // can relese connection now  
> releaseConnection();
>   
> return yearList;
> }
> catch(Exception e)
> {

>   finally 
>   {
> try
> {
>   if(rs != null)
>rs.close();
>   if (pstmt != null)
>  pstmt.close();
> if (conn != null)
>  conn.close();
> }
> catch(SQLException se)
> {
>   /** Ignore */
> }
>   }
>   
>   throw new DAOException("getYears(): Failed to 
> access report
> year ! Error: " + e.getMessage());
> }
> 
>   }
> 
> 
> Thanks
> Kumar
> 
> 
> -Original Message-
> From: Steve Kirk [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, October 26, 2005 10:35 AM
> To: 'Tomcat Users List'
> Subject: RE: Error: Cannot get a connection, pool exhausted
> 
> 
> 
> how many concurrent requests are you handling?  you have configured 
> > maxActive
> > 100
> so as soon as 100 concurrent conns are reached, you will 
> exhaust the pool.
> 
> If you do not have as many as 100 concurrent conns, then it 
> is likely that
> your servlet calls are not returning conns to the pool after they have
> finished using them.  Make sure that your servlets' doPost() 
> and doGet()
> methods include a call to the Connection#close() method 
> before they return,
> whether or not an error occurred.  This returns connections 
> to the pool, for
> use by other threads using the pool.  The best place to call 
> the close()
> method is in a finally() block.
> 
> > -Original Message-
> > From: KUMAR, NANDA [AG-Contractor/1000] 
> > [mailto:[EMAIL PROTECTED] 
> > Sent: Wednesday 26 October 2005 16:13
> > To: users@tomcat.apache.org
> > Subject: Error: Cannot get a connection, pool exhausted
> > 
> > 
> > Frequently we were getting "Cannot get a connection, pool 
> > exhausted" error
> > on production. I know in our application, we are closing the 
> > connection
> > after each connection. Here is our context.xml parameters and 
> > values. We set
> > maxActive connection to 100. Please let me know what we are 
> > doing wrong or
> > if you need more information.
> > 
> > 
> >  > workDir="work\Catalina\localhost\test">
> > 
> > 
> >   
> > url
> > jdbc:oracle:thin:@test.com:1521:test
> >   
> >   
> > password
> > test123
> >   
> >   
> > maxActive
> > 100
> >   
> >   
> > maxWait
> > 1
> >   
> >   
> > driverClassName
> > oracle.jdbc.driver.OracleDriver
> >   
> >   
> > username
> > test
> >   
> >   
> > maxIdle
> > 30
> >   
> > 
> > 
> > 
> > Thanks
> > Kumar



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



RE: Tomcat is dying unpredictably

2005-10-26 Thread Steve Kirk

A long shot, but if you are running RHL9 you might try this, as mentioned in
the TC 5.5 release notes at
http://tomcat.apache.org/tomcat-5.5-doc/RELEASE-NOTES.txt :


Tomcat on Linux:

GLIBC 2.2 / Linux 2.4 users should define an environment variable:
export LD_ASSUME_KERNEL=2.2.5

Redhat Linux 9.0 users should use the following setting to avoid
stability problems:
export LD_ASSUME_KERNEL=2.4.1

Apparently the problem is that RHL introduced the "Native Posix thread
library", see here (find "NPTL" in the page to jump to the explanation): 
http://www.redhat.com/docs/manuals/linux/RHL-9-Manual/release-notes/x86/ 

I've noticed it handing a JVM that does a lot of socket access from the
command line.  The VM just stops dead without reporting anything.  That was
on the last released build of RHL9 (2.4.20)

> -Original Message-
> From: Mark Shifman [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday 26 October 2005 17:40
> To: Tomcat Users List
> Subject: Tomcat is dying unpredictably
> 
> 
> Recently tomcat has started dying in an unpredictable manner. 
> I am running
> java version "1.4.2"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28)
> Java HotSpot(TM) Client VM (build 1.4.2-b28, mixed mode)
> 
> jakarta-tomcat-5.0.19 on a Linux box with kernel 
> 2.4.21-37.ELsmp #1 SMP 
> Wed Sep 7 13:28:55 EDT 2005
> (recently upgraded) and struts  1.2.6.
> 
> the output from catalina.out is shown.
> any help would be appreciated
> 
> 
> 
> Another exception has been detected while we were handling last error.
> Dumping information about last error:
> ERROR REPORT FILE = (N/A)
> An unexpected exception has been detected in native code 
> outside the VM.
> PC= 0x0029cded
> Unexpected Signal : 11 occurred at PC=0x29CDED
> SIGNAL= 11
> Function=FUNCTION NAME = (null)+0x29CDED
> (N/A)
> Library=/lib/tls/libc.so.6
> OFFSET= 0x29CDED
> 
> LIBRARY NAME  = NOTE: We are unable to locate the function name 
> symbol for the error
> /lib/tls/libc.so.6
>   just occurred. Please refer to release documentation 
> for possible
> Please check ERROR REPORT FILE for further information, if 
> there is any.
> Good bye.
>   reason and solutions.
> 
> 
> Current Java thread:
> at java.net.Inet4AddressImpl.getHostByAddr(Native Method)
> at java.net.InetAddress$1.getHostByAddr(InetAddress.java:774)
> at 
> java.net.InetAddress.getHostFromNameService(InetAddress.java:464)
> at java.net.InetAddress.getHostName(InetAddress.java:407)
> at java.net.InetAddress.getHostName(InetAddress.java:379)
> at 
> org.apache.coyote.http11.Http11Processor.parseHost(Http11Proce
> ssor.java:1308)
> at 
> org.apache.coyote.http11.Http11Processor.prepareRequest(Http11
> Processor.java:1276)
> at 
> org.apache.coyote.http11.Http11Processor.process(Http11Process
> or.java:817)
> at 
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandle
> r.processConnection(Http11Protocol.java:732)
> at 
> org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoi
> nt.java:619)
> at 
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(
> ThreadPool.java:688)
> at java.lang.Thread.run(Thread.java:534)
> 
> Dynamic libraries:
> Can not get information for pid = 5855
> 
> Heap at VM Abort:
> Heap
>  def new generation   total 3520K, used 2449K [0x08e6, 
> 0x0923, 
> 0x0934)
>   eden space 3136K,  75% used [0x08e6, 0x090ae558, 0x0917)
>   from space 384K,  22% used [0x091d, 0x091e60b8, 0x0923)
>   to   space 384K,   0% used [0x0917, 0x0917, 0x091d)
>  tenured generation   total 46504K, used 38229K [0x0934, 
> 0x0c0aa000, 
> 0x0ce6)
>the space 46504K,  82% used [0x0934, 0x0b895408, 0x0b895600, 
> 0x0c0aa000)
>  compacting perm gen  total 20224K, used 19970K [0x0ce6, 
> 0x0e22, 
> 0x10e6)
>the space 20224K,  98% used [0x0ce6, 0x0e1e0808, 0x0e1e0a00, 
> 0x0e22)
> 
> Local Time = Fri Oct 21 22:05:03 2005
> Elapsed Time = 33731
> #
> # The exception above was detected in native code outside the VM
> #
> # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode)
> #
> # An error report file has been saved as /tmp/hs_err_pid5855.log.
> # Please refer to the file for further information.
> #
> jsvc.exec error: Service did not exit cleanly
> 
> 
> 
> 
> 
> 
> -- 
>  Mark Shifman MD. Ph.D.
>  Yale Center for Medical Informatics
>  Phone (203)737-5219
>  [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: Repeated logging problem on 5.5

2005-10-27 Thread Steve Kirk
This is a repost of a message I first posted in June that I got no replies
to.

I have a double-logging problem, by which I mean that 
some of my log messages get logged to two logfiles.  I have only one 
logfile configured using java.util.logging, but in some cases, the 
same log message gets logged to the TC stdout log as well, which I don't 
want.  It's not the end of the world, but I'd like to understand what's 
happening in case I've misunderstood something.

This double logging problem only happens when there is a java.util.logging
call 
from either: 
- the init() method of my own servlet
- a class created during that init() method, that persists in the VM after 
  the init() method has returned, through a static field reference.

More detail, incl my versions and config setup, are in my original post
here: 
http://article.gmane.org/gmane.comp.jakarta.tomcat.user/113877 

Does anyone have any ideas what the cause might be, please?



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



RE: Tracking

2005-10-27 Thread Steve Kirk
Charles, see also my reply to Nanda Kumar's thread "Cannot get a connection,
pool exhausted" for a coding example.  HTH :)

> -Original Message-----
> From: Steve Kirk [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday 26 October 2005 14:01
> To: 'Tomcat Users List'
> Subject: RE: Tracking
> 
> 
> 
> Charles, I don't know of a way to have TC clear up conns for 
> you, but you
> really should clear up connections explicitly.  To some 
> extent DBCP will
> clear up "abandoned" connections (to which you had a variable 
> reference,
> which goes out of scope when you have finished processing the 
> request), but
> this is bad style rally and you should not rely on it.
> 
> The "standard" way to clear up connections is to use a 
> try/catch/finally
> structure in your code.
> 
> eg
> (I'm assuming that you are using DBCP)
> 
> Connection c = MyClass.getConnection();   // or however 
> you get a conn from
> the pool
> try
> {
>   // use the connection to do whatever
> }
> catch(Exception e)
> {
>   // handle exceptions
> }
> finally
> {
>   c.close();
> }
> 
> > -Original Message-
> > From: Charles P. Killmer [mailto:[EMAIL PROTECTED] 
> > Sent: Tuesday 25 October 2005 21:05
> > To: Tomcat Users List
> > Subject: Tracking
> > 
> > My bigger problem is that I am using Connection pooling.  And 
> > if I don't
> > close every connection when I am down with it, the server stops
> > responding.  Restart Tomcat and everything is back to normal. 
> >  Is there
> > a setting to have Tomcat close all connections for me when a request
> > finishes?
> 
> 
> 
> -
> 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 share resources across two applications

2005-10-27 Thread Steve Kirk

Why not just include  tags in your w1 webapp's pages whose href
attributes point direct to URIs that begin "/w2app/" and vice-versa?  I
don't think you need to use dispatchers.

The docs for ServletContext#getContext (your line 1) say: "...The given path
must be begin with "/", is interpreted relative to the server's document
root and is matched against the context roots of other web applications
hosted on this container. In a security conscious environment, the servlet
container may return null for a given URL.".

The spec says ServletContext#getContext "Returns: the ServletContext object
that corresponds to the named URL, or null if either none exists or the
container wishes to restrict this access."

So:

1. Are you sure that your url begins with a "/" ?

2. If you are, the null indicates that there is a security constraint
preventing access to the URL (or the url does not exist). This could be a
standard TC rule preventing access between webapps.  I don't know for sure,
perhaps someone that knows more will chip in.

> -Original Message-
> From: Nihita Goel [mailto:[EMAIL PROTECTED] 
> Sent: Thursday 27 October 2005 13:33
> To: users@tomcat.apache.org
> Subject: How to share resources across two applications
> 
> 
> Hi,
> I have two applications running on the tomcat application server.
> w1 - with context path "/w1app"
> and w2 with context path "/w2app"
> I wish to provide links in w1 displaying pages of w2.
> 
> I have used this code in my HttpServlet class of w1
> 
> if  /// some condition
> 
> Servlet Context othercontext = 
> getServletContext().getContext("/w2app"); 
> (1)
> RequestDispatcher rd = othercontext.getRequestDispatcher(url); (2)
> rd.forward (request,response) (3)
> 
> However - the it gives a NullPointerException at 1.
> 
> I have been trying hard but without success..
> 
> Thanks



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



RE: org.apache.jasper.JasperException: setAttribute: Non-serializable attribute

2005-10-27 Thread Steve Kirk

Not sure, but this could be it:  TC saves Session objects to files when the
webapp is started/stopped.  (This is a configurable feature in context.xml).
To do this, any attribute that you add to a Session object must be
serializable.  Therefore I would guess that if you call
Session#setAttribute() with a non-serializable object as an arg, it might be
complaining.

I'd be interested to know if this is the problem, because I had trouble in a
related area a while back, which arose because TC did *not* complain about
the attribute at the time, only when the webapp was stopped and it tried to
write it to sessions.ser 

> -Original Message-
> From: Graf László [mailto:[EMAIL PROTECTED] 
> Sent: Thursday 27 October 2005 17:04
> To: users@tomcat.apache.org
> Subject: org.apache.jasper.JasperException: setAttribute: 
> Non-serializable attribute
> 
> 
> Hi,
> 
> I am using JBoss-4.0.3 which runs an embeded Tomcat 5.5.9.
> Before sending the code segment I would like to ask you,
> when throws the server the following exception:
> 
> ---
> java.lang.IllegalArgumentException: setAttribute: 
> Non-serializable attribute
> ---
> 
> Below you can see the whole output of the server.
> 
> 
> 
> "HTTP Status 500 -
> type Exception report
> message
> description The server encountered an internal error () that 
> prevented 
> it from fulfilling this request.
> 
> exception
> 
> org.apache.jasper.JasperException: setAttribute: 
> Non-serializable attribute
> 
> org.apache.jasper.servlet.JspServletWrapper.service(JspServlet
Wrapper.java:370)
> 
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet
.java:314)
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
> 
> org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyH
eaderFilter.java:81)
> 
> root cause
> 
> java.lang.IllegalArgumentException: setAttribute: 
> Non-serializable attribute
> 
> org.apache.catalina.session.StandardSession.setAttribute(Stand
ardSession.java:1233)
> 
> org.apache.catalina.session.StandardSessionFacade.setAttribute
> (StandardSessionFacade.java:129)
> 
> org.apache.jasper.runtime.PageContextImpl.doSetAttribute(PageC
> ontextImpl.java:341)
> 
> org.apache.jasper.runtime.PageContextImpl.setAttribute(PageCon
> textImpl.java:320)
> 
> org.apache.jsp.alt_005ffejlec_jsp._jspService(org.apache.jsp.a
> lt_005ffejlec_jsp:94)
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
> 
> org.apache.jasper.servlet.JspServletWrapper.service(JspServlet
Wrapper.java:322)
> 
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet
.java:314)
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
> 
> org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyH
eaderFilter.java:81)
> 
> note The full stack trace of the root cause is available in 
> the Apache 
> Tomcat/5.5.9 logs."
> 
> -- 
> Graf László
> 
> 
> -
> 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: Error: Cannot get a connection, pool exhausted

2005-10-27 Thread Steve Kirk
yes.  in the same place you have set maxActive etc.

> -Original Message-
> From: KUMAR, NANDA [AG-Contractor/1000] 
> [mailto:[EMAIL PROTECTED] 
> Sent: Thursday 27 October 2005 15:46
> To: 'Tomcat Users List'
> Subject: RE: Error: Cannot get a connection, pool exhausted
> 
> 
> Thanks Jan, Let me try this. I need to add these parameters 
> in context.xml?
> Am I right?
> 
> Thanks
> Nanda
> 
> -Original Message-
> From: Jan Pernica [mailto:[EMAIL PROTECTED]
> Sent: Thursday, October 27, 2005 1:49 AM
> To: Tomcat Users List
> Subject: Re: Error: Cannot get a connection, pool exhausted
> 
> 
> And try to use
> 
> removeAbandoned="true" logAbandoned="true" 
> removeAbandonedTimeout="120"
> 
> to track which connections were not properly closed (see
> http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-exampl
> es-howto.html)
> 
> Regards
> 
> 
> Jan
> 
> 
> 
> Steve Kirk wrote:
> 
> >how many concurrent requests are you handling?  you have configured 
> >  
> >
> >>maxActive
> >>100
> >>
> >>
> >so as soon as 100 concurrent conns are reached, you will 
> exhaust the pool.
> >
> >If you do not have as many as 100 concurrent conns, then it 
> is likely that
> >your servlet calls are not returning conns to the pool after 
> they have
> >finished using them.  Make sure that your servlets' doPost() 
> and doGet()
> >methods include a call to the Connection#close() method 
> before they return,
> >whether or not an error occurred.  This returns connections 
> to the pool,
> for
> >use by other threads using the pool.  The best place to call 
> the close()
> >method is in a finally() block.
> >
> >  
> >
> >>-Original Message-
> >>From: KUMAR, NANDA [AG-Contractor/1000] 
> >>[mailto:[EMAIL PROTECTED] 
> >>Sent: Wednesday 26 October 2005 16:13
> >>To: users@tomcat.apache.org
> >>Subject: Error: Cannot get a connection, pool exhausted
> >>
> >>
> >>Frequently we were getting "Cannot get a connection, pool 
> >>exhausted" error
> >>on production. I know in our application, we are closing the 
> >>connection
> >>after each connection. Here is our context.xml parameters and 
> >>values. We set
> >>maxActive connection to 100. Please let me know what we are 
> >>doing wrong or
> >>if you need more information.
> >>
> >>
> >> >>workDir="work\Catalina\localhost\test">
> >>
> >>
> >>  
> >>url
> >>jdbc:oracle:thin:@test.com:1521:test
> >>  
> >>  
> >>password
> >>test123
> >>  
> >>  
> >>maxActive
> >>100
> >>  
> >>  
> >>maxWait
> >>1
> >>  
> >>  
> >>driverClassName
> >>oracle.jdbc.driver.OracleDriver
> >>  
> >>  
> >>username
> >>test
> >>  
> >>  
> >>maxIdle
> >>30
> >>  
> >>
> >>
> >>
> >>Thanks
> >>Kumar
> >>
> >>
> >>
> >>--
> >>---
> >>This e-mail message may contain privileged and/or 
> >>confidential information, and is intended to be received only 
> >>by persons entitled to receive such information. If you have 
> >>received this e-mail in error, please notify the sender 
> >>immediately. Please delete it and all attachments from any 
> >>servers, hard drives or any other media. Other use of this 
> >>e-mail by you is strictly prohibited.
> >>
> >>
> >>All e-mails and attachments sent and received are subject to 
> >>monitoring, reading and archival by Monsanto. The recipient 
> >>of this e-mail is solely responsible for checking for the 
> >>presence of "Viruses" or other "Malware". Monsanto accepts no 
> >>liability for any damage caused by any such code transmitted 
> >>by or accompanying this e-mail or any attachment.
> >>--
> >>---
> >>
>

RE: DBCP connection leak after undeploy

2005-10-27 Thread Steve Kirk

Interesting, thanks for mailing to the list.

Have you considered whether managing the DBCP resource yourself might help?
In other words you don't have to use the TC container-managed method of
declaring DBCP resources if you don't want to.  If you wrote a
ServletContextListener to create and close the pool and make it available to
your webapp, you would have more control over these issues (or to put it
another way, you could choose to write the "glueing integration code"
yourself).

I have this on my "to do" list, because of other issues around using
container managed resources.  Have not done it yet but I have some quick and
dirty code that does it, which I need to combine/adapt.

PS I don't think that I have see the problem that you have reported.  I run
TC 5.5.9 on WinXP with Mysql 4.1.11 and Connector/J 3.1.8, have never
noticed that problem, my pools always seem to clean up fine.

> -Original Message-
> From: Bogdan Calmac [mailto:[EMAIL PROTECTED] 
> Sent: Thursday 27 October 2005 16:49
> To: Tomcat Users List
> Subject: Re: DBCP connection leak after undeploy
> 
> 
> This problem is caused by Tomcat not cleaning up the JDBC resources
> defined in context.xml. When a context is stopped the DBCP resource is
> not notified and the pooled connections are leaked. I've submitted a
> bug along with a fix
> (http://issues.apache.org/bugzilla/show_bug.cgi?id=37262) but it was
> rejected on the grounds that DBCP is an some external library and
> tomcat should not contain any glueing integration code.
> 
> I'm not verry happy about it, because connection leaks seem like a
> pretty serious issue to me. But hey, why do I complain, I din not pay
> a dime for Tomcat, right?
> 
> On 10/26/05, Bogdan Calmac <[EMAIL PROTECTED]> wrote:
> > When tomcat is stopped the connection is closed. I'll 
> probably submit
> > the example to bugzilla. Can somebody familiar with the code suggest
> > which catalina object keeps a reference of the datasource (beside
> > being registered in JNDI)?
> >
> > On 10/26/05, Steve Kirk <[EMAIL PROTECTED]> wrote:
> > >
> > > Your code and config below look fine to me, conns seem to 
> be returned OK to
> > > pool as you say.  Sounds to me like the pool itself 
> leaves the database with
> > > hanging conns in the pool when it goes down.
> > >
> > > When you say "If I deploy/undeploy several times" do you 
> stop and restart TC
> > > between undeploy and redeploy?  If so, might be worth 
> trying to see whether
> > > the problem still happens if you stop and restart TC 
> cleanly rather than
> > > redeploying the webapp while TC is running?  Might help 
> narrow down the
> > > cause slightly.  Might be worth reporting to bugzilla?
> > >
> > > > -Original Message-
> > > > From: Bogdan Calmac [mailto:[EMAIL PROTECTED]
> > > > Sent: Wednesday 26 October 2005 02:18
> > > > To: users@tomcat.apache.org
> > > > Subject: DBCP connection leak after undeploy
> > > >
> > > >
> > > > I've written a simple web application consisting of a 
> servlet which
> > > > does a select from a table and displays the result. It is then
> > > > packaged as a war and deployed using the tomcat ant task. After
> > > > executing the servlet, it is undeployed using the ant 
> task again.
> > > > stdout confirms that the webapp is deployed and 
> undeployed without
> > > > errors. The problem is that the connection to the DB is 
> left open even
> > > > after undeploy.
> > > >
> > > > Software used:
> > > >  - tomcat 5.5.9 on Windows
> > > >  - DBCP connection pool
> > > >  - MSSQL server
> > > >
> > > > The datasource is defined in META-INF/context.xml with:
> > > >
> > > >> > > type="javax.sql.DataSource"
> > > >maxActive="5" maxIdle="2" maxWait="1"
> > > >username="sa" password="sa"
> > > >
> driverClassName="net.sourceforge.jtds.jdbc.Driver"
> > > >url="jdbc:jtds:sqlserver://localhost/pubs"/>
> > > >
> > > > and then referenced in WEB-INF/web.xml with:
> > > >
> > > >   
> > > >   DB Connection
> > > >   jdbc/default
> > > >   javax.sql.DataSource
> > > >   Container
> > > >   
> > >

RE: static server implementation?

2005-10-27 Thread Steve Kirk

Have you considered that you can remove much of the dynamic config from
conf\web.xml so that there is no default servlet or other dynamic behaviour
in any webapp unless you explictly configure it so in the webapp's own
web.xml?

In fact this is what I prefer to do myself (except on dev box because I use
the manager webapp).  My conf/web.xml is almost empty.

that way, you can have a webapp which has none of the dynamic capabilities.

> -Original Message-
> From: Caldarale, Charles R [mailto:[EMAIL PROTECTED] 
> Sent: Thursday 27 October 2005 19:21
> To: Tomcat Users List
> Subject: RE: static server implementation?
> 
> 
> > From: Robert Koberg [mailto:[EMAIL PROTECTED] 
> > Subject: Re: static server implementation?
> > 
> > If you have a need for many virtual hosts, but do not need 
> > or want any ability for dynamic activity it would make sense 
> > to have a limited version of a tomcat host/context. I mean, 
> > I have a need to create VHosts from java, but those VHosts 
> > should not be able to affect anything (Read Only).
> 
> I'm still not understanding why a standard Tomcat isn't 
> sufficient.  If
> you don't configure any dynamic content capabilities, none will
> magically appear to thwart your goals.  Are you concerned about
> performance?  Have you tested a static-only Tomcat to see if it's
> adequate for your needs?
> 
>  - Chuck
> 
> 
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE 
> PROPRIETARY
> MATERIAL and is thus for use only by the intended recipient. If you
> received this in error, please contact the sender and delete 
> the e-mail
> and its attachments from all computers.
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



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



RE: Tomcat Startup

2005-10-28 Thread Steve Kirk
This...
> Can't load server.xml
...suggests that you need to check your %Catalina_Home%\conf\server.xml file

check its permissions as well, against the user that TC is running as

> -Original Message-
> From: feilong [mailto:[EMAIL PROTECTED] 
> Sent: Friday 28 October 2005 10:51
> To: users@tomcat.apache.org
> Subject: Tomcat Startup
> 
> 
> Hi,
> My Catalina_Home: C:\Programme\jakarta-tomcat-5.0.30\
> JAVA_HOME:  C:\Programme\JBuilderX\jdk1.4
> 
> 
> C:\Programme\jakarta-tomcat-5.0.30\bin>catalina run
> Using CATALINA_BASE:   C:\Programme\jakarta-tomcat-5.0.30\
> Using CATALINA_HOME:   C:\Programme\jakarta-tomcat-5.0.30\
> Using CATALINA_TMPDIR: C:\Programme\jakarta-tomcat-5.0.30\\temp
> Using JAVA_HOME:   C:\Programme\JBuilderX\jdk1.4\
> Can't load server.xml
> Can't load server.xml
> Oct 28, 2005 10:43:18 AM org.apache.catalina.startup.Catalina start
> INFO: Server startup in 0 ms
> java.lang.reflect.InvocationTargetException
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
> java:39)
> at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
> sorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:324)
> at 
> org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287)
> at 
> org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425)
> Caused by: java.lang.NullPointerException
> at 
> org.apache.catalina.startup.Catalina.await(Catalina.java:619)
> at 
> org.apache.catalina.startup.Catalina.start(Catalina.java:579)
> ... 6 more
> 
> Best
> Feilong 
> 
> 



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



RE: Asking Again: What's the "xmlValidation" Attribute for?

2005-10-28 Thread Steve Kirk
Bob, I replied to your original post - if you did not get that, check the
archive here 
http://mail-archives.apache.org/mod_mbox/tomcat-users/200510.mbox/%3c00fc01c
[EMAIL PROTECTED] 

Re what xml the host tag is referring to, I assume that the xml settings in
host relate to loading all the config files, incl web.xml, tomcat-users,
server.xml, etc.  Can't think of any other reason that the TC engine would
use XML...?

'xmlNamespaceAware' : I think this relates to the DTD, hence if you have
validation true you need 

> -Original Message-
> From: Bob Bronson [mailto:[EMAIL PROTECTED] 
> Sent: Friday 28 October 2005 02:27
> To: tomcat-user@jakarta.apache.org
> Subject: Asking Again: What's the "xmlValidation" Attribute for?
> 
> 
> I'm using TC 5.5.12.
> 
> Please look at this snippet from the server.xml that is distributed
> with TC:
> 
>   
> unpackWARs="true" autoDeploy="true"
> xmlValidation="false" xmlNamespaceAware="false">
> 
> 
> Can anyone tell me what the 'xmlValidation' attribute on 
>  is for? 
> I realize it has something to do with "XML validation", but 
> what XML is 
> it referring to? Is it the corresponding web.xml? And how does the 
> 'xmlNamespaceAware' attribute fit in?
> 
> And what's the comment about the Xerces 2.2 parser? I'm using 
> Sun's JDK
> 1.5.0. Does it use Xerces internally?
> 
> When I set the 'xmlValidation' attribute to 'true' I get a big stack
> trace. One would think it might be appropriate to offer a nice error
> message describing the problem.
> 
> I've looked at the latest TC documentation for  and it makes no
> mention of the 'xmlValidation' attribute:
> http://tomcat.apache.org/tomcat-5.5-doc/config/host.html
> 
> Can someone please explain these two attributes? My web.xml is getting
> unwieldy and I'd like to start validating it.
> 
> Thanks very much.
> 
> --
> Bob Bronson
> 
> 
> 
> -
> 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 is dying unpredictably

2005-10-28 Thread Steve Kirk

Sorry, doesn't suggest anything specific to me.

> -Original Message-
> From: Mark Shifman [mailto:[EMAIL PROTECTED] 
> Sent: Thursday 27 October 2005 20:13
> To: Tomcat Users List
> Subject: Re: Tomcat is dying unpredictably
> 
> 
> Thanks for your reply.  After adding the export, tomcat 
> doesn't die but I am
> getting an ERROR that ThreadDeath happened. see trace below.
> 
> Any  ideas where to go next?
> 
> Oct 27, 2005 10:31:55 AM org.apache.catalina.loader.WebappClassLoader 
> loadClass
> INFO: Illegal access: this web application instance has been stopped 
> already (the eventual following stack trace is caused by an 
> error thrown 
> for debugging purposes as well as to attempt to terminate the thread 
> which caused the illegal access, and has no functional impact)
> Oct 27, 2005 10:31:55 AM org.apache.catalina.loader.WebappClassLoader 
> loadClass
> INFO: Illegal access: this web application instance has been stopped 
> already (the eventual following stack trace is caused by an 
> error thrown 
> for debugging purposes as well as to attempt to terminate the thread 
> which caused the illegal access, and has no functional impact)
> ERROR 2005-10-27 10:31:55,101 org.apache.coyote.tomcat5.CoyoteAdapter 
> service
> An exception or error occurred in the container during the request 
> processing
> java.lang.ThreadDeath
> at 
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappC
> lassLoader.java:1270)
> at 
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappC
> lassLoader.java:1230)
> at java.beans.Introspector.instantiate(Introspector.java:1322)
> at 
> java.beans.Introspector.findExplicitBeanInfo(Introspector.java:393)
> at java.beans.Introspector.(Introspector.java:342)
> at java.beans.Introspector.getBeanInfo(Introspector.java:144)
> at 
> org.apache.commons.beanutils.PropertyUtils.getPropertyDescript
> ors(PropertyUtils.java:949)
> at 
> org.apache.commons.beanutils.PropertyUtils.getPropertyDescript
> ors(PropertyUtils.java:979)
> at 
> org.apache.commons.beanutils.PropertyUtils.getPropertyDescript
> or(PropertyUtils.java:887)
> at 
> org.apache.commons.beanutils.PropertyUtils.getSimpleProperty(P
> ropertyUtils.java:1172)
> at 
> org.apache.commons.beanutils.PropertyUtils.getNestedProperty(P
> ropertyUtils.java:772)
> at 
> org.apache.commons.beanutils.PropertyUtils.getProperty(Propert
> yUtils.java:801)
> at 
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardW
> rapperValve.java:298)
> at 
> org.apache.catalina.core.StandardValveContext.invokeNext(Stand
> ardValveContext.java:151)
> at 
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
> ine.java:567)
> at 
> org.apache.catalina.core.StandardContextValve.invokeInternal(S
> tandardContextValve.java:245)
> at 
> org.apache.catalina.core.StandardContextValve.invoke(StandardC
> ontextValve.java:199)
> at 
> org.apache.catalina.core.StandardValveContext.invokeNext(Stand
> ardValveContext.java:151)
> at 
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(Aut
> henticatorBase.java:587)
> at 
> org.apache.catalina.core.StandardValveContext.invokeNext(Stand
> ardValveContext.java:149)
> at 
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
> ine.java:567)
> at 
> org.apache.catalina.core.StandardHostValve.invoke(StandardHost
> Valve.java:184)
> at 
> org.apache.catalina.core.StandardValveContext.invokeNext(Stand
> ardValveContext.java:151)
> at 
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReport
> Valve.java:164)
> at 
> org.apache.catalina.core.StandardValveContext.invokeNext(Stand
> ardValveContext.java:149)
> at 
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
> ine.java:567)
> at 
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEn
> gineValve.java:156)
> at 
> org.apache.catalina.core.StandardValveContext.invokeNext(Stand
> ardValveContext.java:151)
> at 
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
> ine.java:567)
> at 
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972)
> at 
> org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.
> java:206)
> at 
> org.apache.coyote.http11.Http11Processor.process(Http11Process
> or.java:833)
> at 
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandle
> r.processConnection(Http11Protocol.

RE: DBCP connection leak after undeploy

2005-10-28 Thread Steve Kirk
Yes, confirmed, I get the same problem. (I used the undeploy command from
within the NetBeans runtime window, and also checked using the undeploy link
in the browser from /manager/html/).  Conns are cleaned up OK if you
start/stop TC, but not if you undeploy the app with TC still running, as you
said.

Having said that, does anyone undeploy apps like this on production servers?
I wouldn't think so, but then again I suppose it might affect ISP type
users.

PS I have these config values:
maxActive="10" 
maxIdle="5" 

> -Original Message-
> From: Bogdan Calmac [mailto:[EMAIL PROTECTED] 
> Sent: Thursday 27 October 2005 19:27
> To: Tomcat Users List
> Subject: Re: DBCP connection leak after undeploy
> 
> 
> > PS I don't think that I have see the problem that you have 
> reported.  I run
> > TC 5.5.9 on WinXP with Mysql 4.1.11 and Connector/J 3.1.8, 
> have never
> > noticed that problem, my pools always seem to clean up fine.
> 
> You might not have the same setup. I would suggest to try the 
> following:
> 
> 1. make sure you define the datasource in META-INF/context.xml and you
> access the DB using that JNDI datasource.
> 2. package your webapp as a war
> 3. Do a "netstat" and note how many DB connections are open
> 4. deploy your webapp using the ant task or the manager webapp
> 5. Access your webapp to use the DB
> 6. Do another "netstat" to confirm that there is one more DB
> connection (which is now pooled)
> 7. undeploy your webapp using the ant task or the manager webapp (do
> not stop tomcat)
> 8. Do one more "netstat" and I would be very surprised if the extra
> connection was closed :-)
> 
> Another explanation for your finding could be setting maxIdle="0" in
> the resource definition, but that practically disables pooling.
> 
> -
> 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 not starting

2005-10-31 Thread Steve Kirk
from your stacktrace it appears that this error occurs when XML is being
parsed, because TC can't find a class:

java.lang.NoClassDefFoundError: org/apache/naming/TransactionRef

in my installation (5.5.9) this class is in
%catalina_home%\common\lib\naming-factory.jar so might be worth checking
that you have that

> -Original Message-
> From: Nehal Sangoi [mailto:[EMAIL PROTECTED] 
> Sent: Monday 31 October 2005 06:03
> To: 'Tomcat Users List (E-mail)'
> Subject: Tomcat not starting
> 
> 
> Infact, i am unable to start all tomcat instances and result 
> is follwoing
> error
> Pls help!!
> 
> 
> Hi,
> 
> I am unable to start one of my tomcat instances. But its 
> getting crashed
> before it starts. Follwoing are the errors found.
> 
> 
> Oct 31, 2005 12:09:47 AM org.apache.tomcat.util.digester.Digester
> startElement
> SEVERE: Begin event threw error
> java.lang.NoClassDefFoundError: org/apache/naming/TransactionRef
> at
> org.apache.catalina.core.StandardServer.(StandardServer.java:94)
> at 
> sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> Method)
> at
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeCo
> nstructorAcces
> sorImpl.java:39)
> at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Dele
> gatingConstruc
> torAccessorImpl.java:27)
> at 
> java.lang.reflect.Constructor.newInstance(Constructor.java:494)
> at java.lang.Class.newInstance0(Class.java:350)
> at java.lang.Class.newInstance(Class.java:303)
> at
> org.apache.tomcat.util.digester.ObjectCreateRule.begin(ObjectC
> reateRule.java
> :205)
> at org.apache.tomcat.util.digester.Rule.begin(Rule.java:152)
> at
> org.apache.tomcat.util.digester.Digester.startElement(Digester
> .java:1275)
> at
> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.s
> tartElement(Ab
> stractSAXParser.java:533)
> at
> com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.st
> artElement(XML
> DTDValidator.java:798)
> at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentSca
> nnerImpl.scanS
> tartElement(XMLDocumentFragmentScanner
> Impl.java:878)
> at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl
> $ContentDispat
> cher.scanRootElementHook(XMLDocumentSc
> annerImpl.java:1157)
> at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentSca
> nnerImpl$Fragm
> entContentDispatcher.dispatch(XMLDocum
> entFragmentScannerImpl.java:1794)
> at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentSca
> nnerImpl.scanD
> ocument(XMLDocumentFragmentScannerImpl
> .java:368)
> at
> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.
> parse(XML11Con
> figuration.java:834)
> at
> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.
> parse(XML11Con
> figuration.java:764)
> at
> com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XML
> Parser.java:14
> 8)
> at
> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.p
> arse(AbstractS
> AXParser.java:1242)
> at
> org.apache.tomcat.util.digester.Digester.parse(Digester.java:1561)
> at 
> org.apache.catalina.startup.Catalina.load(Catalina.java:473)
> at 
> org.apache.catalina.startup.Catalina.load(Catalina.java:509)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccess
> orImpl.java:39
> )
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMeth
> odAccessorImpl
> .java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at 
> org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:243)
> at 
> org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:408)
> java.lang.reflect.InvocationTargetException
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccess
> orImpl.java:39
> )
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMeth
> odAccessorImpl
> .java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at 
> org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:243)
> at 
> org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:408)
> Caused by: java.lang.NoClassDefFoundError: 
> org/apache/naming/TransactionRef
> at
> org.apache.catalina.core.StandardServer.(StandardServer.java:94)
> at 
> sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> Method)
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EM

RE: Tomcat logging - Persistence of Logs

2005-10-31 Thread Steve Kirk

The  under 5.0.x uses -MM-DD format in the filename, so this
would change each day, would that give you what you need? See "FileLogger"
under "Standard Implementation" at:
http://tomcat.apache.org/tomcat-5.0-doc/config/logger.html

PS note that  is deprecated in 5.5.x

> -Original Message-
> From: Tom Burke [mailto:[EMAIL PROTECTED] 
> Sent: Monday 31 October 2005 11:59
> To: Tomcat Users List
> Subject: Tomcat logging - Persistence of Logs
> 
> 
> I have a problem with log files. I have a customer who has 
> Tomcat 5.0.28 
> running on Windows 2003 Server. The main output is being logged to 
> stdout.log in the tomcat/logs directory - this is the Windows 
> equivalent 
> of catalina.out on a linux/unix system.
> 
> The problem is that for good reasons the customer is stopping & 
> restarting Tomcat every night (at our recommendation). This 
> is a new app 
> and it's not entirely bug-free yet, so giving thjem a clean 
> start every 
> day is useful. The trouble is that this also recreates 
> stdout.log, which 
> is a pity as sometime we aren't being alerted to problems 
> until the day 
> after, by which time the relevant log has disappeared.
> 
> Does anyone know how to make the Windows stdout.log file persistent?
> 
> Tom Burke 



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



RE:

2005-10-31 Thread Steve Kirk
windows or linux?  if on windows and runing as a service, have you run the
"service install" command after copying across the contents of the TC root
directory?

also check:
have you set the env variables JAVA_HOME and CATALINA_HOME?
are file permissions on the jar file OK?

> -Original Message-
> From: Lothar Krenzien [mailto:[EMAIL PROTECTED] 
> Sent: Monday 31 October 2005 11:40
> To: users@tomcat.apache.org
> Subject: 
> 
> 
> 
> Hi there,
> 
> I'm using Tomcat 5.5 and want to copy a working installation 
> from server A to server B, so that on both servers I have a 
> running Tomcat service. The installation on server  A is 
> running without any problems, but on server B I get always 
> the erros message 'the file 
> "-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogMan
> ager" could not found'. I know that I can rename/delete the 
> file tomcat-juli.jar in the bin directory. But I would like 
> to know the reason for this error.
> 
> Thanks for any answer.
> Lothar
> 
> __
> ___
> Mit der Gruppen-SMS von WEB.DE FreeMail können Sie eine SMS an alle 
> Freunde gleichzeitig schicken: 
> http://freemail.web.de/features/?mc=021179
> 
> 
> 
> 
> -
> 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 logging - Persistence of Logs

2005-10-31 Thread Steve Kirk
in case it helps but you haven't already seen it, the verbosity of 
can be tweaked, see same page as in last reply.

Can I just check what you are saying: are you saying that the standard
output to the file which captures stdout is different on the 2 platforms,
even with out-of-the-box TC config?  This would be a surprise, I was under
the impression that TC was functionally identical on whatever platform (the
only difference really being the exact pathnames to files).  So I just had a
quick look at catalina.bat vs catalina.sh on 5.5.9 (my installed version)
and it appears that there could be a difference:  catalina.sh starts the
bootstrap class with the redirection '>> "$CATALINA_BASE"/logs/catalina.out
2>&1' appended, whereas the windows bat file does nothing like this; there
is no redirection at all that I can see, or even a mention of the logfile
name.  Maybe this explains what you're seeing - the gubbins that is output
to the DOS window when you start in DOS is perhaps included in the log file
instead when you run under linux?  This is only a guess, I have not had time
to check it out.

> -Original Message-
> From: Tom Burke [mailto:[EMAIL PROTECTED] 
> Sent: Monday 31 October 2005 16:21
> To: Tomcat Users List
> Subject: Re: Tomcat logging - Persistence of Logs
> 
> 
> Indeed, I have a daily log already but it doesn't seem to be 
> as verbose 
> as the stdout.log.
> 
> I was just wondering if the default log - stdout.log in Windows, 
> catalina.out in linux - could be made to behave the same way 
> on the two 
> platforms. But it looks as if this is an OS-specific difference, as I 
> can't see any difference in the configuration files between the two 
> servers.
> 
> Tom Burke
> 
> 
> - Original Message - 
> From: "Steve Kirk" <[EMAIL PROTECTED]>
> To: "'Tomcat Users List'" 
> Sent: Monday, October 31, 2005 12:52 PM
> Subject: RE: Tomcat logging - Persistence of Logs
> 
> 
> >
> > The  under 5.0.x uses -MM-DD format in the filename, so 
> > this
> > would change each day, would that give you what you need? See 
> > "FileLogger"
> > under "Standard Implementation" at:
> > http://tomcat.apache.org/tomcat-5.0-doc/config/logger.html
> >
> > PS note that  is deprecated in 5.5.x
> >
> >> -Original Message-
> >> From: Tom Burke [mailto:[EMAIL PROTECTED]
> >> Sent: Monday 31 October 2005 11:59
> >> To: Tomcat Users List
> >> Subject: Tomcat logging - Persistence of Logs
> >>
> >>
> >> I have a problem with log files. I have a customer who has
> >> Tomcat 5.0.28
> >> running on Windows 2003 Server. The main output is being logged to
> >> stdout.log in the tomcat/logs directory - this is the Windows
> >> equivalent
> >> of catalina.out on a linux/unix system.
> >>
> >> The problem is that for good reasons the customer is stopping &
> >> restarting Tomcat every night (at our recommendation). This
> >> is a new app
> >> and it's not entirely bug-free yet, so giving thjem a clean
> >> start every
> >> day is useful. The trouble is that this also recreates
> >> stdout.log, which
> >> is a pity as sometime we aren't being alerted to problems
> >> until the day
> >> after, by which time the relevant log has disappeared.
> >>
> >> Does anyone know how to make the Windows stdout.log file 
> persistent?
> >>
> >> Tom Burke
> >
> >
> >
> > 
> -
> > 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: DBCP connection leak after undeploy

2005-10-31 Thread Steve Kirk

I was thinking that you could write your own ServletContextListener code to
create/close the pool, so that you do not have to rely on TC to manage DBCP
via JNDI.  I am planning to do this myself sometime soon, for other reasons
(you've just given me another one).  I'm thinking that by not using JNDI, I
would not encounter of the problem you mention below, because the problem is
related to the TC-JNDI interface.  Does that sound right to you?

> -Original Message-
> From: Bogdan Calmac [mailto:[EMAIL PROTECTED] 
> Sent: Monday 31 October 2005 16:50
> To: Tomcat Users List
> Subject: Re: DBCP connection leak after undeploy
> 
> 
> In our company we share several Tomcat servers for all developers, so
> that's why we use deploy/undeploy instead of start/stop.
> 
> As a workaround for this problem, you can create a
> ServletContextListener and close the datasource yourself in
> contextDestroyed(). I used refection here to avoid compile time
> dependency on Tomcat DBCP.
> 
> try
> {
>   Context initCtx = new InitialContext();
>   ds = (DataSource) 
> initCtx.lookup("java:comp/env/jdbc/YourDSName");
>   if ("org.apache.tomcat.dbcp.dbcp.BasicDataSource".equals(
>   ds.getClass().getName()))
>   {
> Method closeMethod = ds.getClass().getMethod("close");
> closeMethod.invoke(ds);
> }
> catch (Exception e)
> {
>   yourLog.error("Failed to close DBCP DataSource.", e);
> }
> 
> The above code would actually not work because JNDI is destroyed by
> the time contextDestroyed() is called (see
> http://issues.apache.org/bugzilla/show_bug.cgi?id=37264) so you could
> do the lookup and cache the datasource object in contextInitialized().
> 
> On 10/28/05, Steve Kirk <[EMAIL PROTECTED]> wrote:
> > Yes, confirmed, I get the same problem. (I used the 
> undeploy command from
> > within the NetBeans runtime window, and also checked using 
> the undeploy link
> > in the browser from /manager/html/).  Conns are cleaned up OK if you
> > start/stop TC, but not if you undeploy the app with TC 
> still running, as you
> > said.
> >
> > Having said that, does anyone undeploy apps like this on 
> production servers?
> > I wouldn't think so, but then again I suppose it might 
> affect ISP type
> > users.
> >
> > PS I have these config values:
> > maxActive="10"
> > maxIdle="5"
> >
> > > -Original Message-
> > > From: Bogdan Calmac [mailto:[EMAIL PROTECTED]
> > > Sent: Thursday 27 October 2005 19:27
> > > To: Tomcat Users List
> > > Subject: Re: DBCP connection leak after undeploy
> > >
> > >
> > > > PS I don't think that I have see the problem that you have
> > > reported.  I run
> > > > TC 5.5.9 on WinXP with Mysql 4.1.11 and Connector/J 3.1.8,
> > > have never
> > > > noticed that problem, my pools always seem to clean up fine.
> > >
> > > You might not have the same setup. I would suggest to try the
> > > following:
> > >
> > > 1. make sure you define the datasource in 
> META-INF/context.xml and you
> > > access the DB using that JNDI datasource.
> > > 2. package your webapp as a war
> > > 3. Do a "netstat" and note how many DB connections are open
> > > 4. deploy your webapp using the ant task or the manager webapp
> > > 5. Access your webapp to use the DB
> > > 6. Do another "netstat" to confirm that there is one more DB
> > > connection (which is now pooled)
> > > 7. undeploy your webapp using the ant task or the manager 
> webapp (do
> > > not stop tomcat)
> > > 8. Do one more "netstat" and I would be very surprised if 
> the extra
> > > connection was closed :-)
> > >
> > > Another explanation for your finding could be setting 
> maxIdle="0" in
> > > the resource definition, but that practically disables pooling.
> > >



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