2.2 Spec divergence?

2001-05-11 Thread Boyce, David

Does anyone else think this is a divergence of Tomcat 3.2.1 from the 2.2
spec? In section 4.7 Temporary Working Directories it says:

It is often useful for Application Developers to have a temporary working
area on the local
filesystem. All servlet containers must provide a private temporary
directory per servlet context and
make it available via the context attribute of
javax.servlet.context.tempdir. The
object associated with the attribute must be of type java.io.File.

But in my experiments the File object returned by Tomcat 3.2.1 is not an
existing directory. It appears to be a suggestion, e.g. should you want to
make a temp directory, this would be a good place but it's up to me to use
File.mkdirs() to actually create it. No big deal, but then File.mkdirs()
isn't documented to succeed when the dir already exists, so in order to
ensure portability to containers which may interpret the spec as saying
return an existing directory ... I need to code something like

File tmpdir = (File) ...
if (! tmpdir.exists())
tmpdir.mkdirs();

and of course catch various exceptions. Just wondering if I missed
something, or perhaps it's a bug fixed in a later 3.* version?

Thanks,
David Boyce



Tomcat/Netscape 3.6 connector for Solaris?

2001-05-07 Thread Boyce, David

Does anyone know a location of documentation and/or binaries for the
Tomcat-Netscape Enterprise 3.6 server? The
http://jakarta.apache.org/tomcat/jakarta-tomcat/src/doc/tomcat-netscape-howt
o.html document is completely NT-centric, to the point that it's not clear
whether the redirector has been ported to Solaris or what it would be called
if so. Considering the close relationship between Sun and Jakarta I'm
surprised by what I seem to be seeing. I'm willing to RTFM if I can just
find TFM.

Thanks,
David Boyce



RE: How to set access restriction to servlets in tomcat?

2001-04-27 Thread Boyce, David

Also, the login-config elements in the sample aren't properly closed with
a /login-config. The / is missing.

-dsb

-Original Message-
From: JULIEN,TIMOTHY (HP-NewJersey,ex2) [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 27, 2001 11:01 AM
To: '[EMAIL PROTECTED]'
Subject: RE: How to set access restriction to servlets in tomcat?


The login-config element should occur only once in your whole web.xml, and
it should be on its own - not part of other elements.  Sorry I didn't make
this clear.

Also, you may have to configure Apache to do BASIC authentication - but I'm
not sure.

Tim

-Original Message-
From: Xiaofeng Chen [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 27, 2001 10:26 AM
To: [EMAIL PROTECTED]
Subject: Re: How to set access restriction to servlets in tomcat?


I added the auth-method tag in web.xml and restarted tomcat and apache. It
still doesn't work.
The following is my settings in web.xml. Do you think there are other things
we need to do? Thanks.

security-constraint
  web-resource-collection
web-resource-nameIsItWorking/web-resource-name
url-patterl/servlet/IsItWorking/url-pattern
login-config
auth-methodBASIC/auth-method
realm-nametimasta/realm-name
login-config
  /web-resource-collection
/security-constraint

servlet-mapping
  url-pattern/servlet/IsItWorking/url-pattern
  login-config
auth-methodBASIC/auth-method
realm-nametimasta/realm-name
  login-config
  servlet-nameIsItWorking/servlet-name
/servlet-mapping

servlet
  servlet-nameIsItWorking/servlet-name
  servlet-classIsItWorking/servlet-class
/servlet


- Original Message -
From: JULIEN,TIMOTHY (HP-NewJersey,ex2) [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, April 27, 2001 2:31 AM
Subject: RE: How to set access restriction to servlets in tomcat?




 one piece I left out -

 you also need to tell your app how to authenticate.
 (Although, I am surprised Tomcat gave you access to a protected resource)
 (i.e., how to get user credentials, in order to determine if they have
 access)

 There are 4 types of authentication:

 login-config
  auth-methodBASIC/auth-method !-- optional --
  realm-nametimasta/realm-name !-- optional --
 /login-config

 authenticates using BASIC - popup dialog boxes.


 login-config
  auth-methodCLIENT-CERT/auth-method !-- optional --
 /login-config

 authenticates using a certificate, X509.  Usually found in a header.

 login-config
  auth-methodFORM/auth-method !-- optional --
  form-login-config !-- optional --
   form-login-page/login.jsp/form-login-page
   form-error-page/error.jsp/form-error-page
  /form-login-config
 /login-config

 authenticates using forms.  This works in conjunction with a page,
 login.jsp, which has a form with fields j_username and j_password and
 action
 j_security_check.

 the final type is DIGEST, but i don't know if Tomcat supports this, as it
 is
 not required.

 Tim Julien
 HP Middleware

 -Original Message-
 From: Xiaofeng Chen [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, April 26, 2001 5:49 PM
 To: [EMAIL PROTECTED]
 Subject: Re: How to set access restriction to servlets in tomcat?


 Hi, Tim: Thank you for your reply. I followed your instruction and edited
 the web.xml like the following:
 security-constraint
   web-resource-collection
   web-resource-nameIsItWorking/web-resource-name
   url-pattern/servlet/IsItWorking/url-pattern
 /web-resource-collection
 /security-constraint

 servlet-mapping
   url-pattern/servlet/IsItWorking/url-pattern
   servlet-nameIsItWorking/servlet-name
 /servlet-mapping

 servlet
   servlet-nameIsItWorking/servlet-name
   servlet-classIsItWorking/servlet-class
 /servlet

 I have the testing servlet IsItWorking in the
 $TOMCAT_HOME/webapps/WEB-INF/classes directory. But
 when I tried to access the servlet, there is no loggin prompt for me, I
 just
 get the page right away. Do you see anything
 wrong with my settings in the web.xml. Thanks for your help.


 - Original Message -
 From: JULIEN,TIMOTHY (HP-NewJersey,ex2) [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Thursday, April 26, 2001 10:18 AM
 Subject: RE: How to set access restriction to servlets in tomcat?





 use the security-constraint element in  web.xml:

 security-constraint
   web-resource-collection
   web-resource-nameSecure  Servlets/web-resource-name
 url-pattern/main/secure/url-pattern
 /web-resource-collection
 /security-constraint

 servlet-mapping
   url-pattern/main/secure/url-pattern
 servlet-namemain  servlet/servlet-name
 /servlet-mapping

 servlet
 servlet-namemain  servlet/servlet-name
   servlet-classorg.foo.Servlet/servlet-class
 /servlet

 Tim Julien
 HP Middleware

 -Original Message-
 From: Xiaofeng Chen  [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, April 26, 2001 11:05  AM
 To: [EMAIL PROTECTED]
 Subject: How to set  access restriction to servlets in tomcat?


 Could someone drop me any hints about how to set  access restriction 

RE: Tomcat/IIS 5 /examples solution?

2001-04-27 Thread Boyce, David

Steve,

FWIW the person to whom you owe this help is an Erin (and thus presumably a
she), not an Eric. Yet more words to eat.

-dsb 

-Original Message-
From: Steve Holmlund [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 27, 2001 1:34 PM
To: [EMAIL PROTECTED]
Subject: RE: Tomcat/IIS 5 /examples solution?


 -Original Message-
 From: David McCormick [mailto:[EMAIL PROTECTED]]
 Sent: Friday, April 27, 2001 5:40 AM
 To: '[EMAIL PROTECTED]'
 Subject: RE: Tomcat/IIS 5 /examples solution?


 Can you point me to Eric's post?

Gladly, http://jguru.com/faq/view.jsp?EID=275211

Ignore my response below his, where I start to tell him he's mistaken, and
then eat my words.

Steve



RE: Tomcat Init At Boot

2001-04-25 Thread Boyce, David

The Tomcat logfiles are presumably not showing anything because the failure
happens before Tomcat starts up. Try adding the following line at the top of
your rc script:

exec  /tmp/rc.out 21  set -x

And take a look at /tmp/rc.out after a reboot. You should see the failure.

-David Boyce

-Original Message-
From: Mike Gruber [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 25, 2001 12:07 PM
To: [EMAIL PROTECTED]
Subject: Tomcat Init At Boot


I am currently using the binary versions of Tomcat 3.2.1 and JDK 1.3.0_02 on
Caldera eServer 2.3.  I have placed a tomcat init script in the init.d
directory (see script below) and linked to in from the various rcx.d dirs.
My problem is that the script is being run during the boot sequence, but
Tomcat never starts.  If I run the exact same script from the command line
(as root) however, Tomcat starts no problem.  The log files aren't reporting
any noticeable errors when Tomcat fails to load at boot, so I am unsure what
the discrepancy is between init running the script and the root user running
the script.  Any information or advice anyone can give me on this problem
will be greatly appreciated.

MGRUBER

ps - I have tried other init scripts and I get the same result with them
all.  Here is the latest version:

---
#!/bin/sh
#
# Start/Stop Jakarta Tomcat

# Source function library
. /etc/rc.d/init.d/functions

export PATH=$PATH:/usr/java/jdk1.3.0_02/bin
export JAVA_HOME=/usr/java/jdk1.3.0_02
export TOMCAT_HOME=/usr/java/jakarta-tomcat-3.2.1

case $1 in
  start)
echo -n Starting tomcat: 
daemon /usr/java/jakarta-tomcat-3.2.1/bin/tomcat start
echo
touch /var/lock/subsys/tomcat
;;
  stop)
echo -n Shutting down tomcat: 
daemon /usr/java/jakarta-tomcat-3.2.1/bin/tomcat stop
echo
rm -f /var/lock/subsys/tomcat
rm -f /var/run/tomcat.pid
;;
  restart)
$0 stop
sleep 2
$0 start
;;
  *)
echo Usage: $0 {start|stop|restart}
exit 1
esac

exit 0
---



RE: Reaped pid = 24793, status = 0

2001-04-24 Thread Boyce, David

A guess: you're letting the object reference go out of scope without doing a
waitFor() or similar. When it then gets garbage collected the JVM tells you
what became of your abandoned child.

-David Boyce

-Original Message-
From: Christoph Kukulies [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 24, 2001 12:34 PM
To: [EMAIL PROTECTED]
Subject: Reaped pid = 24793, status = 0



I'm doing an

 Process p=runner.exec(cmdarray);

in a servlet.

As a result everytime the exec executes (it executes a binary program
sitting in the filesystem of the server) I'm getting these
Reaped pid = number status=0

Do I have to care about them. Is it that I'm doing something 
that could be done better without this messages appearing?

-- 
Chris Christoph P. U. Kukulies [EMAIL PROTECTED]



Tomcat and NT service via wrapper script?

2001-04-24 Thread Boyce, David

Short version: I need to run Tomcat as a service on NT (and know how to do
so) but need a hook to run an arbitrary command as part of the service
startup.
Details: I'm running Tomcat out of a ClearCase view (for those unfamiliar,
ClearCase is a dynamic filesystem abstraction with a metalanguage allowing
you to specify which versions of files you want to see, e.g. the state as
of 3:34 PM yesterday or my changes but no one else's, etc. But note that
my problem has nothing to do with ClearCase per se). Running in a view has
many advantages, especially for development, as deployment (or rollback)
becomes as simple as changing a line of metalanguage to select newer (or
older) versions.

However, the use of ClearCase is a red herring; the only concern is that the
view must be started with the command cleartool startview view-name
before Tomcat runs. I'm doing this on UNIX now and it works just great with
a little bit of scripting. But I now need to do the same thing on Windows;
unfortunately the whole service business there seems pretty intractable.
All I need is a hook to run the startview command prior to Tomcat startup
but I haven't been able to dig up documentation on how or whether it can be
done.

To save time let me enumerate what I don't need: I know how to run Tomcat as
a service on NT and have done so successfully. I'm aware of the JDK 1.3.0
bug which affects this. I realize that ClearCase (which also runs as a
service on NT) must be started prior to Tomcat and have read up on how to
edit service dependencies in the registry. All I still need is a way to run
an arbitrary command (which happens in my case to be cleartool startview)
as part of the service startup sequence. Has anyone done something similar?

Thanks in advance,
David Boyce




RE: Tomcat and NT service via wrapper script?

2001-04-24 Thread Boyce, David

Keith,

Thanks, I also considered that one for a while previously before realizing
its fatal flaw. The way ClearCase works, starting a view is analogous to
mounting a filesystem. Thus the wrapper.properties file (as well as all the
other config files, classes, etc.) aren't present till the view starts so
there's a catch-22.

It comes back to how to run the equivalent of this two-line script:

some.random.program
tomcat start(or alternatively java
org.apache)

as a service. I don't have MSVC or MSDN so am sort of handcuffed in terms of
research but it looks as if the jk_nt_service.exe is written to assume the
thing it's managing is a java program, Likewise with JavaService and
javaserv. Does anyone know why it's not possible (apparently) to run a
script as a service? Why does the service installer/manager/whatever it's
called need to know what kind of program the service cmd is?

I realize this is drifting away from Tomcat proper so I'll take it somewhere
else after this attempt.

David Boyce


-Original Message-
From: Keith Gross [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 24, 2001 5:47 PM
To: [EMAIL PROTECTED]
Subject: Re: Tomcat and NT service via wrapper script?


I haven't done what you're looking to do but I did do a lot of research on
the NT service wrapper for Tomcat while trying to overcome the user logoff
problem that JDK 1.3.0 has.  I can see one promising possibility.  The
service wrapper uses the wrapper.properties file in the conf sub-directory
to form a command line that is used to launch Tomcat in a separate process.
You can see the commandline in the last line of the file.  You could
possibly rewrite the command line to instead run the command processor
(cmd.exe) with a batch file that would run your command and than start
Tomcat.  I'm at home and most of my research was done at work so if you have
questions or problems post them and I'll consult my notes at work.

Any number problems could come up with this arrangement.

1). The way the service wrapper launches the sub-process might prevent the
command processor from being launched as desired.
2). The context your running in (i.e. as a service and under the system
account) might make interacting with ClearCase difficult.  Pathing and
security are the two most likely issues here.
3). If the ClearCase command takes to long it will causes the service
manager to think the service has failed and shut things down.

Good luck,
Keith Gross

- Original Message -
From: Boyce, David [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, April 24, 2001 3:48 PM
Subject: Tomcat and NT service via wrapper script?


 Short version: I need to run Tomcat as a service on NT (and know how to do
 so) but need a hook to run an arbitrary command as part of the service
 startup.
 Details: I'm running Tomcat out of a ClearCase view (for those unfamiliar,
 ClearCase is a dynamic filesystem abstraction with a metalanguage allowing
 you to specify which versions of files you want to see, e.g. the state as
 of 3:34 PM yesterday or my changes but no one else's, etc. But note
that
 my problem has nothing to do with ClearCase per se). Running in a view has
 many advantages, especially for development, as deployment (or rollback)
 becomes as simple as changing a line of metalanguage to select newer (or
 older) versions.

 However, the use of ClearCase is a red herring; the only concern is that
the
 view must be started with the command cleartool startview view-name
 before Tomcat runs. I'm doing this on UNIX now and it works just great
with
 a little bit of scripting. But I now need to do the same thing on Windows;
 unfortunately the whole service business there seems pretty intractable.
 All I need is a hook to run the startview command prior to Tomcat startup
 but I haven't been able to dig up documentation on how or whether it can
be
 done.

 To save time let me enumerate what I don't need: I know how to run Tomcat
as
 a service on NT and have done so successfully. I'm aware of the JDK 1.3.0
 bug which affects this. I realize that ClearCase (which also runs as a
 service on NT) must be started prior to Tomcat and have read up on how to
 edit service dependencies in the registry. All I still need is a way to
run
 an arbitrary command (which happens in my case to be cleartool
startview)
 as part of the service startup sequence. Has anyone done something
similar?

 Thanks in advance,
 David Boyce




RE: Java Update on Linux

2001-04-12 Thread Boyce, David

That's not a release, it's a release *candidate*. A big difference.

-Original Message-
From: Hunter Hillegas [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 12, 2001 11:27 AM
To: Tomcat User List
Subject: Java Update on Linux


Anyone tried the JDK1.3.1 that Sun released recently for Linux?

They claim reliability enhancements... Just wondering.

Hunter



macro expansion in server.xml?

2001-04-03 Thread Boyce, David

I have an intranet web app which must run on perhaps a couple of dozen
widely distributed Tomcat containers; some on Solaris, some Windows NT,
maybe Linux and AIX later. In  this situation the toughest challenge isn't
writing the web app per se but in maintaining the many containers, tweaking
server.xml et al manually for each. I've been experimenting with using a
Network Appliance (a fileserver that can serve UNIX via NFS and Windows via
SMB) to hold a single physical copy of Tomcat such that all these containers
are running from a single pile of bits. This is actually working quite
nicely so far except for a little holdup - they all want to write their
logfiles to the same place. So I'm wondering if there's a way to put
logfiles in, say, $TOMCAT_HOME/$HOSTNAME or otherwise indirect through a
macro/property besides TOMCAT_HOME.

I've tried setting the log paths in server.xml to absolute pathnames e.g.
/var/log/tomcat/... which works on UNIX but not Windows. Same for C:/log in
reverse; it has to be a relative path for interop reasons. Does anybody have
successful experience or ideas in this area?

Thanks,
David Boyce