Re: advise on updating some commons packages

2003-07-16 Thread Kevin HaleBoyes

--- Tim Funk [EMAIL PROTECTED] wrote:
 Yes thats ok.
 
 You don't need to be wary as long as you Test test test
 
 -Tim
 

Thanks Tim.
I will indeed test.  I've got it all setup on my development
machine and won't be committing for some time.
Kevin.


__
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

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



advise on updating some commons packages

2003-07-15 Thread Kevin HaleBoyes
I'm using Tomcat 4.1.24 and Struts in my web application.
I've just migrated to the final release of Struts and have run
into a few problems.

As many of you are aware, Struts removed commons-pool and
commons-dbcp from their distribution.  As it turns out, the releases
that they had provided in the RC (and beta) releases were newer than
those shipped with Tomcat 4.1.24.  In particular, many of the
delegate classes supported the getDelegate() method in the newer
releases.  I was using those in my application as I needed to operate
on the underlying ResultSet (Oracle).

Now that commons-pool and commons-dbcp are not provided my
application uses those provided with Tomcat but as I mentioned above
getDelegate() isn't available.

To fix it,
I've checked out commons from cvs and rebuilt the commons-collection,
commons-pool, and commons-dbcp packages and dropped them into
CATALINA_HOME/common/lib replacing the packages that shipped with
Tomcat.

My questions are:
Is this OK?
What are the issues that I should be aware of?

Thanks for your help
Kevin.

__
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

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



faking a JNDI context

2003-03-07 Thread Kevin HaleBoyes
First off, Craig, I hope it is not inappropriate for me to CC you
directly.

There was a discussion many months ago, on this list, about the
benifits of using the JNDI mechanism for getting DataSource objects.
The basic code is as follows:

Context initCtx = new InitialContext();
Context envCtx = (Context)initCtx.lookup(java:comp/env);
DataSource ds = (DataSource)envCtx.lookup(jdbc/Db);
Connection conn = ds.getConnection();

This requires the proper setup in the server.xml and web.xml
configuration files.

I've been using this for some time now and it works great.

In that discussion, Craig mentioned how to use that same code when
outside of the (Tomcat) servlet environment, for example in a 
stand-alone application.  IIRC, the trick was to instantiate
a DataSource and to put it into the proper context.  Craig even gave
sample code to do that.

I'm after that code.  I've searched the archive but that has proved
to be difficult in that I can't narrow down the search adequately.

Can anyone point me to that discussion in the archives or provide
this sample code?

Thanks,
Kevin.


__
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/

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



RPM release of 4.1.18 (full) ?

2003-01-03 Thread Kevin HaleBoyes
Is there a plan to release Tomcat 4.1.18 (full) in RPM format?
What is involved in producing the RPM?

Thanks,
Kevin.

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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




RE: help with DataSourceRealm in 4.1.17

2002-12-20 Thread Kevin HaleBoyes

--- Roberts, Eric [EMAIL PROTECTED] wrote:
 Hi,
 
 Try just jdbc/db.

Yeah, I've tried every combination that I can - jdbc/Db, /jdbc/Db,
env/jdbc/Db, /env/jdbc/Db, etc. up to java:comp/env/jdbc/Db.
None work.  Again, I think it is a timing issue where the Realm
is initialized before the JNDI resources.  I'm going to try putting
the CML context definition in server.xml instead of in its own
file.

K.

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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




help with DataSourceRealm in 4.1.17

2002-12-19 Thread Kevin HaleBoyes
I've been using JDBCRealm successfully in my application but
jumped on the DataSourceRealm when I saw it in 4.1.17.

So, I replaced my JDBCRealm definition to the DataSourceRealm
but have run into a problem.  I have the following in the
CATALINA_HOME/webapps/cml.xml file:

Context path=/cml
  docBase=/usr/local/jakarta/cml
debug=99
   privileged=false

Resource name=jdbc/Db auth=Container
type=javax.sql.DataSource/
ResourceParams name=jdbc/Db
parameternamefactory/name
  
valueorg.apache.commons.dbcp.BasicDataSourceFactory/value/parameter
parameternamedriverClassName/name
  
valueoracle.jdbc.OracleDriver/value/parameter
parameternameurl/name
  
valuejdbc:oracle:thin:@200.65.6.188:1521:tiggs9i/value/parameter
parameternameusername/name
   valuecml/value/parameter
parameternamepassword/name
   valuecml/value/parameter
parameternamemaxActive/name
   value20/value/parameter
parameternamemaxIdle/name
   value10/value/parameter
parameternamemaxWait/name
   value-1/value/parameter
parameternamevalidationQuery/name
   valueselect sysdate from
dual/value/parameter
/ResourceParams

Realm  className=org.apache.catalina.realm.DataSourceRealm
debug=99
   dataSourceName=java:comp/env/jdbc/Db
userTable=mmis_users
  userNameCol=user_name
  userCredCol=user_pass
userRoleTable=mmis_user_roles
  roleNameCol=role_name
   digest=MD5
/
/Context




I know the jdbc/Db JNDI resource is configured properly because
I'm able to access the datasource from the application using:

Context initCtx = new InitialContext();
Context envCtx = (Context)initCtx.lookup(java:comp/env);
DataSource ds = (DataSource)envCtx.lookup(jdbc/Db);
return ds.getConnection();

but when Tomcat starts up I get the following error:

2002-12-19 14:55:01 DataSourceRealm[/cml]: Exception performing
authentication
javax.naming.NameNotFoundException: Name java:comp is not bound in
this Context
at
org.apache.naming.NamingContext.lookup(NamingContext.java:811)
at
org.apache.naming.NamingContext.lookup(NamingContext.java:194)
at
org.apache.catalina.realm.DataSourceRealm.open(DataSourceRealm.java:463)
at
org.apache.catalina.realm.DataSourceRealm.start(DataSourceRealm.java:582)
at
org.apache.catalina.core.StandardContext.start(StandardContext.java:3543)
etc...


I even tried using
   dataSourceName=java:/comp/env/jdbc/Db
in the Realm definition (note the slash after the colon as
was shown in the Realm HOW-TO) but this gave a similar exception.

Does anyone know what name I should use for the data source?
Thanks,
Kevin.


__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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




Re: help with DataSourceRealm in 4.1.17

2002-12-19 Thread Kevin HaleBoyes
Replying to my own email...

I think I can see the problem but I'm no further ahead in solving
it.  It seems to be a timing issue.  The realm is being configured
before the Resource is added.

In the localhost_cml_log.2002-12-19.txt file I can see the Realm
error (NameNotFoundException) before the messages for the
NamingContextListener.

2002-12-19 15:54:40 NamingContextListener[/Standalone/localhost/cml]:
Creating JNDI naming context
2002-12-19 15:54:40 NamingContextListener[/Standalone/localhost/cml]:
  Resource parameters for jdbc/Db = ResourceParams[name=jdbc/Db,
parameters={url=jdbc:oracle:thin:@200.65.6.188:1521:tiggs9i,
validationQuery=select sysdate from dual, maxIdle=10, maxActive=20,
driverClassName=oracle.jdbc.OracleDriver, maxWait=-1, username=cml,
factory=org.apache.commons.dbcp.BasicDataSourceFactory,
password=cml}]
2002-12-19 15:54:40 NamingContextListener[/Standalone/localhost/cml]:
  Adding resource ref jdbc/Db

I've considered moving the Resource definitions into the server.xml
file to see if that fixes the problem but that solution is not
desirable as I'd like to keep everything to do with my webapp in
the cml.xml file.

Help would be appreciated.
Kevin.

P.S.  I've included tomcat-dev to the recipients as it seems to be
an internals thing and less of a user issue.  Sorry if I'm wrong
and it doesn't belong on the dev list.



--- Kevin HaleBoyes [EMAIL PROTECTED] wrote:
 I've been using JDBCRealm successfully in my application but
 jumped on the DataSourceRealm when I saw it in 4.1.17.
 
 So, I replaced my JDBCRealm definition to the DataSourceRealm
 but have run into a problem.  I have the following in the
 CATALINA_HOME/webapps/cml.xml file:
 
 Context path=/cml
   docBase=/usr/local/jakarta/cml
 debug=99
privileged=false
 
 Resource name=jdbc/Db auth=Container
 type=javax.sql.DataSource/
 ResourceParams name=jdbc/Db
 parameternamefactory/name
   

valueorg.apache.commons.dbcp.BasicDataSourceFactory/value/parameter
 parameternamedriverClassName/name
   
 valueoracle.jdbc.OracleDriver/value/parameter
 parameternameurl/name
   

valuejdbc:oracle:thin:@200.65.6.188:1521:tiggs9i/value/parameter
 parameternameusername/name
valuecml/value/parameter
 parameternamepassword/name
valuecml/value/parameter
 parameternamemaxActive/name
value20/value/parameter
 parameternamemaxIdle/name
value10/value/parameter
 parameternamemaxWait/name
value-1/value/parameter
 parameternamevalidationQuery/name
valueselect sysdate from
 dual/value/parameter
 /ResourceParams
 
 Realm  className=org.apache.catalina.realm.DataSourceRealm
 debug=99
dataSourceName=java:comp/env/jdbc/Db
 userTable=mmis_users
   userNameCol=user_name
   userCredCol=user_pass
 userRoleTable=mmis_user_roles
   roleNameCol=role_name
digest=MD5
 /
 /Context
 
 
 
 
 I know the jdbc/Db JNDI resource is configured properly because
 I'm able to access the datasource from the application using:
 
 Context initCtx = new InitialContext();
 Context envCtx = (Context)initCtx.lookup(java:comp/env);
 DataSource ds = (DataSource)envCtx.lookup(jdbc/Db);
 return ds.getConnection();
 
 but when Tomcat starts up I get the following error:
 
 2002-12-19 14:55:01 DataSourceRealm[/cml]: Exception performing
 authentication
 javax.naming.NameNotFoundException: Name java:comp is not bound in
 this Context
 at
 org.apache.naming.NamingContext.lookup(NamingContext.java:811)
 at
 org.apache.naming.NamingContext.lookup(NamingContext.java:194)
 at

org.apache.catalina.realm.DataSourceRealm.open(DataSourceRealm.java:463)
 at

org.apache.catalina.realm.DataSourceRealm.start(DataSourceRealm.java:582)
 at

org.apache.catalina.core.StandardContext.start(StandardContext.java:3543)
 etc...
 
 
 I even tried using
dataSourceName=java:/comp/env/jdbc/Db
 in the Realm definition (note the slash after the colon as
 was shown in the Realm HOW-TO) but this gave a similar exception.
 
 Does anyone know what name I should use for the data source?
 Thanks,
 Kevin.
 
 
 __
 Do you Yahoo!?
 Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
 http://mailplus.yahoo.com
 
 --
 To unsubscribe, e-mail:  
 mailto:[EMAIL PROTECTED]
 For additional commands, e-mail:
 mailto:[EMAIL PROTECTED]
 


__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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




Re: build.xml for Ant/JspC

2002-10-03 Thread Kevin HaleBoyes

 There is a snippet of the build.xml that we use for jsp
compilation.

I'm lurking on this thread but wanted to ask:
What is your classpath refid=all-classpath / set to?
I've attempted JspC but I get class-not-found errors and when I
resolve them I get problems with the endorsed/sealed XML classes.

In the end I resorted to calling jspc.sh as shipped with Tomcat
as it seems to manage the classpath properly:

exec executable=/bin/sh
arg line=${catalina.home}/bin/jasper.sh/
arg line=jspc/
arg line=-webapp ${build.home}/
arg line=-webinc ${build.jspc.home}/webinc.xml/
arg line=-uriroot ${build.home}/
arg line=-p com.mydomain/
arg line=-d ${build.jspc.home}/
arg line=-v/
/exec

In answer to another posters question (sorry, I don't remember
who it was), once the above call to jspc.sh finishes I then call
the java compiler as follows:

javac srcdir=${build.jspc.home}
  destdir=${build.home}/WEB-INF/classes
debug=${compile.debug}
  deprecation=${compile.deprecation}
 optimize=${compile.optimize}
classpath refid=compile.classpath/
include name=**/*.java/
/javac

Thanks,
Kevin.


__
Do you Yahoo!?
New DSL Internet Access from SBC  Yahoo!
http://sbc.yahoo.com

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




Digested Passwords and the server/lib/catalina.jar file

2002-09-10 Thread Kevin HaleBoyes

I am using JDBC Realms in my application with digested passwords.
Specifically the MD5 digest.  I need to programatically digest
passwords entered into the application for storage in the users
table (when a new user is created or password changed).

In the Digested Passwords section of the Realm HOWTO (Tomcat 4.1.10)
there is a description of using the static Digest().  In order to use
this method then I must, and I quote

   To use either of the above techniques, the
$CATALINA_HOME/server/lib/catalina.jar file will need to be
on your class path to make the RealmBase class available.

There are a few ways to do this.  I could copy the catalina.jar file
to my web application WEB-INF/lib directory.  Or, I could copy the
catalina.jar file to $CATALINA_HOME/common/lib.

I don't like the first method as it is error prone when I move to
the next version of Tomcat (and forget to replace the cataline.jar
file).  So I'll probably go with the second method and copy the
.jar file to the common/lib directory.

Should I move the file instead of copying it?
Could I create a symbolic link instead of copying?
Is there a better way to do this?

Thanks,
Kevin.


__
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com

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




Re: Digested Passwords and the server/lib/catalina.jar file

2002-09-10 Thread Kevin HaleBoyes

 From: [EMAIL PROTECTED]

Moving a Tomcat server .jar file does not seem like a
comfortable option-- it is like moving system
libraries the OS depends on to a shareable area
because you do not like them where they currently are
located-- but if it works and you feel comfortable
with it then use it.  I hope this helps.

I'm not sure that comfort is really a goal or option here.
I'm simply following advice from the author of the Realm
HOWTO (Craig?).  The specific method wasn't given nor was
a recomendation made so I'm trying to figure out the best
way to proceed.  I suppose there is a third option - extract
the code from Catalina Realm and insert it into my application.
I've done that on a previous contract but it didn't seem like
the best solution either.

Isn't this a very common problem that almost everyone on the
list has faced?  Well, everyone that uses Realms with MD5 digested
passwords.


Anyway, thank you very much for your help.
Kevin.


__
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com

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




Re: Automatic start from /etc/rc3.d ???

2002-06-06 Thread Kevin HaleBoyes

The original message is at the end...

I'm using RedHat linux but I suspect the solution is very similar.

I've created a user tomcat4 in the already existing apache group.
Login is disabled for this user for security reasons.  The
jakarta-tomcat-4.0.3 directory is owned by root with 777 perms
on the work and logs subdirectories.  On further thought I suppose
I could have chown'd those directories to tomcat4.apache with 755
perms.

I've created a file /etc/sysconfig/tomcat4 as follows:

-%--
export JAVA_HOME=/usr/java/j2sdk1.4.0

export CATALINA_BASE=/usr/local/jakarta/jakarta-tomcat-4.0.3
export CATALINA_HOME=$CATALINA_BASE
-%--

This gets referenced/sourced in the init script which is
named /etc/rc.d/init.d/tomcat4.  It is heavily based on
the httpd init script.  It doesn't do status yet and the locking
hasn't been tested but it seems to work ok otherwise.

I then run 'chkconfig --add tomcat4' to install it in the proper
runlevel directories.  There may also be a problem with the
order on shutdown but I'm not sure.  I think I might be trying
to shutdown postgresql before tomcat which ends up blocking, so
the shutdown fails.  At least, I think that is what happens.  YMMV.

I ask one favour.  If you improve upon this script then please post
your changes as there has been a real lack of this sort of tomcat
infrastructure postings.  Now, I'm just as guilty since I meant to
post this long ago but ended up forgetting...

Kevin

-%--
#!/bin/bash
#
# Startup script for the Apache Tomcat JSP/Servlet Container
#
# chkconfig: 345 85 15
# description: Apache Tomcat is a JSP/Servlet container.  It is used to serve \
#  JSP pages and execute servlets.
# processname: XXX - fixme - XXX
# pidfile: none
# lockfile: /var/lock/subsys/tomcat4
# config: $CATALINA_HOME/conf/server.xml
# config: /etc/sysconfig/tomcat4

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

# Source additional OPTIONS if we have them.
if [ -f /etc/sysconfig/tomcat4 ] ; then
. /etc/sysconfig/tomcat4
fi

prog=tomcat4

start() {
echo -n $Starting $prog: 
#daemon $httpd `moduleargs` $OPTIONS
su tomcat4 ${CATALINA_HOME}/bin/catalina.sh start $21
RETVAL=$?
echo
[ $RETVAL = 0 ]  touch /var/lock/subsys/tomcat4
return $RETVAL
}
stop() {
echo -n $Stopping $prog: 
#killproc $httpd
su tomcat4 ${CATALINA_HOME}/bin/catalina.sh stop $21
RETVAL=$?
echo
[ $RETVAL = 0 ]  rm -f /var/lock/subsys/tomcat4 /var/run/tomcat4.pid
}
status() {
echo -n $Status $prog: not implemented yet!
echo
RETVAL=1
}

case $1 in
  start)
start
;;
  stop)
stop
;;
  restart)
stop
sleep 20
start
;;
  *)
echo $Usage: $prog {start|stop|restart}
exit 1
esac

exit $RETVAL

-%--



Original message follows:

Hi all,

Using SOLARIS 2.8, Tomcat 4.0.2 on a SUN 220R Server

Well my Tomcat engine is runnin' under a special user, let's say
wildcat.

I'm  looking for a way to automatically start this engine at system
boot, like i do with Apache.

Apache has a special way - start by root and change user to handle the
processes - to do the trick, but not Tomcat.

Does any one knows about a restriction to use smth like su wildtiger -c
'$TOMCAT_HOME/bin/startup.sh'...

Any suggestions welcome.

Jean-Luc :O)




__
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

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




RE: tomcat/apache with ALIASES (Was canonical names)

2002-04-26 Thread Kevin HaleBoyes

I've run into a similar problem and never came to a solid conclusion.
I had setup mod_webapp connector between Apache/Tomcat and whenever
I accessed dynamic content my URL would get rewritten to the value
of the ServerName (in httpd.conf).  I think it has something to do with
UseCanonicalName setting (also in httpd.conf) but I'm really not sure.

I didn't have any Host settings (in server.xml);  I didn't even
have a Context setting and just let Tomcat autoload my application.

I suppose this doesn't help much but I wanted to add a data point.

K.


 From: Brian Bernardo [EMAIL PROTECTED]
 To: 'Tomcat Users List' [EMAIL PROTECTED]
 Subject: RE: tomcat/apache with ALIASES (Was canonical names)
 Date: Thu, 25 Apr 2002 09:50:22 -0700
 
 First of all, I am very proficient with DNS; that was not the question.  I
 want users who go to http://name.domain/webapps to have the same
 webappdeployment as http://name2.domain/webapps.  It is important that
 however they got there (domain prefix) be maintained throughout their
 session.  This works fine for static content, but as soon as anyone goes to
 http://name?.domain/webapps they get redirected over to
 http://ServerName/webapps.  ServerName is defined within the apache
 httpd.conf file (same with vitualhost name).  That is not good.  There has
 to be a way to have either virtual hosts or some method for tomcat to serve
 the same dynamic content regardless of how they got there without
 redirecting.  
 
 Any one know how to accomplish this?
 
 B



__
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




mod_webapp configuration question

2002-03-13 Thread Kevin HaleBoyes

In my httpd.conf file I've got:

ServerName 192.168.0.147

LoadModule webapp_module modules/mod_webapp.so
WebAppConnection warpConnection warp 192.168.0.147:8008

NameVirtualHost *
VirtualHost *
ServerName 192.168.0.147
WebAppInfo   /webapp-info
WebAppDeploy mywebappwarpConnection /
#   WebAppDeploy manager warpConnection /manager/
/VirtualHost VirtualHost *
ServerName 192.168.0.52
WebAppInfo   /webapp-info
WebAppDeploy mywebappwarpConnection /# this is line 1
#   WebAppDeploy manager warpConnection /manager/

Alias /awstats /var/www/awstats
Directory /var/www/awstats
SetHandler perl-script
PerlHandler Apache::Registry
Options +ExecCGI
/Directory
/VirtualHost

My server.xml files is unchanged from the Tomcat 4.0.3 distribution.

My mywebapp is deployed at 192.168.0.52:8080/mywebapp/ and because of
the warp connection (labelled line 1) it is the home page for requests to
http://192.168.0.52/ and It works fine.

What I'm trying to configure is access to /awstats on the URL
http://192.168.0.52/awstats/awstats.pl but
currently I get an error from Tomcat
Apache Tomcat/4.0.3 - HTTP Status 404 - /awstats/awstats.pl

If I comment out line 1 in the 192.168.0.52 virtual host
and restart the httpd/tomcat4 processes, I can then access
awstats.

How can I have both awstats and mywebapp accessible in the
192.168.0.52 virtual host?

Thanks,
Kevin.



__
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: log analysis tools

2002-03-13 Thread Kevin HaleBoyes


 Date: Wed, 13 Mar 2002 07:03:13 -0800 (PST)
 From: Lauren Commons [EMAIL PROTECTED]
 Subject: log analysis tools
 To: [EMAIL PROTECTED]
 
 I'm looking for suggestions of access log analysis
 tools, such as webalyzer or logjack.

I've just installed awstats from http://awstats.sourceforge.net/
and so far it looks great.

  But I'd like a
 servlet so that my client (who I'm building the site
 for) can view and update the stats on demand from a
 JSP/servlet based administration site I'm also
 building for him.

It's perl based.  I'm running Redhat 7.2, apache, tomcat 4,
mod_perl, mod_webapp, and
awstats just plugged into the /var/www/awstats directory with
a slight twist of httpd.conf.

The stats can be viewed using most web browsers and you can
either protect access or leave it open.  The stats aren't
regenerated for each request.

Updates by awstats are usually scheduled using cron or similar,
and the documentation has suggestion for the frequency of the
updates.  The updates are performed by running the awstats.pl
script so you could probably arrange for a servlet to do that
for you on demand.

 at a minimum, I'd like hits by page and totals per
 hour/day/month, so he knows how many visitors, plus
 which pages they visit.

I suspect this is all provided by awstats.  I'm still in
the process of evaluation...

  Up to the minute stats would
 be good, but I'd prefer to make the user explicitly
 request an update so that every call to the report
 jsp/html page doesn't trigger a log file analysis.

see above.

Kevin.

 =
 -
 Mr Lauren Commons
 DISCLAIMER: The opinions expressed 
 ARE in fact those of my employer.


__
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




YAMWQ - Yet Another Mod_Webapp Question

2002-01-31 Thread Kevin HaleBoyes

This may seem long but I wanted to include anything
I thought was relevant.

  CATALINA_HOME=/usr/local/jakarta/jakarta-tomcat-4.0.2-b2
  JAVA_HOME=/usr/java/jdk1.3.1_02

I added a new Host entry to server.xml for my new website.
This is the only change I made to the stock server.xml.

   Host name=192.168.0.52 debug=0 appBase=webapps unpackWARs=true
 Realm className=org.apache.catalina.realm.MemoryRealm /

 Valve className=org.apache.catalina.valves.AccessLogValve
  directory=logs  prefix=192.168.0.52_access_log.
suffix=.txt
  pattern=common/

 Logger className=org.apache.catalina.logger.FileLogger
prefix=192.168.0.52_log. suffix=.txt timestamp=true/

 Context path=/manager docBase=manager debug=0 privileged=true/

 Context path= docBase=NewWebsite debug=0 reloadable=true
   Logger className=org.apache.catalina.logger.FileLogger
  prefix=NewWebsite_log. suffix=.txt timestamp=true/
 /Context
   /Host

This works great.  When I point my browser at http://192.168.0.52:8080/
I get my home page and the JSP/servlet stuff works as expected.

Like so many other, the next step is to set up the
Warp connector so that I can front Tomcat with Apache.

I changed the stock httpd.conf (RedHat 7.2 i386) by adding a
new VirtualHost section to correspond to NewWebsite above.
I installed mod_webapp.so from the downloaded webapp-module-1.0.2-tc402
archive.

   NameVirtualHost 192.168.0.52

   LoadModule webapp_module modules/mod_webapp.so
   WebAppConnection warpConnection warp 192.168.0.52:8008
   WebAppDeploy examples warpConnection /examples/

   VirtualHost 192.168.0.52
   ServerName 192.168.0.52
   WebAppDeploy NewWebsite warpConnection /
   /VirtualHost

The address 192.168.0.52 will eventually become a properly
DNS-registered name www.NewWebsite.com (names and ip
addresses may have been changed to protect the guilty).

The intention is to have any request for http://192.168.0.52/ be
redirected by mod_webapp to the NewWebsite Tomcat context.
But that is not what happens.  Instead, the browser sits as if
it is loading something that never comes and there are no
messages in any of the apache  tomcat log files on the server.
Not even an access log entry.

On startup of httpd I get the following message in the httpd
error log.

  [Thu Jan 31 12:49:58 2002] [warn] Loaded DSO modules/mod_webapp.so uses
plain Apache 1.3 API, this module might crash under EAPI! (please recompile it
with -DEAPI)
  [Thu Jan 31 12:49:59 2002] [notice] Apache/1.3.20 (Unix)  (Red-Hat/Linux)
mod_python/2.7.6 Python/1.5.2 mod_ssl/2.8.4 OpenSSL/0.9.6b DAV/1.0.2 PHP/4.0.6
mod_perl/1.24_01 mod_throttle/3.1.2 configured -- resuming normal operations
  [Thu Jan 31 12:49:59 2002] [notice] suEXEC mechanism enabled (wrapper:
/usr/sbin/suexec)
  [Thu Jan 31 12:53:08 2002] [error] Connection warpConnection cannot
connect
  [Thu Jan 31 12:53:08 2002] [error] Cannot open connection warpConnection
  [Thu Jan 31 12:53:08 2002] [error] Connection warpConnection cannot
connect
  [Thu Jan 31 12:53:08 2002] [error] Cannot open connection warpConnection
  [Thu Jan 31 12:53:08 2002] [error] Connection warpConnection cannot
connect
  [Thu Jan 31 12:53:08 2002] [error] Cannot open connection warpConnection
  [Thu Jan 31 12:53:08 2002] [error] Connection warpConnection cannot
connect
  [Thu Jan 31 12:53:08 2002] [error] Cannot open connection warpConnection
  [Thu Jan 31 12:53:08 2002] [error] Connection warpConnection cannot
connect
  [Thu Jan 31 12:53:08 2002] [error] Cannot open connection warpConnection
  [Thu Jan 31 12:53:08 2002] [error] Connection warpConnection cannot
connect
  [Thu Jan 31 12:53:08 2002] [error] Cannot open connection warpConnection
  [Thu Jan 31 12:53:08 2002] [error] Connection warpConnection cannot
connect
  [Thu Jan 31 12:53:08 2002] [error] Cannot open connection warpConnection
  [Thu Jan 31 12:53:08 2002] [error] Connection warpConnection cannot
connect
  [Thu Jan 31 12:53:08 2002] [error] Cannot open connection warpConnection
  [Thu Jan 31 12:53:08 2002] [error] [client 192.168.0.15] File does not
exist: /var/www/html/NewContext
  [Thu Jan 31 12:54:38 2002] [error] [client 192.168.0.15] File does not
exist: /var/www/html/NewContext/


So I should probably first address the [warn] about EAPI.

I've got jakarta-tomcat-connectors-4.0.2-b2-src.tar.gz  and
jakarta-tomcat-connectors-4.0.2-b2.patch from
tomcat4-4.0.2-b2.1.src.rpm
(though I can't remember where I got that src rpm?).

I've unpacked it and am about to dive in but I thought I'd check
with the group here to see if I'm going along the right track.

Should the above configuration work (once I get rid of the EAPI problem
with my freshly compiled mod_webapp.so)?

One of the strange things (to me) is
the setup I've shown here is the actual production machine that I'm
trying to prepare.
My development/test machine OS/Apache is very similar (RedHat 7.1 instead)
and a very similar setup works fine.


Thanks

Re: Tomcat-as-an-NT-service startup failure

2002-01-07 Thread Kevin HaleBoyes

Thanks for your help Andrew.

First to answer some of the points made:
I didn't install the jk_nt_service component since Tomcat already worked
as a service.  Ie., I could start and stop it from the NT service manager.

I only have one JDK installed on the machine though there is also a JRE
installed.  Tomcat, during installation, identified the JDK properly.

I uninstalled Tomcat from the machine and started again.  This time
I rebooted after (almost) every step.  The result:  Tomcat now starts
properly as a service at boot time!  I don't know why there is a difference
based on the number of times I rebooted during the install!  Tomcat can
also serve content when I access it directly on the 8080 port.

I do still have one problem though.
I can't get the redirection between IIS and Tomcat to work properly.

I added the jakarta virtual directory
(points to bin\native in the Tomcat installation directory) and I ensured
that execute permission is enabled.  The isapi_redirect.dll exists in the
bin\native directory.

I also added the ISAPI filter (isapi_redirect.dll) using the IIS manager
and it shows up with the green arrow.  I also enabled the AJP connector in
the server.xml file and set the following in the uriworkermap.properties
file:
 default.worker=ajp13
 /*.jsp=$(default.worker)

When I access a jsp page I get the following error in the IIS log files:

2002-01-07 17:55:59 192.168.0.173 - 196.32.42.57 80 GET
/jakarta/isapi_redirect.dll - 404
Mozilla/5.0+(Windows;+U;+Windows+NT+5.0;+en-US;+rv:0.9.7)+Gecko/20011221

I get that message and then a whole bunch of garbage (ascii barf) with some
recognizable text:

ATETIME_FORMATS@@AAE@ABV0@@Z ??0EXTLOG_DATETIME_CACHE@@QAE@XZ
??0HASH_TABLE@@QAE@ABV0@@Z ??0HTTP_HEADERS@@QAE@XZ ??0HT_ELEMENT@@QAE@ABV0@@Z
??0HT_ELEMENT@@QAE@XZ ??0IIS_CTL@@QAE@ABV0@@Z ??0IIS_SERVER_CERT@@QAE@ABV0@@Z
??0IIS_SERVICE@@QAE@ABV0@@Z ??0IIS_SSL_INFO@@QAE@ABV0@@Z
??0LOGGING@@QAE@ABV0@@Z ??0MULTISZ@@QAE@ABV0@@Z ??0MULTISZ@@QAE@PADK@Z
??0MULTISZ@@QAE@PBD@Z ??0MULTISZ@@QAE@XZ ??0PARAM_LIST@@QAE@XZ
??0STR@@QAE@ABV0@@Z ??0STR@@QAE@K@Z ??0STR@@QAE@PADK@Z ??0STR@@QAE@PBD@Z
??0STR@@QAE@XZ ??0TS_RESOURCE@@QAE@XZ ??0W3_DATETIME_CACHE@@QAE@XZ
??1ADDRESS_CHECK@@QAE@XZ ??1ASCLOG_DATETIME_CACHE@@UAE@XZ
??1BUFFER_CHAIN@@QAE@XZ ??1BUFFER_CHAIN_ITEM@@QAE@XZ
??1CACHED_DATETIME_FORMATS@@UAE@XZ ??1DICTIONARY_MAPPER@@UAE@XZ
??1EXTLOG_DATETIME_CACHE@@UAE@XZ ??1HASH_TABLE@@UAE@XZ ??1HTTP_HEADERS@@QAE@XZ
??1HTTP_HEADER_MAPPER@@UAE@XZ ??1HT_ELEMENT@@UAE@XZ ??1MULTISZ@@QAE@XZ
??1PARAM_LIST@@QAE@XZ ??1STR@@QAE@XZ ??1TS_RESOURCE@@QAE@XZ
??1W3_DATETIME_CACHE@@UAE@XZ ??

I'm not sure where to go from here so any help and or comments
would be greatly appreciated.

Kevin.


 --- Andrew Bruno [EMAIL PROTECTED] wrote: 
 Hi Kevin,
 
 in my document there could be a mistake.
 
 tomcat binary comes pre-installed with the NT Service, so there is no need to
 install the second jk_nt_service
 
 Look in your services, and see if you see if you see a service named Apache
 Tomcat with executabel path being C:\tomcat4\bin\tomcat.exe
 
 Then you will probably have a second service (as specified in my doc) which
 you created with jk_nt_service
 
 Please let me know if this is the case.
 
 Also, do you have only one JVM installed?  I read some posting about people
 have two JVMs, which caused some problems?
 
 ~ Andrew
 
 
   - Original Message - 
   From: Kevin HaleBoyes 
   To: [EMAIL PROTECTED] 
   Sent: Saturday, December 15, 2001 4:01 AM
   Subject: Tomcat-as-an-NT-service startup failure
 
 
   I just installed j2sdk1.3.1, Tomcat4, and the IIS redirector stuff
   posted by Andrew Bruno.  It all seems to work fine except on the
   initial startup of the machine.  If I manually start the Tomcat
   service then everything works great but when I reboot the machine,
   the Tomcat service _fails_ to start.  I get the following message
   in the application section of the Event Viewer: The Java Virtual
   Machine has exited with a code of 1, the service is being stopped.
 
   But, like I said above, I can then go into the service admin program
   and start Tomcat. Does anyone have any idea why the JVM is exiting
   or how I can find out what it all means (what is code 1)?
 
   I'm using the latest jdk, tomcat, redirector on Win2K
(+sp1+hot patches).
 
   Thanks,
   Kevin.



__
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Tomcat-as-an-NT-service startup failure

2001-12-14 Thread Kevin HaleBoyes

I just installed j2sdk1.3.1, Tomcat4, and the IIS redirector stuff
posted by Andrew Bruno.  It all seems to work fine except on the
initial startup of the machine.  If I manually start the Tomcat
service then everything works great but when I reboot the machine,
the Tomcat service _fails_ to start.  I get the following message
in the application section of the Event Viewer: The Java Virtual
Machine has exited with a code of 1, the service is being stopped.

But, like I said above, I can then go into the service admin program
and start Tomcat. Does anyone have any idea why the JVM is exiting
or how I can find out what it all means (what is code 1)?

I'm using the latest jdk, tomcat, redirector on Win2K
 (+sp1+hot patches).

Thanks,
Kevin.


__
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Repost: taglib and rtexprvalue problem/bug

2001-09-11 Thread Kevin HaleBoyes

I posted this the other day but no one responded.
I've since moved from Tomcat 4.0-b7 to 4.0-rc1 and the
problem still exists so I thought I would try again...


I have one jsp that jsp:include's another and augments the
request parameters using jsp:param.  The included jsp uses a
taglib tag with the rtexprvalue attribute set to true.

The problem is I keep getting the following exception when I use
an expression in the attribute field:

org.apache.jasper.compiler.ParseException:
/WEB-INF/jsp/od.jsp(12,53) Attribute from has no value

Here is the taglib.tld excerpt:

!DOCTYPE taglib
   PUBLIC -//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN
   http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd;

tag
 nameorderDetail/name
 tagclasstaglib.orddet.OrderDetailsTag/tagclass
 bodycontentJSP/bodycontent
 info/info

 attribute
  namefrom/name
  requiredtrue/required
  rtexprvaluetrue/rtexprvalue
 /attribute
/tag

The outer jsp file is simple:

 htmlheadtitleTest/title/head
 bodycenterh1Test/h1/center
 jsp:include page=/WEB-INF/jsp/od.jsp
   jsp:param name=from value=p:D/
 /jsp:include
 /body/html

And the included jsp file isn't much more complicated:

%@ taglib uri=/WEB-INF/tlds/taglib.tld prefix=opf %

preod.jspbr /
%= request.getParameter(from) %/pre

opf:orderDetail from=%= request.getParameter(from) %
  PO Number:opf:orderAttr attribute=ponumber/
/opf:orderDetail

If I use the included file as shown then I get the
'Attribute from has no value' Parse exception.  If I replace the
opf:orderDetail line to a static string
opf:orderDetail from=p:D
then the file gets included just fine __and__ the
getParameter() call
at the top shows that the parameter is, in fact, set.

I really don't understand what I'm doing wrong and would appreciate
any help.  This is Tomcat 4.0-rc1 on Linux RedHat 7.1.

Kevin HaleBoyes




Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie



Re: Repost: taglib and rtexprvalue problem/bug

2001-09-11 Thread Kevin HaleBoyes

Thanks, I'll make sure I properly encode things from now on.

In the mean time, I removed any special characters and have
only alphabetic characters in my jsp:param list and I still
get:

   org.apache.jasper.compiler.ParseException:
  /WEB-INF/jsp/od.jsp(11,53) Attribute from has no value

So, I still see it as a problem with the use of an expression
as the attribute value in a custom taglib tag.

Kevin HaleBoyes


From: Craig R. McClanahan 

I just answered this in the bug report, but will answer here as well
since
it's been raised here.

Request URIs (including the query string) processed by servlet
containers
must conform to the requirements of HTTP.  In this case, the
relevant spec
is RFC 2396, Section 3.2, which describes the legal syntax for query
strings.  In particular, characters like ':' and '=' are *reserved*,
and
must be URL encoded in order to be processed.

This same requirement, therefore, applies to query parameters
included
with jsp:include and RequestDispatcher.include().

Craig McClanahan





Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie



servlet spec section 9.5 question

2001-09-11 Thread Kevin HaleBoyes

I've started looking into deploying a WAR file to
distribute my application.  I used the dist target
from the sample build.xml file in the tomcat documentation
to build the WAR file itself (app.name is opf):

jar jarfile=${dist.home}/${app.name}.war
 basedir=${deploy.home}/

I put the opf.war file into the webapps directory and
restarted the server and everything worked great!

I also had a look at the contents of the file and noticed
the standard META-INF directory.  But,
section 9.5 of the Servlet 2.3 PFD specification says

   ... a META-INF directotry will be present which contains
information useful to the Java Archive tools.  If this
directory is present, the servlet container must not allow
it be served as content to a web client's request

If I'm interpreting this correctly, what I tried above shouldn't
have worked since the .war file _did_ contain a META-INF directory.
I'm using RedHat 7.1 and Tomcat 4.0 RC1.

Does anyone have any thoughts on this?

Kevin HaleBoyes



Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie



RE: Repost: taglib and rtexprvalue problem/bug

2001-09-11 Thread Kevin HaleBoyes

 From: Larry Isaacs 
 Assuming your post doesn't have typo's, I think the JSP 1.2 spec
 still requires the inner quotes to be escaped. I don't recall
 that changing. Try changing:
 
 opf:orderDetail from=%= request.getParameter(from)
 %
 
 to:
 
 opf:orderDetail from=%= request.getParameter(\from\)
 %
 ^ ^
 I have been bit by this numerous times.

It never occurred to me that this would be the problem!!!
You are correct and the escaping fixed it.

Thanks very much,
Kevin



Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie



Taglibs and rtexprvalue problem

2001-09-10 Thread Kevin HaleBoyes

I have one jsp that jsp:include's another and augments the 
request parameters using jsp:param.  The included jsp uses a
taglib tag with the rtexprvalue attribute set to true.

The problem is I keep getting the following exception when I use
an expression in the attribute field:

org.apache.jasper.compiler.ParseException:
/WEB-INF/jsp/od.jsp(12,53) Attribute from has no value

Here is the taglib.tld excerpt:

!DOCTYPE taglib
   PUBLIC -//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN
   http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd;

tag
nameorderDetail/name
tagclasstaglib.orddet.OrderDetailsTag/tagclass
bodycontentJSP/bodycontent
info/info

attribute
namefrom/name
requiredtrue/required
rtexprvaluetrue/rtexprvalue
/attribute
/tag

The outer jsp file is simple:

 htmlheadtitleTest/title/head
 bodycenterh1Test/h1/center
 jsp:include page=/WEB-INF/jsp/od.jsp
jsp:param name=from value=p:D/
 /jsp:include
 /body/html

And the included jsp file isn't much more complicated:

 %@ taglib uri=/WEB-INF/tlds/taglib.tld prefix=opf %

 hr / preod.jspbr /
  %= request.getParameter(from) %/pre hr /

 opf:orderDetail from=%= request.getParameter(from) %
   PO Number:opf:orderAttr attribute=ponumber/
 /opf:orderDetail

If I use the included file as shown then I get the
'Attribute from has no value' Parse exception.  If I replace the
opf:orderDetail line to a static string opf:orderDetail from=p:D
then the file gets included just fine __and__ the getParameter() call
at the top shows that the parameter is, in fact, set.

I really don't understand what I'm doing wrong and would appreciate
any help.  This is Tomcat 4.0b7 on Linux RedHat 7.1.

Kevin HaleBoyes




Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie



FORM-based authentication question

2001-09-07 Thread Kevin HaleBoyes

I'm successfully using FORM-based logins in my application but I have
a few questions.  When a user logs in, I want to attach certain information
to the session.  Currently I use a filter that checks to see if the
request.getRemoteUser is set (or has changed) and if so, I do a database
call to get the User information, instantiate a UserClass and set it into
the session.  It works fine but...

The filter gets called for every request but only acts when a user logs in.
Sure the test (to see if anything needs to be done) is simple and fairly
quick, but it is done for _every_ request.

Is there a better way?

I'm thinking something similar in style to the HttpSessionListener interface.
Maybe an AuthenticationListener.  Tomcat 4 (or any Servlet 2.3 container :)
knows when a user has been authenticated (or, for that matter, when the
authentication/session times out) but I don't see any way to hook into that
event.  The timed out session information can be had using the
HttpSessionListener.sessionDestroyed() method and my application knows
if, in the very rare case :-) that a user actually logs out.  But notification
of an authentification seems to be missing (from the spec).

The HttpSessionListener.sessionCreated() method doesn't do what I want since
a session is created even when a user is not authenticated.

How do others attach information to the session once a user has been
authenticated?

Thanks,
Kevin HaleBoyes



Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie



hiding my login.jsp

2001-09-07 Thread Kevin HaleBoyes

I'm using form based authentication with the following in my web.xml file:
login-config
auth-methodFORM/auth-method
form-login-config
form-login-page/login.jsp/form-login-page
form-error-page/loginerror.jsp/form-error-page
/form-login-config
/login-config

I tried to hide my login.jsp and loginerror.jsp pages by putting them
in a subdirectory of WEB-INF (and changing the form-*-page attributes)
but I couldn't login to my application.

Specifically, I put the two files in the WEB-INF/jsp directory and changed
the web.xml file to:
form-login-page/WEB-INF/jsp/login.jsp/form-login-page
form-error-page/WEB-INF/jsp/loginerror.jsp/form-error-page

Any thoughts on why this wouldn't work?

Thanks,
Kevin HaleBoyes



Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie



Re: Mozilla and Tomcat

2001-08-23 Thread Kevin HaleBoyes

I'm coming into this discussion a bit late but wanted to add my 2c.

I was running Tomcat/Catalina 4.0b6 with Mozilla 0.9.2 (on RedHat 7.1)
and life was good.  I upgraded to Mozilla 0.9.3 without any changes
to my application and started getting problems similar to what is being
discussed.  I would pound (ok, click firmly) on the reload button and
after several attempts, the page would load properly.  I'm afraid I don't
remember what page was displayed when it didn't work.

I tried restarting Tomcat and Mozilla in various combinations but it
didn't help.  I also recompiled my application and restarted Tomcat but
that didn't help either.

Once I got rid of 0.9.3 and reinstalled 0.9.2 life was good again.
I've since upgraded to Tomcat 4.0b7 and am staying with Mozilla 0.9.2
and life is still good.

My application is a (mostly, as in 99%) Model 2 JSP/servlet application
with several taglibs and beans running on the Oracle 9i database.  It isn't
a large application (and given that it is my first one of this sort, probably
not very well written) but it did show the problem.
Kevin.



Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie



Re: behaviour of getRequestDispatcher for bogus URLs

2001-08-22 Thread Kevin HaleBoyes

  What should the behaviour be if I call forward() on
  a RequestDispatcher that (I know) doesn't exist?
(Ya, ya, I get the same behaviour as if I didn't know
 it doesn't exist :-)
  
  For example:
  
 getServletContext().
getRequestDispatcher(/I_know_this_page_doesnt_exist.html).
   forward(request, response);
  
  I would expect a NullPointerException but that is not what I get.
  Instead, I see the following output in my browser window (Mozilla 0.92):
 htmlbody/body/html
  Or The document contains no data from Netscape 4.7.
  And, if I use lwp-request I get a 404 error which is reasonable.
  
  What should I get?
  
  The javadoc for ServletContext says:
 This method returns null if the ServletContext cannot
  return a RequestDispatcher for any reason.
  But I'm not sure what that reason might be given that a bogus URL
  doesn't seem to do it.  Also, the spec doesn't say anything about
  bad URLs.
  
 
 I *like* the interesting questions :-).

 The answer depends on a precise understanding of what the spec says.  It
 says that you get a RequestDispatcher for the servlet that will handle
 the request URI you specify.

Ok, in the Dispatching Requests chapter (8) in Sevlet Spec v2.3 PFD 2, it
says
  If no servlet can be resolved based on the given path, a
   RequestDispatcher is provided that returns the content for that path.

and that content is a 404 error.

  In Tomcat, there is an implicit mapping like
 this:
 
   servlet-mapping
 servlet-name default /servlet-name
 url-pattern / url-pattern
   /servlet-mapping
 
 which says, in effect, the 'default' servlet handles *all* requests that
 are not mapped to anything else.  Thus, there will never be a URL for
 which you cannot return a RequestDispatcher.

So that is an implementation detail.  I.E.  that is how catalina implements
the spec.  Why does the spec allow for getRequestDispatcher to return null?
Now that I've asked that, I don't actually remember seeing in the spec that
is can return null.  Oh yeah, in the Duke Bookstore example from Sun, they
say in the source code that getRequestDispatcher() can return null.

 When you actually try to RequestDispatcher.forward() to this, you will get
 a 404 error, just as if you'd asked for it directly.
 
  Thanks,
  Kevin.
 
 Craig

Kevin.



Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie


behaviour of getRequestDispatcher for bogus URLs

2001-08-21 Thread Kevin HaleBoyes

What should the behaviour be if I call forward() on
a RequestDispatcher that (I know) doesn't exist?
  (Ya, ya, I get the same behaviour as if I didn't know
   it doesn't exist :-)

For example:

   getServletContext().
  getRequestDispatcher(/I_know_this_page_doesnt_exist.html).
 forward(request, response);

I would expect a NullPointerException but that is not what I get.
Instead, I see the following output in my browser window (Mozilla 0.92):
   htmlbody/body/html
Or The document contains no data from Netscape 4.7.
And, if I use lwp-request I get a 404 error which is reasonable.

What should I get?

The javadoc for ServletContext says:
   This method returns null if the ServletContext cannot
return a RequestDispatcher for any reason.
But I'm not sure what that reason might be given that a bogus URL
doesn't seem to do it.  Also, the spec doesn't say anything about
bad URLs.

Thanks,
Kevin.




Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie



jsp mapping

2001-07-12 Thread Kevin HaleBoyes

First off, I'm running Tomcat 4b5 (standalone) on Linux RedHat 7.1.

I've been looking at (and learning from) the Java Pet Store from Sun and
have been writing some custom Taglibs for my application.  I'm currently doing
lists of things that use the NextFormTag and PrevFormTag extensions from
a jsp file/program.  These tags generate form elements to move to the next
and previous pages where you specify the action of the form.  Here is an
example (snippet):

   opf:prevForm action=/cust/listorders
 input type=submit value=Prev name=Prev/
   /opf:prevForm
   opf:nextForm action=/cust/listorders
 input type=submit value=Next name=Next/
   /opf:nextForm

This generates the following HTML output:

form method=GET action=/cust/listorders
input type=hidden name=orderlist_startIndex value=5
input type=hidden name=orderlist_next value=true
input type=submit value=Next name=Next/
/form

I'm having trouble specifying the action element of the form.  From above,
listorders is actually a JSP file.  I need to provide a mapping from the
actual JSP file /cust/listorders.jsp to /cust/listorders but I'm not sure
how to go about it.

I tried to put the following in my web.xml file but it didn't work:

servlet
servlet-namelistorders/servlet-name
servlet-class/cust/listorders.jsp/servlet-class
/servlet

servlet-mapping
servlet-namelistorders/servlet-name
url-pattern/cust/listorders/url-pattern
/servlet-mapping

When I click the Next button I get the following in my browser:

HTTP Status 404 - /cust/listorders
The requested resource (/cust/listorders) is not available. 


Can anyone help?  I searched the archives at mikal but didn't come up with
anything that was applicable.

Many thanks,
Kevin.




Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie



(application library) ClassNotFoundException

2001-07-09 Thread Kevin HaleBoyes

I've been running Tomcat 4.0b5 since it was released and had the JDBCRealm
stuff working just fine.  I've been using Oracle 8.1.7 (8i) on Linux RedHat
6.2.  I upgraded just recently to RedHat 7.1 and Oracle 9i (9.0.1) and tried
to get my application working again but it is failing on the JDBCRealm
initialization.  Specifically, the first call to open() fails with a
ClassNotFoundException for the oracle JDBC driver.  The relavent part of the
server.xml file is

   Realm  className=org.apache.catalina.realm.JDBCRealm debug=99
   driverName=oracle.jdbc.OracleDriver
   connectionURL=jdbc:oracle:thin:@castor:1521:orasid9i
   connectionName=opf connectionPassword=opf
   userTable=opf_user_cred userNameCol=user_name
   userCredCol=password
   userRoleTable=opf_user_roles roleNameCol=role_name
   digest=MD5
   /

The only change I made for 9i was to change the driverName from
oracle.jdbc.driver.OracleDriver to oracle.jdbc.OracleDriver as recommended
by Oracle.  In my application lib directory I made a link to the classes12.zip
(and .jar file) and rebuilt.  I've confirmed that the classes12.{jar,zip}
files are in
/usr/local/jakarta/jakarta-tomcat-4.0-b5/src/build/webapps/opf/WEB-INF/lib/
directory and tried to start Tomcat.:

I get the following message

Starting service Tomcat-Standalone
Apache Tomcat/4.0-b5
Catalina.start: LifecycleException:  Exception opening database connection: 
java.sql.SQLException: oracle.jdbc.OracleDriver
LifecycleException:  Exception opening database connection: 
java.sql.SQLException: oracle.jdbc.OracleDriver
at org.apache.catalina.realm.JDBCRealm.start(JDBCRealm.java:621)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1108)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:278)
at org.apache.catalina.core.StandardService.start(StandardService.java:353)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:458)
at org.apache.catalina.startup.Catalina.start(Catalina.java:725)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:647)
at org.apache.catalina.startup.Catalina.process(Catalina.java:177)
at java.lang.reflect.Method.invoke(Native Method)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:196)
- Root Cause -
java.sql.SQLException: oracle.jdbc.OracleDriver
at org.apache.catalina.realm.JDBCRealm.open(JDBCRealm.java:534)
at org.apache.catalina.realm.JDBCRealm.start(JDBCRealm.java:619)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1108)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:278)
at org.apache.catalina.core.StandardService.start(StandardService.java:353)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:458)
at org.apache.catalina.startup.Catalina.start(Catalina.java:725)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:647)
at org.apache.catalina.startup.Catalina.process(Catalina.java:177)
at java.lang.reflect.Method.invoke(Native Method)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:196)

You'll notice something odd about the message.  It doesn't say what the
exception actually was!!!
So, I edited JDBCRealm.java and put in a few
log() calls to get the following:

2001-07-09 13:47:17 JDBCRealm[Standalone]: open():- opening a DB connection
2001-07-09 13:47:17 JDBCRealm[Standalone]: open():- instantiating a new driver:
name=oracle.jdbc.OracleDriver, instance=null
2001-07-09 13:47:17 JDBCRealm[Standalone]: open():- instantiation exception:
java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver
at
org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoader.java:)
at
org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoader.java:976)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:120)
at org.apache.catalina.realm.JDBCRealm.open(JDBCRealm.java:529)
at org.apache.catalina.realm.JDBCRealm.start(JDBCRealm.java:619)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1108)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:278)
at org.apache.catalina.core.StandardService.start(StandardService.java:353)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:458)
at org.apache.catalina.startup.Catalina.start(Catalina.java:725)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:647)
at org.apache.catalina.startup.Catalina.process(Catalina.java:177)
at java.lang.reflect.Method.invoke(Native Method)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:196)


RE: (application library) ClassNotFoundException

2001-07-09 Thread Kevin HaleBoyes

 Herein lies your problem.  The classes12.jar(it has to be a jar not
 a zip), has to be in TOMCAT_HOME/lib, not your webapps lib folder.
 
 Think of it this way.  Where do you configure the JDBCRealm?  In
 TOMCAT_HOME/conf/server.xml.  The server.xml file is parsed at
 startup
 and therefore the Realm is created before the context(s) have been
 loaded.

Yes, of course!!!   I had it in my head ... but this is the way I did
it before but I had forgotten that I had copied the classes111.jar (for 8i)
into the server/lib directory.

So, this leads me to a follow up question.  I know that I've got the jar
file in the server/lib directory, is there any way to use that from my
application.  If not then I have to have the exact same jar file in my
WEB-INF/lib directory to use Oracle JDBC in my application.

Thanks very much for your help,
Kevin.




Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie



RE: (application library) ClassNotFoundException

2001-07-09 Thread Kevin HaleBoyes

 From: Michael Wentzel 

 So, this leads me to a follow up question.  I know that I've
 got the jar
 file in the server/lib directory, is there any way to use that
from my
 application.  If not then I have to have the exact same jar
file in my
 WEB-INF/lib directory to use Oracle JDBC in my application.

You could always alter you startup script to so that the TOMCAT
CLASSPATH
contains the fully qualified oracle jar.

Ok that works, but is that the right thing to do?
K.




Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie



-security flag and (oracle) JDBC realms

2001-05-18 Thread Kevin HaleBoyes

I've downloaded the 4.0b5 release and noticed the warning/suggestion to start
running with the -security flag.  So, I did just that.  I also uncommented the
Oracle-based JDBCRealm Realm element (and commented out the Memory based
realm).  Tomcat wouldn't start since it couldn't find the driver so I made
a symbolic link (running on RedHat Linux 6.2) in the
 $CATALINA_HOME/common/lib directory to the classes111.jar file from the
Oracle distribution.  Is that where the Oracle JDBC driver should be put?  I
also tried it in $CATALINA_HOME/lib but that didn't work.

Once the driver was found I had to make a change to the Realm entry itself.
It has
connectionURL=jdbc:oracle:thin:@ntserver:1521:ORCL?user=scott;password=tiger
so I changed the server, SID, username, and password to suite my installation
but Tomcat complained with 
   java.sql.SQLException: invalid arguments in call
After looking at the JDBCRealm.java source code it seams that it needs the
connectionUser and connectionPassword attributes to be defined (it puts them in
the Properties instance to pass to the connect() call from the open() method).
So I removed the
?user=...;password=...
portion of the connectionURL attribute and added the required two.

Things were shaping as Tomcat can now find the JDBC driver and the Oracle
driver isn't complaining about the connection information.  But now I'm getting
another error and this is where
my inexperience with Java security model hinders me.  I'm getting the following
exception when Tomcat starts:

java.security.AccessControlException: access denied (java.net.SocketPermission
localhost resolve)
at
java.security.AccessControlContext.checkPermission(AccessControlContext.java:272)
at java.security.AccessController.checkPermission(AccessController.java:399)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:545)
at java.lang.SecurityManager.checkConnect(SecurityManager.java:1042)
at java.net.InetAddress.getAllByName0(InetAddress.java:559)
at java.net.InetAddress.getAllByName0(InetAddress.java:540)
at java.net.InetAddress.getByName(InetAddress.java:449)
at java.net.Socket.init(Socket.java:100)
at oracle.net.nt.TcpNTAdapter.connect(TcpNTAdapter.java)
at oracle.net.nt.ConnOption.connect(ConnOption.java)
at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java)
at oracle.net.resolver.AddrResolution.resolveAndExecute(AddrResolution.java)
at oracle.net.ns.NSProtocol.establishConnection(NSProtocol.java)
at oracle.net.ns.NSProtocol.connect(NSProtocol.java)
at oracle.jdbc.ttc7.TTC7Protocol.connect(TTC7Protocol.java)
at oracle.jdbc.ttc7.TTC7Protocol.logon(TTC7Protocol.java)
at oracle.jdbc.driver.OracleConnection.init(OracleConnection.java)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java)
at org.apache.catalina.realm.JDBCRealm.open(JDBCRealm.java:539)
at org.apache.catalina.realm.JDBCRealm.start(JDBCRealm.java:607)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1108)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:278)
at org.apache.catalina.core.StandardService.start(StandardService.java:353)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:458)
at org.apache.catalina.startup.Catalina.start(Catalina.java:725)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:647)
at org.apache.catalina.startup.Catalina.process(Catalina.java:177)
at java.lang.reflect.Method.invoke(Native Method)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:196)

So I had a look at the catalina.policy file but I'm really not sure what I need
to add.  It seems that a DNS resolution is attempted but the security system
denided it.  I found the entry:

// These permissions apply to the servlet API classes
// and those that are shared across all class loaders
// located in the common directory
grant codeBase file:${catalina.home}/common/- {
permission java.security.AllPermission;
};

I thought I could add a similar entry like:

grant codeBase file:${catalina.home}/common/lib/- {
permission java.security.AllPermission;
};

but that didn't work.

I would like to start running with the -security flag but this will obviously
stop me in my tracks.

Any help would be appreciated,
Kevin.


Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie



Re: -security flag and (oracle) JDBC realms

2001-05-18 Thread Kevin HaleBoyes

It seems I'm answering my own questions.  I poked around a bit more
in the Tomcat/Catalina documentation and found stuff on realms that helped
a bit.

 realm).  Tomcat wouldn't start since it couldn't find the driver so I made
 a symbolic link (running on RedHat Linux 6.2) in the
 $CATALINA_HOME/common/lib directory to the classes111.jar file from the
 Oracle distribution.  Is that where the Oracle JDBC driver should be put?  I
 also tried it in $CATALINA_HOME/lib but that didn't work.

A symbolic link didn't work at all.  Makes sense I guess.  So I copied the
classes111.jar file from Oracle into the $CATALINA_HOME/server/lib directory.

 I'm getting the following exception when Tomcat starts:
 java.security.AccessControlException: access denied
(java.net.SocketPermission localhost resolve)

I added the following to the catalina.policy file:

grant codeBase file:${catalina.home}/server/- {
permission java.net.SocketPermission localhost:1521, connect;
};


And that did it.  Next I have to figure out how to seed (for now) my users
table with MD5 passwords.  Any help there would be welcome.

Kevin.


Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie



RE: FORM-based login questions

2001-05-17 Thread Kevin HaleBoyes

Thanks for your help.

I've been browsing the archives for this list and have noticed that the
question about the mis-redirect from the direct-access to the login.jsp
comes up fairly often.  I'm wondering (haven't tried anything yet) if I
can set up the redirection manually if the login page is accessed directly.
Maybe by adding an appropriate header field in the request...
I wonder if Sun lurks on this list and acts on any of these (seemingly)
short comings?

I looked at the Tomcat source code for an answer about protecting
the login.jsp file/form itself.  Tomcat serves it up even if it is in a
protected url path.  I haven't tried it but I think that's what the code
says.

Thanks again for your help.
Kevin.


-Original Message-

Date: Wed, 16 May 2001 14:50:36 -0700
To: '[EMAIL PROTECTED]' [EMAIL PROTECTED]
From: JULIEN,TIMOTHY (HP-NewJersey,ex2) [EMAIL PROTECTED]
Subject: RE: FORM-based login questions
Message-ID: [EMAIL PROTECTED]

1. You are right that the spec doesn't say what to do when a login form is
accessed directly.  This is why Tomcat doesn't know what to do.  Two things:

a) don't let users access login form directly.  Not sure what happens in
Tomcat if you protect the login form.  At least you can remove all links to
the login form in your app.  This is actuallythe point behind login forms -
so you don't have to worry about it in your app, it just happens by magic.
b) the spec needs to change to handle the case where a login form is
directly accessed by a client.  My personal view is a welcome file should be
returned.  If there isn't one, then a 404 should occur.

2. there is no logout mechanism in Servlet.  Your solution is i think good.

3. you could use a filter that runs before every servlet which does this
work for you

-Original Message-



Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie



FORM-based login questions

2001-05-16 Thread Kevin HaleBoyes

I've managed to get FORM-based login to work but I've got a few questions
regarding
it.  I have an application that has three different roles: customer,
administrator, and retailer.
They will have access to their own part of the overall application - generally,
the customer
will access jsp's and servlets in the /ft/cust resource collection.  Similarly
for the admin
and retailer roles.  My web.xml file contains the following:

security-constraint
web-resource-collection
web-resource-nameAdmin Functions/web-resource-name
url-pattern/admin/*/url-pattern
/web-resource-collection
auth-constraint
role-nameltadmin/role-name
/auth-constraint
/security-constraint

security-constraint
web-resource-collection
web-resource-nameEtailer Functions/web-resource-name
url-pattern/etailer/*/url-pattern
/web-resource-collection
auth-constraint
role-nameltetailer/role-name
/auth-constraint
/security-constraint

security-constraint
web-resource-collection
web-resource-nameCustomer Functions/web-resource-name
url-pattern/cust/*/url-pattern
/web-resource-collection
auth-constraint
role-nameltcust/role-name
/auth-constraint
/security-constraint

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

My tomcat-users.xml file has the users and roles defined appropriately:

  user name=lftcustpassword=troles=ltcust /
  user name=lftadmin  password=t   roles=ltadmin /
  user name=lftetailpassword=troles=ltetailer /


As I said, this is working but I did have a few question.  First, the context
for the
application is /ft and I'm running Tomcat 4.0b3 on a RedHat linux 6.2 box.

You'll notice that the root of the application is not protected so if a
browser is pointed
to http://localhost:8080/ft/index.jsp it is served up without a
username/password prompt.
If I try to go to the /ft/cust/index.jsp URL then my login.jsp form is
presented (user logs
in and is redirected to the /ft/cust/index.jsp location).

If I access the URL http://localhost:8080/ft/login.jsp  directly, right from
the start, I get
the login form presented.  If I login with a correct username and password I
get the 
following error displayed in my browser window:
HTTP Status 400 - Bad Request
and the URL is:
http://localhost:8080/ft/j_security_check

It's almost like the FORM authentication handler doesn't know where to go after
the
login suceeds.  Is there anything I can do about this?  The Java Servlet
Specification 2.3
document doesn't describe how this should be handled.

Along a similar line.  Say my /ft/index.jsp page has a link to login
(/ft/login.jsp) and a
user takes it.  Once the user is authenticated, how can I direct them to a
particular
page (as the next page from the login form)?

Another question.  How do I logout?  What I do right now is have a logout.jsp
page 
that calls
% session.invalidate(); %
but is this the proper way of achiving a logout?

Yet another question.  I would like to attach some information (ie, an instance
of a Java
class) to the session once the user is authenticated.  It will contain things
like the user
id and name from the database.  Is there any way of doing this?  I suppose I
could have
code in all my servlets and jsp files that builds the instance and attaches it
to the session
if getRemoteUser() returns not-null and the session information isn't bound. 
This is
tedious though and requires duplicated code in every servlet or jsp that
follows a login.
Again, I don't see anything in the Servlet spec.  Actually, I consider this to
be a bit of
a short-coming (if you can't do it) in the servlet spec.

Thanks for the help,
Kevin.




Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie



tomcat and naming

2001-05-14 Thread Kevin HaleBoyes

I'm trying to get a JNDI example running but I have run into trouble.
I'm using tomcat 4.0b3 on a RedHat Linux 6.2 box with JDK 1.3.0_02

I've created a servlet that tries to get the InitialContext in the init()
method but I always
get an exception when I run it.  Here is the servlet:

import javax.naming.NamingException;
import javax.naming.NameNotFoundException;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.directory.InitialDirContext;

import javax.sql.*;

import javax.servlet.*;
import javax.servlet.http.*;


public class NamingServlet extends HttpServlet
{
public void init() throws ServletException
{
DataSource datasource = null;
InitialContext ic = null;
String DATASOURCE_NAME = java:comp/env/jdbc/NamingDataSource;

try
{
ic = new InitialContext();
}
catch (NamingException ne)
{
throw new ServletException(Naming Exception while 
instantiating an Initial
Context:\n + ne.getMessage());
}

try
{
datasource = (DataSource)ic.lookup(DATASOURCE_NAME);
}
catch (NameNotFoundException ne)
{
throw new ServletException(NamingNotFound Exception while 
looking up  +
DATASOURCE_NAME + :\n + ne.getMessage());
}
catch (NamingException ne)
{
throw new ServletException(Naming Exception while looking up 
 +
DATASOURCE_NAME + :\n + ne.getMessage());
}
}
}

I copied the jndi.jar  from catalina into my source lib directory.  I'm using
Oracle 8.1.7
javax.sql package for the DataSource classes but I don't think this is
important since I'm
not even making it that far.  Here's the exception I get when I access the
mapped URL
of http://localhost:8080/naming/naming  :

javax.servlet.ServletException: Naming Exception while instantiating an Initial
Context:
Cannot instantiate class: org.apache.naming.java.javaURLContextFactory
at NamingServlet.init(NamingServlet.java:27)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at
org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:802)
at
org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:583)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:231)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:879)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:225)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:879)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2175)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:446)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:879)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:162)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at
org.apache.catalina.valves.RequestDumperValve.invoke(RequestDumperValve.java:219)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:879)
at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:827)
at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:904)
at java.lang.Thread.run(Thread.java:484)

I have the tomcat examples running, including the JNDI example, but I can't see
what I'm
doing that is different.  The only vague clue that I have is the
class-not-found
exception for org.apache.naming.java.javaURLContextFactory but I don't know
where to
go from there.

Any help would be appreciated,
Kevin.



Do You Yahoo!?
Get your free @yahoo.co.uk 

tomcat, JNDI naming, and OracleDataSource

2001-05-14 Thread Kevin HaleBoyes

I don't know if my original message made it to the list yet.  I received the
following error when I tried to send a question to tomcat-user list:

   - The following addresses had permanent fatal errors -
[EMAIL PROTECTED]
(reason: 550 User unknown)

I'm not sure why it redirected to namezero.com.  Hope this one makes it!

I'm trying to get a JNDI example of my own working - the one in the example
context works fine.  I originally wrote because I couldn't even get an
IntialContext instantiation to work.  I solved that by making sure the
naming.jar file was in my application-context classpath.  Actually, I hope the
first message didn't make it to the list!

Anyway, here's the problem.  In my code, I instantiate an InitialContext
and then do a lookup for a DataSource (connection factory).  The lookup
fails with the following exception:

javax.servlet.ServletException: NamingNotFound Exception while looking up
java:comp/env/jdbc/NamingDataSource:
Name java:comp is not bound in this Context
at NamingServlet.init(NamingServlet.java:39)
at
org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:802)
at
org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:583)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:231)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:879)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:225)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:879)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2175)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:446)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:879)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:162)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at
org.apache.catalina.valves.RequestDumperValve.invoke(RequestDumperValve.java:219)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:879)
at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:827)
at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:904)
at java.lang.Thread.run(Thread.java:484)


I'm at home right now so I don't have the code in fron of me but it is
basically as follows (with the naming exceptions caught and turned into
ServletExceptions):

import javax.naming.*;
import javax.sql.*;

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

  InitialContext ic = new InitialContext();
  DataSource ds =
(DataSource)ic.lookup(java:comp/env/jdbc/NamingDataSource);
}


and here is my web.xml file:

?xml version=1.0 encoding=ISO-8859-1?
!DOCTYPE web-app
PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.2//EN
http://java.sun.com/j2ee/dtds/web-app_2_2.dtd;
web-app
  display-nameNaming Test/display-name
  descriptionTest JNDI Naming/description
  servlet
servlet-namenaming/servlet-name
servlet-classNamingServlet/servlet-class
  /servlet
  servlet-mapping
servlet-namenaming/servlet-name
url-pattern/naming/url-pattern
  /servlet-mapping
  resource-ref
res-ref-namejdbc/NamingDataSource/res-ref-name
res-typejavax.sql.DataSource/res-type
res-authContainer/res-auth
  /resource-ref
/web-app


So the exception says:
Name java:comp is not bound in this Context
but isn't it enough to declare/define it in my web.xml file.
I'm going to look through the ejb specification tomorrow in case it sheds
any light (since the servlet spec says naming and resource references are
described in the ejb spec).

As an aside, what I'm actually trying to do is get an
OraclePooledConnectionDataSource (I think that's the class name?)
with the base class OracleDataSource in the oracle.jdbc.pool package but
I thought I'd start with a simpler case.  I'm also waiting to see if