RE: tomcat contexts and JVMs

2001-01-17 Thread Kitching Simon



 -Original Message-
 From: [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]]
 Sent: Tuesday, January 16, 2001 11:15 PM
 To:   [EMAIL PROTECTED]
 Subject:  tomcat contexts and JVMs
 
 Hi All:
 
 I am a bit confused.  Does each context in server.xml have its own JVM
 session?
 
 For example, I have two contexts:
 1) Catalog - for a product catalog app
 2) Support - for customer support apps
 
 Both these contexts need a connection pool to my backend Oracle database.
 If both contexts use separate JVM sessions then I would have double the
 number of connections to my Oracle database and the connections would
 increase per context added.
 
 Is there a way to share the connection pool object across contexts?  Again
 all this relates back to whether the various contexts runs within one JVM
 session or each has its own JVM session.
[Kitching Simon]  

I'm not quite sure what you mean by "session". Presuming you
mean a "separate jvm process", the answer is no. All contexts
in tomcat run in a single tomcat instance, unless you start messing
about with load distribution features to deliberately run multiple
jvms.

However, the sun servlet spec essentially states that each context
should *look like* it is running in a separate jvm; this is done by
careful use of ClassLoaders. The whole design of the sun servlet 
spec points towards web applications running totally separated
from each other, so that *if* you decide to move a web application
to a separate jvm or even separate machine, nothing breaks.

As far as I know, you can only share data between contexts by
deliberately violating the servlet specifications, which means that
it is also a very non-portable solution.

I suggest
(a) run your Catalog and Support stuff together within a single
context.
(b) use a single EJB server which does the actual database access,
and call this EJB server from your web applications.
(c) just live with the extra number of connections.

All the above is just my interpretation of the specs : no
guaruntees I've understood it right :) - any corrections from
those who know better are welcome.

Regards,

Simon

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

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




RE: multi-jvm, one servlet context

2001-01-17 Thread Kitching Simon



 -Original Message-
 From: sun [SMTP:[EMAIL PROTECTED]]
 Sent: Thursday, January 18, 2001 12:34 AM
 To:   [EMAIL PROTECTED]
 Subject:  multi-jvm, one servlet context
 
 hi, there,
 can I ask tomcat to start with several jvm to serve one servlet context?
 currently, my servlet running speed is very slow, can I use multi-jvm to
 make it faster?
 sorry for stupid question, hope can get answer.
  
 rgds
 sun
[Kitching Simon]  
I can't see how running multiple jvms will improve the 
speed of your servlets...more processes will slow
down your machine rather than speed it up.

Whatever is causing your servlets to run slow,
I don't think multiple jvms is the solution.

Regards,

Simon

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




RE: Running Tomcat as non-root user

2001-01-16 Thread Kitching Simon

Hi Geoff,

As far as I know (and I did a fair bit of research on this
topic), there is no way for any java app to start as one
user, then switch to running as another user.

What I do is run tomcat on port 8080 as non-root, and 
use a firewall product to redirect port 80 - 8080. This
works fine.

I can't give you great details, as the firewall stuff was
set up by a sysadmin (which I am not), but we use
Solaris and I think the firewall is "ifconfig". I guess 
that linux' ipchains or ipfilter or whatever can do the
same job.

Regards,

Simon
 -Original Message-
 From: Geoff Lane [SMTP:[EMAIL PROTECTED]]
 Sent: Monday, January 15, 2001 11:46 PM
 To:   [EMAIL PROTECTED]
 Subject:  Running Tomcat as non-root user
 
 In the Tomcat UG under the heading 'Modify and Customize the Batch
 Files' it says one of the reasons to do so (modify start up scripts)
 would be: "To switch user from root to some other user using the "su"
 UNIX command."
 
 This is an excellent idea from a security standpoint. But to bind to
 port 80 (instead of the default high port 8080) root is needed. How many
 applications do this (Apache for example) is to initially run as root,
 bind to port 80, and then drop root privileges. Is something like this
 possible with Tomcat running standalone? Running concurrently with
 Apache would accomplish this because the AJP connection could be run as
 any user since it's on a high port.
 
 Thanks.
 
 -- 
 Geoff Lane [EMAIL PROTECTED]
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, email: [EMAIL PROTECTED]

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




RE: Blending webapps with HTML files

2001-01-15 Thread Kitching Simon

Hi,

I don't know if my approach qualifies as
"best practice", but I do have a couple of
comments to contribute to this thread..

I would just point out first that the following
comments really applies to tomcat running 
"stand-alone". After re-reading your email, you 
appear to be talking about issues relating to using 
tomcat together with apache, which makes things
more complicated

As I see it, each "web application" should
be regarded as completely independent. 
In fact, you might like to think of a separate host
machine for each webapp, and a "router"
machine that reads the server.xml file at
startup; when a url is received by the
router machine, it figures out what Context
matches the url (finds a context with a
path attribute which matches the first part
of the url). The router then forwards the 
request to the machine for that Context 
(ie web application). If no context's path
matches the first part of the incoming url,
then the context whose path="" is selected.

Of course, this would be pretty expensive :-) 
However, by clever use of class loaders, a
servlet engine (like tomcat) can get almost
the same effect using just a single machine 
and a single jvm.

Web Applications run in a "pure" servlet engine
*really* are separate from each other, it's not 
just an issue of having a different document root 
directory. Each web app has its own indivudual
WEB-INF/web.xml file, so they can be configured 
very differently; different servlet classes, different 
servlet mappings, different mime type definitions, 
different parameters passed to servlets on init. 
And all classes under a web application's root 
directory are loaded by a class loader specific 
to that webapp, which has all sorts of subtle effects.

Perhaps the following comments might clarify things?
(a)
each webapp has its own document root directory,
specified in the Context tag. For those people
too lazy to define Context tags explicitly, there is
an auto-setup procedure which looks in dir
$TOMCAT_HOME/webapps, and sets up a
Context for each subdirectory it finds there. This
does not mean that there *must* be a common
root directory that all webapps hang off, that's just
the way the auto-setup procedure works.

(b)
the ROOT example web application that comes
with tomcat isn't "special" in any way. Its Context
tag in the server.xml just happens to have a path
attribute of "", which means that when a url like
http://xyz/abc.html comes in, tomcat first tries to
find a webapp whose path is "xyz", and if no such
webapp exists, then tomcat passes the url off to
the context (webapp) whose path="". In other words,
the directory name "ROOT" could have been called
"TheDefaultWebAppRootDir".

I think part of your email is asking about how best to 
structure directories when the dynamic part of a 
web application's files are to be served by tomcat 
and the static part by a separate web server. As I
use tomcat stand-alone, I can't comment on that.
When using a "pure" tomcat solution, these problems
just don't occur :-) However, I think that whatever 
solution you choose should comply with the "spirit"
of the servlet spec, ie you should set up apache so
that a user can't tell that they are not using pure
tomcat (apart from speed). Having a system which
fetches static pages from urls which have a different
prefix from the dynamic part of the webapp is asking
for trouble, I think.

By the way, Geoff suggests putting libs in the global
TOMCAT_HOME/lib directory. I think this is not a
"best practice"; you might want to check the email 
archives for my email of 2000-12-27, with subject 
"RE: Servlet error I can't seem to resolve". Again, 
that's just my opinion but no-one shot it down...

Regards,

Simon
 -Original Message-
 From: Geoff Lane [SMTP:[EMAIL PROTECTED]]
 Sent: Saturday, January 13, 2001 7:01 AM
 To:   [EMAIL PROTECTED]
 Subject:  Re: Blending webapps with HTML files
 
 First time posting to the list. So good to meet you all. :)
 
  David Wall wrote:
  
  I'm new to Tomcat 3.2.1 and Servlet 2.2 in particular, having just
  come from JRun before webapps made their debut.
  
  I'm struggling with the "best practices" people are using for storing
  their JSPs and Java class files in the webapps directory, while
  storing images and html files in the web server directory root.
  
  For example, in Apache 1.3.14, my document root is htdocs and I am
  putting some files there for serving by apache, like:
  
  htdocs/images/a.gif
  htdocs/images/b.gif
  htdocs/index.jsp -- empty dummy file workaround so that Apache
  will send a request for "/" to Tomcat's ROOT index.jsp
  htdocs/app.js
  htdocs/app.css
  etc...
 
 I've noticed the same thing with mapping a servlet to an index file (in
 my case I mapped it to index.html). I think you have to 'trick' the
 webserver into loading a file - if it doesn't find a default file to
 load it won't do anything.
  
  And in my webapps under Tomcat I have:
  
  webapps/ROOT/index.jsp-- the 

where can I find tomcat 3.2.2

2001-01-15 Thread Kitching Simon

Hi,

I recently filed a bug report in BugRat, and 
see that there is now a comment
"fixed in tomcat 3.2.2". 

However, I can't find  any release called 3.2.2 
on the apache site, nor any such tag in the 
cvs repository.

Can anyone tell me 
(a) how to get the fixed code?
(b) when a binary 3.2.2 is likely to be available?

Thanks,

Simon

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




RE: url-pattern mapping worked in 3.1, but not 3.2.1

2001-01-15 Thread Kitching Simon

$TOMCAT_HOME/conf/web.xml is not used in tomcat 3.2

Put the mapping in yourwebapp/WEB-INF/web.xml

 -Original Message-
 From: David Fan [SMTP:[EMAIL PROTECTED]]
 Sent: Monday, January 15, 2001 5:51 PM
 To:   [EMAIL PROTECTED]
 Subject:  url-pattern mapping worked in 3.1, but not 3.2.1
 Importance:   High
 
 
 Hi,
 
 I have the following configuration in my web.xml which used to work in
 tomcat 3.1:-
 
 servlet
   servlet-nameapp/servlet-name
   servlet-classabc/servlet-class
 /servlet
 servlet-mapping
 servlet-name
   app
  /servlet-name
 url-pattern
   /app/*
  /url-pattern
 /servlet-mapping
 
 When I upgraded to tomcat 3.2.1, the mapping does not work anymore.  I
 used to be able to map http://server/mywebapp/app/xxx.html to my servlet
 'abc'.
 Since the upgrade, tomcat does not seem to know about anything from
 http://server/mywebapp/app or below (e.g.
 http://server/mywebapp/app/xxx.html) -
 at least as far as I can see from the log file when the debug level in
 'mywebapp' context has been set to 13.
 
 The following still works with the above setting (as one would expect): -
 http://server/mywebapp/servlet/app
 http://server/mywebapp/servlet/abc
 
 However, it is not very satisfactory as the above still expose 'servlet'
 in the URL path.
 
 The evidence so far led me to believe something has been changed on the
 interpretation of the url-pattern tag.  Has anyone experience similar
 problem,
 and how can this be solved?
 
 Thanks in advance.
 
 David
 
 
 
 --
 
 This e-mail may contain confidential and/or privileged information. If you
 are not the intended recipient (or have received this e-mail in error)
 please notify the sender immediately and destroy this e-mail. Any
 unauthorised copying, disclosure or distribution of the material in this
 e-mail is strictly forbidden.
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, email: [EMAIL PROTECTED]

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




RE: Defining an init parameter for all servlets

2001-01-15 Thread Kitching Simon

 -Original Message-
 From: Ariel [SMTP:[EMAIL PROTECTED]]
 Sent: Monday, January 15, 2001 6:52 PM
 To:   '[EMAIL PROTECTED]'
 Subject:  Defining an init parameter for all servlets
 
 
 I would like to define some initialization parameters to be used by 
 all servlets running on Tomcat.
 Is there a way to define this in web.xml, besides copying the init-param
 section of the global parameter to every servlet's section in web.xml?
[Kitching Simon]  Yep!

To set a parameter accessable by all servlets
*in a web application*, see "context-param" tag
(or is it config-param?) in the sun servlet specification...

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

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




RE: shutdown.sh not working

2001-01-12 Thread Kitching Simon

Try running the shutdown command several times.
On HP-UX, I need to run it 3 times to shut tomcat
down; on solaris I only need to run the script once.

It appears to be related to the way different JVMs
handle interrupting threads; I've asked several times
on this group but no-one seems to have an answer 
for this problem, and, as there is a work-around,
I guess we just wait  hope it goes away some
day with a new jvm release

Regards,

Simon

 -Original Message-
 From: kiril [SMTP:[EMAIL PROTECTED]]
 Sent: Friday, January 12, 2001 4:54 PM
 To:   Jakarta (E-mail)
 Subject:  shutdown.sh not working
 
 Why doesn't shutdown.sh work?  Whenever I want to shutdown or restart
 tomcat, I have to 'kill' its process. 
 

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




RE: Mounting directory

2001-01-11 Thread Kitching Simon

It would help if you said what version 
of tomcat, what operating system 
and what java version..

If you are working on unix, then are
the directory and files readable by the
user that tomcat is running as?

Regards,

Simon

 -Original Message-
 From: Chalasani, Ashant [SMTP:[EMAIL PROTECTED]]
 Sent: Thursday, January 11, 2001 1:56 PM
 To:   '[EMAIL PROTECTED]'
 Subject:  Mounting directory
 
 Hello all,
 
 I'm new to Tomcat and jsp at large, so please bear with the dumb
 questions...
 
 I have the Jakarta server running and the server.xml file has the context
 set by default to /webapps/examples for demonstrating examples.
 
   Context path="/examples" 
 docBase="webapps/examples" 
 crossContext="false"
 debug="0" 
 reloadable="true" --
   /Context
 
 The examples that came with the Tomcat download all load fine through
 localhost:8080.  For example /webapps/examples/dates/date.jsp loads and
 functions.
 But when I include a folder of my own such as
 /webapps/examples/xyz/date.jsp
 (note: I'm using the same jsp file as in example, only the xyz directory
 is
 different), the file doesn't load and I get HTTP 404 error.
 
 Can anybody suggest a reason/remedy.
 
 Thanks in advance
 AC
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, email: [EMAIL PROTECTED]

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




RE: Mounting directory

2001-01-11 Thread Kitching Simon

So you have created a directory
%TOMCAT_HOME%\webapps\examples\xyz
and put a file "date.jsp" in there?

And then you try to access it as:
http://localhost:8080/examples/xyz/date.jsp
and you get HTTP 404?

I suggest trying an html file instead of date.jsp,
eg create "test.html" in the xyz directory and 
try to load that.

Does date.jsp try to "include" other files, or
redirect to other files which aren't in your new
xyz directory?


 -Original Message-
 From: Chalasani, Ashant [SMTP:[EMAIL PROTECTED]]
 Sent: Thursday, January 11, 2001 2:11 PM
 To:   '[EMAIL PROTECTED]'
 Subject:  AW: Mounting directory
 
 Thanks Simon,
 
 I am using 
   jakarta-tomcat-3.2.1.zip
   Win-NT 4.0
   Java 1.2 on jBuilder 3
 
 Regards,
 Ashant
 
 -Ursprngliche Nachricht-
 Von: Kitching Simon [mailto:[EMAIL PROTECTED]]
 Gesendet: Thursday, January 11, 2001 2:07 PM
 An: '[EMAIL PROTECTED]'
 Betreff: RE: Mounting directory
 
 
 It would help if you said what version 
 of tomcat, what operating system 
 and what java version..
 
 If you are working on unix, then are
 the directory and files readable by the
 user that tomcat is running as?
 
 Regards,
 
 Simon
 
  -Original Message-
  From:   Chalasani, Ashant [SMTP:[EMAIL PROTECTED]]
  Sent:   Thursday, January 11, 2001 1:56 PM
  To: '[EMAIL PROTECTED]'
  Subject:Mounting directory
  
  Hello all,
  
  I'm new to Tomcat and jsp at large, so please bear with the dumb
  questions...
  
  I have the Jakarta server running and the server.xml file has the
 context
  set by default to /webapps/examples for demonstrating examples.
  
  Context path="/examples" 
docBase="webapps/examples" 
crossContext="false"
debug="0" 
reloadable="true" --
  /Context
  
  The examples that came with the Tomcat download all load fine through
  localhost:8080.  For example /webapps/examples/dates/date.jsp loads and
  functions.
  But when I include a folder of my own such as
  /webapps/examples/xyz/date.jsp
  (note: I'm using the same jsp file as in example, only the xyz directory
  is
  different), the file doesn't load and I get HTTP 404 error.
  
  Can anybody suggest a reason/remedy.
  
  Thanks in advance
  AC
  
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, email: [EMAIL PROTECTED]
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, email: [EMAIL PROTECTED]
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, email: [EMAIL PROTECTED]

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




RE: Multiple Tomcat instances on one machine

2001-01-11 Thread Kitching Simon

Hi William,

Tomcat *can* share binaries across multiple running instances.
However, as I found the docs a bit confusing when I tried to
get this working, here's how to do it:

create the following directory structure for each instance (eg under
each user's home directory if you want an instance per user):

somedirname
  + conf
 + server.xml
  + work

Start tomcat with the -f option, specifying the appropriate server.xml:

$TOMCAT_HOME/bin/tomcat.sh start -f /somedirname/conf/server.xml

I use a single context tag with an absolute docBase 
in the server.xml to indicate where the webapp's files are,
but I guess you could create a webapps directory as a sibling
to the "conf" directory to hold webapps. I guess that you can
also point multiple instances to the same docBase - but
haven't tried it.

Cheers,

Simon
 -Original Message-
 From: William Au [SMTP:[EMAIL PROTECTED]]
 Sent: Thursday, January 11, 2001 3:10 PM
 To:   [EMAIL PROTECTED]
 Subject:  Multiple Tomcat instances on one machine
 
 I would like to run multiple Tomcat instances on one machine, each using
 a different
 port number.  Do I need to have a seperate, full copy ofTOMCAT_HOME for
 each
 instance?  Or can I just have one common set of binaries with multiple
 server.xml
 and other configuration files?
 
 Bill
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, email: [EMAIL PROTECTED]

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




RE: TOMCAT PROBLEM of disconection

2001-01-11 Thread Kitching Simon

The problem is that the java virtual machine you are using
has a bug. There really isn't any work-around for this sort
of problem - if the jvm is buggy, the best thing is to change 
jvm.

JVM version 1.3 is available for just about every platform
now, I suggest you download  install it.

Regards,

Simon

 -Original Message-
 From: Khaled Ben Mohamed [SMTP:[EMAIL PROTECTED]]
 Sent: Thursday, January 11, 2001 5:36 PM
 To:   '[EMAIL PROTECTED]'
 Subject:  TOMCAT PROBLEM of disconection
 
 After a undetermined disconection I have this message in a linux system
 console
 and tomcat stopped (sometimes the java process take more than 63Mo of
 memory) 
 What's happen ?
 I have also a internel servlet error 500 sometimes 
 please help me 
 SIGSEGV   11*  segmentation violation
 si_signo [11]: SIGSEGV   11*  segmentation violation
 si_errno [0]: Succs
 si_code [0]: SI_USER [pid: 0, uid: 0]
 stackpointer=0x44699dec
 
 Full thread dump Classic VM (1.2.2-L, green threads):
 "Thread-129" (TID:0x40ebf098, sys_thread_t:0x859af18, state:R) prio=5
 at java.lang.StringBuffer.init(StringBuffer.java:116)
 at java.lang.StringBuffer.init(StringBuffer.java:130)
 at
 sun.tools.java.ClassDeclaration.getClassDefinition(ClassDeclaration.java:1
 07
 )
 at
 sun.tools.java.ClassDefinition.getVariable0(ClassDefinition.java:868)
 at
 sun.tools.java.ClassDefinition.getVariable0(ClassDefinition.java:857)
 at
 sun.tools.java.ClassDefinition.getVariable0(ClassDefinition.java:857)
 at
 sun.tools.java.ClassDefinition.getVariable0(ClassDefinition.java:857)
 at
 sun.tools.java.ClassDefinition.getVariable(ClassDefinition.java:817)
 at sun.tools.tree.Context.getFieldCommon(Context.java:180)
 at sun.tools.tree.Context.getField(Context.java:274)
 at
 sun.tools.tree.IdentifierExpression.bind(IdentifierExpression.java:117)
 at
 sun.tools.tree.IdentifierExpression.checkValue(IdentifierExpression.java:2
 20
 )
 at
 sun.tools.tree.IdentifierExpression.checkAmbigName(IdentifierExpression.ja
 va
 :281)
 at
 sun.tools.tree.MethodExpression.checkValue(MethodExpression.java:184)
 at sun.tools.tree.Expression.checkCondition(Expression.java:278)
 at sun.tools.tree.Expression.checkCondition(Expression.java:261)
 at sun.tools.tree.WhileStatement.check(WhileStatement.java:44)
 at
 sun.tools.tree.Statement.checkBlockStatement(Statement.java:153)
 at
 sun.tools.tree.CompoundStatement.check(CompoundStatement.java:61)
 at sun.tools.tree.Statement.checkMethod(Statement.java:88)
 at sun.tools.javac.SourceMember.check(SourceMember.java:535)
 at sun.tools.javac.SourceClass.checkMembers(SourceClass.java:998)
 at sun.tools.javac.SourceClass.checkInternal(SourceClass.java:608)
 at sun.tools.javac.SourceClass.check(SourceClass.java:507)
 at sun.tools.javac.Main.compile(Main.java:546)
 at
 org.apache.jasper.compiler.SunJavaCompiler.compile(SunJavaCompiler.java:13
 8)
 at org.apache.jasper.compiler.Compiler.compile(Compiler.java:238)
 at
 org.apache.jasper.runtime.JspServlet.loadJSP(JspServlet.java:413)
 at
 org.apache.jasper.runtime.JspServlet$JspServletWrapper.loadIfNecessary(Jsp
 Se
 rvlet.java:14
 9)
 at
 org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.
 ja
 va:161)
 at
 org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:261)
 at
 org.apache.jasper.runtime.JspServlet.service(JspServlet.java:369)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
 at
 org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:50
 3)
 at
 org.apache.tomcat.core.RequestDispatcherImpl.forward(RequestDispatcherImpl
 .j
 ava:163)
 at
 org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:357
 )
 at
 _0002frecupData_0002ejsprecupData_jsp_15._jspService(_0002frecupData_0002e
 js
 precupData_js
 p_15.java:1402)
 at
 org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:126)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
 at
 org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.
 ja
 va:174)
 at
 org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:261)
 at
 org.apache.jasper.runtime.JspServlet.service(JspServlet.java:369)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
 at
 org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:50
 3)
 at
 org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
 at
 org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnecti
 on
 (Ajp12Connect
 ionHandler.java:156)
 at
 org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:3
 38
 )
 

RE: segmentation violation in Java

2001-01-11 Thread Kitching Simon

The point is that there can only be two
possible causes for a "segmentation violation":
* the jvm has a bug,or
* JNI is being used, and is calling buggy native code libraries

There are no alternative reasons! By definition,
java **cannot** cause segmentation violations,
no matter how buggy or badly written. Ok, there are
certain code constructs that could trigger the jvm
crash, and programs that don't use those features
are therefore not going to encounter the crash, but
it is almost impossible to deduce, from a jvm crash,
what java code caused the problem.

I think that trying to randomly modify a java program
that causes a jvm to crash in order to find some 
variant which does *not* cause the jvm to crash is
really not the best way of solving the problem...
far better to move to another jvm.

I suggest that if a JVM crash happens for one person, 
then every other person using the same JVM version 
from the same vendor on the same platform should be 
very worried; there is no guaruntee at all that it won't
happen to other programs

Having said that, I happen to be using Sun's jvm 1.2.2_04
on solaris, and haven't seen any segmentation violations.
If I ever do get one, I will be upgrading to 1.3, rather than
trying to tweak my code, I can promise you!

Cheers,

Simon

 -Original Message-
 From: Khaled Ben Mohamed [SMTP:[EMAIL PROTECTED]]
 Sent: Thursday, January 11, 2001 6:26 PM
 To:   '[EMAIL PROTECTED]'
 Subject:  TR: 
 
 I use the same jvm so i don't understand ?
  
  
   -Message d'origine-
   De : Michael Kuz [mailto:[EMAIL PROTECTED]]
   Envoy : jeudi 11 janvier 2001 18:27
: 'Khaled Ben Mohamed'
   Objet : RE: 
 
 
 
   I'm using Suns 1.2.2 for Linux 
 
   [mkuz@mkuz ~]$ java -version 
   java version "1.2.2" 
  Classic VM (build 1.2.2_006, green threads, nojit) 
 
 
 
  -Original Message- 
  From: Khaled Ben Mohamed [ mailto:[EMAIL PROTECTED]] 
  Sent: Thursday, January 11, 2001 10:17 AM 
  To: '[EMAIL PROTECTED]' 
  Subject: 
  
  
  -Original Message----- 
  From: Kitching Simon [ mailto:[EMAIL PROTECTED]] 
  Sent: Thursday, January 11, 2001 9:50 AM 
  To: '[EMAIL PROTECTED]' 
  Subject: RE: TOMCAT PROBLEM of disconection 
   
   
  The problem is that the java virtual machine you are using 
  has a bug. There really isn't any work-around for this sort 
  of problem - if the jvm is buggy, the best thing is to change 
  jm. 

  JVM version 1.3 is available for just about every platform 
  now, I suggest you download  install it. 
  
  Isn't 1.3 still 'buggy' on Linux? 
  
  What JVM do you think i have to use ? 
  
 

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




RE: Password encryption in Java

2001-01-08 Thread Kitching Simon


A java implementation of crypt can be found at:

http://locutus.kingwoodcable.com/jfd/crypt.html

Alternatives are to use MD5 or similar from the
java encryption api (I think most jvms provide an
implementation of the major algorithms). However,
if you need to access the password from both
java and other languages (eg c) then crypt() is
probably the easiest solution.

Cheers,

Simon
 -Original Message-
 From: Deepak C S [SMTP:[EMAIL PROTECTED]]
 Sent: Monday, January 08, 2001 9:35 AM
 To:   '[EMAIL PROTECTED]'
 Cc:   '[EMAIL PROTECTED]'; '[EMAIL PROTECTED]'
 Subject:  Password encryption in Java
 
 
  Hi,
 
   Can anybody tell about" How we can encrypt Passwords in Java??"say
 like Perl's or Unix Crypt function??
 
 i mean,
 
 Is there any Java equivalent of unix crypt() func??
 
 thanx in advance,
 Deeps
 
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, email: [EMAIL PROTECTED]

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




RE: Servlet and Multiple Instances

2001-01-08 Thread Kitching Simon

Hi Cam,

Servlets don't "have threads". 

Tomcat as a whole has a pool of threads for serving 
incoming requests (see the Connector tag in 
$TOMCAT_HOME/conf/server.xml).

Unless you do something unusual, tomcat creates 
*one* instance of your servlet, and only one.

Any *tomcat* request-serving thread which happens to 
need to run your servlet as part of a request just goes
ahead and calls the service method (doGet/doPost) on
the single servlet instance. If some other thread is already 
inside the instance, then the normal synchronization 
mechanisms are applied - synchronized methods can 
have only one thread in them, but "normal" methods 
are just run by the multiple threads in parallel, etc.

So, does your servlet declare some critical method
to be "synchronized"? If so, this is the reason that
multiple client requests can't be served in parallel. If
not (and you haven't deliberately turned down the size
of the tomcat thread pool to 1), then I cannot think of 
any other reason for the behaviour you are seeing.

As far as I know, there is no standard method of
telling any servlet-spec-compliant system to create
a "pool" of servlet instances, and run different requests 
using different instances. There really isn't any point in
such a mechanism, because if you've bothered to 
declare "synchronized" methods on the servlet, that
implies that there is data which *needs* to be shared
across threads - so a pool of objects would break any
code that needs synchronized methods anyway. If
you *do* have a major servlet method "synchronized",
then you need to think about **why** you declared it
like that, and if possible get rid of the declaration (maybe
you can just synchronize a smaller block of code?)

Cheers,

Simon

 -Original Message-
 From: Algarve, Leila [SMTP:[EMAIL PROTECTED]]
 Sent: Monday, January 08, 2001 12:08 PM
 To:   '[EMAIL PROTECTED]'
 Subject:  AW: Servlet and Multiple Instances
 
 Check if your servlet class implements SingleThreadModel, in this case one
 instance of the servlet will be able to handle just one request.
 
 Leila
 
 
 -Ursprngliche Nachricht-
 Von: Cam DeBuck [mailto:[EMAIL PROTECTED]]
 Gesendet: Montag, 8. Januar 2001 07:12
 An: [EMAIL PROTECTED]
 Betreff: Servlet and Multiple Instances
 
 
 I've written a servlet that is getting hit pretty hard.  It works fine
 when
 just one user access hit.  However, when they are multiple people hitting
 the servlet, it seems like that it is only serving one person at a time.
 Is
 there some confirguration option that I am missing so that it can spawn
 multiple threads.  Any help would be appreciated.  Thanks.
   --Cam--
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, email: [EMAIL PROTECTED]

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




off-topic: handling non-ascii characters in URLs

2001-01-05 Thread Kitching Simon

Hi All,

While following a related thread (RE: a simple test to charset), 
a question occured to me about charset encodings in URLs. 
This isn't really tomcat-related (more to do with HTTP standards) 
but thought someone here might be able to offer an answer.

When a webserver sends content to a browser, it can indicate
the character data format (ascii, latin-1, UTF8, etc) as an http
header. However, how is the character data type specified for data
send *by* a browser *to* a webserver (ie GET or POST action)?

Andre Alves had an example where an e-accent character
was part of the URL. I saw that IE4 replaced this character
with %E9 when submitting a form using GET method, but this
really assumes that the receiving webserver is using latin-1.

There is this thing called an "entity-header" defined in the HTTP
specs, which may contain a "content-encoding" entry. This seems
to cover POST urls ok then, as the POSTed data is in an entity-body,
and therefore an entity-header can be used to define its encoding.

But the URLs themselves cannot have their encoding specified by 
an entity-header, because they are not in an entity-body. So does
this mean that all URLs should be restricted to ascii, and forms
should not use GET method unless their data content is guarunteed
to be all-ascii??  I remember seeing an article recently about domain
names now being available in asian ideogram characters, which seems
to indicate otherwise

Any comments?

Cheers,

Simon

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




RE: Broken pipe

2001-01-05 Thread Kitching Simon

Hi Markus,

This is a problem has been puzzling me for quite 
a while too.

However, it does seem related to an exception being
generated in my own code, ie it happens only after
some jsp I have written throws an exception (which
I catch  log). I think, therefore, that it isn't a tomcat
bug as such, but some nasty side-effect of a bug in
my code.

This problem is next-but-one on my list of things
to deal with; if you figure it out, please let me know
otherwise I will send you what I find out in a week or
so.

Regards,

Simon

 -Original Message-
 From: Markus Nietfeld [SMTP:[EMAIL PROTECTED]]
 Sent: Friday, January 05, 2001 1:50 PM
 To:   [EMAIL PROTECTED]
 Subject:  Broken pipe
 
 Dear all,
 
 we are encountering a bunch of exceptions of the following type:
 
 Context log: path="/jive" Error in jsp service() : Broken pipe
  javax.servlet.ServletException: Broken pipe
 at
 org.apache.jasper.runtime.JspServlet.service(JspServlet.java:375)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
 at
 org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:50
 3)
 at
 org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
 at
 org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(Htt
 pC
 onnectionHandler.java:160)
 at
 org.apache.tomcat.service.TcpWorkerThread.run(PoolTcpEndpoint.java:366)
 at
 org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:411)
 at java.lang.Thread.run(Thread.java:479)
 
 java.io.IOException: Broken pipe
 at java.net.SocketOutputStream.socketWrite(Native Method)
 at java.net.SocketOutputStream.write(SocketOutputStream.java:75)
 at
 org.apache.tomcat.service.http.HttpResponseAdapter.sendStatus(HttpResponse
 Ad
 apter.java:141)
 at
 org.apache.tomcat.service.http.HttpResponseAdapter.endHeaders(HttpResponse
 Ad
 apter.java:111)
 at
 org.apache.tomcat.core.BufferedServletOutputStream.sendHeaders(BufferedSer
 vl
 etOutputStream.java:127)
 at
 org.apache.tomcat.core.BufferedServletOutputStream.reallyFlush(BufferedSer
 vl
 etOutputStream.java:239)
 at
 org.apache.tomcat.core.ResponseImpl.flushBuffer(ResponseImpl.java:330)
 at
 org.apache.tomcat.core.HttpServletResponseFacade.flushBuffer(HttpServletRe
 sp
 onseFacade.java:235)
 at
 org.apache.jasper.runtime.JspWriterImpl.flush(JspWriterImpl.java:195)
 at
 skins.flirt._0002fskins_0002fflirt_0002fpost_0002ejsppost_jsp_47._jspServi
 ce
 (_0002fskins_0002fflirt_0002fpost_0002ejsppost_jsp_47.java:530)
 at
 org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:126)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
 at
 org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.
 ja
 va:174)
 at
 org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:261)
 at
 org.apache.jasper.runtime.JspServlet.service(JspServlet.java:369)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
 at
 org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:50
 3)
 at
 org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
 at
 org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(Htt
 pC
 onnectionHandler.java:160)
 at
 org.apache.tomcat.service.TcpWorkerThread.run(PoolTcpEndpoint.java:366)
 at
 org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:411)
 at java.lang.Thread.run(Thread.java:479)
 
 Does anybody know the most common reasons for this exception?
 
 Thanks for any help,
 Markus.
 
 Markus Nietfeld | Senior Software Engineer
 
 PopNet Agentscape AG | Kaiserin-Augusta-Allee 10-11 | D-10553 Berlin
 +49 30 590 04 78 27 | fax +49 30 590 04 78 99 |
 mailto:[EMAIL PROTECTED]
 A Member of the PopNet Group | http://www.popnet-agentscape.de
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, email: [EMAIL PROTECTED]

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




RE: off-topic: handling non-ascii characters in URLs

2001-01-05 Thread Kitching Simon


 -Original Message-
 From: Birte Glimm [SMTP:[EMAIL PROTECTED]]
 Sent: Friday, January 05, 2001 12:15 PM
 To:   [EMAIL PROTECTED]
 Subject:  RE: off-topic: handling non-ascii characters in URLs
 
 True,
 it`s the Browser that encodes the special chars I think. I sometimes had
 problems with not encoded URL`s in Netscape, but the IE always translates
 them right.
 Birte Glimm
 
[Kitching Simon]  
The problem is that there are multiple different encoding schemes. 
If IE is "translating them right" then what rules exactly is it
following?

Characters are transmitted as bytes (ie a number from 0 to 255);
in order for two communicating parties to interpret a particular
code 
correctly, they need to agree on what encoding scheme to use -
either
in advance, or by the sending party indicating the encoding scheme.
I 
can't find where in the specs it says how to define the encoding
scheme 
for characters in urls.

As an example, a webserver might interpret data like:
* urls are always 7-bit-ascii
* urls are always latin-1
* urls are always UTF-8
or there is some way to define the encoding of a url when sending a
url to 
a webserver - but I can't see how.

Note that the byte 0xE9 can mean different things:
* in 7-bit-ascii, it is invalid
* in latin-1 it is an e-accent
* in latin-2 (nordic languages) it is something else
* in UTF-8, it is interpreted as the first byte of a multi-byte
character.
etc.

In practice, it seems to me that latin-1 (ie ISO-8859-1) is being
used, ie
for those of us who don't use any character not in latin-1, we don't
see
any problems. However, I can't see anywhere in the specs that says
that
HTTP-compliant apps must use latin-1. And what happens if you want
to
use non-latin-1 characters in a url, or in a form using
method="GET"? 
Examples of languages using characters not in latin-1 are turkish,
hebrew, 
finnish, chinese, ...

Here is an interesting quote from RFC 2396
(http://www.ietf.org/rfc/rfc2396.txt):

"A URI is a sequence of characters from a very limited set, i.e. the
letters
of the basic Latin alphabet, digits, and a few special characters".

This tends to imply that all non-ascii characters *must* be
transformed into
a %xx form; that's fine (with the implication that data sent to a
webserver
via GET must also be encoded in this way), but the %xx still is an
index into
**some unknown character set**!!! How can the recipient (eg a
webserver) know
which character set is it an index into?

Another quote from RFC 2396:

"Internet protocols that transmit octet sequences intended to
represent character
sequences are expected to provide some way of identifying the
charset used, if
there might be more than one [RFC2277]. However, there is currently
no provision
within the generic URI syntax to accomplish this identification".

This says clearly that it is the HTTP protocol's responsibility to
find some way to
define the character set used in URLs transmitted over HTTP - which
leads back
to the HTTP RFC, in which I could find no such way of defining the
charset for URIs
in the situation where a browser is sending a request to a web
server.

? 

Perhaps someone out there working in Japanese/Chinese/similar can
give some
feedback on this? You must have to deal with this all the time...

Cheers,

Simon

 -----Original Message-
 From: Kitching Simon [mailto:[EMAIL PROTECTED]]
 Sent: Freitag, 5. Januar 2001 11:58
 To: '[EMAIL PROTECTED]'
 Subject: off-topic: handling non-ascii characters in URLs
 
 
 Hi All,
 
 While following a related thread (RE: a simple test to charset), 
 a question occured to me about charset encodings in URLs. 
 This isn't really tomcat-related (more to do with HTTP standards) 
 but thought someone here might be able to offer an answer.
 
 When a webserver sends content to a browser, it can indicate
 the character data format (ascii, latin-1, UTF8, etc) as an http
 header. However, how is the character data type specified for data
 send *by* a browser *to* a webserver (ie GET or POST action)?
 
 Andre Alves had an example where an e-accent character
 was part of the URL. I saw that IE4 replaced this character
 with %E9 when submitting a form using GET method, but this
 really assumes that the receiving webserver is using latin-1.
 
 There is this thing called an "entity-header" defined in the HTTP
 specs, which may contain a "content-encoding" entry. This seems
 to cover POST urls ok then, as the POSTed data is in an entity-body,
 and therefore an entity-header can be used to define its encoding.
 
 

RE: why must I add the port number

2001-01-04 Thread Kitching Simon

If you don't specify a port when you type the url into a web browser,
most (all?) web browsers default to port 80.

The problem with having tomcat run on port 80 "out of the box" is that:

(a) you might be installing tomcat on a machine that already has a web
server
running on the standard port. In this case, someone installing and running
tomcat
to do some experiments might prevent the previously installed webserver from
running.
This is only a minor problem for Windows PCs, but is a serious issue for
multi-user
systems like big HPUX or Solaris systems, as many people can be working on
the
machine at the same time, and there can be "production" systems running on
the
same computer people are doing development on.

(b) for security, UNIX-based machines only allow user "root" (the system
administrator)
to access port numbers below 1024. If tomcat tried to run on port 80 "out of
the box" then
it would fail to start on any unix system. Windows doesn't have much
security, so doesn't
bother with this restriction.

Therefore, tomcat's default configuration (server.xml) specifies port
"8080". 

If you want to change this, and situations (a) and (b) above do not apply to
you, 
just edit the $TOMCAT_HOME/conf/server.xml file and set the port to "80".
See the standard documentation for more information.


 -Original Message-
 From: Birte Glimm [SMTP:[EMAIL PROTECTED]]
 Sent: Thursday, January 04, 2001 3:49 PM
 To:   [EMAIL PROTECTED]
 Subject:  why must I add the port number
 
 Hi, I have installed tomcat as a standalone webserver on Win 2000. 
 To get a page or a servlet I have to type e.g.
 http://localhost:8080/examples/servlet/helloWorldExample
 but why must I include the port? Isn`t it the standard http port as in all
 other webservers? If the port number is missing I get "Cannot find server"
 and "The page cannot be displayed"
 
 Thanks
 
 Birte Glimm

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




RE: IllegalStateException???

2001-01-04 Thread Kitching Simon

According to the sun servlet specs, you are **not allowed** to
do a forward operation after having called a method to get the
output stream, exactly as the message states.

Are you sure you have never obtained an output stream
before attempting to forward to "confirm.jsp" ??

If you have something like
  posted data -- servlet1
  servlet1 does "include" for "handle-data.jsp"
  servlet1 does "forward" to "confirm.jsp"
then if handle-data.jsp obtains an output stream, this would
exactly explain the problem.

I suspect that the first thing *any* jsp page does is grab the
output stream, have a look at the generated jsp code for
"handle-data.jsp" or whatever your equivalent is.

If your situation is different from what I have guessed, then
please include more information in your next post - the page
you included here looks ok, so the problem is probably in the
upstream processing you didn't give any info about!

Cheers,

Simon

 -Original Message-
 From: Matt Goss [SMTP:[EMAIL PROTECTED]]
 Sent: Thursday, January 04, 2001 4:23 PM
 To:   [EMAIL PROTECTED]
 Subject:  IllegalStateException???
 
 Hi everyone,
 I just ported an applicaiton onto tomcat 3.2 that ran fine on JRUN 3.0.
 The application consists of servlets that accept form posts from JSP's,
 they process the data and then forward to other jsp pages. When I
 forward to a specific page, the page displays fine, but I'm getting an
 error message on my server screen :
 error message
 2001-01-04 09:53:05 - Ctx( /rollout ):IllegalStateException in: R(
 /rollout +/editcomponent/confirm.jsp + null) Cannot forward as
 OutputStream or Writer has already been obtained
 /error message
 the page is a simple confirmation page and looks like this:
 jsp page
 html
 head
 titleCUSTOMER OPERATION CONFIRMATION/title
 meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"
 
 /head
 body bgcolor="#FF"
 h1The %=request.getParameter("cmd")% operation was successful!
 :)/h1
 a href="doeditcustomer.html"Return to the Customer list/abr
 a href="index.jsp"Return to navigation page/a
 /body
 /html
 /jsp page
 
 does anyone have any idea what could be causing this???
 Matt Goss  File: Card for Matt GossFile: ATT17765.txt  

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




RE: charset problem

2001-01-04 Thread Kitching Simon

I think the most likely cause is that it is your SQL
statement that is throwing an exception when you
try to insert non-ascii characters into a text column
in the database.

Java text is all based on UNICODE, so it is unlikely
that tomcat has any problems at all with special
characters. 

So the point for *you* to check is whether your
SQL is being run, and if so whether it is throwing
an exception. 

If you can confirm that your SQL is not being
run at all (ie that the problem *is* somewhere in
tomcat) then I suggest you post again.

 -Original Message-
 From: André Alves [SMTP:[EMAIL PROTECTED]]
 Sent: Thursday, January 04, 2001 6:34 PM
 To:   [EMAIL PROTECTED]
 Subject:  charset problem
 
 Hi, 
 I'm using apache 1.3.9, tomcat 3.2.1 and NT 4 SP 5.
 When I pass words with special characters like parameter to tomcat,
 to be inserted in a data base, the insert don't occurs. I would like
 know if exists any configuration to tomcat accept words with special
 characters, like "André" or "João".
 
 Thanks
 
 
 __
 Do You Yahoo!?
 Yahoo! Photos - Share your holiday photos online!
 http://photos.yahoo.com/
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, email: [EMAIL PROTECTED]

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




RE: IllegalStateException???

2001-01-04 Thread Kitching Simon

Hmm .. looks ok to me..

On to theory # 2 :-)

Is the %= request.getParameter("cmd") % perhaps throwing an
exception (due to null being returned)? It might be that exception-
catching code (that tomcat auto-inserts when generating .jsp - .java)
is trying to do a redirect to an error page...I've had problems with this
before.

Why not try putting
%
 String cmd = "oops";
  try
{
  cmd = request.getParameter("cmd");
}
catch(Throwable t)
{
}
%

at the top of your page, then using
%= cmd % instead of %= request.getParameter("cmd") % ??

This should let you know if theory #2 flies or dies :-)

Cheers,

Simon

 -Original Message-
 From: Matt Goss [SMTP:[EMAIL PROTECTED]]
 Sent: Thursday, January 04, 2001 7:22 PM
 To:   [EMAIL PROTECTED]
 Subject:  Re: IllegalStateException???
 
 The servlet that gets posted to performs some business logic via JavaBeans
 and then
 forwards to the display page (in this case, the confirm.jsp) it never gets
 the output
 stream and it doesn't include any other jsp's.
 sample code
 //save the changes and then send to confirm page
 Customer tmpcust =
 (Customer)req.getSession(false).getAttribute("tmpcust");
 try{
 logger.log("removing customer:"+tmpcust.getId(),
 logger.INFO);
 this.clist.removeCustomer(tmpcust.getId());
 logger.log("customer removed", logger.INFO);
 }catch(Exception E){
 logger.log(E, "error removing customer",
 logger.ERROR);
 req.setAttribute("msg", "error removing customer,
 check logs");
 
 this.send(req, resp,
 this.props.getProperty("error"),
 "editcustomer");
 return;
 }
 this.send(req, resp,
 this.props.getProperty("confirm"),
 "editcustomer");
 //snip
 public void send(HttpServletRequest req, HttpServletResponse resp, String
 page, String
 component) throws IOException, ServletException
 {
 RequestDispatcher rd =
 req.getRequestDispatcher("/"+component+"/"+page);
 rd.forward(req, resp);
 }
 /sample code
 ??? any clue?
 Matt
 
 Kitching Simon wrote:
 
  According to the sun servlet specs, you are **not allowed** to
  do a forward operation after having called a method to get the
  output stream, exactly as the message states.
 
  Are you sure you have never obtained an output stream
  before attempting to forward to "confirm.jsp" ??
 
  If you have something like
posted data -- servlet1
servlet1 does "include" for "handle-data.jsp"
servlet1 does "forward" to "confirm.jsp"
  then if handle-data.jsp obtains an output stream, this would
  exactly explain the problem.
 
  I suspect that the first thing *any* jsp page does is grab the
  output stream, have a look at the generated jsp code for
  "handle-data.jsp" or whatever your equivalent is.
 
  If your situation is different from what I have guessed, then
  please include more information in your next post - the page
  you included here looks ok, so the problem is probably in the
  upstream processing you didn't give any info about!
 
  Cheers,
 
  Simon
 
   -Original Message-
   From: Matt Goss [SMTP:[EMAIL PROTECTED]]
   Sent: Thursday, January 04, 2001 4:23 PM
   To:   [EMAIL PROTECTED]
   Subject:  IllegalStateException???
  
   Hi everyone,
   I just ported an applicaiton onto tomcat 3.2 that ran fine on JRUN
 3.0.
   The application consists of servlets that accept form posts from
 JSP's,
   they process the data and then forward to other jsp pages. When I
   forward to a specific page, the page displays fine, but I'm getting an
   error message on my server screen :
   error message
   2001-01-04 09:53:05 - Ctx( /rollout ):IllegalStateException in: R(
   /rollout +/editcomponent/confirm.jsp + null) Cannot forward as
   OutputStream or Writer has already been obtained
   /error message
   the page is a simple confirmation page and looks like this:
   jsp page
   html
   head
   titleCUSTOMER OPERATION CONFIRMATION/title
   DEFANGED_meta http-equiv="Content-Type" content="text/html;
 charset=iso-8859-1"
  
   /head
   body bgcolor="#FF"
   h1The %=request.getParameter("cmd")% operation was successful!
   :)/h1
   a href="doeditcustomer.html"Return to the Customer list/abr
   a href="index.jsp"Return to navigation page/a
   /body
   /html
   /jsp page
  
   does anyone have any idea what could be causing this???
   Matt Goss  File: Card for Matt GossFile: ATT17765.txt 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, email: [EMAIL PROTECTED] 
 File: Card for Matt GossFile: ATT19241.txt  

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




RE: load on startup

2001-01-04 Thread Kitching Simon

Perhaps the problem is that your servlet *is*
being started, but is throwing an exception
during constructor or init method..print
statements in your constructor and init method
should prove this one way or another.

The load-on-startup value is just an integer that
indicates order of startup (low numbers first). The
value you've used is just a very very low integer :-)

Actually, you might want to use "0" or "1" as your
load-on-startup value, to ensure that the DefaultServlet
(which uses this -ve value itself to try to get started before
everything else) does actually get started before your
servlet code.

 -Original Message-
 From: Michael Wentzel [SMTP:[EMAIL PROTECTED]]
 Sent: Thursday, January 04, 2001 7:15 PM
 To:   '[EMAIL PROTECTED]'
 Subject:  Q:load on startup 
 
 When trying to configure a servlet to load
 at server startup using:
 
 servlet
   servlet-name
   PDFStyle
   /servlet-name
   servlet-class
   reporting.PDFStyleServlet
   /servlet-class
   load-on-startup
 -2147483645
   /load-on-startup
 /servlet
 
 I get the following:
 
 cannot load servlet name: PDFStyle
 
 The class file is in the Web-inf/classes/reporting path
 as it should be but it's still not loading.
 
 Any ideas on what's wrong?  Is this the correct form for
 the load-on-startup tag in web.xml?  What does the integer
 represent(classid...)?
 
 
 ---
 Michael Wentzel
 Software Developer
 Software As We Think
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, email: [EMAIL PROTECTED]

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




RE: charset problem

2001-01-04 Thread Kitching Simon

Hi Andre,

I'm still willing to bet your sql is the problem.
It looks exactly like you are catching a nasty
exception somewhere, and totally ignoring it
(though I have been known to be wrong on
occasions :-)

I think you will have to provide more info, and
in particular do some research/debugging yourself,
then ask *specific questions* in this group
to get help - you know how hard it is to debug 
code you've written yourself, that is in front of
you. And in addition, while people here are pretty
helpful, no-one is being paid to solve problems..
(I'm just trying to avoid working on my own bugs
at the moment..)

I use special characters (french, german) with tomcat,
inserting into database fields, and have no problems,
so it works in the general case. Of course, we use
instances of Oracle which have been configured to 
use the ISO-8859-1 character set, etc. I didn't have
to set up Tomcat special in any way, as far as I
can remember.

What you *can* take away from the answers so
far is that no-one seems to have encountered a 
similar issue with tomcat, ie that it is not a known 
bug or common problem.

Good luck solving it!

Simon

 -Original Message-
 From: André Alves [SMTP:[EMAIL PROTECTED]]
 Sent: Thursday, January 04, 2001 8:04 PM
 To:   [EMAIL PROTECTED]
 Subject:  RE: charset problem
 
 The query is simply ignored. setting environment variable
 "TOMCAT_OPTS=-Dfile.encoding=ISO8859_1", not work. Is like tomcat
 recived the request but made nothing .
 
   I enter data in the simple html form. tomcat receives this datas,
 and send the end page, as if the data were inserted but, when I made
 a search, the data had not been modified. This only occurs when
 characters special in the form exist. When I don't have any special
 characters in the form, the data are brought up to date.
 
 --- Michael Wentzel [EMAIL PROTECTED] escreveu:  Does
 anything at all get inserted into the database or is the query
  simply ignored/Exception thrown/...?  If you post the exact results
  of executing your query and a snippet of code used to do so it
  would
  help diagnose the problem.
  
  
  ---
  Michael Wentzel
  Software Developer
  Software As We Think
  
  
 
 -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, email: [EMAIL PROTECTED]
   
 
 
 __
 Do You Yahoo!?
 Yahoo! Photos - Share your holiday photos online!
 http://photos.yahoo.com/
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, email: [EMAIL PROTECTED]

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




RE: Session Problem

2001-01-04 Thread Kitching Simon

And the "default" timeout for sessions can be set in your
web.xml file with:

session-config
session-timeout
30
/session-timeout
/session-config

The value is in minutes...

Cheers,

Simon

 -Original Message-
 From: Jeff Fletcher [SMTP:[EMAIL PROTECTED]]
 Sent: Thursday, January 04, 2001 8:36 PM
 To:   '[EMAIL PROTECTED]'
 Subject:  RE: Session Problem
 
 HttpSession session = request.getSession(true);
 session.setMaxInactiveInterval(300);
  
 Will set the timeout to 5 minutes (300 seconds).
  
 Jeff
  
 
   -Original Message-
   From: Mike Campbell [mailto:[EMAIL PROTECTED]]
   Sent: Thursday, January 04, 2001 12:37 PM
   To: '[EMAIL PROTECTED]'
   Subject: RE: Session Problem
   
   
 
   Craig (or anyone), 
 
You might want to turn your thinking inside out on how to 
handle this problem 
:-). 
 
   I came in on this discussion thread mid-strand, and have a question.
 Your code snipped on session handling made perfect sense, and really made
 the session-handling issue finally "click" for me.  My question is about
 timeouts; where is the timeout value set?
 
   Thanks 
 

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




RE: a simple test to charset

2001-01-04 Thread Kitching Simon

Very interesting - a concrete example is always more interesting
to investigate than an abstract bug!

So I gave your code a try and it worked fine on my system!
I can't imagine what might be making it run for me but not run for you..

Just a by-the-way: I think you should also be setting
the charset attribute of the content type for safety,
but I have to admit I don't either, and accents have
always worked fine for me.

How I run it (ie how it works fine):
* tomcat 3.2.1 on HPUX
* Microsoft IE4 as the browser
* I set up a specific servlet-mapping to run the HelloWorldExample,
  rather than running it through the invoker servlet. (I had deliberately
  turned off the invoker servlet a long time ago; funny enough, I
  can't seem to get it running again now...)


You might want to try using a url-encoded version of your url, ie
not
http://my_ip/servlet/HelloWorldExample?name=André
but
http://my_ip/servlet/HelloWorldExample?name=Andr%E9

Actually, though, both of these work OK for me anyway.

I'll have a think about this tomorrow (home time now) -
good luck tracking this down...

Simon
 -Original Message-
 From: André Alves [SMTP:[EMAIL PROTECTED]]
 Sent: Thursday, January 04, 2001 9:06 PM
 To:   [EMAIL PROTECTED]
 Subject:  a simple test to charset
 
 I, made the following test:
 import java.io.*;
 import java.text.*;
 import java.util.*;
 import javax.servlet.*;
 import javax.servlet.http.*;
 
 public class HelloWorldExample extends HttpServlet
 {
   public void doGet(HttpServletRequest request, HttpServletResponse
 response) throws IOException, ServletException
   {
 String strName = request.getParameter("name"); 
 response.setContentType("text/html");
 PrintWriter out = response.getWriter();
 
 out.println("html");
 out.println("head");
 out.println("/head");
 out.println("body bgcolor=\"white\"");
 out.println("body");
 out.println("start");
 out.println("br");
 out.println("Name = "+strName);
 out.println("br");
 out.println("end");
 out.println("/body");
 out.println("/html");
   }
 }
 
 And I invoke this servlet with the url:
 http://my_ip/servlet/HelloWorldExample?name=André
 
 The html responde is:
 
 start
 Name: Andr
 end
 
 Tomcat did not catch special caracter "é". 
 
 __
 Do You Yahoo!?
 Yahoo! Photos - Share your holiday photos online!
 http://photos.yahoo.com/
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, email: [EMAIL PROTECTED]

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




RE: Setting properties outside of the WAR

2001-01-03 Thread Kitching Simon

I think that this whole issue (specifying configuration parameters
to web applications) needs some serious thought - possibly
at the level of the servlet spec development group, even.

The problem is that two deployments of the same application are
not necessarily identical. The most obvious example is where two
otherwise identical installations need to be configured to use
different databases (ie different JDBC connection strings).

It is really **nasty** to deploy a webapp, then have to edit a string
inside the WEB-INF/web.xml as part of the deployment procedure.
(a) it's hard to describe in such a way that an "application support team"
can reliably get it right,
(b) if it is stuffed up, then really nasty consequences can occur
- testing system gets connected to production database, or 
  production system gets connected to development database,
  which is worse ???!!

I think what is needed, instead, **is** some configuration 
outside of the webapp. Upgrading a webapp then doesn't
"throw away" the configuration settings used for the previous
release. Obviously, there needs to be some kind of consistency
checking to ensure that new configuration items don't need to
be added for the new release, etc.

My current solution (which you are welcome to, Ritchie, if you
want a copy) is a perl script which is run after installing a copy
of the webapp. It searches the tree of files, replacing any occurrence
of strings of form @token-name@ with a value from a property file
which is specific to each *installation* of the webapp. My development
installation of the webapp gets configured using one property file,
my acceptance-test instance uses a second, and the production
system uses a third properties file.

While the *main* file that gets modified during the install is the
web.xml file, there are other files that get modified, eg the log4j
configuration options file which is also in WEB-INF.

Note that I do not want to use ANT to do this token-replacement
during building of the "WAR" file, because I want to have a standard
WAR file that can be deployed into development, testing and production.

Any alternatives that could be used to configure a webapp per-deployment
would be welcome - I'm not perfectly happy with my current solution, I just
can't think of anything better

Regards,

Simon
 -Original Message-
 From: Craig R. McClanahan [SMTP:[EMAIL PROTECTED]]
 Sent: Tuesday, January 02, 2001 10:10 PM
 To:   [EMAIL PROTECTED]
 Subject:  Re: Setting properties outside of the WAR
 
 Ritchie Young wrote:
 
  Thanks for the response but that wasn't quite what I was getting at.
 
  The idea was that there should be some easy way for an administrator to
 set
  a property for the application. It just strikes me that the
 TOMCAT_OPTIONS
  variable is a slightly cumbersome way especially when there start to be
 a
  few more applications.
 
  I thought that the "Context" tag in server.xml wouldn't be a bad place
 to
  incorporate application specific settings such as where the application
 can
  find it's properties file. This would also allow for multiple instance
 of
  the same application to use different configurations but only one WAR
 file.
 
 
 The settings in server.xml are designed to configure Tomcat's own features
 --
 not your application.  Your app is responsible for that.  You can do
 things in a
 portable way (for example, call
 ServletContext.getResource("/WEB-INF/myprops.properties")), or not, as you
 choose.
 
 Keep in mind that the intent of web applications is that they are *stand
 alone*
 gadgets, to be dragged and dropped onto a servlet container (*any*
 container,
 not just Tomcat) and work correctly.  Given that, it does not make sense
 for the
 servlet API to provide any mechanism to access resources outside of the
 WAR.
 You are free, of course, to implement any such technique (such as passing
 the
 absolute pathname to a properties file in a servlet initialization
 parameter),
 but you are making it harder on people who want to deploy your webapp in a
 variety of environments, as well as limiting the set of environments in
 which
 your app can run (for example, an ISP might prohibit file access in order
 to
 protect the various web apps from each other).
 
 
  Cheers
  Ritchie
 
 
 Craig McClanahan
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, email: [EMAIL PROTECTED]

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




RE: Tomcat 3.2.1 not recognizing index document

2001-01-03 Thread Kitching Simon

Hi,

As has been stated many times in this email group,
tomcat 3.2 does *not* read the file
$TOMCAT_HOME/conf/web.xml any more.

I bet you defined your welcome-file there - you should
define the welcome-file entry in WEB-INF/web.xml
instead.

Note that the WEB-INF/web.xml file has always been
the *right* place for this definition (though using either 
file would have worked in the past). It makes more sense
to define the welcome-file entries at a webapp-specific
level rather than at a tomcat-wide level, as separate
webapps are likely to want different settings.

The tomcat 3.2 developers made a minor error (in my
opinion) by forgetting to take the old no-longer-used
global web.xml file out of the latest releases.

Tomcat developers - can you get rid of the global
web.xml file from the distribution, to avoid this confusion???
Or rename it to something else (like web.builtin.xml ;-)

Cheers,

Simon

 -Original Message-
 From: [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]]
 Sent: Tuesday, January 02, 2001 7:57 PM
 To:   [EMAIL PROTECTED]
 Subject:  Tomcat 3.2.1 not recognizing index document
 
 Recently I upgraded to Tomcat 3.2.1 from 3.1 and everything seems to have
 gone well except for one thing:
 
 If i try to go to my URL at http://www.somesite.com/ it cannot handle it,
 and maps to http://http/index.jsp
 
 However, if i type in http://www.somesite.com/index.jsp it loads
 perfectly.
 
 I've messed with the httpd.conf files with apache, and have determined
 that
 somehow, whenever you don't type in a filename, it has problems. My
 previous
 copy of Tomcat 3.1 was working great, so it has to be with the handoff
 from
 apache to tomcat. I've checked, and Apache handles regular .html
 DirectoryIndex files perfectly!
 
 This one is really bugging me, please help!
 
 
 
 
 
 
 
 
 ___
 Send a cool gift with your E-Card
 http://www.bluemountain.com/giftcenter/
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, email: [EMAIL PROTECTED]

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




RE: log files

2001-01-03 Thread Kitching Simon

Tomcat 4 generates "access logs" of the kind you need
Tomcat 3.2 does not.

If you are using tomcat 3.2, either use a webserver like
apache as a front-end (apache does generate access
logs) or upgrade to tomcat 4.

For more information, search the email archives, as
this question has been asked several times in the
recent past.

Regards,

Simon

 -Original Message-
 From: Will Ashley [SMTP:[EMAIL PROTECTED]]
 Sent: Tuesday, January 02, 2001 7:20 PM
 To:   '[EMAIL PROTECTED]'
 Subject:  log files
 
 Hello,
 
 I need the ability to have tomcat log information when a user clicks on
 one
 of my links to open a PDF file.  I need to run a monthly report that tells
 me the total number of PDFs that were opened and which ones.  I looked in
 the log files that Tomcat is prodocing, but it is not loggin anything when
 I
 open a PDF file from a JSP.  Will changing the verbosityLevel in the
 Server.xml file do the trick?
 
 Thanks,
 
 Will Ashley
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, email: [EMAIL PROTECTED]

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




RE: Setting properties outside of the WAR

2001-01-03 Thread Kitching Simon

Hi Ritchie (and anyone else interested)

Something else occurred to me after sending this email,
and reading an unrelated email from Craig.

Craig was talking about being able to run a webapp direct
from a WAR file without unpacking it. Yes, the idea sounds
nice, but then how is anyone to configure the webapp? The
web.xml file can't be edited! This implies that the WAR is
built with the necessary attributes already set, but isn't that
like distributing a shrink-wrapped application with all the 
configuration items hard-wired and impossible to change by
the end user???

Anyway, here's the perl script and a few related files.
Documentation is in the comments inside "install.pl".

The code may seem a little odd in places - the install
program is a result of "experimenting" with various 
approaches, and not all the traces of previous
experiments have been removed!

 install.pl  install.cfg  installTokensExample.cfg  
and here's an example of a file that will be modified during install:
 web.xml.install 

What I do to distribute an app is build a jar file containing
the install.pl, install.cfg and installTokensExample.cfg files,
and then a subdirectory containing the entire web application.

To install a distribution the first time:
* create an install directory, cd to it
* Unjar the jar
* cp installTokensExample.cfg ../installTokens.cfg (note rename)
* vi ../installTokens.cfg and set specific attributes for that install
* perl install.pl

To upgrade a distribution, ie where a proper installTokens.cfg has
already been created,
* delete the old install directory
* recreate the install directory, cd to it
* unjar the new jar file
* perl install.pl

Any feedback welcome

Cheers,

Simon

 -Original Message-
 From: Ritchie Young [SMTP:[EMAIL PROTECTED]]
 Sent: Wednesday, January 03, 2001 4:30 PM
 To:   [EMAIL PROTECTED]
 Subject:  Re: Setting properties outside of the WAR
 
 Oh good, it's not just me.
 
 Thanks, I would appreciate it if you did forward me a copy of that script.
 
 Cheers
 Ritchie
 
 - Original Message -----
 From: "Kitching Simon" [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Wednesday, January 03, 2001 6:07 PM
 Subject: RE: Setting properties outside of the WAR
 
 
  I think that this whole issue (specifying configuration parameters
  to web applications) needs some serious thought - possibly
  at the level of the servlet spec development group, even.
 
  The problem is that two deployments of the same application are
  not necessarily identical. The most obvious example is where two
  otherwise identical installations need to be configured to use
  different databases (ie different JDBC connection strings).
 
  It is really **nasty** to deploy a webapp, then have to edit a string
  inside the WEB-INF/web.xml as part of the deployment procedure.
  (a) it's hard to describe in such a way that an "application support
 team"
  can reliably get it right,
  (b) if it is stuffed up, then really nasty consequences can occur
  - testing system gets connected to production database, or
production system gets connected to development database,
which is worse ???!!
 
  I think what is needed, instead, **is** some configuration
  outside of the webapp. Upgrading a webapp then doesn't
  "throw away" the configuration settings used for the previous
  release. Obviously, there needs to be some kind of consistency
  checking to ensure that new configuration items don't need to
  be added for the new release, etc.
 
  My current solution (which you are welcome to, Ritchie, if you
  want a copy) is a perl script which is run after installing a copy
  of the webapp. It searches the tree of files, replacing any occurrence
  of strings of form @token-name@ with a value from a property file
  which is specific to each *installation* of the webapp. My development
  installation of the webapp gets configured using one property file,
  my acceptance-test instance uses a second, and the production
  system uses a third properties file.
 
  While the *main* file that gets modified during the install is the
  web.xml file, there are other files that get modified, eg the log4j
  configuration options file which is also in WEB-INF.
 
  Note that I do not want to use ANT to do this token-replacement
  during building of the "WAR" file, because I want to have a standard
  WAR file that can be deployed into development, testing and production.
 
  Any alternatives that could be used to configure a webapp per-deployment
  would be welcome - I'm not perfectly happy with my current solution, I
 just
  can't think of anything better
 
  Regards,
 
  Simon
   -Original Message-
   From: Craig R. McClanahan [SMTP:[EMAIL PROTECTED]]
   Sent: Tuesday, January 02, 2001 10:10 PM
   To: [EMAIL PROTECTED]
   Subject: Re: Setting properties outside of the WAR
  
   Ritchie Young wrote:
  
Thanks for the response but that wasn't quite w

RE: Pl clear this

2000-12-29 Thread Kitching Simon

The answer is all good news :-)

Tomcat is licenced under the Apache Software Licence.
You can find a copy of this licence in the tomcat version
you just downloaded - it is in a file called "LICENCE".

Basically, though, the licence says that tomcat is totally free
for any use at all. Tomcat is not a "commercial" product, in that
no-one is trying to make money out of it by selling it. That doesn't
mean it isn't "commercial-quality". In fact (my opinion), apache 
products tend to be as good as or better than their commercial rivals.
Employees of companies like Sun, IBM, and others have contributed 
to Apache products.

There is no "Enterprise" version - the version you downloaded
is the complete product. There is no limit on the number of users, 
or anything like that. 

And if you want to download the source code for tomcat, that's
available too. You can modify the source code, build tomcat into
your commercial product, whatever you want, at no cost. The only
requirement is that if you use part or all of tomcat (or any other
apache product) in your system, you include the following statement
somewhere:
 "This product includes software developed by the 
 Apache Software Foundation (http://www.apache.org/)."

Note that all the above is *my interpretation* of the licence agreement. 
See the real licence agreement (bundled with the tomcat download) 
for the actual details of the licence.

 -Original Message-
 From: Narayanan [SMTP:[EMAIL PROTECTED]]
 Sent: Friday, December 29, 2000 7:45 AM
 To:   [EMAIL PROTECTED]
 Subject:  Pl  clear  this
 

 
  Hi  All 
 
  I  have downloaded the latest version of tomcat and using tha t.
 
 1. Is this the licensed  Version .?
 
 2. is there any Enterprise Vesion that has to be purchased . ?
 
 3. How many Users this will support ?.
 
 Pl if i get the answers for this it will be very useful.
 
Thanks in advanvce..New Year Wishes to all.
 

 

 
 
 

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




RE: context initialization

2000-12-28 Thread Kitching Simon

I didn't mention that part :-)

Obviously, there's no point in tomcat calling the
doGet/doPost methods - they're meant to be
passed in data about the calling browser etc.,
and output an HTML page. That just doesn't
make sense in the "load-on-startup" situation.

You define (actually, over-ride) the init method of
the servlet instead, like this:

public void init(ServletConfig config) throws ServletException 
{
super.init(config);
  // put your startup code here, like creating java objects and
  // putting them in the application context where all jsp pages
  // and other servlets can get at them.
  // 
  // eg
  //
  // ServletContext context = config.getServletContext();
  // SystemState systemState = new SystemState();
  // context.setAttribute("systemState", systemState);

}   

This is all documented in the sun java servlet specifications...

Regards,

Simon

 -Original Message-
 From: Nicolás Marjovsky [SMTP:[EMAIL PROTECTED]]
 Sent: Thursday, December 28, 2000 7:57 PM
 To:   [EMAIL PROTECTED]
 Subject:  Re: context initialization
 
 Dear Simon:
 I've tried what you told me but the servlet doesn´t gets executed,
 it´s
 just preloaded.
 
 Any ideas?
 
 Thanks for your help,
 Nicolás
 
 - Original Message -----
 From: "Kitching Simon" [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Wednesday, December 27, 2000 7:16 AM
 Subject: RE: context initialization
 
 
 If I understand your question correctly, I do this sort of
 thing currently, by having a servlet which instantiates
 a bunch of objects, and adds them to the context.
 This servlet is defined as "load-on-startup".
 
 
 In the webapp's web.xml, I have:
 
 !-- define a servlet/class that can be accessed by all other
 components
 --
 servlet
 servlet-nameinitializerServlet/servlet-name
 servlet-classorange.ola3.InitializerServlet/servlet-class
 load-on-startup1/load-on-startup
 
 init-param
   !-- set system state mode. Valid values are:
PRODUCTION, TEST, DEBUG
   --
 
   param-namesystemStateMode/param-name
   param-valueDEBUG/param-value
 /init-param
 /servlet
 
 In reality, I have a whole bunch more init-param tags, containing things
 like JDBC connection strings.
 The servlet code itself does a bunch of things like:
 
   systemState = new SystemState();
   context.setAttribute("systemState", systemState);
 
 Regards,
 
 Simon
 
  -Original Message-
  From: Nicolás Marjovsky [SMTP:[EMAIL PROTECTED]]
  Sent: Tuesday, December 26, 2000 10:40 PM
  To: [EMAIL PROTECTED]
  Subject: context initialization
 
  Hello,
  I need to put some static objects into a web application context at
  start-up time... I want to set the context when the application is going
  up. Where should I put this? In web.xml?
 
  Thanks,
  Nicolás
 



RE: context initialization

2000-12-27 Thread Kitching Simon

If I understand your question correctly, I do this sort of
thing currently, by having a servlet which instantiates 
a bunch of objects, and adds them to the context.
This servlet is defined as "load-on-startup".


In the webapp's web.xml, I have:

!-- define a servlet/class that can be accessed by all other components
--
servlet
servlet-nameinitializerServlet/servlet-name
servlet-classorange.ola3.InitializerServlet/servlet-class
load-on-startup1/load-on-startup

init-param
  !-- set system state mode. Valid values are:
   PRODUCTION, TEST, DEBUG
  --

  param-namesystemStateMode/param-name
  param-valueDEBUG/param-value
/init-param
/servlet

In reality, I have a whole bunch more init-param tags, containing things
like JDBC connection strings.
The servlet code itself does a bunch of things like:

  systemState = new SystemState();
  context.setAttribute("systemState", systemState);

Regards,

Simon

 -Original Message-
 From: Nicolás Marjovsky [SMTP:[EMAIL PROTECTED]]
 Sent: Tuesday, December 26, 2000 10:40 PM
 To:   [EMAIL PROTECTED]
 Subject:  context initialization
 
 Hello,
 I need to put some static objects into a web application context at
 start-up time... I want to set the context when the application is going
 up. Where should I put this? In web.xml?
  
 Thanks,
 Nicolás



RE: Running a thread from a JSP

2000-12-27 Thread Kitching Simon



 -Original Message-
 From: William Brogden [SMTP:[EMAIL PROTECTED]]
 Sent: Tuesday, December 26, 2000 8:54 PM
 To:   [EMAIL PROTECTED]
 Subject:  Re: Running a thread from a JSP
 
 
 
 "David M. Holmes" wrote:
  
  We have a custom tag that is in every JSP that creates a socket
 connection to a target server and
  POSTs some data do a page on the target server that writes the data to a
 database. The issue we
  are having is that we don't want to delay the user's response by doing
 the socket connection
  synchronously. If we do the socket connection asynchronously we risk
 having the data not being
  sent when the server is under stress. I have not verified that this is
 occuring with the custom
  tag yet, but we are seeing it happen using ASP with an HTTP component. I
 am pretty sure that the
  same condition will occurr. So I would like for the JSP to start a
 thread to do the socket
  connection, run in the background, and return the response immediately
 so there is no delay to the
  user. I am thinking that when the response finishes the thread that it
 started will also die. Is
  that correct?
 
 That should work just fine - I have done something very 
 similar to send email. You might want to provide for logging
 the data to a file if the socket connection fails.
 When the job is done, the Thread falls out of the run
 method and dies - all very neat.
    [Kitching Simon]  
I have an alternative solution to suggest.

Create a class which is responsible for the data 
transmission you need to do. Have this class inherit
from Thread (or implementing Runnable, whichever you prefer),
and have it maintain an input queue of messages to send.

You can then instantiate a *single* instance of this class,
start the thread, and put it in the application context as part
of your webapp startup (alternative: make it a singleton).

Your jsp pages then just place a message on this object's
input queue and return. The class's thread (using the standard
producer/consumer architecture you can find in any decent
java textbook) takes the message from the queue and
posts it off asynchronously, as you wanted.

Somehow, this seems cleaner to me than the approach you
described above. While I think you *can* spawn threads from
a jsp page, it just doesn't seem nice to me. 

Just one point about your email:
I am thinking that when the response finishes the thread that it
started will also die. Is
 that correct?
no, this is not correct. If you start a thread, it will continue
running regardless of what
its parent thread does. The Thread *class* contains references to
all active threads, so
even if the only reference to a thread from *your* code gets
deleted, the thread does
not get shut down  garbage collected. The only way a thread ends is
if it returns
from its starting method, either deliberately, or as a result of an
exception propagating
out of the starting method.

Regards,

Simon

 -- 
 WBB - [EMAIL PROTECTED]
 Java Cert mock exams http://www.lanw.com/java/javacert/
 Author of Java Developer's Guide to Servlets and JSP 
 ISBN 0-7821-2809-2



RE: Servlet error I can't seem to resolve

2000-12-27 Thread Kitching Simon

The stack-trace seems pretty clear to me - the
"sendIt" method of the IridiumSendMail class is
storing a null pointer into a hashtable.

What you may find is that the IridiumSendMail
class is expecting to load a resource file from
somewhere, but not finding it because you
forgot to install it, or didn't install it in the
right place.

Just a note on the location of the "mail.jar"
and "activation.jar" files - I think that the
correct place for these is where you
first had them, in the WEB-INF/lib
directory within your web application.
Placing jars in the classpath is
generally a bad idea with tomcat
(though quite a lot of tomcat users
don't seem to understand this; presumably
they are the same ones that would be
using global variables under c++ :-)

regards,

Simon
 -Original Message-
 From: Brad Siegfreid [SMTP:[EMAIL PROTECTED]]
 Sent: Wednesday, December 27, 2000 5:21 PM
 To:   [EMAIL PROTECTED]
 Subject:  Servlet error I can't seem to resolve
 
 I have a simple form handling servlet (FormEngineLight) that connects to a
 email class (IridiumSendMail) that have been working with another host
 under JServ 1.0b3. I moved to a new host with Tomcat 3.2 and also now have
 Tomcat 3.2 working on a local machine for testing. Now my servlet/class
 combo fails to work in either location. They require mail.jar and
 activation.jar, which are in the classpath (initially just in the context
 lib directory, now in the locations that load at boot). My apps are
 compiled agains Java 1.18 but are running on 1.2 for both local and
 hosted.
 
 The stackTrace I get from FormEngineLight (emailed back using the
 sun.net.smtp classes) is: 
 
 java.lang.NullPointerException
   at java.util.Hashtable.put(Hashtable.java:381)
   at IridiumSendMail.sendIt(IridiumSendMail.java)
   at FormEngineLight.writeToIridiumSendMail(FormEngineLight.java)
   at FormEngineLight.sendConfirmation(FormEngineLight.java)
   at FormEngineLight.service(FormEngineLight.java)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
   at
 org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:49
 9)
   at
 org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
   at
 org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(Htt
 pConnectionHandler.java:160)
   at
 org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:3
 38)
   at java.lang.Thread.run(Thread.java:479)
 
 Both of my files are in jars and reside in the lib directory. The
 FormEngineLight servlet is accessible and sends me the error shown above.
 Does the IridiumSendMail file have to be listed in the web.xml file even
 if its not a servlet. If so, do I list it as if it were a servlet?
 
 Thanks,
 Brad Siegfreid
 Iridiumdesign



RE: Servlet error I can't seem to resolve

2000-12-27 Thread Kitching Simon



 -Original Message-
 From: Jeffry Guttadauro [SMTP:[EMAIL PROTECTED]]
 Sent: Wednesday, December 27, 2000 6:07 PM
 To:   [EMAIL PROTECTED]
 Subject:  RE: Servlet error I can't seem to resolve
 
 Hi, Simon.
 
  Why would you say that it's a bad idea to put .jar files in the
 classpath?  In the case of commonly-used jars, like mail.jar for example,
 why
 would it be better to replicate this in each application's WEB-INF/lib
 directory?
 
 Thanks,
 -Jeff
 
[Kitching Simon]  
First of all, it makes it easier to install a webapp.
For example, if you migrate a webapp to a different
machine because it has been wildly successful and
bigger hardware is required, and all required libs are
under WEB-INF/lib, then the move is trivial. Otherwise,
the required libs need to be installed separately. And
remember that this may happen well after the original
developers have left!

Secondly, it removes inter-webapp version dependencies. 
Suppose that one webapp requires an updated version of a 
shared lib. If you upgrade the shared lib, then you need to 
retest every single webapp, even if only one of them *actually*
needed the upgrade. And with libs in the classpath, it
can be difficult to even know which webapps use a lib
and which don't.

Thirdly, putting stuff in the classpath interferes with 
auto-reloading of changed classes. Each webapp gets its
own classloader, which makes it possible to do things like
dynamically reloading classes that have changed, and 
stopping a single webapp context without shutting down
the whole of tomcat. If some of the webapp's code is loaded
from the CLASSPATH (ie is loaded by the system classloader,
not the webapp-specific classloader) then there can
be problems.

Fourthly, when a class is loaded via the system classpath,
there is only one copy of the class methods, and one copy
of class (ie static) variables for that class. If methods on the
class are synchronized, then there will be contention for the
class lock between webapps. One webapp could possibly
hang another by acquiring  not releasing such a lock. When
a class is loaded by the webapp-specific classloader, this
contention cannot occur - webapps are better isolated from
each other. And of course, if a webapp sets the value of a
static member of the class (eg setMaxFoo(3)) then that
attribute is visible to all webapps in the tomcat instance, 
again not providing web application isolation. (note, while
this could be regarded as a "feature" for allowing data
communication between webapps, I thing this is a bad
idea, as it assumes the webapps are running in the same
virtual machine. Communicating via a shared database,
or a shared EJB, or even raw sockets, seems to me to be 
a better way for webapps to intercommunicate).

Fifthly, if you get seriously into security, for example by
defining java security policies, then there may 
be implications. I'm not entirely sure about the effects
here, but it seems that having per-webapp copies
of libs, and *not* having extra stuff in the classpath
(eg libs used by other webapps) can only be good.

Sixthly, I think there are problems with loading resource
files. If you (or shared code) calls getResourceBundle()
or related methods, I suspect the places the JVM looks for
the resource file is different...

Against that, the "libs in CLASSPATH" approach seems to
offer two benefits: save disk space and save RAM. I think
trying to save a megabyte of disk space (and that's a big jar!)
is really pointless in this age. Saving RAM by only loading 
one copy of a class might have some benefit - but I'm not
sure that this doesn't happen anyway. The fact that a class
needs to *behave* as if it were per-classloader doesn't mean
that two copies of the bytecode are loaded (or does it? I
don't know what run-time-linking does to the original bytecode...)

I guess if you have a really large jar, and dozens of webapps
use it, there is a valid case for the classpath approach, but
in general I think having self-contained webapps makes
life easier for everyone concerned..


Just my two cents :-)

Simon


 [EMAIL PROTECTED] on 12/27/2000 10:32:34 AM
 Please respond to [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 cc:
 Subject: RE: Servlet error I can't seem to resolve
 
 The stack-trace seems pretty clear to me - the
 "sendIt" method of the IridiumSendMail class is
 storing a null pointer into a hashtable.
 
 What you may find is that the Iridi

RE: Tomcat info.

2000-12-22 Thread Kitching Simon

I'm not sure what you mean by "build" tomcat.

It's enough just to *install* tomcat. There is a
"binary" release available pre-compiled, which is
all most people will ever need. Just follow the
relevant links from the jakarta.apache.org site,
and download the "jakarta-tomcat-3.2.1.zip"
if you are on windows, or "jakarta-tomcat-3.2.1.tar.gz"
if you are on unix (same code, just different 
compression method used to build download file).

Apart from a Java SDK (not just run-time environment),
no other software is needed to get jsp and servlets
running - tomcat does it all.

 -Original Message-
 From: Kasper (swebase) [SMTP:[EMAIL PROTECTED]]
 Sent: Friday, December 22, 2000 11:41 AM
 To:   [EMAIL PROTECTED]
 Subject:  Tomcat info.
 
 To run JSP is it enough to build tomcat??
  
 I have to get a server up and running with JSP, so i wonder if its enough
 to build tomcat?
 
 Med Vänlig Hälsning
 Kasper Kristiansson
 



RE: very basic web server hosting question

2000-12-22 Thread Kitching Simon

What ted was pointing out is that you do *not* look in the "win32" directory
for tomcat, because tomcat is not platform-specific. The file you need is:
http://jakarta.apache.org/builds/jakarta-tomcat/release/v3.2.1/bin/jakarta-t
omcat-3.2.1.zip

What is in the win32 directory is just stuff like the Microsoft IIS -
tomcat connector, which
*is* specific to win32.

Tomcat works fine with apache (and several other webservers) as a front end.

If you need CGI, you *must* use some webserver as a front-end, because 
tomcat doesn't support CGI (though I can't see any reason why this couldn't 
be added in future - except that there really isn't much point, because CGI
is pathetic).

However, the current release of apache isn't really meant to run on windows,
so (much as 
I hate to say it) if you want to do CGI as well as servlets, you may want to
run Microsoft IIS
as a front-end instead. Note that the next release of Apache (currently in
alpha-release) is
supposed to be much better on windows.

 -Original Message-
 From: Horia Bochis [SMTP:[EMAIL PROTECTED]]
 Sent: Friday, December 22, 2000 1:49 PM
 To:   Tomcat User List
 Subject:  Re: very basic web server hosting question
 
 
 Well, I have been here:
 
 http://jakarta.apache.org/builds/jakarta-tomcat/release/v3.2.1/bin/win32/i
 386/
 
 and what can I take from there, for tomcat to work opn my windows?
 
 I allready have SDK installed on my machine.
 
 Can this be implemented with apache? I mean, can those work toghether? I
 would like to combine CGI with Servlets ?!
 
 Thanx. :)
 
 
 Horia Bochis
 =
 WebMaster @ Romania Data Systems - Oradea
   HomePage: http://horia.rdsor.ro
 
 
 On Thu, 21 Dec 2000, Ted Husted wrote:
 
  On 12/22/2000 at 12:16 AM Horia Bochis wrote:
  I am also a beginner in this tomcat stuff, and I had a strage wish to
  get the tomcat for windows, but I have got lost betweens so many files,
  there. Any hint?
 
  Tomcat is a 100% native Java application, which means there is only one
  version for all platforms.
 
  There are specific Java Virtual Machines for each platform, but only
  one Tomcat.
 
 
  -- Ted Husted, Husted dot Com, Fairport NY USA.
  -- Custom Software ~ Technical Services.
  -- Tel 716 425-0252; Fax 716 223-2506.
  -- http://www.husted.com/
 
 
 



RE: classes in zip files

2000-12-22 Thread Kitching Simon


As far as I am aware, Tomcat has *never* recognised
".zip" files in the lib directory, only .jars.

Perhaps in the past, you happened to have the zip in
a classpath...

Anyway, the fix is just to rename any .zip to .jar,
they are (currently) exactly the same internal format.

 -Original Message-
 From: Ron Hamersma [SMTP:[EMAIL PROTECTED]]
 Sent: Friday, December 22, 2000 5:46 PM
 To:   [EMAIL PROTECTED]
 Subject:  classes in zip files
 
 Hi!,
  
 this is probably a stupid question but i have to ask it anyway:
 i have some classes in a zip file (classes111.zip from oracle for the jdbc
 thin driver),
 and somehow Tomcat 3.2.1 does not seem to pick it up in the lib directory,
 while Tomcat 3.2 had no problems.
  
 I'm running on NT4.0 as well as Windows ME, with Apache 1.3.12 and 1.3.14
 respectively.
  
 BTW jar files are no problem.
  
 Thanx in advance,
  
 Ron (definitely newbie)
 
  



RE: creation of application wide objects

2000-12-21 Thread Kitching Simon



 -Original Message-
 From: Peter Brandt-Erichsen [SMTP:[EMAIL PROTECTED]]
 Sent: Thursday, December 21, 2000 1:46 AM
 To:   [EMAIL PROTECTED]
 Subject:  Re: creation of application wide objects
 
 My apologies for the confusion and also for 
 misquoting David and you. 
 
 So, it is possible to specify a set of servlets 
 to load on startup. That's awesome.
 
 How do I point Tomcat to auto load servlets on
 start up, that are defined in my custom contexts?  
 Does Tomcat scan through each defined context's
 web.xml and just start loading all the servlets that are
 defined?
[Kitching Simon]  
That's exactly right. When tomcat starts a webapp, it
checks the web.xml file for that webapp, and starts
any servlets specified as load-on-startup.

 Also, if I had three sevlets to auto load would I specify
 
 load-on-startup
 3
 /load-on-startup
[Kitching Simon]  
No, the number indicates the *order* of startup. Servlets
with lower load-on-startup numbers are *guarunteed* to
get started before servlets with higher numbers. If several
servlets are define with the same number, then they get 
started in any order. See the sun specs for the precise 
definition of this behaviour.

 Peter 
 
 
 -Original Message-
 From: craig mcclanahan [EMAIL PROTECTED]
 To: [EMAIL PROTECTED] [EMAIL PROTECTED]
 Date: Wednesday, December 20, 2000 4:31 PM
 Subject: Re: creation of application wide objects
 
 
 Intergate wrote:
  
  Alex,
  
  Were you successful with this auto loading solution?
  It is something that I have been searching for...
  
  I seem to remember a message a while back from someone
  on the list that indicated that the
  
load-on-startup
 1
 /load-on-startup
  
  wasn't implemented as of Tomcat 3.2.1 and would not
  be available until 4.0.
  
 
 That is not correct -- this capability works in Tomcat 3.2.1.  The
 confusion is probably due to the issue pointed out in my next response.
 
  Also, David wrote this morning that Tomcat 3.2.1 does
  not read the web.xml file and that it shouldn't even be
  included in the distribution anymore??
 
 Tomcat 3.2.1 does not read the web.xml file in $TOMCAT_HOME/conf.  It
 *definitely* reads the web.xml file in your application's WEB-INF
 directory -- that is where you should be doing your customizations.
 
  
  P.
 
 Craig McClanahan
 
 



RE: How to accommodate the webapps directory structure change

2000-12-21 Thread Kitching Simon

It looks like there is a little confusion of terminology here..
When I say "webapp root", I mean the root directory of *a*
web application (ie a tomcat context). I am not talking about
the directory $TOMCAT_HOME/webapps.

A single instance of tomcat can host any number of totally
independent web applications. There are two ways of 
defining a web application:

(a) just create a directory under $TOMCAT_HOME/webapps,
and leave it up to the auto-context-creater-thingy to detect
the presence of the directory and automatically define a
context for it (the same process works if there is a .WAR
file in the $TOMCAT_HOME/webapps directory).

(b) explicitly insert a context tag into file
$TOMCAT_HOME/conf/server.xml, specifying a
directory.

In case (a), the "webapp root" is the directory
$TOMCAT_HOME/webapps/somewebappname.
In case (b), the "webapp root" is whatever you
specified for the "baseDir" attribute of the context.

Note that web applications running under tomcat are 
meant to be entirely independent, just like applications 
running in whatever OS you happen to use. When you
write a windows or unix app, you can generally forget
about the fact that other processes are running at the
same time, because the OS gives each process a nice
isolated environment to run in, where it cannot interfere
with other apps, nor other apps interfere with it (except
over minor details, like contention over files). Servlet
engines are meant to provide the same nice isolation
between "web applications".

To get back to your questions:

1. Are you meaning that "webapps" is already one roof,
underneath it can *only* allow one sw system staying there?

No, you can have as many *independent* web applications as
you want inside one tomcat instance. If you want each web
application to be installed within $TOMCAT_HOME/webapps,
then that's fine but they don't have to be there, because the
context tag allows the *root directory* of each web application
to be specified. The only disadvantage of this is that you can't
deploy by just dropping a .WAR file, you need to change the
server.xml file too. Note the word "independent" though - you
said that the "subsystems" you want have "some relations";
if you model them as separate web applications, you may need
to do some fancy hacking to allow them to communicate.

2. Are you meaning, between WEB-INF and webapps, there
should be *only one* level of directory, rather than two?

No. Assuming that you have installed two web applications
in the $TOMCAT_HOME/webapps directory, you will have:

$TOMCAT_HOME/webapps
  + plan
+ WEB-INF
  + classes
  + libs
+ files_for_webapp1
+ more_files_for_webapp1
+ etc
  + execution
+ WEB-INF
  + classes
  + libs
+ files_for_
+ files2
+ etc

but not

$TOMCAT_HOME/webapps
  + is
+ plan
  + WEB-INF
+ classes
+ libs
  + files_for_webapp1
  + more_files_for_webapp1
  + etc
+ execution
  + WEB-INF
+ classes
+ libs
  + files_for_webapp1
  + more_files_for_webapp1
  + etc

because the auto-context-creator-thingy will see
only *one* web application "is", then see that there
is no WEB-INF directory below "is". 

The second directory structure shown above will work 
ok if you disable the auto-context-creator-thingy, and 
instead define separate contexts in server.xml, setting 
baseDir to $TOMCAT_HOME/webapps/is/plan, 
$TOMCAT_HOME/webapps/is/execution, etc. I 
suggest, however, that if you do want to have this
"is" parent directory, you put it somewhere other than
under webapps.

4. Is there any document talking about the whole Tomcat directory
tree
structure
and its design priciple, ie. why they design directory tree
structure
in that way ?

Tomcat is just complying with the SUN servlet and jsp specifications.
See the original sun documents (downloadable from the sun site).

Regards,

Simon

 -Original Message-
 From: Steven Liu [SMTP:[EMAIL PROTECTED]]
 Sent: Wednesday, December 20, 2000 7:50 PM
 To:   Kitching Simon
 Cc:   '[EMAIL PROTECTED]'
 Subject:  RE: How to accommodate the webapps directory structure
 change
 Importance:   High
 
 Thanks very much, Simon, I see your point.
 
 Now I'd tell you why I want to add one more dir "is"
 
 I'm designing a software system, whose architecture is
 like 
 webapps
  |
 is(Integratioin Suite)
  |
   |--||-|--|
 Plan Execution Report Search Admin
 
 My intention is to allow each subsystem like
 Plan/Execution/Report/Search/Admin as independent
 as possiable, even though there will be some relations
 among them. So I can let different develop group to
 develop each subsystem a bit more independently.
 
 My reason to add "is" dir i

RE: How to accommodate the webapps directory structure change

2000-12-20 Thread Kitching Simon

Hi Steven,

The problem you have with your new directory structure is that the
WEB-INF directory isn't immediately below the webapp root.

In the first case, you have a webapp root of "execution", and WEB-INF
is directly below that directory, so this is OK.

In the second case, you need WEB-INF to be off the "is" directory,
not the "execution" directory. Because it is in the wrong place, it is
regarded as a plain old content directory, not a special directory.
Tomcat will therefore not find the web.xml file, *or* any of the servlet
classes. As a result, any /servlet/... url won't work - tomcat won't
find any corresponding class file.

Cheers,

Simon

 -Original Message-
 From: Steven Liu [SMTP:[EMAIL PROTECTED]]
 Sent: Tuesday, December 19, 2000 7:13 PM
 To:   '[EMAIL PROTECTED]'
 Subject:  How to accommodate the webapps directory structure change
 
 Following is my directory/file structure for a servlet, it works fine.
 the index.html has the statement:
 "td WIDTH="30%"a href="../execution/servlet/ABC"img
 SRC="../images/execute.gif" HSPACE=4 BORDER=0  align=TOP/aa
 href="../execution/servlet/ABC"Execute/a/td
  
 webapps
|
 execution
||
 servlets  WEB-INF
|   |
 index.html  classes
||
  abc.class  LocalStrings.properties
  
  
 However, after I change the structure into following(add one more
 level of directory, ie "is"), it won't work any more !
 How should I change the statement in index.html like above to 
 accommodate the directory structure change ?
 Or I should do something else to accommodate ?
  
 webapps
|
   is
 execution
||
 servlets  WEB-INF
|   |
 index.html  classes
||
  abc.class  LocalStrings.properties
  
 
 [EMAIL PROTECTED] 
  _ 
| 
 \_/o\_/ 
   \_/ 
 
   Every once in a while, the boundaries get redefined. 
 



RE: Deny web-inf access (security problem)

2000-12-20 Thread Kitching Simon

Hi Paul,

I disagree with Guy's email here. There are several very good
reasons why your servlet classes *should* be within your webapp,
and *not* within your CLASSPATH. Just follow the examples that
come with tomcat, and you shouldn't go far wrong.

The sun servlet specs say quite explicitly that *no* file in WEB-INF 
can ever be downloaded by a browser. So if you can download the
binary "mybean.class" file, save it to disk, then decompile it, that
is a definite security hole, and a violation of the servlet spec.

There can be problems if you use apache as a front-end, because of
course apache doesn't obey the servlet specs - it isn't a servlet engine.
However, in your case you explicitly said that you were running tomcat
standalone, so that can't be it.

One thing you didn't tell us is what version of tomcat you are using.

There has been a recent patch to tomcat3.2 (3.2.1) which fixes a
number of security problems. I am willing to bet that if you upgrade
to tomcat3.2.1 (from whatever you were using) the problem will go
away.

I would also just point out that the WEB-INF directory should 
have the same capitalisation I have shown, even on windows
(which you appear to be using). Yes, windows file explorer will
"adjust" the capitalisation of files, but you should make sure
that at the "DOS" level, the capitalisation is actually correct.

Regards,

Simon

 -Original Message-
 From: [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]]
 Sent: Wednesday, December 20, 2000 12:58 AM
 To:   [EMAIL PROTECTED]
 Subject:  RE: Deny web-inf access (security problem)
 
 Set up a directory outside your tomcat directory to contain java class
 files, and include that directory in your classpath.  Keep it outside of
 your Apache directory as well.
 
 -Original Message-
 From: Paul Gonin [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, December 19, 2000 2:02 PM
 To: [EMAIL PROTECTED]
 Subject: Deny web-inf access (security problem)
 
 
 Hi, 
 
 I have a JSP that uses a bean. It uses the following directory structure :
 webapps/myapply/myapply.jsp
 webapps/myapply/web-inf/classes/mybean.class
 
 It works fine but I am annoyed that people can download the bean directly
 and "access" its content because it contains critical information
 (passwords). 
 
 How do I protect my bean and more generraly I'd like to protect the whole
 web-inf directory (if it's possible)
 
 Note : I'm using Tomcat standalone.
 
 Thanks 



RE: Question about default servlet in Tomcat 3.2.1

2000-12-20 Thread Kitching Simon

Hi David,

Tomcat 3.2.1 no longer reads the file $TOMCAT_HOME/conf/web.xml.
It is a bit misleading that it is still in the distribution, but you can
ignore
anything in this file.

Do you perhaps have something in *your* webapp's web.xml
file that refers to DefaultServlet??

 -Original Message-
 From: David Haraburda [SMTP:[EMAIL PROTECTED]]
 Sent: Tuesday, December 19, 2000 9:18 PM
 To:   [EMAIL PROTECTED]
 Subject:  Question about default servlet in Tomcat 3.2.1
 
 Hi,
 
 I am having a problem with Tomcat 3.2.1 (I am using Java 1.2.2 on Linux)
 and I am wondering if anyone is expierencing the same thing.
 
 When I startup Tomcat 3.2.1, I get an error message saying "cannot load
 servlet name: default".  Tomcat continues to load, but I am having some
 other problems, and I'm not sure what's going on exactly, so now I'm
 looking at this possibly being the problem.  I noticed in the web.xml
 that comes with Tomcat 3.2.1 that that the servlet-class for the default
 servlet is still org.apache.tomcat.servlets.DefaultServlet, which no
 longer exists (in fact, it looks like the whole servlets directory was
 removed with the 3.2 release).  Is there a different class I should be
 using as the default?  I saw in CVS a noted that said
 org.apache.tomcat.request.StaticInterceptor replaced DefaultServlet.  Do
 I need to do anything with this?  I tried removing the whole default
 servlet section from my web.xml, but I still get the error.  I'm not
 sure if this is causing my problem or not, but right now I'm just
 looking to eliminate the error message.
 
 Thanks,
 
 David



RE: Strange redirect problem...

2000-12-20 Thread Kitching Simon

Hi,

Is it possible to try tomcat stand-alone instead of behind
apache? That will eliminate half the possible sources of
the redirect problems..

 -Original Message-
 From: Cato, Christopher [SMTP:[EMAIL PROTECTED]]
 Sent: Tuesday, December 19, 2000 10:32 PM
 To:   '[EMAIL PROTECTED]'
 Subject:  Strange redirect problem...
 
 Hello... I'm running TomCat 3.21 on RedHat Linux 6.2 with Apache 1.3.12 /
 mod_jk
 
 I have run into a strange little problem. I have a web application
 consisting of 40 servlets. In the servlet code a good deal of redirects
 are
 going on between the servlets. All redirects are pointed towards
 "/app01/servlet/servletx".
 The only apps that are configured except the /app01 are /example, /test
 and
 /admin.
 
 The problem is that some of the redirections that are supposed to go to
 '/app01/servlet/servletx/' go to '/servlets/servletx' instead. 
 
 I've checked all the code, and there are no references to /servlets/
 anywhere... So, I'm kind of stuck here...
 I used to have a '/servlets' JkMount directive in httpd.conf, but not
 anymore Nothing in server.xml or web.xml either... What's going on
 here?
 Where does that /servlets/ come from?
 
 Is it possible to turn on debugging of the redirectHandler? If so, where?
 
 
 Mvh / Regards
 
 Christopher Cato [EMAIL PROTECTED]
 Rational Software Nordic AB / ECAT - Ericsson Corporate Account Team 



RE: sealing violation in 4.0m5

2000-12-20 Thread Kitching Simon

Hi Bill.

I believe a "sealing violation" is when a class which was loaded under one
classloader tries to call a class loaded under a different classloader, in 
circumstances where this isn't allowed.

I suggest that the problem is therefore something to do with classpaths,
ie your classpath includes some files it shouldn't. The result
is that tomcat is expecting code to be loaded by a particular classloader,
but because it is in the classpath, it has already been loaded by the
system class loader.

Hope this helps,

Simon

 -Original Message-
 From: Bill Pfeiffer [SMTP:[EMAIL PROTECTED]]
 Sent: Wednesday, December 20, 2000 6:06 AM
 To:   Tomcat
 Subject:  sealing violation in 4.0m5
 
 Trying to port my 3.2 app to 4.0.  One simple page works, but the main
 page
 of my app yeilds the exception below.  Any idea what a "sealing violation'
 is?  Sounds like a security issue.
 
 Ideas?
 
 TIA,
 
 Bill Pfeiffer
 
 A Servlet Exception Has Occurred
 Exception Report:
 javax.servlet.ServletException: Servlet.init() for servlet OasisCommand
 threw exception
  at
 org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:774)
  at
 org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:544
 )
  at
 org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.
 ja
 va:227)
  at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:977)
  at
 org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.
 ja
 va:196)
  at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:977)
  at
 org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2038)
  at
 org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:1
 61
 )
  at org.apache.catalina.valves.ValveBase.invokeNext(ValveBase.java:242)
  at
 org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:414)
  at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:975)
  at
 org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.ja
 va
 :159)
  at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:977)
  at
 org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.jav
 a:
 811)
  at
 org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:89
 0)
  at java.lang.Thread.run(Thread.java:484)
 
 Root Cause:
 java.lang.SecurityException: sealing violation
  at java.net.URLClassLoader.defineClass(URLClassLoader.java:234)
  at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
  at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
  at
 org.apache.catalina.loader.StandardClassLoader.findClass(StandardClassLoad
 er
 .java:648)
  at
 org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoad
 er
 .java:987)
  at
 org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoad
 er
 .java:906)
  at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
  at
 com.pdma.oasis.servlets.OasisCommandServlet.initCommands(OasisCommandServl
 et
 .java:94)
  at
 com.pdma.oasis.servlets.OasisCommandServlet.init(OasisCommandServlet.java:
 27
 )
  at
 org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:755)
  at
 org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:544
 )
  at
 org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.
 ja
 va:227)
  at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:977)
  at
 org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.
 ja
 va:196)
  at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:977)
  at
 org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2038)
  at
 org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:1
 61
 )
  at org.apache.catalina.valves.ValveBase.invokeNext(ValveBase.java:242)
  at
 org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:414)
  at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:975)
  at
 org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.ja
 va
 :159)
  at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:977)
  at
 org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.jav
 a:
 811)
  at
 org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:89
 0)
  at java.lang.Thread.run(Thread.java:484)
 



RE: how to eliminate port number?

2000-12-20 Thread Kitching Simon

And of course, Ted has assumed that you are running on windows.
For unix, there are additional issues, as port 80 can be listened on
only by programs running as "root".

 -Original Message-
 From: Ted Husted [SMTP:[EMAIL PROTECTED]]
 Sent: Wednesday, December 20, 2000 10:55 AM
 To:   Tomcat User List
 Subject:  Re: how to eliminate port number?
 
 On 12/20/2000 at 6:34 PM Katsuyuki Michishita wrote: 
  tomcat need to put port number 8080 in the URL, is there any way that I
 do not have to put 8080?  
  
 If Tomcat is the only Web server on the machine, change the default Tomcat
 port to 80 in its server.xml configuration.
  
 
 From TC3.2
  
   !--  Connectors  --
  
 !-- Normal HTTP --
 Connector className="org.apache.tomcat.service.PoolTcpConnector"
 Parameter name="handler" 
  
 value="org.apache.tomcat.service.http.HttpConnectionHandler"/
 Parameter name="port" 
 value="8080"/
 /Connector
  
 
 
 -- Ted Husted, Husted dot Com, Fairport NY USA.
 -- Custom Software ~ Technical Services.
 -- Tel 716 425-0252; Fax 716 223-2506.
 -- http://www.husted.com/



RE: Need Some help..

2000-12-20 Thread Kitching Simon

Hi,

The changes you describe below weren't quite what I meant. I guess
I should have been more explicit.

I suggest:

step 1:
  define your webapp in the $TOMCAT_HOME/conf/server.xml file with a prefix,
like

Context path="/mywebapp"
 docBase="/home/mywebapproot"
 debug="0"
 reloadable="true"
 trusted="false" 
/Context

  and in your web.xml, add something like:
servlet
servlet-name
invoker
/servlet-name
servlet-class
org.apache.tomcat.servlets.InvokerServlet
/servlet-class
/servlet

servlet-mapping
servlet-name
invoker
/servlet-name
url-pattern
/myservlets/*
/url-pattern
/servlet-mapping

This should allow you to run your servlets (ie any class which implements
Servlet, and 
whose .class file is stored under yourwebapproot/WEB-INF/classes) using urls
like
 http://somehost:8080/mywebapp/myservlets/somepkg.someservletclass

If you don't like having all your servlets "appear" to be under one
directory, don't
like having to type in the package name, want servlets to be invoked by
names
which don't match the actual java class name, or want to pass initialisation
params
to servlets, then you have to add individual servlet and servlet-mapping
tags for 
each servlet instead of setting up an InvokerServlet.

Note that the InvokerServlet is just an ordinary servlet - you could have
written it yourself,
but tomcat nicely provides an implementation. Above, the standard
servlet-mapping
feature is used to redirect all urls starting with "myservlets" to an
"ordinary" servlet called
InvokerServlet. The code inside InvokerServlet just fetches the rest of the
URL, and then
calls the java "getClassFor" method, and (provided it succeeced) calls the
class.

step 2:
Change the "path" attribute in the context entry from "/mywebapp" to "",
which will get rid
of the "mywebapp" prefix, so that you can run your servlets as
 http://somehost:8080/myservlets/somepkg.someservletclass


Remember that the settings in $TOMCAT_HOME/conf/server.xml are applied to
*all* webapps within
a tomcat instance. I think that by doing redirections at this level, you can
cause really nasty side-effects.
I'm not sure what an InvokerInterceptor actually does, but I think it is too
"high-level" for achieving what
you want to achieve.

Try thinking of a webapp as an application, like microsoft word. Changing
settings in a webapp's web.xml
file is like selecting File|Properties within word to modify setting for the
word application. Changing
settings in $TOMCAT_HOME/conf/server.xml is like changing
operating-system-wide settings.

Regards,

Simon

 -Original Message-
 From: Thyagesh [SMTP:[EMAIL PROTECTED]]
 Sent: Tuesday, December 19, 2000 1:07 PM
 To:   [EMAIL PROTECTED]
 Subject:  Re: Need Some help..
 
 Hi,
 Thanks Simon for the valuable advice. I got most of it. I still need
 some clarifications:
 
 I am use:Tomcat 3.2
  WindowsNT4
   IIS 4.0.
 
 Things I did is:
 1) I Repeated the following lines in server.xml in tomcat home/conf
 for different context-paths
 (i.e. for  http://host/context-path/servlet name: /servlet, /login
 etc)
 
 by adding different values of 'prefix' attribute.
 
 RequestInterceptor
 className="org.apache.tomcat.request.InvokerInterceptor"
 debug="0" prefix="/login/" /
 
 2) Defined mappings in web.xml (in webapps/root/.../web.xml) for all
 servlets that are in packages.
 
 This seems to work when I requests to Tomcat directly. I wanted to
 know:
 A) whether the above configurations is logically CORRECT.
 
 -Thanks
 
 -Thyagesh
 
 
 
 
 - Original Message -
 From: Kitching Simon [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Monday, December 18, 2000 4:43 PM
 Subject: RE: Need Some help..
 
 
  Hi,
 
  I suggest thinking of your mappings in two steps:
  (a) get the mappings right *within* a context
  (b) decide what context prefix you want.
 
  If you ve a context with a path (ie url prefix) of
  "mywebapp", then you can set up URLs as you desire
  *within* that webapp.
 
  Configuring the url-servlet mappings (ie what servlet
  is run when a user requests a particular url) is done
  by defining servlet-mapping tags within the
  WEB-INF/web.xml file for your webapp. The urls
  you define like this are all *relative* to the webapp
  url, eg if you set up a mapping from "/foo" to the
  java class "mypackage.myclass", then it must be
  accessed by the user as "http://somehost/webappname/foo".
 
  If you have a whole bunch of servlets, and you don't want
  to enter separate servlet-mapping entries for each one, then
 

RE: JSP vs Servlets...

2000-12-20 Thread Kitching Simon

Hi,

If you want to generate lots of HTML, with a little bit of java logic code,
then use jsp, and embed your java logic "in-line".

If you want to do lots of logic/computation, then generate a small amount
of html output, you may wish to use servlets only, and use "print"
statements to create the html.

If you want to do significant amounts of processing, *and* generate
a significant amount of HTML, then you should use both - servlets
for the logic, which then forward to jsps to generate the html. And
if your webapp (web site) gets to more than a dozen or so pages, 
you should look at something like Struts or Turbine, which *uses* 
both servlets and jsp, but adds features to simplify processing of
forms, navigation between pages, database access, etc.

Cheers,

Simon

 -Original Message-
 From: Rui Oliveira [SMTP:[EMAIL PROTECTED]]
 Sent: Wednesday, December 20, 2000 6:40 PM
 To:   [EMAIL PROTECTED]
 Subject:  JSP vs Servlets...
 
 Hello,
 
 can someone tell me which one is best: JSP or Servlets?
 
 Is there a reason (beside implementatio reasons) to choose one instead
 of the other?
 
 
 Thx in advance
 Rui



RE: JSP Compile Error

2000-12-20 Thread Kitching Simon

Matt,

I gave your page a spin, and it compiled file. 

The system I tested with was:
OS: HP-UX11
jdk: java version "1.2.2.04" HotSpot VM (1.0.1fcs, mixed mode, PA2.0 build
1.2.2.04-00/04/14-PA_RISC2.0)
Tomcat3.2.1 stand-alone

I'll try it on a solaris machine sometime, just need to remember my password
:-)

Simon

 -Original Message-
 From: Matt White [SMTP:[EMAIL PROTECTED]]
 Sent: Wednesday, December 20, 2000 5:37 PM
 To:   [EMAIL PROTECTED]
 Subject:  JSP Compile Error
 
 Hey...
 
 I've run into a really weird error that seems to be a part of Tomcat
 itself.
 
 Attached are two files, JSPTEST.JSP and JUNK.JAVA. The JSP file is just an
 example file, this seems to happen with just about any of them.
 
 Here's what happens. Whenever I attempt to call the JSP file, the Java
 file isn't produced correctly. The last line of the Java file is this:
 
 
 out.write("\r\nHTML\r\nHEAD\r\n\tTITLEJSP Test
 Page/TITLE\r\n/HEAD\r\nBODY\r\n\r\nTABLE BORDER=\"1\"\r\n\r\n
 ");
 
 
 And it repeats over and over again. The Java file attached is a VERY
 truncated version... I let it run for a few minutes and the Java file
 produced was over 400Mb!
 
 This of course doesn't allow the VJM to quit, since it's working on
 creating this beast, and it continues to grow, consuming all of one
 processor if I allow it to.
 
 Details on the server in question:
 
 - OS: Solaris/x86 8
 - JDK: Solaris VM (build Solaris_JDK_1.2.2_05a, native threads, sunwjit)
 - Apache 1.3.14
 - Tomcat 3.2
 - mod_jk
 - The JIT Java compiler is disabled. It will work every now and then if
 it's turned off, and never if it's turned on.
 
 
 Any insight into this problem would be much welcomed, this is really wild
 and I'm not sure where to go next.
 
 - Matt
   File: jsptest.jspFile: junk.java  



RE: Libs and classes are missing in 3.2.1 continue

2000-12-20 Thread Kitching Simon

Hi Andrew,

Sounds like a weird problem!

The only thing I know of that changed between 3.1 and 3.2 which
*might* have this effect is the way that classloaders are used.

Just as a wild guess, double-check your classpath, and make
sure you have the smallest possible classpath set up before
running tomcat (hopefully, an empty classpath will work). Maybe
your classes are getting loaded by the wrong classloader 
are therefore inaccessable (though I would have expected
a different error message than ClassNotFound).

I presume you can see ordinary jsp/html files in your
webapp ok? ie tomcat has actually recognised the
webapp context?

Oh - you might also want to carefully check the
CAPITALISATION of your directory names. The
WEB-INF directory should *not* be called "Web-inf";
check from the dos prompt to be sure this is right.

Good luck,

Simon

 -Original Message-
 From: Andrew [SMTP:[EMAIL PROTECTED]]
 Sent: Wednesday, December 20, 2000 7:04 PM
 To:   [EMAIL PROTECTED]
 Subject:  Re: Libs and classes are missing in 3.2.1 continue
 
 This doesn't work I'm talking about libs/classes in web applications
 but
 not tomcat lib dir.Tomcat must take these libs/classes from predefined
 places in .WAR dir structure
 as Servlet WebApp conformant and 3.1 did it but 3.2- not.
 Thanks anywhere...
 
 P.S. I'm using W2K platform(tomcat.BAT I mean though that's no
 difference;)
 
 
 - Original Message -
 From: "Mauricio Nuñez" [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Wednesday, December 20, 2000 8:06 PM
 Subject: Re: Libs and classes are missing in 3.2.1
 
 
  I modified the tomcat.sh to solve this problem.
 
  search for unset CLASSPATH, and after this, add
  CLASSPATH=${TOMCAT_HOME}/lib
 
 
  this solve your problem !
 
 
  - Original Message -
  From: "Andrew" [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Wednesday, December 20, 2000 1:18 PM
  Subject: Libs and classes are missing in 3.2.1
 
 
   Hello, I've the following problem. I've set up my context in
 c:\a\b
  and
   place my libs in c:\a\b\WEB-INF\lib dir;classes is in
   c:\a\b\WEB-INF\classes.
   So there is the problem not libs not classes not detected in web-app
   runtime( Root exception: ClassNotFoundException).In case of classes I
 mean
   bean classes used
   on JSP etc.- supply classes(not jar'ed) ,defined in different
 packages.
  For
   example c:\a\b\WEB-INF\classes\package1\class1.class.
   class1.class couldn't be found... all the same with packaged lib
 classes.
   Anybody help!!!
   P.S. With tomcat 3.1 all was OK.
  
 
 



RE: Servlet display

2000-12-20 Thread Kitching Simon

Hi Carlos,

I think it unlikely that anyone is "studying the problem".
What you *can* get from this email group is tips from people who
have encountered the same problem in the past, or suggestions from
other people about how you might go about solving this yourself.
Unfortunately, there is no-one on this group being paid to resolve
other people's problems - this is not a commercial tech support line.

In the "suggestion about how you might solve this yourself" category,
I have the following to offer:

I suggest that you run your problem page, then click "view source" and
save the output. This is what the browser sees, so the problem is almost
certainly that the page you have just saved contains some bad HTML. 
Try loading this page directly from disk into your browser, and see if the
same
problem occurs. If it does, try chopping bits out of the page until you get
a
minimal page that still shows the problem. If there is then something that
appears tomcat-related, post your query again, together with the minimal
page that demonstrates the problem.

Regards,

Simon
 -Original Message-
 From: Landaluze Produktions IS - Carlos [SMTP:[EMAIL PROTECTED]]
 Sent: Tuesday, December 19, 2000 8:45 PM
 To:   [EMAIL PROTECTED]
 Subject:  Re: Servlet display
 
 i have the same problem with tomcat + apaache
 it works well if only run the tomcat in the 80 port.
 there is anybody studing the problem
 - Original Message -
 From: "RV Tobin" [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, December 19, 2000 5:56 PM
 Subject: Re: Servlet display
 
 
  I'm going through re-direct hell as we speak.  I am using Tomcat 3.1 and
  when I insert a record to my MySQL database table, it works for the
 first
  submit, but if I try to return to the form to make another post to the
 site,
  I get the following showing up at the bottom of my page:
 
  HTTP/1.1 200 Date: Tue, 19 Dec 2000 17:47:22 GMT Server: Apache/1.3.12
  (Unix) (Red Hat/Linux) tomcat/1.0 PHP/3.0.15 mod_perl/1.21
 Content-Language:
  en Servlet-Engine: Tomcat Web Server/3.1 (JSP 1.1; Servlet 2.2; Java
  1.3.0beta; Linux 2.2.14-5.0 i386; java.vendor=Sun Microsystems Inc.)
  Keep-Alive: timeout=15, max=85 Connection: Keep-Alive Transfer-Encoding:
  chunked Content-Type: text/html;charset=8859_1 800
 
  Sometimes, the page I am trying to redirect to is added to the bottom of
 the
  page with the form and submit button.  Sometimes, a "page has moved"
 message
  appears at after the above server info, and if I click on the link
 provided,
  I get sent to the page that I'm trying to redirect to.  All in all, it
 is
  very frustrating.  I'm using UltraDev, and the code that redirects the
 page
  is generated by UltraDev, and it works just fine on another page that I
 do
  an update and then redirect on, but here I have nothing but trouble.
 
  If I hit the refresh button before going to the posting form, I get
 properly
  redirected, naturally, because it is like posting for the first time.
 But
  that is not what we should demand that users do if they want to post
 more
  than once to the site.
 
  The UD code is this, in case anyone can tell me what on earth might be
 going
  on:
 
  String MM_redirectPage = "../JspFiles/pdcThankyou.jsp";
 
  // redirect with URL parameters
if (MM_redirectPage.length() == 0) MM_redirectPage =
  request.getRequestURI();
if (MM_redirectPage.indexOf('?') == -1  request.getQueryString() !=
  null)
  MM_redirectPage += "?" + request.getQueryString();
response.sendRedirect(response.encodeRedirectURL(MM_redirectPage));
 
  I've posted to the UD site, and all I've received were responses from
 people
  who are suffering from the same fate, and have the same setup, so if I
 fix
  this problem, I'll be able to help a few other people who are sharing my
  misery.
 
  Thanks for any assistance.
 
  Val
 
  - Original Message -
  From: "Hayer, Jagjeet" [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Tuesday, December 19, 2000 11:35 AM
  Subject: Servlet display
 
 
   Hi all,
  
   Has anyone had a problem with servlet display where a re-direction
 results
   in some of the actual JavaScript  being displayed within the browser
   display?
  
   Thanks in advance,
  
   Jag.
  
   The content of this e-mail is confidential, may contain privileged
  material
   and is intended solely for the recipient(s) named above. If you
 receive
  this
   in error, please notify Software AG immediately and delete this
 e-mail.
  
   Software AG (UK) Limited
   Registered in England  Wales 1310740
   Registered Office: Hudson House, Hudson Way,
   Pride Park, Derby DE24 8HS
 
 



RE: Netscape displaying the HTML code

2000-12-20 Thread Kitching Simon

I agree. I think the problem is that webservers normally set the
http content type attribute header by figuring it out from the
file suffix. However, in your case your servlet is serving the
code, not the webserver, so you need to do this in your servlet.

I guess that in the absence of any http content type header,
IE assumes HTML, while netscape assumes text. 

Regards,

Simon

 -Original Message-
 From: Srinivas, Rajesh [SMTP:[EMAIL PROTECTED]]
 Sent: Tuesday, December 19, 2000 10:23 PM
 To:   [EMAIL PROTECTED]
 Subject:  RE: Netscape displaying the HTML code
 
 hi,
  I suppose you have to set the content type as text/html using the
 setContentType() method of response object.
 Hope this helps.
 Rajesh
 
 -Original Message-
 From: Guntupalli Shanti [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, December 19, 2000 1:16 PM
 To: [EMAIL PROTECTED]
 Subject: Netscape displaying the HTML code
 
 
 Hi,
 
 I have tomcat 3.2 running on Apache 1.3.14.
 All the HTML content in my web site is returned by the servlets based on 
 the templates passed
 in the query. Something like
 
 http://www.myserver.com:8070/examples/servlet/servletname?page=main
 
 where main is a html template file.
 When I am accessing the page from IE I get exactly what I want
 but when I access this in netscape it displays all the HTML code.
 Does any one know how to fix it?
 
 Thanks in advance
 Shanti



RE: Tomcat Configuration

2000-12-20 Thread Kitching Simon

Hi,

It seems to be working fine. Tomcat doesn't have any kind of
GUI interface as part of the server.

There is a minimal interface for administering tomcat, but it is
web-based, ie tomcat itself runs without an interface, and you
connect with a web-browser to tomcat in order to change its
configuration. This interface comes with tomcat, see the
docs for more information - and don't expect it to be very
fancy, it's just an experimental version at the moment.

To check if it's working, open your browser and type:
http://localhost:8080

If you get an html page back, then tomcat is running ok.

 -Original Message-
 From: Hong Tian [SMTP:[EMAIL PROTECTED]]
 Sent: Wednesday, December 20, 2000 4:27 AM
 To:   [EMAIL PROTECTED]
 Subject:  Tomcat Configuration
 
 Hi, Everyone,
 
 I'm new for Tomcat, I'm having problem startup Tomcat 3.2 on Windows 98.
 The
 problem is: after I types "startup" under the Tomcat home directory in 
 MS-DOS, it
 start tomcat in a new window, but idle there, not going forword, only some
 
 prompt
 says:
 "2000-12-19   pooltcpConnector- starting httpConnectionHandler on port
 8080,
 2000-12-19 PoolTcpConnector: Starting Ajp12ConnectionHandler on port 8007"
 
 Could you tell me what's going on? where should I change to make it
 startup
 successful?
 
 Thanks
 hong
 [EMAIL PROTECTED]
 
 
 
 _
 Get your FREE download of MSN Explorer at http://explorer.msn.com



RE: Basic web-app question

2000-12-20 Thread Kitching Simon

Hi Dave,

IN a webapp, you can structure the directories containing
.jsp and .html files however you wish. However, your java 
.class files need to be in a single "unified" directory tree, 
under WEB-INF/classes.

This doesn't mean your source code has to be structured
in the same way. As long as you have some option in the
tool you use to compile (be it an IDE, or ant, or make, or..)
to put the compiled classes somewhere other than in the
same directory as the source, you can do what you want.

As an alternative: bundle groups of related files into jars, 
and put the jars in WEB-INF/lib. You can have multiple jars
here...but this is not very convenient during development
phase.

Cheers,

Simon

 -Original Message-
 From: Dave Newton [SMTP:[EMAIL PROTECTED]]
 Sent: Wednesday, December 20, 2000 6:04 PM
 To:   [EMAIL PROTECTED]
 Subject:  Basic web-app question
 
 This may be an utterly stupid question, but since I don't have
 to impress anybody (much ;) I'll ask it anyway.
 
 Normally when I've developed a web application in another 
 environment I can use sub-directories to help keep things 
 clean. It appears that JSP/Servlet applications are delivered
 in a WAR with a specific directory hierarchy (classes, etc.)
 
 Can the WAR file (or a webapp in general if I deploy non-WAR)
 contain a directory hierarchy, i.e., I have a site with a 
 home page (main directory) and a few things off of it, then,
 say, a message base (or whatever) "section" in a subdirectory,
 etc.? Does that work?
 
 Thanks!
 
 --
 Dave Newton, [EMAIL PROTECTED]



RE: Can't stop tomcat

2000-12-18 Thread Kitching Simon

Try running the "stop" command several times.
If you eventually get a bunch of socket exceptions on the screen,
you know that it worked (the errors appear if you run stop, and there
is no tomcat instance to stop).

I think there are some problems with some JVMs, which are not
stopping all threads properly. I get this behaviour on HP-UX, and
used to get it on Solaris until I upgraded to the latest JVM.

 -Original Message-
 From: Blair Tingey [SMTP:[EMAIL PROTECTED]]
 Sent: Friday, December 15, 2000 7:31 PM
 To:   [EMAIL PROTECTED]
 Subject:  Can't stop tomcat
 
 Hello,
  
 I have installed Tomcat 3.2 on Solaris and I have not modified any of the
 XML files so this is a pretty generic install. After starting tomcat using
 ./tomcat.sh start
  
 I issue the command: ./tomcat.sh stop  to stop Tomcat and the process
 does not stop.
  
 It looks as if classes are unloaded and I get a  Tomcat Stopped message,
 but if I look at the processes I still have the Tomcat process running.
  
 What can I do to stop Tomcat by using ./tomcat.sh stop ?
  
 Thanks,
 Blair Tingey



RE: Includes

2000-12-18 Thread Kitching Simon

Hi Bruce,

I'm not entirely sure what your problem is.

I'm almost certain you cannot include files "across contexts"
using jsp:include (ie run-time include). That would involve
invoking a servlet in one context from a servlet in another
context.

I'm almost certain that %@ include url (ie compile-time include) 
would not work across contexts either. The JSP specification
(I used jsp1.2b1) states that the url *must* be a relative URL. It
also states that the included page is "subject to access control",
ie only files accessable from the webapp are includable; this seems
to rule out including any file that is not under the webapp-specific
document root, ie nothing stored in another webapp(context) can
be included.

Why can't you have all your files in a single context?? And
what is the relevance of the context path? Including of files
should work regardless of what prefix the webapp(context) has 
been given.

Regards,

Simon

 -Original Message-
 From: Bruce Cota [SMTP:[EMAIL PROTECTED]]
 Sent: Monday, December 18, 2000 9:23 AM
 To:   [EMAIL PROTECTED]
 Subject:  Includes
 
 Hi, I'm a newcomer to Tomcat and recently upgraded from
 3.1 to 3.2.   I have been working on a site in which one
 directory holds files included in several sibling directories.
 
 With 3.1, I was able to use a Context with path="/", but
 with 3.2 this  does not seem to work -- I get 404's from
 tomcat in 3.2.
 
 I tried breaking up my directories into different contexts, but
 I can't seem to get includes to work across contexts -- I get
 "Bad file argument to include" when I try to include a jsp
 from the "include context"  in a file in one of the other
 contexts.  For that matter, I seem to have the same problem
 when I use anything but a relative url in an include.
 
 Am I doing something wrong?  Is there a way to  use
 a path="/" in a 3.2 context, or can I include files across
 contexts?
 
 Thanks for any advice,
 -Bruce



RE: Need Some help..

2000-12-18 Thread Kitching Simon

Hi,

I suggest thinking of your mappings in two steps:
(a) get the mappings right *within* a context
(b) decide what context prefix you want.

If you ve a context with a path (ie url prefix) of
"mywebapp", then you can set up URLs as you desire
*within* that webapp. 

Configuring the url-servlet mappings (ie what servlet
is run when a user requests a particular url) is done
by defining servlet-mapping tags within the 
WEB-INF/web.xml file for your webapp. The urls
you define like this are all *relative* to the webapp
url, eg if you set up a mapping from "/foo" to the
java class "mypackage.myclass", then it must be
accessed by the user as "http://somehost/webappname/foo".

If you have a whole bunch of servlets, and you don't want
to enter separate servlet-mapping entries for each one, then
you may want to take advantage of the "invoker servlet" which
effectively sets up bulk url mappings for you, but doesn't give
you such fine control as creating invididual mappings.

Deciding whether you want the webapp to have a
prefix of "/" (ie be the root webapp) is a separate
thing. This is configured with the context tag
in the $TOMCAT_HOME/conf/server.xml file.

WAR files have nothing to do with paths at all; they
are just a convenient method of installing the bunch of
files making up a webapp.


PS: In future, please specify your tomcat VERSION, as
answers to questions often depend on which tomcat you
are using.

Regards,

Simon

 -Original Message-
 From: Thyagesh [SMTP:[EMAIL PROTECTED]]
 Sent: Monday, December 18, 2000 7:52 AM
 To:   [EMAIL PROTECTED]
 Subject:  Need Some help..
 
  Hi,
 I know its stupid. But I really struck with Tomcat's Docs  can't
 figure how to configure it. I had used JServ extensively. I had to migrate
 to Tomcat since I need a Servlet Container to Connect to IIS in Windows.
My Requirements are that I had to Run Servlets which are in
 packages.
 Hence I need mappings to these servlets. Also I need different context
 Paths
 to same set of code(ex: /servlet, /foo) like zones in JServ.
 Thing I want to know whether I had to create a WAR file to make it
 work
 . OR Just add code to /webapps/root/.../classes(then where would be
 mappings??).
 I had seen docs but couldn't figure out
 
 Any Help will be really useful. Please..
 
 -Thyagesh
 
 



RE: Pbm. in setting the parameter for an applet in servlet...

2000-12-18 Thread Kitching Simon

I can see a typo in there - you don't have a "" before PARAM

To check the output of your servlet, are you running it, using
"view source", saving the results then trying to run *that*?
This procedure will ensure you are testing exactly what
your servlet is generating...

 -Original Message-
 From: Subha Gowri K V [SMTP:[EMAIL PROTECTED]]
 Sent: Monday, December 18, 2000 12:22 PM
 To:   [EMAIL PROTECTED]
 Subject:  Pbm. in setting the parameter for an applet in servlet...
 
 
 Hi,
 
 We have a problem in passing parameter to an applet which is called by a
 servlet.
 
 1. In servlet we are setting the param like :
 
 out.println("APPLET CODE=ResultApplet.class
 CODEBASE=\"http://hostname/dir\"" + " WIDTH=50 HEIGHT=100");
 out.println("ALIGN=TOP");
 out.println("PARAM NAME=\"Results\" VALUE=\""+"Hello"+"\"");
 out.println("/APPLET");
 
 2. We are fetching the parameter in applet like
   String s = getParameter("Results");
 
 But in applet we are getting null value only.
 
 3. If I call the same applet from a simple html page, it is passing
 parameters correctly.
 
 Note : We are using Tomcat as the servlet engine  apache as the
 web-server.
 
 Any idea?
 
 Thanks in advance.
 
 Regards,
 Subha



RE: Includes

2000-12-18 Thread Kitching Simon

Hmm..seems like it should work fine. I do this sort of stuff
right now, and there are no problems.

One note: I set path to an *empty string*, not to "/"..don't
know if this makes a difference or not.

server.xml:
Context path=""
docBase="/home/ola3dev/webserver/docroot"
 debug="0"
 reloadable="false" 
/Context

directory "/home/ola3dev/webserver/docroot" is layed out like:

WEB-INF
directory1
  file1.jsp
  file2.jsp
directory2
  file3.jsp
  file4.jsp

and files in one directory can include files in another
directory without problem.

One question: what happens if you put plain html
files directly into the docBase directory. Can you
access them from tomcat??

 -Original Message-
 From: Bruce Cota [SMTP:[EMAIL PROTECTED]]
 Sent: Monday, December 18, 2000 2:46 PM
 To:   [EMAIL PROTECTED]
 Subject:  Re: Includes
 
 Thanks for the reply
 
 The problem I have is that I cannot get a context with the
 path "/" to work -- I just get 404's.  The site I'm trying
 to work on (which already exists) uses url's like
 "www.company.com/app1/index.jsp" and
 "www.company.com/app2/index.jsp", where both
 index1.jsp and index.2.jsp include urls like
 "/include/setup.jsp".   I can't seem to make this
 work in tomcat 3.2.  In tomcat 3.1 I did it by
 setting up a Context with path="/" and
 a docBase set to the parent directory which
 includes "app1", "app2", and "include".
 But in 3.2 when I do this I get 404's.
 
 Kitching Simon wrote:
 
  Hi Bruce,
 
  I'm not entirely sure what your problem is.
 
  I'm almost certain you cannot include files "across contexts"
  using jsp:include (ie run-time include). That would involve
  invoking a servlet in one context from a servlet in another
  context.
 
  I'm almost certain that %@ include url (ie compile-time include)
  would not work across contexts either. The JSP specification
  (I used jsp1.2b1) states that the url *must* be a relative URL. It
  also states that the included page is "subject to access control",
  ie only files accessable from the webapp are includable; this seems
  to rule out including any file that is not under the webapp-specific
  document root, ie nothing stored in another webapp(context) can
  be included.
 
  Why can't you have all your files in a single context?? And
  what is the relevance of the context path? Including of files
  should work regardless of what prefix the webapp(context) has
  been given.
 
  Regards,
 
  Simon
 
   -Original Message-
   From: Bruce Cota [SMTP:[EMAIL PROTECTED]]
   Sent: Monday, December 18, 2000 9:23 AM
   To:   [EMAIL PROTECTED]
   Subject:  Includes
  
   Hi, I'm a newcomer to Tomcat and recently upgraded from
   3.1 to 3.2.   I have been working on a site in which one
   directory holds files included in several sibling directories.
  
   With 3.1, I was able to use a Context with path="/", but
   with 3.2 this  does not seem to work -- I get 404's from
   tomcat in 3.2.
  
   I tried breaking up my directories into different contexts, but
   I can't seem to get includes to work across contexts -- I get
   "Bad file argument to include" when I try to include a jsp
   from the "include context"  in a file in one of the other
   contexts.  For that matter, I seem to have the same problem
   when I use anything but a relative url in an include.
  
   Am I doing something wrong?  Is there a way to  use
   a path="/" in a 3.2 context, or can I include files across
   contexts?
  
   Thanks for any advice,
   -Bruce



RE: At Value must be quoted. Error

2000-12-18 Thread Kitching Simon



 -Original Message-
 From: Donald Mullaney [SMTP:[EMAIL PROTECTED]]
 Sent: Monday, December 18, 2000 7:48 PM
 To:   [EMAIL PROTECTED]
 Subject:  Re: At Value must be quoted.  Error
 
 Thxs Simon,
 
 I had a typo that I was looking right at and I could not see.  Nothing
 like
 staring to hard..
 
 Is there a document anywhere that describes error messages?  The error
 message was not clear to me, but then again I am new to this.
[Kitching Simon]  
For this type of error, probably not. As I said, tomcat uses an XML
parser (probably
Xerces, as it's from apache..). So the place to look for any
documentation
on xml-parser-related errors is in the Xerces(?) documentation. 

In general, the documentation on tomcat isn't very in-depth. That's
the price
you pay for using open-source; who wants to write docs when they
could
be coding :-) Having said that, people are working on it, so I guess
that the 
situation will improve over time. For now, though, you need to
scratch the
old noggin a bit, search the email archives, and in extreme cases,
read the 
code...and for those really tough cases, there's always this group.

Cheers,

Simon


 Thanks again,
 Donald
 
 - Original Message -
 From: "Kitching Simon" [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Monday, December 18, 2000 11:03 AM
 Subject: RE: At Value must be quoted. Error
 
 
  Hi Don,
 
  It looks to me like the XML parser that tomcat uses to read the file is
  objecting to something in the file. Minor typos are sometimes damn
  hard to spot :-)
 
  I suggest:
  (a)
  try commenting out blocks of the server.xml file, and restarting.
  of course, tomcat won't *run* properly with only half a config file, but
  you should be able to see when the config file at least parses.
  By the old divide-and-conquer method, you should be able to narrow
  things down to the point you can spot the problem,
  (b)
  If you have made only minor changes to the default file, you can try
  using "diff" to compare the version in the distribution with the one
 that
  doesn't work.
  (c)
  if all else fails, try posting the server.xml file to this group...
 
  Cheers,
 
  Simon
 
   -Original Message-
   From: Donald Mullaney [SMTP:[EMAIL PROTECTED]]
   Sent: Monday, December 18, 2000 6:51 PM
   To: [EMAIL PROTECTED]
   Subject: At Value must be quoted.  Error
  
  
   Help.  I am running Apache 1.3 and Tomcat on Caldera's eServer.  I was
   trying make modifications to the default server.xml file.  After the
   modifications restarted tomcat and got the errors below.  I also
 returned
   the server.xml to the orginal state and I still get the same error.
 Any
   ideas?  What is the error in reference to?  I have search the
   documentation and can't find anything that relates.
  
   [root@host bin]# ./startup.sh
   Using classpath:
  
 .:/usr/local/jakarta-tomcat/lib/ant.jar:/usr/local/jakarta-tomcat/lib/jasp
  
 er.jar:/usr/local/jakarta-tomcat/lib/servlet.jar:/usr/local/jakarta-tomcat
  
 /lib/test:/usr/local/jakarta-tomcat/lib/webserver.jar:/usr/local/jakarta-t
  
 omcat/lib/xml.jar:/usr/java/lib/tools.jar:.:/usr/local/jakarta-tomcat/src:
  
 /usr/local/lib/postgresql.jar:/usr/local/jakarta-tomcat/src:/usr/local/jak
   arta-tomcat/src
   [root@host bin]# ERROR reading
 /usr/local/jakarta-tomcat/conf/server.xml
   At Value must be quoted.
  
   FATAL: configuration error
   java.lang.NullPointerException:
   at
   org.apache.tomcat.util.xml.XmlMapper.readXml(XmlMapper.java:221)
   at org.apache.tomcat.startup.Tomcat.execute(Tomcat.java:143)
   at org.apache.tomcat.startup.Tomcat.main(Tomcat.java:163)
  
   Thanks,
  
   Donald Mullaney
  
   Melting Sand, LLC
   7660 E. Broadway Blvd Suite 308
   Tucson, AZ 85710
  
   E-Mail: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
   Phone: 520.918.SAND (7263)
 



RE: Finding Tomcat version

2000-12-14 Thread Kitching Simon

If tomcat is running, the easiest way to find the version
is to get a directory listing (ie ask for any directory name
where there isn't an index file), and look at the bottom
for the server version.

 -Original Message-
 From: Craig R. McClanahan [SMTP:[EMAIL PROTECTED]]
 Sent: Thursday, December 14, 2000 8:57 PM
 To:   [EMAIL PROTECTED]
 Subject:  Re: Finding Tomcat version
 
 Nagaraja Prakasam wrote:
 
  Hello All,
  Our application uses Tomcat. When I install our application on the
 customer
  system, I need to find out the Tomcat version. Do you guys know any
 standard
  method to find out the Tomcat version by knowing TOMCAT_HOME.
 
 
 If you know TOMCAT_HOME, check the contents of page
 "webapps/ROOT/index.html" --
 the title element self-describes what version you are running.
 
 Also, you can ask programmatically by calling
 ServletContext.getServerInfo().
 
 
  Thanks,
  -Naga
 
 Craig McClanahan
 




RE: Forward problems servlet to JSP in 3.2

2000-12-11 Thread Kitching Simon

Hi,

I just have a little bit extra to add to Andrea's email:

The problem is that when a browser has loaded a page containing
relative urls to other files, the *browser* resolves these into absolute
references by merging them with the URL that it *thinks* the
parent page was loaded from.

Because a "forward" operation within the tomcat webserver (or
any other webserver for that matter) is totally invisible to the
browser, it thinks that the parent page came from 
/contextname/servlet/something, and therefore uses that
url to figure out what absolute page "images/mygif.gif"
should be loaded from.

The solutions (as far as I know) are

(a) 
andrea's solution of mapping the servlet url, so that
the servlet doing the forwarding appears to be in the
same directory as the file it eventually forwards to.
(but this won't work if you might be forwarding to
files in different directories)

(b) 
to use absolute paths for all links

Neither of these solutions really appeals to me.

Anyone else out there (Craig??) got a better solution?

PS: I expect that this is a really common problem
for Struts users, because forwarding is very common.
Any comments, Struts users??


 -Original Message-
 From: AC [SMTP:[EMAIL PROTECTED]]
 Sent: Monday, December 11, 2000 3:10 PM
 To:   [EMAIL PROTECTED]
 Subject:  Re: Forward problems servlet to JSP in 3.2
 
 You should use servlet mapping. If you have http://myhost/myjsp.jsp the 
 servlet that call your jsp should be mapped as http://myhost/myservlet .
 In 
 this way all the relative links are still good.
 An additional hint.. if you map your servlet with an extension, for 
 instance myservlet.Svlt and use a configuration such as
 JkMount /tf/*.jsp ajp13
 JkMount /tf/*.Svlt ajp13
 
 all the request not related to tomcat are served by Apache
 
 andrea
 
 
 At 13.48 11/12/2000 +, you wrote:
   I'm using using forward to pass a request from my servlet to a JSP
   page i.e.ServletContext.getRequestDispatcher
 ("my.jsp").forward(req,
   res).
 
   This is fine (the JSP gets displayed no problem) but any relative
   links in the JSP get messed up with a "/servlet" in the middle -
 e.g.
   a graphic referenced as "images/mygif.gif" becomes a link to
   "contextname/servlet/images/mygif.gif" rather than
   "contextname/images.mygif.gif", links to HTML files similarly get
   "/servlet" inserted.
 
   Help ! There must be a simple solution I'm missing here.
 
   Steve Quail.



RE: limit threads per servlet in Tomcat

2000-12-08 Thread Kitching Simon

Hi Jay,

Why would you want to do this?

As far as I can see, having one object with 21 threads 
is *more* efficient than 21 threads distributed across
two objects.

If you have some kind of lock contention, then using two
objects is not going to improve this; by definition, a lock is
only required when threads need to share data. So if you have
a lock (with inter-thread contention), then you *cannot* create
two objects, as the data-sharing will then not work.

If you don't have lock contention, then why create new
instances? This just seems to me to use up memory

Is there something I'm missing ??

Cheers,

Simon

 -Original Message-
 From: J Y [SMTP:[EMAIL PROTECTED]]
 Sent: Friday, December 08, 2000 4:35 PM
 To:   [EMAIL PROTECTED]
 Subject:  limit threads per servlet in Tomcat
 
 Hi
 
 I wish to setup Tomcat to limit threads per servlet, say 20 threads to 
 execute in one servlet concurrently. the 21th request would cause the
 Tomecat engine to generate a new servlet instance.
 
 Is there a way to do it. any comment appriciated.
 
 Also, what's the performance concerns. is that possible to create a pool
 of 
 servelts?
 
 Thanks
 
 Jay
 __
 ___
 Get more from the Web.  FREE MSN Explorer download :
 http://explorer.msn.com



RE: limit threads per servlet in Tomcat

2000-12-08 Thread Kitching Simon

Hi,

I think this answer is to a slightly different 
question than the one that was asked...

The config example below limits the number of
threads handling client requests to 3. However,
any further clients that connect *wait* for an
earlier request to finish (freeing the thread).

The original question asked if a *new object*
could be spawned if the number of concurrent
requests exceeded a certain limit.

Now that I think of it, perhaps Jay's question
is a result of a minor misunderstanding about
tomcat's threads. Just in case, here's a brief
summary of thread-pools in tomcat.

A common misunderstanding is to think that
each servlet implements "runnable", and it is
the servlet's thread(s) that waits for a URL 
specifying itself. This won't work because
(a) a web application can have hundreds of
servlets in it. Allowing (for example) 20 threads
*per servlet* just won't work.
(b) a request can pass through multiple servlets
(via forward or include commands).

Instead, Tomcat creates threads to handle 
incoming requests. When a client connects, the 
thread gets assigned to that client, and runs 
*whatever* servlets need to be run to satisfy the 
request.

In summary, the solution is to use the example
as given below. This way, tomcat is configured 
to handle a certain number of requests in parallel,
no matter what servlets are to be executed. The 
upper bound on the number of threads ensures
that there is an upper bound on the resources
required by tomcat (at least thread-related resources).

There is only ever one instance of each servlet,
and this is all there needs to be, no matter how
many threads are configured in the thread pool.

Cheers,

Simon

 -Original Message-
 From: [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]]
 Sent: Friday, December 08, 2000 5:18 PM
 To:   [EMAIL PROTECTED]
 Subject:  Re: limit threads per servlet in Tomcat
 
 
 
 Oh yes there is a way to set it. In the server.xml file. Like this
 
 Connector className="org.apache.tomcat.service.PoolTcpConnector"
 Parameter name="handler"
 value="org.apache.tomcat.service.connector.Ajp12ConnectionHandler"/
 Parameter name="port" value="8007"/
 Parameter
 name="max_threads"
 value="3"/
 Parameter
 name="max_spare_threads"
 value="2"/
 Parameter
 name="min_spare_threads"
 value="1" /
 /Connector
 
 Just find the Connector entry corresponding to the one above and go for
 it. The
 nodes that youll need are the 'thread' named nodes.
 
 Yes, it'll hit your performance (esp OutOfmemory) if you don't allocate
 enough
 for the possible threads so take care.
 
 Clifford
 
 
 
 
 
 
 
 "J Y" [EMAIL PROTECTED] on 12/08/2000 03:35:09 PM
 
 
 Please respond to [EMAIL PROTECTED]
  
 
  
 
  
 
 
 
   
   
   
  To:  [EMAIL PROTECTED]  
   
  cc:  (bcc: Clifford Okoro/Harrow/Ladbrokes)  
   
   
   
  Subject: limit threads per servlet in Tomcat 
   
 
 
 
 
 
 
 
 Hi
 
 I wish to setup Tomcat to limit threads per servlet, say 20 threads to
 execute in one servlet concurrently. the 21th request would cause the
 Tomecat engine to generate a new servlet instance.
 
 Is there a way to do it. any comment appriciated.
 
 Also, what's the performance concerns. is that possible to create a pool
 of
 servelts?
 
 Thanks
 
 Jay
 __
 ___
 
 Get more from the Web.  FREE MSN Explorer download :
 http://explorer.msn.com
 
 
 
 
 __
 
 
This communication and any files transmitted with it are confidential
 and
intended solely for the use of the individual or entity to whom they
 are
addressed. If you have received it in error please notify the sender or
[EMAIL PROTECTED] or telephone +44 (0)20 8868 8899. The
 unauthorised
use, disclosure, copying or alteration of this message is forbidden.
Ladbrokes Limited will not be liable for direct, special, indirect or
consequential damage as a result of any virus being passed on, or
 arising
from alteration of the contents of this message by a third party.
 Please note
that in replying to this mail, you are granting the right for that
 reply to
be forwarded to any other individual and to be read by a surrogate in
 the
event that the 

RE: Is 3.1 a production ready release?

2000-11-14 Thread Kitching Simon

Hi,

No, 3.1 is not production quality - I know, I tried :-(

However, 3.2 is due out in a matter of a week or two.
I am using 3.2beta6 for a small-medium volume 
business-to-business web site, and it is ok. Not
the fastest webserver in the world, but adequate, 
open-source, free, standards-compliant, and 
improving at a great rate.

The verdict on 3.2's stability will be coming 
in over the next few months, I guess, as
people do try to use it in large sites...

 -Original Message-
 From: Ranko Bijelonic [SMTP:[EMAIL PROTECTED]]
 Sent: Monday, November 13, 2000 11:51 PM
 To:   [EMAIL PROTECTED]
 Subject:  Is 3.1 a production ready release?
 
 Hi,
 
 would you use 3.1 in your production environment or is this just for
 testing
 and development?



RE: Please Look - 3.2 beta 7 problem - RequestDispatcher include()

2000-11-14 Thread Kitching Simon



 -Original Message-
 From: Wyn Easton [SMTP:[EMAIL PROTECTED]]
 Sent: Tuesday, November 14, 2000 12:24 PM
 To:   [EMAIL PROTECTED]
 Subject:  Please Look -  3.2 beta 7 problem -  RequestDispatcher
 include()
 
 Are you not suppose to mix URL access with a RequestDispatcher?
 Thanks.
 
 Also, in 3.2 beta 6 I could do an include() then a forward().
 Now in 3.2 beta 7 I get an illegalState error on the forward()
 because of an open outputstream.  I'm not opening an output stream.
 The include() must be doing it. 
 
[Kitching Simon] 
I don't think that it is valid to do include then forward, ie
if it was possible before, then *that* was the bug, not
the current behaviour.

To quote from the servlet docs:

forward should be called before the response has been committed
to the client (before response body output has been flushed).
If the response already has been committed, this method throws
an IllegalStateException.

Now I can't find the reference for the moment, but I'm sure that in
the 
specs somewhere it says that the buffer is *always* flushed before
an include operation.

Therefore it is not possible, *by definition* to do an include then
a forward.
  
 --- Wyn Easton [EMAIL PROTECTED] wrote:
  I'm having this problem on 3.2 beta 7
  
  The exact text of the  exception is:
  
  java.lang.IllegalArgumentException: Short Read
  
  This Exception is being generated in HttpUtils.java in the
  parsePostData() method.
  
  Here is what is happening:
  
  I'm opening a HttpURLConnection to servlet_A that has been set to use
  the POST method by calling setRequestMethod("POST") for the
  HttpURLConnection. In servlet_A I get a ServletInputStream and
  read from the HttpURLConnection.
  I then get an ServletOutputStream from the response.
  I then get a RequestDispatcher for servlet_B.
  When I call the include() method I get the exception mentioned
  because parsePostData() in HttpUtils tries to read "len" number
  of bytes from the ServletInputStream "in" and there is nothing
  to read. I changed parsePostData() in HttpUtils to return an
  empty Hashtable for this case and it worked fine. 
  (Maybe this is how this should work since nothing read means no
  parameters in the POST data. Even if the len is greater than 0.)
  
  However, if I try to use the ServletOutputStream after returning
  to servlet_A from servlet_B nothing is written to the original
  HttpURLConnection.  I don't know if the ServletOutputStream is
  being closed when I return from the include(). I don't get an
  Exception when writing to the ServletOutputStream. I just don't
  get any data at the listening end of the HttpURLConnection.
  
  I'm going to modify my code to use the include() instead of
  the HttpURLConnection, but shouldn't it work either way?
  
  Thanks.
  
  
  =
  Wyn Easton
  [EMAIL PROTECTED]
  
  __
  Do You Yahoo!?
  Yahoo! Calendar - Get organized for the holidays!
  http://calendar.yahoo.com/
 
 
 =
 Wyn Easton
 [EMAIL PROTECTED]
 
 __
 Do You Yahoo!?
 Yahoo! Calendar - Get organized for the holidays!
 http://calendar.yahoo.com/



RE: Please Look - 3.2 beta 7 problem - RequestDispatcher inclu de()

2000-11-14 Thread Kitching Simon



 -Original Message-
 From: Wyn Easton [SMTP:[EMAIL PROTECTED]]
 Sent: Tuesday, November 14, 2000 2:47 PM
 To:   [EMAIL PROTECTED]
 Subject:  RE: Please Look -  3.2 beta 7 problem -  RequestDispatcher
 inclu de()
 
 Fair enough.
 I did notice the addition of:
 
   // NOTE:  This *must* be done before the include flag is set for
   // this request!
   response.flushBuffer();
 
 in RequestDispatcherImpl.java.  That is probably the change that made
 my include - forward stop working.
  
 I guess it is OK by the spec. to do multiple include() method calls?
[Kitching Simon]  
Yes, no problem with this as far as I know. 

Cheers,

Simon

 Thanks.
 
 --- Kitching Simon [EMAIL PROTECTED] wrote:
  
  
   -Original Message-
   From: Wyn Easton [SMTP:[EMAIL PROTECTED]]
   Sent: Tuesday, November 14, 2000 12:24 PM
   To:   [EMAIL PROTECTED]
   Subject:  Please Look -  3.2 beta 7 problem -  RequestDispatcher
   include()
   
   Are you not suppose to mix URL access with a RequestDispatcher?
   Thanks.
   
   Also, in 3.2 beta 6 I could do an include() then a forward().
   Now in 3.2 beta 7 I get an illegalState error on the forward()
   because of an open outputstream.  I'm not opening an output stream.
   The include() must be doing it. 
   
  [Kitching Simon] 
  I don't think that it is valid to do include then forward, ie
  if it was possible before, then *that* was the bug, not
  the current behaviour.
  
  To quote from the servlet docs:
  
  forward should be called before the response has been committed
  to the client (before response body output has been flushed).
  If the response already has been committed, this method throws
  an IllegalStateException.
  
  Now I can't find the reference for the moment, but I'm sure that in
  the 
  specs somewhere it says that the buffer is *always* flushed before
  an include operation.
  
  Therefore it is not possible, *by definition* to do an include then
  a forward.

   --- Wyn Easton [EMAIL PROTECTED] wrote:
I'm having this problem on 3.2 beta 7

The exact text of the  exception is:

java.lang.IllegalArgumentException: Short Read

This Exception is being generated in HttpUtils.java in the
parsePostData() method.

Here is what is happening:

I'm opening a HttpURLConnection to servlet_A that has been set to
  use
the POST method by calling setRequestMethod("POST") for the
HttpURLConnection. In servlet_A I get a ServletInputStream and
read from the HttpURLConnection.
I then get an ServletOutputStream from the response.
I then get a RequestDispatcher for servlet_B.
When I call the include() method I get the exception mentioned
because parsePostData() in HttpUtils tries to read "len" number
of bytes from the ServletInputStream "in" and there is nothing
to read. I changed parsePostData() in HttpUtils to return an
empty Hashtable for this case and it worked fine. 
(Maybe this is how this should work since nothing read means no
parameters in the POST data. Even if the len is greater than 0.)

However, if I try to use the ServletOutputStream after returning
to servlet_A from servlet_B nothing is written to the original
HttpURLConnection.  I don't know if the ServletOutputStream is
being closed when I return from the include(). I don't get an
Exception when writing to the ServletOutputStream. I just don't
get any data at the listening end of the HttpURLConnection.

I'm going to modify my code to use the include() instead of
the HttpURLConnection, but shouldn't it work either way?

Thanks.


=
Wyn Easton
[EMAIL PROTECTED]
 
 
 =
 Wyn Easton
 [EMAIL PROTECTED]
 
 __
 Do You Yahoo!?
 Yahoo! Calendar - Get organized for the holidays!
 http://calendar.yahoo.com/



RE: auto-loading

2000-11-13 Thread Kitching Simon



 -Original Message-
 From: ' [SMTP:[EMAIL PROTECTED]]
 Sent: Monday, November 13, 2000 7:37 PM
 To:   [EMAIL PROTECTED]
 Subject:  auto-loading
 
 Hi,
 How do I stop tomcat from automatically loading applications in /webapps?
 do I uncomment the ...context.AutoSetup  ContextInterceptor in server.xml?
[Kitching Simon]  
I presume you mean *comment out* the AutoSetup.
This is exactly what needs to be done.

 Will this effect anything else?
 
 thanks!
[Kitching Simon]  
Cheers,

Simon



RE: jsp:forward

2000-11-10 Thread Kitching Simon

Hi,

I really can't see what you are trying to achieve here.
What you have here appears to me to be infinite 
recursion.

Maybe you need to look at the definition of what
jsp:forward does (see the sun jsp/servlet specs).

Maybe you really meant to use jsp:include??
or you just are trying to set the URL that a
form gets submitted to (output the appropriate
url in the form action=someurl tag)??

If you still can't figure this out, then I suggest 
you send an email describing what you are
trying to do with this code...

Regards,

Simon
 -Original Message-
 From: Wyn Easton [SMTP:[EMAIL PROTECTED]]
 Sent: Friday, November 10, 2000 12:37 PM
 To:   [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Subject:  Re: jsp:forward
 
 Looks like when you forward to a JSP that you have not been to,
 the JSP engine knows how to handle the "out" stream, but when you
 go back to the same JSP the class is probably being reused and "out"
 already exists and you get the error. Just a guess.
 I'm pretty sure you should not close "out" until you exit the last
 JSP. You do not need to close "out" actually, it is done for you.
 
 Maybe your problem is like the old saying "You can never go home" :-
 
 --- Choo Yew Beng [EMAIL PROTECTED] wrote:
  Hi Gurus In Jakarta Project,
  I had the following question:
  1.jsp
  form name="1a" action="1.jsp"
  
  
  
   jsp:forward page="2.jsp" flush="true" /
  /form
  2.jsp
  form name="2a" action="2.jsp"
  
  
  
   jsp:forward page="3.jsp" flush="true" /
  /form
  3.jsp
  form name="3a" action="3.jsp"
  
  
  
   jsp:forward page="1.jsp" flush="true" /
  /form
  When I tried to get back to 1.jsp, response error occur.
  Writer or outputstream has been committed blah blah blah.
  
  I tried response.getWriter().close() and
  response.getOutputStream().close().
  I even tried out.close but none work.
  Can someone please advice on the above and how to go about resolving
  the
  problems?
  Thx n look forward to a favorable reply if any?
  Choo Yew Beng
  
 
 
 =
 Wyn Easton
 [EMAIL PROTECTED]
 
 __
 Do You Yahoo!?
 Thousands of Stores.  Millions of Products.  All in one Place.
 http://shopping.yahoo.com/



RE: Dispatching to a jsp file

2000-11-10 Thread Kitching Simon

Hi,

 -Original Message-
 From: Richard Evans [SMTP:[EMAIL PROTECTED]]
 Sent: Friday, November 10, 2000 4:31 PM
 To:   [EMAIL PROTECTED]
 Subject:  Dispatching to a jsp file
 
 I think this is a basic servlet API/Jsp question, but I am rather
 confused.
 
 I have a servlet which needs to send a Jsp page back to the client.  The
 servlet decides the location of the file dynamically.  Ideally I do not
 want
 the Jsp files to be in the webroot because I don't want users to access
 them
 directly.
 
 I've looked at getRequestDispatcher but this takes a URI, not a file name.
 Is
 there any way to cause an arbitrary file somewhere to be read by the Jsp
 engine and returned to the client?
 
 Richard
 
[Kitching Simon]  

If you mean that you want to only allow access 
to the jsps "via" the servlet, I think the correct 
way to do this is to put your jsps in some directory
that has restricted access (eg to nobody at all) 
as defined in your WEB-INF/web.xml file.

Then have your servlet use the RequestDispatcher 
exactly as you describe below. Don't worry about 
file names - have the servlet compute a url relative 
to your webroot, and pass that to the dispatcher.

Servlets doing a redirect don't have to obey the
same access restrictions as a browser accessing
a file directly - once a user has been granted access
to a servlet, the servlet can forward the request anywhere.

Also, having your jsps under the webroot means that
you can deploy your app as a standard WAR file, etc.

It sounds like you are doing a standard MVC type
design - maybe you would be interested in looking
at Apache STRUTS, which works in exactly this way..

Cheers,

Simon





RE: Access a Servlet!!

2000-11-10 Thread Kitching Simon

Special offer today! Two for the price of one :-)

 -Original Message-
 From: João Feliciano [SMTP:[EMAIL PROTECTED]]
 Sent: Friday, November 10, 2000 1:11 PM
 To:   Tomcat-User
 Subject:  Access a Servlet!!
 
 Hello,
 
 I have a servlet that I access through this url
 http://localhost/servlet/servletApp/ and I would like to access through
 this
 one http://localhost/servletAppAlias/.
 
 Can I do this? How?
[Kitching Simon]  
in yourwebapp/WEB-INF/web.xml,
(a) add a servlet entry
(b) add a servlet-mapping entry
I'm sure this is in either the docs or the examples

 Do I have to have my web applications on the dir webapps?
[Kitching Simon]  
Nope, you just edit $TOMCAT_HOME/conf/server.xml,
create a context attribute for your webapp and set
the appropriate root directory attribute.

 Thanks.
 
 João Feliciano
[Kitching Simon]  
No problem..

Simon



RE: web.xml location

2000-11-10 Thread Kitching Simon

Hi Jim,

[[ Everybody **PLEASE** specify your tomcat version in your questions ]] 

I guess you aren't talking tomcat4, because you mention Interceptor.

If you are talking tomcat3.2, then there *isn't* a global web.xml file
anymore
(actually, it still exists in the downloaded code, but is ignored).

I use tomcat3.2 currently, and put this in server.xml:
ContextManager
  debug="0"
  workDir="/home/skitchin/webserver/tomcat/work"
  showDebugInfo="true"
  home="/home/skitchin/webserver/tomcat" 

I put this server.xml in ="/home/skitchin/webserver/tomcat/conf,
and use the -f option to get tomcat to read it.

I had to specify a full path for workDir (it didn't seem to
take it relative to the home attribute) but all else works
as expected.

For tomcat3.1, I expect that the above would work, and that
web.xml would be read from the specified home directory, 
but haven't tried it myself :-)

Cheers,

Simon

 -Original Message-
 From: Jim Richards [SMTP:[EMAIL PROTECTED]]
 Sent: Friday, November 10, 2000 1:13 PM
 To:   [EMAIL PROTECTED]
 Subject:  Re: web.xml location
 
 At 03:43 AM 10/11/00 -0800, you wrote:
 The directory structure is predetermined for web applications.
 You might want to check out the Servlet spec.  Your web.xml must be in
 the Web-inf directory.
 
 I didn't mean the web.xml that is stored in the .war file or the WEB-INF
 directory
 but the default one that lives in $TOMCAT_HOME/conf. There is an
 Interceptor
 that loads this file, from a default location conf/web.xml and it seems
 that
 in the server.xml I can specify a new home, but I don't know the XML
 syntax
 for the name/attribute pair.
 
 
 
 --
 Kumera - a new Open Source Content Management System
 for small to medium web sites written in Perl and using XML
 http://www.cyber4.org/kumera/index.html



RE: class load order and conflicts

2000-11-09 Thread Kitching Simon

Hi,

I'll have a stab at this one. Any corrections welcome.

When tomcat starts, the tomcat code itself gets loaded via the default
(root) class loader, which knows about CLASSPATH.

Tomcat then creates a class loader for each webapp, giving the
webapp-specific class loader a search path containing only
the webapp/WEB-INF/classes directory,  and all jars in 
webapp/WEB-INF/lib.

When a servlet or bean class is loaded by tomcat for a webapp,
it gets loaded by the webapp-specific classloader object. This classloader
will first look in the paths it knows about (webapp/WEB-INF/classes
and webapp/WEB-INF/lib/*.jar) and if not found, then pass the request
off to its parent classloader - which is the root classloader, which 
knows about CLASSPATH.

So that covers the search order : webapp-specific classes and
webapp-specific jars (sorry, not sure about the order of these two),
then the CLASSPATH.

And because each webapp has a classloader, any code loaded
from webapp1/WEB-INF/classes or webapp1/WEB-INF/lib/*.jar
is completely invisible to webapp2. Separate copies of the bytecode
are loaded, separate copies of static variables exist, static initializers
get run separately, etc.

I think that classes that aren't found by the webapp-specific classloader
(ie are in CLASSPATH not webapp/WEB-INF/..) get loaded by the root
classloader. Therefore, a single copy is loaded (one copy of static
variables,
etc) which is shared by all webapps. This explains why servlet-reloading
works only for servlets in WEB-INF, and doesn't work if the servlet classes 
are in CLASSPATH.

Hope I got this at least *mostly* right :-)

Cheers,

Simon

 -Original Message-
 From: Ingo Luetkebohle [SMTP:[EMAIL PROTECTED]]
 Sent: Thursday, November 09, 2000 4:05 PM
 To:   [EMAIL PROTECTED]
 Subject:  class load order and conflicts
 
 Hiya,
 
 sorry, this smells like a FAQ but I couldn't find docs :(
 
 In which order are the various class dirs searched for classes?
 /classes and /lib are automatically in the classpath, but are they
 searched last or first?
 Also, say that another servlet different from mine already uses a
 class x contained in a JAR in its /lib dir. I also want to use that
 class but my /lib dir contains a newer version. What will happen? Does
 it depend on which servlet is loaded earlier or does each servlet get
 the class from its /lib dir?
[Kitching Simon]  
Tomcat code runs with the system classloader, and creates a new
classloader for each webapp.
Therefore, any class defined
Class is only visible to class B if they have the same classloaded b

 Regards
 
 -- 
   Ingo Luetkebohle / [EMAIL PROTECTED] / 95428014
 
 its easy to stop using Perl: I do it after every project



RE: forward to an absolute URL

2000-11-09 Thread Kitching Simon

Hi Zsolt,

The jsp:forward tag makes an internal "function call" to the
servlet corresponding to the page you specify. Clearly, this
doesn't make sense for a different site.

Instead, use jsp:redirect (I might not have got that name
quite right, I use scriptlet code
% request.sendRedirect("www.acme.com/coyote"); return; %
instead of the jsp tag, but there should be an equivalent.

Cheers,

Simon

 -Original Message-
 From: Zsolt Koppany [SMTP:[EMAIL PROTECTED]]
 Sent: Thursday, November 09, 2000 5:51 PM
 To:   [EMAIL PROTECTED]
 Subject:  forward to an absolute URL
 
 Hi,
 
 I understand that I can forward a request to an other page with
 jsp:forward page="URL"/. My example works with relative URL but how
 can I forward to a page such as "http://www.netscape.com"?
 
 -- 
 Zsolt Koppany
 Intland GmbH www.intland.com
 Schulze-Delitzsch-Strasse 16
 D-70565 Stuttgart
 Tel: +49-711-7871080 Fax: +49-711-7871017



RE: servlets and the refer link

2000-11-09 Thread Kitching Simon

Hi Betty,

Actually, I *do* think that this information is available as part of a
normal HTTP request
(at least under some conditions, like if redirected by a page whose status
code is
"temporarily moved" or "permanently moved").

I have vague memories of using this feature from CGI about 4 years ago

I think that if you use request.getHeaderNames() and print out the results,
you may find
the header name you want, eg it might be "http-referrer". Once you figure
out what
the header you need is, you can then use request.getHeader("http-referrer")
or whatever
in your code.

You might also want to search around on www.w3c.org for the actual formal
definition.

Of course I could be completely wrong..

Cheers,

Simon
 -Original Message-
 From: Chris Freyer [SMTP:[EMAIL PROTECTED]]
 Sent: Thursday, November 09, 2000 4:10 PM
 To:   '[EMAIL PROTECTED]'
 Subject:  RE: servlets and the refer link
 
 I'm not aware of any call to get the most recent page from a browser's
 cache.  It isn't sent as part of a normal HTTP request.
 You can get it using javascript though--create an HTML or JSP page that
 contains a hidden form.  Place a JavaSript function in the page that runs
 in the  OnLoad event.  Make it detect the browser and use the correct
 object model to grab the most recent entry in the history list and put it
 in the form.  Then submit the form to your server. 
  
 Fair warning though--people don't like it when developers mess with their
 privacy.  Be careful.
  
 Chris
 
  -Original Message-
 From: Betty Chang [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, November 08, 2000 11:07 PM
 To: [EMAIL PROTECTED]
 Subject: servlets and the refer link
 
 
 
   Hi all -- which call do I make to obtain the "refer link" when my
 servlet is accessed via a doGet()?

   I want to obtain the last URL that user visited before getting to my
 servlet.  Is that possible?

   Thanks

   Betty

 



RE: How can I see my webapps classpath?

2000-11-07 Thread Kitching Simon

Yes, but that's not really what Robert was asking.
The original question (as I read it) is really
* How can I find out what directories classes can be loaded from for a given
webapp.

I presume that if you call YourClassName.class.getClassLoader() for any
class inside
your webapp (eg from a servlet you have written and placed in
WEB-INF/classes)
then you will get the classloader which has embedded within it the
information
you require.

However, I can't see any ClassLoader methods that allow someone to query the
path that it will use when you call loadClass("someClass"). In fact, as
custom
classloaders don't have to use a CLASSPATH at all, it makes sense that there
is no such function in the ClassLoader interface.

ClassLoader, however, is just an abstract base class for the object that
will
actually be returned by YourClassName.class.getClassLoader. I think that
the class will *actually* be a java.net.URLClassLoader. So, why not try:

(a) write a servlet (eg ClasspathFinderServlet)
(b) in the servlet:
  ClassLoader cl = ClasspathFinderServlet.class.getClassLoader();
  try
  {
URLClassLoader ucl = (URLClassLoader) cl;
URL[] searchpath = ucl.getURLs();
// print out the URL[] array
  }
  catch(CastException e)
  {
system.err.println("oh well, that idea didn't work");
  }

In order to get a complete classpath, you might need to do the above for 
the parent of the classloader, and all parent classloaders up to the top
of the tree...

This is all theory - if it works, please let me know..

Cheers,

Simon

 -Original Message-
 From: Stubenrauch,Andreas [SMTP:[EMAIL PROTECTED]]
 Sent: Tuesday, November 07, 2000 9:44 AM
 To:   '[EMAIL PROTECTED]'
 Subject:  RE: How can I see my webapps classpath?
 
 AFAIK in Tomcat 3.x there is just one classpath for the entire tomcat
 (resp.
 for the JVM) 
 The webapps/foo/classes/ and webapps/foo/lib/ are not 'really' in the
 classpath. Files in there get loaded by an modified Tomcat-Classloader.
 
 For short: the systemclasspath=your webapp classpath
 
 Regards
 
  -Original Message-
  From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
  Sent: Monday, November 06, 2000 9:28 PM
  To: [EMAIL PROTECTED]
  Subject: How can I see my webapps classpath?
  
  
  I want to print out the classpath that's associated with my web app
  not the system one but the one that tomcat is using for the web app
  after it's seen classes and lib. Is this possible?
  
  



RE: Deploying a WAR with tomcat

2000-11-07 Thread Kitching Simon

Actually, you can just rename it.
Jar currently uses the same format as zip.

 -Original Message-
 From: Ismael Blesa Part [SMTP:[EMAIL PROTECTED]]
 Sent: Tuesday, November 07, 2000 12:17 PM
 To:   [EMAIL PROTECTED]
 Subject:  Re: Deploying a WAR with tomcat
 
 No, It only takes jar files. You can decompress it and jar it.
 
 [EMAIL PROTECTED] wrote:
 
  Does anybody know if it will find .zip's the same way?
 
  The zip in question is Oracles think client driver
 
  classes12_01.zip
 
  On Mon, 6 Nov 2000, Nicholson Robert wrote:
 
   If I have a bunch of jars to deploy with tomcat I only have
   to put them in WEB-INF/lib right?
  
   What's the full documentation on how Tomcats classloaders work? I know
   that when you use cocoon you have to copy the jar to lib and put it
   in the CLASSPATH.
  
   When using a web application do I have to specifically add all jars
   to CLASSPATH even if they are in WEB-INF/lib ... If so why?
  
  
 ==
 =
   To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
 JSP-INTEREST".
   Some relevant FAQs on JSP/Servlets can be found at:
  
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
  



RE: Shutting down Tomcat on HP-UX

2000-11-03 Thread Kitching Simon

Hi,

This is one I'm having problems with too.

When using HPUX11.00 and java 1.2.2_04:
* With tomcat3.1, I needed 2 shutdown commands.
* With tomcat3.2b6, I now need 3 shutdown commands.

This difference is without changing the JVM, so it's
clearly something to do with tomcat code. It's very
consistent (consistently annoying).

Exactly the same webapp shuts down correctly
(on first shutdown command) when run on Solaris,
(java 1.2.2_06) so it's *also* something to do with the 
JVM or platform.

I have no workaround to suggest

Regards,
Simon

 -Original Message-
 From: Kurt R. Hoehn [SMTP:[EMAIL PROTECTED]]
 Sent: Friday, November 03, 2000 4:33 AM
 To:   [EMAIL PROTECTED]
 Subject:  Shutting down Tomcat on HP-UX
 
 I'm having a hard time shutting down tomcat 3.2b6 on HP-UX.  It takes 3 to
 4 shutdowns before the jvm is released from tomcats grasp, I have to
 manually kill the PID.  Is there a know bug on this, a work around or is
 there a configuration problem.
  
 Thank You
 Kurt R. Hoehn
 Etech Studios, Inc.
  



RE: Please Help!!! Error loading tomcat

2000-11-01 Thread Kitching Simon

Well, the real fix is to upgrade your Java Virtual Machine.
A segmentation violation can only be as a result of a bug
in the jvm. 

If this jvm is the very latest release, then 
(a) you might want to consider *downgrading* to an
earlier jvm version, and
(b) I think the jvm developers (blackdown?) would be very 
interested in receiving a copy of the generated core file - 
why not send an email to them asking if  how they 
would like this reported...

 -Original Message-
 From: Mauricio Nuñez [SMTP:[EMAIL PROTECTED]]
 Sent: Tuesday, October 31, 2000 8:04 PM
 To:   [EMAIL PROTECTED]
 Subject:  Please Help!!! Error loading tomcat
 
 Urgent:
 
 somebody can give me a tip. I get the following error loading Tomcat:
 
 SIGSEGV   11*  segmentation violation
 si_signo [11]: SIGSEGV   11*  segmentation violation
 si_errno [0]: Success
 si_code [0]: SI_USER [pid: 0, uid: 0]
 stackpointer=0xbe3feed4
 
 Full thread dump Classic VM (Linux_JDK_1.2.2_RC4, native threads):
 "Thread-6" (TID:0x40ea4980, sys_thread_t:0x446376c8, state:CW, native
 ID:0x3
 80f) prio=5
 at java.lang.Thread.sleep(Native Method)
 at freemarker.template.UpdateTimer.run(UpdateTimer.java, Compiled
 Code)
 at java.lang.Thread.run(Thread.java, Compiled Code)
 "Thread-5" (TID:0x40ea6cf8, sys_thread_t:0x84a8440, state:MW, native
 ID:0x34
 0e) prio=5
 
 Thanks
 
 Mauricio



RE: Execute JSP's in a different directory - sans-examples.

2000-10-31 Thread Kitching Simon

Hi Sterling,

Basically, your description of the process to set 
up a new webapp below is correct.

I suggest that you consider this process as
having two parts:
(a) setting up tomcat
(b) setting up apache

You can configure tomcat, then check that it
is all correct by using tomcat's http port (default
port = 8080). Once this works, then try setting
up apache to pass on the relevant requests
to tomcat. Setting up apache causes lots of
people headaches, so I really recommend
making sure it works with plain tomcat first.

Tomcat 4.0 will apparently remove the need to
configure apache; tomcat will be able to tell
apache about what urls it wishes to handle.
This is not the case for tomcat3.1/3.2 though,
unfortunately.

[more comments embedded below]

Regards,

Simon

 -Original Message-
 From: Sterling [SMTP:[EMAIL PROTECTED]]
 Sent: Monday, October 30, 2000 11:39 PM
 To:   Tomcat-user
 Subject:  Execute JSP's in a different directory - sans-examples.
 
 H-
 
 I've been poking around the docs and archives for this list and from
 what I see there isn't a simple way to make this happen.
 Set up another directory that will execute JSP files without having to
 go through examples. (And from what I've seen this directory cannot be
 inside the httpd/htdocs directory either. True?)
 
 For example:
 Add to tomcat-apache.conf file:
 ApJServMount /MYDIRECTORY ajpv12://127.0.0.1:8007
 
 Create a directory inside
 /usr/local/tomcat/webapps/MYDIRECTORY
[Kitching Simon]  
Well, you can put your document root anywhere. If it is under
webapps, then you don't need to tweak the server.xml file
manually, but you do have to live with the /MYDIRECTORY
prefix for each url. The alternative is to edit $TOMCAT_HOME/
server.xml, and define a context, with docRoot set to
any directory you want. Tomcat3.2 also comes with an
admin utility to define new contexts via a web page, but I 
haven't tried this myself...

 Create all the special JSP files and dirs in that directory
 META-INF, WEB-INF, images, jsp, servlets.
[Kitching Simon]  
Well, yeah. If you want to serve files to a browser, you 
need to put the pages somewhere...

 Now modify the web.xml file inside WEB-INF to include every servlet that
 I'm going to use. When I create another servlet I must re-edit this file
 to include that servlet than reload Tomcat, Restart Apache.
[Kitching Simon]  
If you are happy to have servlets which are accessed via the url
/web-app-name/servlet/servlet-class-name, and you don't
need any special parameters to be passed to the servlets, then
you can use the default mapping [you still need to tell apache
that /web-app-name/servlet/... is to be handled by tomcat].
But if you want servlets to be executed by urls that don't
have a particular prefix, or you want servlet init parameters,
then yes you need a servlet entry in web.xml for each servlet.
I really can't see how else it could be done...until we get that
telepathic interface I've been waiting for.

 This can't be right. This is a lot of configuring just to pull up
 http://www.myserver.net/MYDIRECTORY
 and have it pull and executes JSP files.
 
[Kitching Simon]  
No, if you just want to execute JSP files, it is quite simple. No
WEB-INF directory is needed, no web.xml, etc.
If you want *servlets* as well, then it gets a bit more complicated.
I suggest that it is no more complicated than ASP+COM, or PHP.

 Is this the only way (did I even get it right?) or am I reading the
 wrong information?
 
 Thanks for any thoughts or insights you might have.
 -Sterling
 



RE: Tomcat 3.2-beta-6 or 4.0m3?

2000-10-31 Thread Kitching Simon

Hi Tomcat developers,

I'd love to see some info on the release plans
for these products too. I presume that those of
you with "committer" status have some
general long-term plans

I understand that software development schedules
(and esp. open-source projects) are difficult to
estimate, but a rough guess would still be better
than no information!

I assume that 3.2 release will come well before
4.0 release, so that's one reason to stick with 3.2
instead of moving to 4.0 right now.
Would I be right in guessing 3.2 release is expected
sometime round december, and 4.0 release around 
march/april next year??? 

However, I am really puzzled by the existence of 
the 3.3 stream; surely 3.4 will come out *after*
4.0, in which case what's the point of it???

Cheers,

Simon

 -Original Message-
 From: Zsolt Koppany [SMTP:[EMAIL PROTECTED]]
 Sent: Tuesday, October 31, 2000 1:47 PM
 To:   [EMAIL PROTECTED]
 Subject:  Tomcat 3.2-beta-6 or 4.0m3?
 
 Hi,
 
 right now I work with tomcat-3.2-beta-6. Is it better to move to 4m3?
 What is the reason of having both versions?
 
 Zsolt
 
 -- 
 Zsolt Koppany
 Intland GmbH www.intland.com
 Schulze-Delitzsch-Strasse 16
 D-70565 Stuttgart
 Tel: +49-711-7871080 Fax: +49-711-7871017



RE: Servlet loading on linux startup

2000-10-30 Thread Kitching Simon

Hi,

Maybe this is a file permissions or paths problem...

Check what user tomcat runs as when started from inittab.
Is this the same user you use when you "log in to linux" to
start tomcat? If not, does this user have access permissions
to the WEB-INF/classes directory, the web.xml file, etc?

What about the environment variables like TOMCAT_HOME?
Are they set correctly when tomcat is started from inittab?

Regards,

Simon

 -Original Message-
 From: Domenico di Girolamo [SMTP:[EMAIL PROTECTED]]
 Sent: Monday, October 30, 2000 7:31 PM
 To:   Tomcat ML
 Subject:  Servlet loading on linux startup
 
 If I start Tomcat from inittab on linux startup it do not
 load servlets on web.xml configured as load on startup.
 If I login into linux and stop and restart tomcat then it
 load servlets on startup.
 How can I solve this problem ?
 thanks
 Domenico



RE: Frustration with getInitParameter

2000-10-26 Thread Kitching Simon

Hi Paul,

When you say "the servlet's getInitParameter("test")" what *exactly* do you
mean?

Do you mean that your servlet's init method is like:

  public void init(ServletConfig config) throws ServletException {
super.init(config);

  Object o = config.getInitParameter("test");
  
 
If so, then all I can say is it works for me.

According to the docs, you should also be able
to do this inside the service method:

Object o = this.getServletConfig().getInitParameter("test");

I haven't tried this, though..

Regards,

Simon

 -Original Message-
 From: Paul Hoepfner-Homme [SMTP:[EMAIL PROTECTED]]
 Sent: Thursday, October 26, 2000 4:26 PM
 To:   [EMAIL PROTECTED]
 Subject:  Frustration with getInitParameter
 
 Tomcat 3.2 beta 6.  I have a servlet in the ROOT context.  The web.xml
 file in webapps/ROOT/WEB-INF has this entry: 
 servlet 
 servlet-name.../servlet-name 
 servlet-classMyServlet/servlet-class 
 init-param 
 param-nametest/param-name 
 param-valuehere/param-value 
 /init-param 
 ... 
 /servlet 
 
 From MyServlet I use the servlet's getInitParameter("test") method and it
 returns null.  When I try to iterate through the parameter names, there
 are none to iterate through. 
 
 What am I doing wrong?? 
 
 Thanks 
 --
 Paul Hoepfner-Homme
 [EMAIL PROTECTED]
 
 OVEN Digital |  http://www.oven.com/
  



RE: WEB-INF/lib

2000-10-25 Thread Kitching Simon

Hi Ted,

This functionality works fine in tomcat3.1.
I (and many others on this email list) use
this without problems. I am sure that tomcat3.2
also does this, as this behaviour is defined in 
sun's servlet specification.

The files should be in application/WEB-INF/lib.
Tomcat *does* add these to its classpath
automatically. 

Note that only ".jar" files will be added; files
with the suffix ".zip" get ignored. And don't
forget that if you're using unix, then case
is important..

Regards,

Simon


 -Original Message-
 From: [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]]
 Sent: Tuesday, October 24, 2000 9:17 PM
 To:   [EMAIL PROTECTED]
 Subject:  WEB-INF/lib
 
 Hi All,
 
 I am trying to put my JDBC jar file in the application/WEB-INF/lib
 directory but Tomcat doesn't add the jar file to its classpath
 automatically.  Is there a config parameter in one of the xml files to do
 this?  Also the default "build" script for NT machines says to put the
 jars
 in application/lib instead of application/WEB-INF/lib.  I tried it both
 ways and it doesn't work.  I am restarting the server after ant copies the
 files to the appropriate directories.
 
 If I add the jar file to the CLASSPATH in the script to start the tomcat
 server it works, but I thought it was supposed to happen automatically.
 
 
 Thanks,
 Ted.



RE: Installation Problem

2000-10-25 Thread Kitching Simon

What url did you type into your browser?

Assuming that your tomcat instance is installed
on the same PC as the browser you are using,
you should try:

http://localhost:8080

 -Original Message-
 From: [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]]
 Sent: Wednesday, October 25, 2000 1:14 PM
 To:   [EMAIL PROTECTED]
 Subject:  Installation Problem
 
 
 Hello! 
 
 
 
 My name is Greg Beckwith. I am in the process teaching myself how to
 develop Java Server Pages. I have downloaded the binary version of Tomcat
 and followed the installation instructions (from the "doc" directory)
 listed below: 
 __
 ___
 How Do I Install the Binary Version of Tomcat? 
 
 Very simple. You should: 
 
 * Download the zip/tar.gz/whatever file from
 http://jakarta.apache.org/downloads/binindex.html. 
 * Unzip the file into some directory (say foo). This should create a
 new subdirectory named "tomcat". 
 * Change directory to "tomcat" and set a new environment variable
 (TOMCAT_HOME) to point to the root directory of your Tomcat hierarchy. 
 1.On Win32 you should type: 
 "set TOMCAT_HOME=foo\tomcat" 
 2.On UNIX you should type: 
 for bash/sh "TOMCAT_HOME=foo/tomcat ; export TOMCAT_HOME"
 for tcsh "setenv TOMCAT_HOME foo/tomcat" 
 * Set the environment variable JAVA_HOME to point to the root
 directory of your JDK hierarchy, then add the Java interpreter to your
 PATH environment variable. 
 That's it! You can now execute Tomcat and it will run as a stand-alone
 (type 1) servlet container. 
 
 __
  
 
 I have tried to run the following code: 
 
 
 HTML 
 HEAD 
 TITLESimple JSP Example/TITLE 
 /HEAD 
 
 BODY 
 
 PHow many times?/P 
 
 FORM METHOD ="GET" ACTION="SimpleJSP.jsp" 
 INPUT TYPE="TEXT" SIZE="2" NAME="numtimes" 
 INPUT TYPE="SUBMIT" 
 /FORM 
 
 /BODY 
 /HTML 
 
 I get an IE5 error message stating "The page cannot be displayed." 
 
 
 * Perhaps I installed Tomcat incorrectly. 
 * Maybe I did not start Tomcat properly. 
 
   Observation 
 
   Please forgive me for the following observation (I am just a
 beginner)   
 
 * The "BINARY" file I downloaded (
 http://jakarta.apache.org/downloads/binindex.html.) does not have any
 ".class" files. Shouldn't  a compiled binary file contain these ? 
 
 
   Other: 
   
 
 * I am using a Windows NT (4.0) box. 
 * jdk1.2.1 is installed and working. 
 
 May I ask you for a "more" detailed, step by step set of instructions on
 the installation process. Also, may I have detailed step by step
 instruction on starting Tomcat and running code. 
 
 I look forward to hearing from you! 
 
   Thank - you 
 
   Greg Beckwith 
 
 
 



RE: Why can't Cocoon find my producer class?

2000-10-25 Thread Kitching Simon

Just a thought - is Cocoon itself in your classpath, or
your WEB-INF/lib?

If the former, then the ClassLoader associated with
cocoon's code will be the standard classloader, and
may not find classes which are in the WEB-INF/classes
directory (accessable via the context's ClassLoader).


 -Original Message-
 From: Robert Nicholson [SMTP:[EMAIL PROTECTED]]
 Sent: Wednesday, October 25, 2000 5:42 PM
 To:   Tomcat-User; SERVLET-INTEREST; Jxquick-Interest; JSP-INTEREST
 Subject:  Why can't Cocoon find my producer class?
 
 I have a custom Producer class that I wrote for Cocoon 1.7.4 that I'm
 using
 with Tomcat but whenver I access Cocoon.xml it reports that it couldn't
 find
 my class.
 
 I've put my class in my contexts WEB-INF/classes
 
 and I've tried putting it outside of here and adding
 the path to the classpath on the command line.
 
 What gives? Where does Cocoon look for it's custom Producers?
 
 ---
 Robert Nicholson
 Email: [EMAIL PROTECTED]
 AOL  : rydmerlin



RE: WEB-INF/lib

2000-10-25 Thread Kitching Simon

Yes, but as Craig pointed out in a correction
to an earlier email of mine, what tomcat
does when starting a context is not
to manipulate the classpath, but to
create  manipulate a ClassLoader.

Changes to the path used by the 
ClassLoader will not be visible in
the CLASSPATH system property.

Therefore, the classes in WEB-INF/classes,
and all the jars in WEB-INF/lib will be
accessable via the ClassLoader, but
those directories/libs will not be
in the CLASSPATH.

 -Original Message-
 From: Steve Haines [SMTP:[EMAIL PROTECTED]]
 Sent: Wednesday, October 25, 2000 6:25 PM
 To:   '[EMAIL PROTECTED]'
 Subject:  RE: WEB-INF/lib
 
 Here is how to get your CLASSPATH at runtime:
 
 String classPath = System.getProperty( "java.class.path" );
 
 
 
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, October 25, 2000 7:15 AM
 To: [EMAIL PROTECTED]
 Subject: RE: WEB-INF/lib
 
 
 
 I am doing everything according to the docs and sun spec.  But the classes
 in the jar file are unavailable.  Is there a servlet variable I can check
 at runtime to display my classpath?
 
 Thanks,
 Ted.
 
 
  
 
     Kitching Simon
 
 Simon.Kitching@To:
 "'[EMAIL PROTECTED]'"
 orange.ch
 [EMAIL PROTECTED]
 
 cc:
 
 10/25/2000 03:33Subject: RE: WEB-INF/lib
 
 AM
 
 Please respond
 
 to tomcat-user
 
  
 
  
 
 
 
 
 Hi Ted,
 
 This functionality works fine in tomcat3.1.
 I (and many others on this email list) use
 this without problems. I am sure that tomcat3.2
 also does this, as this behaviour is defined in
 sun's servlet specification.
 
 The files should be in application/WEB-INF/lib.
 Tomcat *does* add these to its classpath
 automatically.
 
 Note that only ".jar" files will be added; files
 with the suffix ".zip" get ignored. And don't
 forget that if you're using unix, then case
 is important..
 
 Regards,
 
 Simon
 
 
  -Original Message-
  From: [EMAIL PROTECTED]
 [SMTP:[EMAIL PROTECTED]]
  Sent: Tuesday, October 24, 2000 9:17 PM
  To:   [EMAIL PROTECTED]
  Subject:   WEB-INF/lib
 
  Hi All,
 
  I am trying to put my JDBC jar file in the application/WEB-INF/lib
  directory but Tomcat doesn't add the jar file to its classpath
  automatically.  Is there a config parameter in one of the xml files to
 do
  this?  Also the default "build" script for NT machines says to put the
  jars
  in application/lib instead of application/WEB-INF/lib.  I tried it both
  ways and it doesn't work.  I am restarting the server after ant copies
 the
  files to the appropriate directories.
 
  If I add the jar file to the CLASSPATH in the script to start the tomcat
  server it works, but I thought it was supposed to happen automatically.
 
 
  Thanks,
  Ted.
 
 



RE: Unable to rename class file

2000-10-24 Thread Kitching Simon

Hi,

I guess that this is generated because
tomcat has seen that your jsp file has
been updated (its timestamp is newer
than the generated .class file), and so
is trying to move the class file generated
from the old .jsp file out of the way so
it can generate a .class file for the newer
version of the .jsp.

Why the rename fails, I don't know.
Is your disk full? Are the directory
permissions on the $TOMCAT_HOME/
work directory stuffed up?

Regards,

Simon

 -Original Message-
 From: Alex Huang [SMTP:[EMAIL PROTECTED]]
 Sent: Tuesday, October 24, 2000 10:24 AM
 To:   [EMAIL PROTECTED]
 Subject:  Unable to rename class file
 
 Once in a while I'm unable to get a page from Tomcat and seeing the error
 below in the tomcat.log file.  Does anyone know what this is?  If I
 request the page again, I get it.  
 
 -alex
 
 Running: Win2000, Apache 1.3.12, Tomcat 3.1 w/pooled connections
 
 Context log: path="" Error in jsp service() : Unable to rename class file
 C:\Apache\Tomcat\work\localhost_8080\_0002fterms_0002ejspterms_jsp_0.class
 to
 C:\Apache\Tomcat\work\localhost_8080\_0002fterms_0002ejspterms.class
  org.apache.jasper.JasperException: Unable to rename class file
 C:\Apache\Tomcat\work\localhost_8080\_0002fterms_0002ejspterms_jsp_0.class
 to
 C:\Apache\Tomcat\work\localhost_8080\_0002fterms_0002ejspterms.class
 at org.apache.jasper.compiler.Compiler.compile(Compiler.java:263)
 at
 org.apache.jasper.runtime.JspServlet.loadJSP(JspServlet.java:413)
 at
 org.apache.jasper.runtime.JspServlet$JspServletWrapper.loadIfNecessary(Jsp
 Servlet.java:149)
 at
 org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.
 java:161)
 at
 org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:261)
 at
 org.apache.jasper.runtime.JspServlet.service(JspServlet.java:369)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
 at
 org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:50
 3)
 at
 org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
 at
 org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnecti
 on(Ajp12ConnectionHandler.java:156)
 at
 org.apache.tomcat.service.TcpWorkerThread.run(PoolTcpEndpoint.java:366)
 at
 org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:411)
 at java.lang.Thread.run(Thread.java:484)
 Context log: path="" bInternal Servlet Error:/bbr



RE: Servlet Directory

2000-10-24 Thread Kitching Simon

Hi,

Just to spell things out a bit clearer:

The code for a servlet class, and any non-library
classes it uses, must be in the classpath. Your
best options are:
(a) put them under {yourwebapp}/WEB-INF/classes,
in a subdirectory that matches your package structure.
(b) put them in a jar file, in {yourwebapp}/WEB-INF/lib

In either case above, tomcat automatically adds the
directories/libs to its classpath when it starts.

You *can* put your servlet classes elsewhere on your 
disk, and make sure your CLASSPATH points to them 
before starting tomcat, but there are many disadvantages 
to this,  including making it difficult to install your code 
elsewhere, and not being able to use the servlet 
auto-reload feature.

Now that your class is *loadable* by tomcat, you need
to tell tomcat what URLs map to what servlets. 

There is an entry in $TOMCAT_HOME/conf/web.xml which
sets up a default mapping for servlets; for any url of form
/webapp/servlet/servletname, an attempt is made to
do a "loadClassForName(servletname)" and if
successful, the request is passed off to the found class.
Of course, the class to be loaded merely has to be in
the classpath somewhere (see (a) and (b) above).
[[NB: this only applies in tomcat3.1; I hear that tomcat3.2
does not have a $TOMCAT_HOME/conf/web.xml file,
in which case I'm not sure how or if the default servlet
mapping gets set up...]]

If you don't like this default mapping, you just define
your own (url-servletclass) mappings in the file
yourwepapp/WEB-INF/web.xml. See the file
$TOMCAT_HOME/conf/web.dtd to see what tags
are allowed in the web.xml file; then read the sun
servlet specs. NB: don't modify the web.xml file
in TOMCAT_HOME/conf, create your own inside
your webapp/WEB-INF.

Note that the servlet class *never* lives *at* the
url that the user enters; the url is always looked up
to find a corresponding class name, and then the
servlet class is loaded from the classpath.

I hope this clarifies things a bit...

Regards,

Simon
 -Original Message-
 From: Clark D. Richey, JR. [SMTP:[EMAIL PROTECTED]]
 Sent: Tuesday, October 24, 2000 3:22 AM
 To:   [EMAIL PROTECTED]
 Subject:  RE: Servlet Directory
 
 The class file has to be in Tomcat's classpath. Where are you putting the
 servlet's class file?
 
  -Original Message-
  From: Corey A. Johnson [mailto:[EMAIL PROTECTED]]
  Sent: Monday, October 23, 2000 8:15 PM
  To: [EMAIL PROTECTED]
  Subject: Servlet Directory
 
 
  Hello all,
 
  First, let me apologize... this is so simple... but i have been beating
  my head against the wall for almost 20 hours straight now...
 
  I have successfully installed Tomcat on my Solaris... With Apache 1.3.14
 
  Everything seems to be working fine... JSPs work well... looking through
  the logs... no errors...  but i can not get any servlets to work in my
  defined servlet directory.  I must be missing something very simple.
  When i try to invoke a servlet, the tomcat.log file shows:
 
  Context log: path="" Class Not Found in init
   java.lang.ClassNotFoundException: testAllego
 
 
  In my tomcat.conf file.. i have the line:
 
  ApJServMount /servlet /root
 
  And i have this in my server.xml file:
 
  Context path="" docBase="/export/home/cni/servlet" debug="0"
  reloadable="true" 
  /Context
 
 
  I feel like i am so close... because ay least it is "trying" to load the
  servlet class... but tomcat can't find it..
 
  please help... i need some sleep...
 
  thanks in advance.
 
  Cj
  --
  Corey A. Johnson
  Creative Network Innovations, Inc.
  1-800-264-5547 ** 1-321-259-1984