RE: Query with 404 error processing -- Tomcat 5.0.19

2004-12-15 Thread Jon Doe

Enable (comment in) the AccessLogValve in your server.xml.  That way you
will be able to see exactly what requested URLs result in 404s.
The file is enabled and nope -- I'm not seeing any 404 errors.
Yoav Shapira http://www.yoavshapira.com
What confuses me is why I get a ClassCastException? This must (I assume :) 
be in the server.xml file. However, that's the standard one that came with 
Tomcat. I've tried to look at that but I can't find any clues to link the 
servlet service() error below to anything in that file.

If it helps the full Java error stack is:
2004-12-14 21:45:30 StandardContext[/manager]Manager: restart: Reloading web 
application at '/Server'
2004-12-14 22:03:51 ApplicationDispatcher[/Server] Servlet.service() for 
servlet default threw exception
java.lang.ClassCastException
	at 
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:182)
	at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:233)
	at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
	at 
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:750)
	at 
org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:512)
	at 
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:445)
	at 
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:359)
	at 
org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:440)
	at 
org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:345)
	at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:194)
	at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
	at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:164)
	at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
	at 
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:578)
	at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
	at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
	at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:156)
	at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
	at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.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(Http11Processor.java:833)
	at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:732)
	at 
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:619)
	at 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:688)
	at java.lang.Thread.run(Thread.java:534)

2004-12-14 22:03:51 [EMAIL PROTECTED]: 
Exception Processing ErrorPage[errorCode=404, location=/404.html]
java.lang.ClassCastException
	at 
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:182)
	at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:233)
	at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
	at 
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:750)
	at 
org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:512)
	at 
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:445)
	at 
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:359)
	at 
org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:440)
	at 
org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:345)
	at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:194)
	at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
	at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:164)
	at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
	at 
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:578)
	at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
	at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
	at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:156)
	at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
	at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972)
	at 

Re: Tomcat as standalone

2004-12-13 Thread Jon Doe
Putting Apache on an Internet-visible network, and having this route its 
traffic to Tomcat on a local network on your website (eg a 10, 172 or 
192.168 address) can improve your security no end. There is no direct way to 
your Tomcat server. As long as you have tightend your code for SQL and HTML 
scams, you will have a very safe environment. Of course this means a second 
server and so more cost, but if you want a Rolls-Royce solution...

:-)
Joe.

From: Ben Souther [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Subject: Re: Tomcat as standalone
Date: Mon, 13 Dec 2004 00:54:52 -0500
Since 90% of your app is dynamic, there is a good chance that
Tomcat as a standalone may actually be more efficient. The work
the webserver and connector has to do to pass the requests/responses
back and forth to tomcat is all in addition to what Tomcat would have to
do anyway.
I would recommend giving Tomcat as a standalone a shot.
If you feel you need more performance, look into your options.
Putting a webserver in front of Tomcat is one of them.  Load balancing,
heavier hardware, clustering, are some others.
Remember, Tomcat, The Apache Web Server, and the connectors needed to
join the two don't have the same release cycles.  Besides performance,
you also want to consider maintenance and upkeep costs.
If you want to be real thorough, set up both scenarios and compare them
under load. Set up SSL under both scenerios. Also compare the effort to
get them up and running.  Then also take a look at the open bug list for
Tomcat to see how many issues are related to connectors.  Look at the
release cycles for tomcat, apache, and the connectors. Then look at how
much time you have budgeted for maintaining each setup.
Without looking at your app, hardware and business plan, nobody can tell
you for certain which way to go.
One thing to be aware of. There is a lot of outdated information on the
web claiming that Tomcat as a standalone is not ready for production.
If you come across one of these sites, make sure you know either when it
was written or what version of Tomcat they're talking about. Both Tomcat
and the JVMs needed to run it have made great strides in recent years.
What was accurate at the time it was written may be very inaccurate now.


On Sun, 2004-12-12 at 23:33, Dola Woolfe wrote:
 It 90% of my website is dynamic, is it a good idea to
 skip the apache server altogether and just run Tomcat
 alone on port 80?
   Seems like a good idea: one few application to worry
 about, no headache with connecting apache and tomcat
 (which I still haven't figured out how to do with 5.x)
 and so forth.

 Please, any opinions.

 Also is 5.5 ready for prime-time?

 Thank you very much in advance.

 Dola



 __
 Do you Yahoo!?
 Take Yahoo! Mail with you! Get it on your mobile phone.
 http://mobile.yahoo.com/maildemo

 -
 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]
_
Express yourself instantly with MSN Messenger! Download today it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

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


RE: Query with 404 error processing -- Tomcat 5.0.19

2004-12-13 Thread Jon Doe
Hi,
Because this processing servlet of yours itself had an error.  A JSP
file by default is processed by Tomcat's JSP servlet, not your Router
servlet.  Accordingly, it's not subject to your custom error handling
mechanism.  A more standard way to do this is declare an error-page
for 404's in your web.xml, and/or an errorPage for the specific JSP page
in the JSP page itself.
Sorry, not sure I understand this. Is this not what I've done with this?:
   error-pageerror-code404/error-code
   location/404.html/location
   /error-page
My understanding of how this works is that any URL that ends with the string 
'.ext' will be picked up by my Servlet. Any other URL ('.jpg', '.jsp' or 
whatever) will thus fall through this, and my Router servlet will not see 
it. It keeps falling to the error-page code above.

Have you any sample code you would be kiind enough to paste? I'm obviously 
being thick here. :(

Joe.

Yoav Shapira http://www.yoavshapira.com

Here is my web.xml file:

?xml version=1.0 encoding=UTF-8?
!DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web
Application
2.3//EN
 http://java.sun.com/dtd/web-app_2_3.dtd;
web-app
display-nameMy server/display-name

servletservlet-nameRouter/servlet-name
servlet-classcom.mycompany.Router/servlet-class
/servlet
servletservlet-nameInitServlet/servlet-name

servlet-classcom.mycompany.InitServlet/servlet-class
load-on-startup2/load-on-startup
/servlet

servlet-mappingservlet-nameInitServlet/servlet-name
url-pattern/InitServlet/url-pattern
/servlet-mapping
!-- All URLs end .ext. These are processed by the front
controller.
--
servlet-mappingservlet-nameRouter/servlet-name
url-pattern*.ext/url-pattern
/servlet-mapping


session-configsession-timeout30/session-timeout/session-config

welcome-file-listwelcome-fileindex.html/welcome-file
/welcome-file-list
error-pageerror-code404/error-code
location/404.html/location
/error-page
/web-app
_
Express yourself instantly with MSN Messenger! Download today it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

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


Query with 404 error processing -- Tomcat 5.0.19

2004-12-12 Thread Jon Doe
Can someone please explain why I get the default Tomcat 404 error when a 
pages does not exist?

I have a set of URLs that end with *.ext. These are all routed to a servlet 
called Router, and these all work fine. This servlet has catch-all at the 
end that displays an error message when an unknown *.ext is processed. That 
all works fine.

However, when an unknown *.jsp file is processed I get the default Tomcat 
error:

  HTTP Status 404 - /unknown.jsp
  type Status report
  message /unknown.jsp
  description The requested resource (/unknown.jsp) is not available.
  Apache Tomcat/5.0.19
The error in the generates this output in the log file:
2004-12-13 00:40:10 ApplicationDispatcher[/Server] Servlet.service() for 
servlet default threw exception
java.lang.ClassCastException
	at 
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:182)
	at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:233)
	at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
...

2004-12-13 00:40:10 [EMAIL PROTECTED]: 
Exception Processing ErrorPage[errorCode=404, location=/404.html]
java.lang.ClassCastException
	at 
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:182)
	at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:233)
	at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
	at 
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:750)
	at 
org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:512)
...

Here is my web.xml file:
?xml version=1.0 encoding=UTF-8?
!DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 
2.3//EN
 http://java.sun.com/dtd/web-app_2_3.dtd;
web-app
   display-nameMy server/display-name

   servletservlet-nameRouter/servlet-name
   servlet-classcom.mycompany.Router/servlet-class
   /servlet
   servletservlet-nameInitServlet/servlet-name
   servlet-classcom.mycompany.InitServlet/servlet-class
   load-on-startup2/load-on-startup
   /servlet
   servlet-mappingservlet-nameInitServlet/servlet-name
   url-pattern/InitServlet/url-pattern
   /servlet-mapping
   !-- All URLs end .ext. These are processed by the front controller. 
--
   servlet-mappingservlet-nameRouter/servlet-name
   url-pattern*.ext/url-pattern
   /servlet-mapping

   
session-configsession-timeout30/session-timeout/session-config

   welcome-file-listwelcome-fileindex.html/welcome-file
   /welcome-file-list
   error-pageerror-code404/error-code
   location/404.html/location
   /error-page
/web-app
And my 404.html file:
html
head
/head
body
Error!
/body
/html
Any help will be, as always, greatly appreciated.
Joe.
_
Express yourself instantly with MSN Messenger! Download today it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

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


Re: Tomcat 5.0.28 -- HTTP server dies

2004-12-04 Thread Jon Doe

From: Ben Souther [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Subject: Re: Tomcat 5.0.28 -- HTTP server dies
Date: Fri, 03 Dec 2004 20:37:35 -0500
 I've set it to listen on port 80.
Are you running tomcat as root?
In Unix/Linux only the root user can bind to ports below 1025.
Try changing the port back to port 8080 and see if it works.
OK, after a great deal of digging into this (and some rewriting of my code 
-- ahem!!) I think I'm getting to the bottom of this.

Why does my HTTP server die -- could it be ever so slightly something to do 
with this call, which also explains the absence of any logging:

  System.exit(1);
(now replaced with throw new ServletException();). Which begs the question, 
is this allowed? I suppose the container can't do much about dodgy code it's 
hosting, but clearly code written in good faith and for all the right 
reasons in this instance could cause significant problems in a shared 
hosting  environment.

Is the only answer to ensure your hosted on a dedicated JVM? (Yipee! I hear 
those hosting companies say.) And are there any other such gotchas 
developers need to be aware of?

They say you live and learn.; hmm...
:)
Joe.
_
Express yourself instantly with MSN Messenger! Download today it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

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


Tomcat 5.0.28 -- HTTP server dies

2004-12-03 Thread Jon Doe
I'm sure the answer to this is pretty straightforward, but I'm struggling to 
see it.

I'm running 5.0.28 on Linux. I've uploaded a WAR file which is clearly 
causing my problems. When I start tomcat (using the startup.sh script) if I 
don't have my WAR file installed in the webapps directory nor a context file 
under conf/Catalina/localhost the system starts without a problem. However, 
when I try to deploy my app it seems to hang tomcat.

My question is, how do I idenfiy the problem? I've replaced every occurence 
of 'debug=0' with 'debug=99' (I've no idea what the different debug 
levels are; but 'greater than zero' seems to be the rule). I've looked at 
all the files in the logs directory, and nothing gives me a clue.

The symptons are these. When it starts if I monitor the listening address 
(netstat -an|grep LIST) I can see the port appear as a listening port. But 
it then just disappears. I would have expected to see something in the logs 
directory. logs/catalina.out simply says '...Installing...'. But it doesn't 
say when it's installed, or give any messages to say it hasn't installed. I 
would have expected Java exception output.

So can anyone give me any clues? Am I correct to just look under logs? I've 
looked in /var/log as well, but there's nothing there. Are there any debug 
hints for this sort of issue. I can't seem to get any meaningful logging out 
of tomcat.

Any help will be appreciated.
Thanks,
Joe
_
Express yourself instantly with MSN Messenger! Download today it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

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


Re: Tomcat 5.0.28 -- HTTP server dies

2004-12-03 Thread Jon Doe

From: Alain Gaeremynck [EMAIL PROTECTED]
Reply-To: Tomcat Users List [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Subject: Re: Tomcat 5.0.28 -- HTTP server dies
Date: Fri, 03 Dec 2004 17:35:02 -0500
Does tomcat (the jvm in fact) die?  If so there would be a core file in the 
directory from which you start tomcat.  that would be a good place to start
Nope. Just checked -- the process is still running (visible from ps -ef) and 
the port is still listening.  But connections from Firefox are still 
loading. If this helps...

[EMAIL PROTECTED] jakarta-tomcat-5.0.28]# ps -ef|grep tomcat
root  1538 1  2 22:25 pts/000:00:43 
/usr/java/j2sdk1.4.2_06/bin/java 
-Djava.endorsed.dirs=/usr/local/bin/jakarta-tomcat-5.0.28/common/endorsed 
-classpath 
/usr/java/j2sdk1.4.2_06/lib/tools.jar:/usr/local/bin/jakarta-tomcat-5.0.28/bin/bootstrap.jar:/usr/local/bin/jakarta-tomcat-5.0.28/bin/commons-logging-api.
root  1602  1362  0 22:49 pts/000:00:00 grep tomcat
[EMAIL PROTECTED] jakarta-tomcat-5.0.28]# netstat -an|grep LIST|grep :80
tcp0  0 127.0.0.1:8005  0.0.0.0:*   LISTEN
tcp0  0 0.0.0.0:80090.0.0.0:*   LISTEN
tcp0  0 0.0.0.0:80  0.0.0.0:*   LISTEN
[EMAIL PROTECTED] jakarta-tomcat-5.0.28]#

I've set it to listen on port 80.
Joe
_
Express yourself instantly with MSN Messenger! Download today it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

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


Re: Tomcat 5.0.28 -- HTTP server dies

2004-12-03 Thread Jon Doe

From: Alain Gaeremynck [EMAIL PROTECTED]
Reply-To: Tomcat Users List [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Subject: Re: Tomcat 5.0.28 -- HTTP server dies
Date: Fri, 03 Dec 2004 18:10:39 -0500
Assuming you have access to the source code of the problematic jar i would 
suggest you put tracaes in the init method of the servlet and or jsp to see 
where it freezes.  Also there might be a piece of code in there that tries 
to access a remote ressource via tcp that takes a while before timing out.  
Maybe start the process wait for the time out period then look at the logs.

These are just what i would look for.  If you don't get anything in the 
logs and the jvm does not exit then there has to be a thread that's waiting 
for something

Hope this helps
Brill. Doh! Not thought of doing that. :(
OK, sounds like a good way forward. I do indeed have several background 
processes that kick off in the init() method. It all works wonderfully under 
NetBeans and W2K!

Many thanks for you help. Much appreciated!
Joe
_
FREE pop-up blocking with the new MSN Toolbar - get it now! 
http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/

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


Re: Tomact 5 - Out of Memory

2004-08-04 Thread Jon Doe
From: David Smith [EMAIL PROTECTED]
Reply-To: Tomcat Users List [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Subject: Re: Tomact 5 - Out of Memory
Date: Wed, 04 Aug 2004 07:38:57 -0400
I would set JAVA_OPTS in the startup script you're using to start
Tomcat. There are loads of emails on the list regarding this. This issue
is common enough you should be able to google the archives for details
and get loads of responses.
Fair point -- if you haven't enough memory overhead, then until the garbage 
collector kicks in to free objects up you will have a problem.
Also as others have suggested, check your code for memory leaks --
especially if it's not under load when it dies.
But hey, I thought one of the big selling points is that Java DOES NOT LEAK! 
Am I mistaken? Isn't it's absence of pointers its big plus? If it does leak 
then changing the heap size is going to be irrelevant. No matter how large 
you set it it will bite you in the bum eventually!

--David
_
Tired of spam? Get advanced junk mail protection with MSN 8. 
http://join.msn.com/?page=features/junkmail

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


Re: web.xml: my default.css file does not work correctly

2004-08-02 Thread Jon Doe
Thanks for this. But it still didn't answer my problem (which is solved -- 
see below). I don't have a 'welcome file'. I have a welcome page generated 
by a servlet -- so you can reference it with

  http://localhost:8080/context/home.myext
And I can map this no problem. But to get this to work:
  http://localhost:8080/context/
fails. I assumed the 'welcome-file-list' was relevant, but it only seems 
to be for real files (html, jsp, etc), not for 'virtual' URLs.

But for the record I solved my problem by creating an index.html file with 
just:

  META HTTP-EQUIV=Refresh CONTENT=0; URL=/context/home.myext
and had *everything* else mapped using my Router servlet. Works like a 
dream!

Thanks again.
Joe.
: So, I've disabled the / mapping by commenting it out. And my CSS
: pages are working as normal. But trying to access my app with the root 
URL
: just causes a directory listing.

Check your book (or the servlet spec) for welcome-file-list.
It's akin to the DirectoryIndex directive in Apache httpd, which lists
the file(s) checked when a request is made to just a directory path
(e.g. index.html).
-QM
--
software  -- http://www.brandxdev.net
tech news -- http://www.RoarNetworX.com
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
_
Add photos to your e-mail with MSN 8. Get 2 months FREE*. 
http://join.msn.com/?page=features/featuredemail

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


web.xml: my default.css file does not work correctly

2004-07-31 Thread Jon Doe
I thought I'd grasped the way the deployment descriptor works in Tomcat. But 
I've still got problems I don't understand. In summary: my default.css file 
does not work with this web.xml file:

web-app
servletservlet-nameIndex/servlet-name
servlet-classcom.wingtip.Index/servlet-class/servlet
servletservlet-nameRouter/servlet-name
servlet-classcom.wingtip.Router/servlet-class/servlet
!-- Access to root invokes Index. --
servlet-mappingservlet-nameIndex/servlet-name
url-pattern//url-pattern/servlet-mapping
!-- All URLs end .myext. These are processed by the front controller. --
servlet-mappingservlet-nameRouter/servlet-name
url-pattern*.myext/url-pattern/servlet-mapping
/web-app
So there is a url-pattern for / -- the root URL, and there is a url-pattern 
for anything ending *myext. All this works fine. I put all the routing code 
into the Router.java file and this works like a dream. It gives me the 
benefit of putting all this logic in one file, and so I can see what is 
going on, and apply consistent security treatment to all my URLs. Great!

But the fly in the ointment is CSS (and image files too). These appear not 
to be available. How do I get round this? I have seen mention of a 'default' 
servlet in the Servlet spec, but no more details. How do you make all URLs 
that don't match your patterns 'fall through' so they can be used by 
whatever notion of webserver exists in Tomcat?

Incidentally, it would be *really* nice to have just the one servlet 
defined. Is it legal/possible to the reference to Index above removed and 
add the / to the Router servlet?

One final point. I've heard mention that it is not good form to use a / 
mapping. If not, what is the alternative?

Joe.
_
The new MSN 8: advanced junk mail protection and 2 months FREE* 
http://join.msn.com/?page=features/junkmail

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


Re: web.xml: my default.css file does not work correctly

2004-07-31 Thread Jon Doe
Thanks for this. Hmm, so this is something that I was not aware of. (The 
O'Relilly book -- Tomcat *Definitive* Reference -- doesn't even mention 
this) So, I've disabled the / mapping by commenting it out. And my CSS 
pages are working as normal. But trying to access my app with the root URL 
just causes a directory listing.

So how do I stop that? I'm deploying my app under a particular context, and 
clearly I want to be able to just put in http://host/context/ and expect it 
to pick the home page. It doesn't, but just gives me a directory listing. So 
adding a / mapping solves this but stops CSS, and without it I get CSS but 
no root mapping!!

Bugger!
Anyone have any ideas?
Joe.

From: Tim Funk [EMAIL PROTECTED]
Reply-To: Tomcat Users List [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Subject: Re: web.xml: my default.css file does not work correctly
Date: Sat, 31 Jul 2004 14:43:16 -0400
You have overriddent the default servlet. That mean its your servlet's job 
to serve static resources. (There a threads in the archives about this)

-Tim
_
Help STOP SPAM with the new MSN 8 and get 2 months FREE*  
http://join.msn.com/?page=features/junkmail

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


How does the deploy descriptor work?

2004-07-23 Thread Jon Doe
I thought I understood this, but clearly I don't! (Or at least my app 
doesn't work.) So, if I may, I would like to explain my understanding of how 
you create the deploy descriptor, and how it works in Tomcat. Just to get 
some clarity.

OK, so I have a website, hosted as the context /mywebsite in Tomcat. So the 
localhost syntax to the root of this application is:

http://localhost/mywebsite/
Now as I understand it, to get this URL to execute a servlet called Index 
(ie the class WEB-INF\classes\com\mywebsite\Index.class -- assumes Windows) 
I need to add this to the deployment descriptor:

servlet
servlet-namemyRoot/servlet-name
servlet-classcom.mywebsite.Index/servlet-class
/servlet
servlet-mapping
servlet-namemyRoot/servlet-name
url-pattern//url-pattern
/servlet-mapping
That is straight forward. Now what if I want /Login, /Register, /Catalogue, 
etc? What is the url-pattern for these? If I enter /Login, for example, will 
this the call that servlet when I use this URL:

http://localhost/mywebsite/Login
If not, and I have to use a url-pattern of /mywebsite/Login, what happens if 
I decide to change the context path, or even to host it as a virtual server? 
Do I have to re-edit the web.xml file to reflect these changes?

One final question. If the url-pattern for Login is 
/mywebsite/Login.something, does this mean the user has to type:

http://localhost/mywebsite/Login.something
for this to trigger? In short, is it the URL that is all important, and not 
the underlying filenames? (God knows how the wildcards work, so I've been 
trying to use 'full paths' as I thought this was easier. But I get no output 
even though I have lines writing to the ServletConfig log, to standard out 
and to the PrintWriter output!)

If anyone can comment on the above -- such as it is totally accurate, or it 
is all rubbish -- that would be useful!

Joe.
_
STOP MORE SPAM with the new MSN 8 and get 2 months FREE* 
http://join.msn.com/?page=features/junkmail

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


RE: How does the deploy descriptor work?

2004-07-23 Thread Jon Doe
Thanks for your reply. I've still a question, given what you have said.
You might want to revisit a few key elements of the Deployment
Descriptor as explained in the Servlet Specification.  These include:
- The use of welcome-file to serve the resource /.  You typically do NOT
want to define a servlet at url-pattern /.
As I'm not using JSP or HTML files directly (at least for the time being) I 
tried putting servlet reference to the welcome-file and that worked. So I've 
got rid of the / -- so that's cool. Thanks for the tip.

- url-pattern does not include the docBase, but rather it's relative to
the docBase.  So for http://yourhost/yourwebsite/Login, the url-pattern
is just /Login.
Read the Servlet Specification, it answers your questions completely and
in detail.  That's what it's for.
I re-read this. It seems to say there are only *two* wildcard options -- 
either /text/* or *.text. I'm not sure whether the *.text form will match 
/some.text or just some.text.

So I've got my HTML form reference looking like this:
...
form action=register.reg method=POST
...
(Note no leading /. It didn't work when I had the slash.) So I then defined 
this in the web.xml file:

...
servlet-mapping
servlet-nameRegister/servlet-name
url-pattern*.reg/url-pattern
/servlet-mapping
...
However, this doesn't work. Any reasons why not? Beause I'm new to this I'm 
not sure whether this is a syntax error here, or an error is my code. 
Whereever I have logging in my server.xml file I've set the debug level to 
9, so I don't miss anything. But it seems not to push out anything. So if 
you confirm the above is correct, I'll focus on my code.

Thanks.
Joe.
Yoav Shapira
Millennium Research Informatics
_
STOP MORE SPAM with the new MSN 8 and get 2 months FREE* 
http://join.msn.com/?page=features/junkmail

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


Tomcat 5: how do you set up logging as a stand-alone webserver?

2004-07-19 Thread Jon Doe
I would like to use Tomcat 5 as a stand-alone webserver (ie NOT with 
Apache). Can anyone point me in the right direction to the appropriate 
documentation? I got the O'Reilly Definitive Guide (which covers Tomcat 4, 
but I assume from a management point of view there is little difference 
between that and 5), and in there it shows how to dump detailed HTTP traffic 
using the RequestDumperValve. But this is clearly overkill!

What I would like is to generate the sort of logs that the Apache webserver 
creates (ie its access and error logs). It seems the logs you get by default 
only push out Java stack traces. I would like to be able to see who is 
trying to connect to the Tomcat server, their web/IP address and the URL 
they are using (there are doubtless script-kiddies out there who are 
determined to blow my webserver away, and I can't seem to pick this info 
up!).

I'm sure my answer is staring me in the face, but I can't just see what it 
is!

Thanks,
Joe.
_
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. 
http://join.msn.com/?page=features/virus

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


RE: Tomcat 5: how do you set up logging as a stand-alone webserver?

2004-07-19 Thread Jon Doe
Brill
This works a treat. Pity it's not in the O'Reilly book. :(
I've learned two things in one day -- Tomcat web logging and Log4j for 
syslog-style logging. That's a pretty big tick in today's box!

Many thanks.
Joe.

From: Shapira, Yoav [EMAIL PROTECTED]
Reply-To: Tomcat Users List [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Subject: RE: Tomcat 5: how do you set up logging as a stand-alone 
webserver?
Date: Mon, 19 Jul 2004 12:05:30 -0400

Hi,
Enable the AccessLogValve, which is commented out by default in
server.xml.  You can read about it in the Valve configuration reference
page in the tomcat docs.  You're right that the RequestDumperValve is
overkill for all but debugging, and it will hamper performance.
Yoav Shapira
Millennium Research Informatics
_
Planning a family vacation? Check out the MSN Family Travel guide! 
http://dollar.msn.com

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