Re: Tomcat 3.3, server.xml and a lot of fun

2001-12-04 Thread Vladimir Grishchenko

A collection of java designer's newsgroup posts can be found here:

http://groups.google.com/groups?[EMAIL PROTECTED]hl=enlr=safe=off;
btnG=Google+Searchsite=groups

Looks like s/he can be nice to people when in good mood. Surprisingly, none
of his posts is Java related.

--V.


- Original Message -
From: java programmer [EMAIL PROTECTED]
To: Jan Labanowski [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Monday, December 03, 2001 10:56 PM
Subject: Re: Tomcat 3.3, server.xml and a lot of fun


 --- Jan Labanowski [EMAIL PROTECTED] wrote:
  You must be working for Microsoft, I assume...
  BTW... servlet.xml cannot have DTD, since people can
  add their own stuff
  (classes), instantiate it in server.xml, and name it
  the way they want,
  and DTD would not allow it...
 
  Jan

 Please don't top post. Replies go under the
 original post. Only MS weenies with MS outlook
 top post.

 Ok. I am going to rant here.

 rant
 Tomcat 3.3.x's internals really suck. I have looked
 at probably all of the JDK source over the past
 5 years and tomcat is at the very bottom in terms
 of quality, readability, even trivialities like
 source code formatting/comments.

 JSP/Servlets are *important*. They are probably the
 most important java api, now that java has proven
 to be a total failure on the client side. (java, in
 general, is *great* though).

 Now, it wouldn't be so bad that tomcat is a internal
 mess, if the exposed API/interface was pleasant.
 By this I mean, installing, configuring, extending,
 and documentation. Tomcat falls down in all areas.

 I mean, I really am very frustrated. There should be
 no reason to be.

 Let's take a simple, yet real world example of 2
 virtual hosts, each served by Tomcat.

 Well, do I use:

 a) 1 tomcat instance with 1 server.xml file with
 different AutoWebApps ? (have you seen how
 terse the autowebapp doc is ? They don't even
 say if the host name param should be a FQDN) ?

 b) 2 separate instances of tomcat with 2 separate
 server.xml files ?

 c) Some other random, trial by fire combo ?

 I mean, in places, the docs say that version 3.3
 and earler require separate instances of Tomcat.
 Other places, they say things like: You can add
 apps to multiple virtual hosts. (implying 1
 tomcat server ?).

 I don't know. The JSPException that I described in
 the original post, is not really documented
 anywhere.  Tomcat should have printed a meaningful
 message when that happened. Just barfing up the
 Exception itself, doesn't help me, i.e., the end
 user at all.

 There isn't any real documentation, and whatever
 there is, is mutually incompatible in many places.

 Is this the best Sun/Apache can do ?

 And on a personal note: I think the whole webapp
 idea is silly. It sounds promising of course, but
 it complicates things for most people. If I am
 running a web site, run with jsp's, then I want:

 apache (httpd)
   |
   |_some doc root
 |
 |__ all .html, .jsp files, images here.

 And only one context (/).

 In addition, path or extension based mappings
 _are_ useful but should be the _sole_ domain of
 the web server. That would be Apache in my case.

 That's how ASP works, that's how LiveWire used
 to work. I don't want my images, files etc., all
 over the place. I want them all under the htdocs
 directory. (yeah, I know I can do it, but I want
 that to be the default out of box tomcat behavior).

 webapps should never have made it
 into the spec. Name three well known
 web sites running in a mass virtual hosted
 environment and deployed as webapps with
 a web.xml file to boot ! Hell, name *any*.

 And the kicker is the gratuitous, idiotic
 use of XML for _configuration_. For you to say:

  servlet.xml cannot have DTD, since people can
  add their own stuff
  (classes), instantiate it in server.xml, and name it
  the way they want,

 shows that you have no conceptual idea what xml is
 intended for.

 Java:
 class foo {
 //variables (structure)
 }

 C:
 struct {
  //variables (structure)
  }

 Database:
 create table [ .. columns/structure ..]

 BNF:
 syntax ::=  { rule }
 rule   ::=  identifier  ::=  expression
 expression ::=  term { | term }
 term   ::=  factor { factor }
 [..]

 XML is similar to the above 4. XML is a way to
 *define*/*create* new and arbitrary data
 formats (although somewhat limited  compared
 to BNF type grammars). This way, I know and
 you know what we are saying when we exhange data.

 If there is _no_ format (dtd), there _is_ no
 structure. That's a shoddy development time
 hack only. Tomcat has been deployed for years
 now. There is no excuse not to have a server.dtd.

 Here's a factoid for the sun team: If I
 had the money, I would buy ServletExec or maybe
 JRun. I have been hacking java since '94 and
 I am frustrated with how inelegant 3.3 feels.

 The Sun/Apache team can learn a great
 deal either of those 2 distros. (I am not talking
 about fancy installers or GUI's but about
 documentation and error handling 

Re: Tomcat 3.3, server.xml and a lot of fun

2001-12-04 Thread Vladimir Grishchenko

Unfortunately, you missed the point...


- Original Message - 
From: java programmer [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Monday, December 03, 2001 10:35 PM
Subject: Re: Tomcat 3.3, server.xml and a lot of fun


 Vladimir Grishchenko [EMAIL PROTECTED], looked
 up from a pending proctological exam, butthole
 opening, and contracting and gushing rectal mucous and
 opined:
 
  I used almost every version of TC since 3.x to 4.0.
  [..a buncha crap flushed..]
 
 
 Jeez. It must be part of the human condition that
 there really is no escape from stupidity.
 
 Here I was, looking for a cogent response, and I
 get a blazing cretin, with _no_ suggestion to offer
 save for proclaming a wholesome and beautiful
 experience with Tomcat. My, my  all the way back
 to version 3.0 you say ?
 
 The irony of your _top_ _post_,(produced more
 than likely with gatesian trash I wouldn't rely
 on to so much as prop the outhouse door), with
 all_ of the original post intact, is as they
 say, quite delicious.
 
 Best regards,
 
 [EMAIL PROTECTED]
 
 
 
 __
 Do You Yahoo!?
 Buy the perfect holiday gifts at Yahoo! Shopping.
 http://shopping.yahoo.com
 
 --
 To unsubscribe:   mailto:[EMAIL PROTECTED]
 For additional commands: mailto:[EMAIL PROTECTED]
 Troubles with the list: mailto:[EMAIL PROTECTED]
 
 

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




Re: an alternative approach to the standard mvc

2001-12-03 Thread Vladimir Grishchenko

What's wrong with Element Construction Set
(http://jakarta.apache.org/ecs/index.html) ?

IMHO the whole point of MVC is to separate presentation logic from business
logic. Your solution seems to only  abstract html construction via java
object manipulation. There's much more to MVC than just that. It's no
replacement for MVC. Overall the idea is nice but not new. Sorry for not
being supportive, just my opinion.

--V.




- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, December 03, 2001 3:48 PM
Subject: an alternative approach to the standard mvc



 Hi everyone,

 For those who have built a web application using the standard MVC pattern
 I'm sure you have found it can be quite a tedious and cumbersome solution.
 The constant need to jump in and out of html/java and the messy process of
 moving data between the model, the controller and the view is not a pretty
 one. I've tried to come up with a better solution for implementing MVC.
 Objective html is a toolkit that aims at making html form development
 similar to the code you write for something like Java-Swing. Instead of
 having 3 components for each form, i.e. the jsp page, the javabean and the
 controller, I've pull all these components back together so you have the
 model, controller and view in the one class file. If you check out my
 example its a much more intuitive and easy to follow solution then having
 the standard 3 parts solution.

 Some advantages of Objective HTML are:
 - Form data is much easily handled and much more intuitive
 - No need to have 3 pieces of code like MVC (jsp, bean, controller),
instead most of your code lies in one class
 - Less knowledge of html required, most of the messy html code is
abstracted in the Java objects
 - Much more Object-Orientated for the discipline freaks
 - Fully open source

 I hope some people can try out this toolkitout  and let me know if it is
useful to them and what I can do to improve it.

 Check out the website at http://objectivehtml.sourceforge.net

 Cheers,
 Keith




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



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




Re: an alternative approach to the standard mvc

2001-12-03 Thread Vladimir Grishchenko

Well, after taking second look I agree that ECS is more primitive.

Don't get me wrong, I'm just trying to say that making HTML construction
done via Java objects and providing convenience methods for extracting
request parameters is no replacement for MVC in a general case.  Say, I want
to change the look and feel of my web site (an old example...), do I need to
rewrite all my classes that inherit from OHTML and have them recompiled? If
it's a simple project it's probably OK, but as a Java software developer I
don't want to create html designs (whether or not via html directly or using
OHTML classes) if there are people on the project who are good at it, and in
their turn those people won't feel comfortable dealing with Java code.

Again, don't get me wrong, the stuff you've created is great, but
unfortunately it's not a universal MVC replacement.
Just my 2 c.

Vlad.

- Original Message -
From: [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Monday, December 03, 2001 4:46 PM
Subject: Re: an alternative approach to the standard mvc




 Well that particular project you referred its just a generic construction
 set for Html or Xml. The toolkit I've proposed goes beyond that, my
objects
 actually have state and are true objects in the OO sense.
 The toolkit does more than just abstract html construction via java
 manipulation, if thats what you think it does then you've missed the whole
 point. I welcome your comment though, cause it means I haven't explained
 the purposes toolkit well enough.

 I know what MVC is meant to do, in theory it sounds very good but one of
 the problems is that a lot of the times business logic drives the
 presentation. What I'm trying to do is make the view/model/controller a
lot
 closer to each other, i.e. I'm trying to couple the parts that they have
in
 common and trying to decouple the parts that should be seperated. In the
 normal MVC pattern you got the model, view and controller all seperated,
 but the reality is that there is strong relationship between all of them.

 Before you make another comment, please have a look at what the method
 updateData() tries to do and look at how you much easier you access the
 data from the form and how you can manipulate the presentation of the
form.

 btw.. my solution does seperate presentation from the logic. All the
 presentation is held in the objects themselves. Though I haven't planned
 it, its possible that these objects at a latter stage will render
something
 else instead of Html.





 Vladimir Grishchenko [EMAIL PROTECTED] on 04/12/2001 11:29:39

 Please respond to Tomcat Users List [EMAIL PROTECTED]

 To:   Tomcat Users List [EMAIL PROTECTED]
 cc:
 Subject:  Re: an alternative approach to the standard mvc


 What's wrong with Element Construction Set
 (http://jakarta.apache.org/ecs/index.html) ?

 IMHO the whole point of MVC is to separate presentation logic from
business
 logic. Your solution seems to only  abstract html construction via java
 object manipulation. There's much more to MVC than just that. It's no
 replacement for MVC. Overall the idea is nice but not new. Sorry for not
 being supportive, just my opinion.

 --V.




 - Original Message -
 From: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Monday, December 03, 2001 3:48 PM
 Subject: an alternative approach to the standard mvc


 
  Hi everyone,
 
  For those who have built a web application using the standard MVC
pattern
  I'm sure you have found it can be quite a tedious and cumbersome
 solution.
  The constant need to jump in and out of html/java and the messy process
 of
  moving data between the model, the controller and the view is not a
 pretty
  one. I've tried to come up with a better solution for implementing MVC.
  Objective html is a toolkit that aims at making html form development
  similar to the code you write for something like Java-Swing. Instead of
  having 3 components for each form, i.e. the jsp page, the javabean and
 the
  controller, I've pull all these components back together so you have the
  model, controller and view in the one class file. If you check out my
  example its a much more intuitive and easy to follow solution then
having
  the standard 3 parts solution.
 
  Some advantages of Objective HTML are:
  - Form data is much easily handled and much more intuitive
  - No need to have 3 pieces of code like MVC (jsp, bean, controller),
 instead most of your code lies in one class
  - Less knowledge of html required, most of the messy html code is
 abstracted in the Java objects
  - Much more Object-Orientated for the discipline freaks
  - Fully open source
 
  I hope some people can try out this toolkitout  and let me know if it is
 useful to them and what I can do to improve it.
 
  Check out the website at http://objectivehtml.sourceforge.net
 
  Cheers,
  Keith
 
 
 
 
  --
  To unsubscribe:   mailto:[EMAIL PROTECTED]
  For additional commands: mailto:[EMAIL PROTECTED]
  Troubles

Re: Tomcat 3.3, server.xml and a lot of fun

2001-12-03 Thread Vladimir Grishchenko

I'm not usually practicing help to rude people but I'll make an exception
and will give you a hint.
I used almost every version of TC since 3.x to 4.0. Yes, I had problems
starting it and moments of frustration, but all issues turned out to be my
fault mostly due to my incompetence at that time. I think you're no
exception. I'll also give you a free advice. If you want to get help here
then change your attitude, otherwise your voice will be lost in the noise.

Sincerely,
--V.

- Original Message -
From: java programmer [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, December 03, 2001 6:06 PM
Subject: Tomcat 3.3, server.xml and a lot of fun


 Hi all:

 Tomcat 3.3 (on linux) seems to be quite shoddily
 developed. Surprising that, given it's high
 visibility and posture.

 Consider for instance:

 I downloaded the binary distro of tomcat 3.3.
 I have set and exported both TOMCAT_HOME and
 JAVA_HOME. Compiled and installed mod_jk.so
 too. (against Apache 1.3.22).

 All I have to do is edit/configure the
 conf/server.xml file and I should be well
 on my way right ?

 Well let' see.

 shell vi server.xml
 shell tomcat.sh start -jkconf

 EmbededTomcat: exception initializing ContextManager
 java.lang.NullPointerException at
 org.apache.tomcat.facade.JspInterceptor.addContext(Unknown
 Source)

 [..bunch of stack trace crap here ..]

 Hmm. The message above gives me *no* more information.


 Nothing looks obviously wrong with the server.xml
 file, let's validate it using the W3C validator.
 But wait, there is *NO* server.dtd. There is only a
 description in the manual which says:

 --- quote --
 This is the main element in server.xml. It has a
 single child describing the tomcat configuration,
 ContextManager.

 Examples
 Server
ContextManager 
   ... ( tomcat configuration )
/ContextManager
 /server
 ContextManager
 - end quote --

 Hmm. Well my file kinda looks ok, but not having a
 DTD kinda means that the tomcat developers don't
 understand the central concept behind xml. But's
 let's leave that aside for now. Let's just validate
 the *syntax* of server.xml using W3C (if the
 structure indeed is as simple as the manual claims).

 [fire up a browser, validate server.xml here]

 Well, that validated fine. So why am I getting
 the error and wh am I getting it?  There is no
 way to tell, either from the Exception, or
 the LACK OF DOCUMENTATION.

 2 hours later, after random permutations and
 combinations of server.xml I still haven't found
 what's wrong.

 Attached below is the complete server.xml,
 in case any of you are interested.

 In the past, I may have gotten upset at having wasted
 all this time. But that was before I found enlightment
 through tomcat. Now I am at peace with the world for
 tomcat teaches us about the futility of trying to
 solve simple problems.

 Of course, now that I have given up trying to make
 this thing work, I do have some idle time to wonder:

 Exactly what are the tomcat developers smoking ?

 Best regards,

 [EMAIL PROTECTED]

  server.xml follows --
 Server
 ContextManager workDir=work 

  ContextXmlReader config=conf/apps.xml /
  ApacheConfig noRoot=true forwardAll=false
   jkDebug=info jkWorker=ajp13 /
  AccessInterceptor /
  AccessLogInterceptor /

  Http10Connector  port=8080 secure=false /
  Ajp12Connector   port=8007 address=127.0.0.1
 backlog=250 /
  Ajp13Connector port=8009 address=127.0.0.1
 backlog=250 /

  AutoDeploy source=modules target=modules
 redeploy=true /
  AutoWebApp dir=modules host=DEFAULT
 trusted=true/
  AutoDeploy source=webapps target=webapps /
  AutoWebApp dir=webapps host=DEFAULT /

  DecodeInterceptor /
  ErrorHandler showDebugInfo=true /
  InvokerInterceptor /
  Jdk12Interceptor /
  JspInterceptor keepGenerated=true
 useJspServlet=false /
  LoaderInterceptor11  useApplicationLoader=true /
  LoadOnStartupInterceptor /

  LogSetter name=tomcatlog timestamps=true
   verbosityLevel=INFORMATION
   path=logs/tomcat-log /

  PolicyLoader
   securityManagerClass=java.lang.SecurityManager
   policyFile=conf/tomcat.policy /
  ReloadInterceptor fullReload=true /
  Servlet22Interceptor /
  SessionExpirer checkInterval=120 /
  SessionId cookiesFirst=true noCookies=false /
  SessionIdGenerator
 randomClass=java.security.SecureRandom
 randomFile=/dev/urandom /
  SimpleMapper1 /
  SimpleSessionStore maxActiveSessions=-1 /

  StaticInterceptor listings=false /
  TrustedLoader /
  WebXmlReader validate=true /
  WorkDirSetup cleanWorkDir=false /
  LogSetter name=servlet_log
 timestamps=true
 verbosityLevel = INFORMATION
 path=logs/servlet-${MMdd}.log /
  LogSetter  name=JASPER_LOG
 timestamps=true
 path=logs/jasper-${MMdd}.log
 verbosityLevel = INFORMATION  /

 /ContextManager
 /Server
 - end 


 __
 Do You Yahoo!?
 Buy the perfect holiday gifts at Yahoo! Shopping.
 

Re: This would be cool in tomcat as well...

2001-11-17 Thread Vladimir Grishchenko

Tomcat is a _reference_ implementation.
I doubt it will be polluted by non-portable extensions, even if they seem to
be useful.

--V.


- Original Message -
From: Geir Magnusson Jr. [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Saturday, November 17, 2001 9:43 AM
Subject: This would be cool in tomcat as well...



 http://www.caucho.com/products/resin/ref/velocity.xtp

 :)

 geir

 --
 Geir Magnusson Jr. [EMAIL PROTECTED]
 System and Software Consulting
 Whoever would overthrow the liberty of a nation must begin by subduing
the
 freeness of speech. - Benjamin Franklin



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



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




Re: Tomcat Spontaneously Restarting System

2001-09-20 Thread Vladimir Grishchenko

TC is pure Java. Java has no methods that can force system shutdown.
The way to do it from Java is JNI. Search for native or loadLibrary
in deployed web applications to see if someone is doing something funky.
Another possible way to do it Is Runtime.exec(), so search for exec also.
You should also distinguish between a graceful shutdown and a system crash.

--V.

- Original Message -
From: Jim Cheesman [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, September 20, 2001 12:12 AM
Subject: RE: Tomcat Spontaneously Restarting System


 At 10:36 PM 19/09/01, you wrote:
 Thanks Chris,
 
 I thought the class was doing something odd, but it
 has happened to me from time-to-time without warning.
 
 I must admit to not having seen stuff like this
 before, although this is the first time using win2k.
 
 I'm pretty sure the problem lies in a conflict with
 some software on the lab machines.  It could be
 anything...




 There's a small suite of applications* that have caused much fun around
 here at work that allow you to remotely execute applications, shutdown
 machines etc. etc. for Win2K. They work IFF you know an (adminstrator?)
 password on the target machine, so you might want to try changing that and
 seeing if the problem goes away...




 * available from http://www.sysinternals.com - psList, psExec, psKill,
 psShutdown... fun for all the family.



 Jim




 --

*   Jim Cheesman   *
  Trabajo:
 [EMAIL PROTECTED] - (34)(91) 724 9200 x 2360
  A kind word
 turneth away wrath, but not
as effectively as superior
 firepower.






Re: Tomcat 4.0 Session Timeout

2001-09-20 Thread Vladimir Grishchenko

Can you use HttpSession.setMaxInactiveInterval(int)  method to set it at
runtime?

--V.


- Original Message -
From: Jim Urban [EMAIL PROTECTED]
To: Tomcat-User [EMAIL PROTECTED]
Sent: Thursday, September 20, 2001 9:52 AM
Subject: Tomcat 4.0 Session Timeout



 I've now asked this three times and have yet to receive a solution.  I
must
 get this resolved since the security requirements of my application
require
 the user's session to automatically time out after 5 minutes of
 inactivity...

 How do I set the session time out for a context in Tomcat 4.0.  The
session
 time out is defaulting to 18000 seconds (5 hours?).  I have tried adding
the
 following to both my context's WEB-INF/web.xml file and the
 $CATALINA_HOME/conf/web.xml file but both are ignored.

   session-config
 session-timeout300/session-timeout
   /session-config

 How do I go about setting the time out to 5 minutes?

 Thanks,
 Jim Urban
 Product Manager
 Netsteps Inc.
 Suite 505E
 1 Pierce Pl.
 Itasca, IL  60143
 Voice:  (630) 250-3045 x2164
 Fax:  (630) 250-3046


 PS:  Love Tomcat 4.0, it seems really solid!





Re: Tomcat 4.0 Session Timeout

2001-09-20 Thread Vladimir Grishchenko

It's not a TC feature, it's in servlet spec, and it was there at least since
2.1.

--V.


- Original Message -
From: Jim Urban [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, September 20, 2001 10:34 AM
Subject: RE: Tomcat 4.0 Session Timeout


 I can, but this defeats the purpose of configuring Tomcat to set it for
me.
 Was this feature removed or just moved in 4.0?

 Jim

 -Original Message-
 From: Vladimir Grishchenko [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, September 20, 2001 12:27 PM
 To: [EMAIL PROTECTED]
 Subject: Re: Tomcat 4.0 Session Timeout


 Can you use HttpSession.setMaxInactiveInterval(int)  method to set it at
 runtime?

 --V.


 - Original Message -
 From: Jim Urban [EMAIL PROTECTED]
 To: Tomcat-User [EMAIL PROTECTED]
 Sent: Thursday, September 20, 2001 9:52 AM
 Subject: Tomcat 4.0 Session Timeout


 
  I've now asked this three times and have yet to receive a solution.  I
 must
  get this resolved since the security requirements of my application
 require
  the user's session to automatically time out after 5 minutes of
  inactivity...
 
  How do I set the session time out for a context in Tomcat 4.0.  The
 session
  time out is defaulting to 18000 seconds (5 hours?).  I have tried adding
 the
  following to both my context's WEB-INF/web.xml file and the
  $CATALINA_HOME/conf/web.xml file but both are ignored.
 
session-config
  session-timeout300/session-timeout
/session-config
 
  How do I go about setting the time out to 5 minutes?
 
  Thanks,
  Jim Urban
  Product Manager
  Netsteps Inc.
  Suite 505E
  1 Pierce Pl.
  Itasca, IL  60143
  Voice:  (630) 250-3045 x2164
  Fax:  (630) 250-3046
 
 
  PS:  Love Tomcat 4.0, it seems really solid!
 
 





Re: Session expiring(?) on UNIX platform. Help!!!!...

2001-09-20 Thread Vladimir Grishchenko

Could it be that your browser is not set to accept cookies if you're using
them for session tracking?

--V.


- Original Message -
From: Bala Nemani [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, September 20, 2001 11:08 AM
Subject: Session expiring(?) on UNIX platform. Help...


 Hello All:
 We are working on an application which stores successful userid in a
session
 and used for subsequent user requests. On NT platform the app runs fine.
 However on UNIX platform, the values stored in session are not found (or
the
 session not found?). Every time a request comes from user it appears to be
 looking for a new session. Checked application code and it works perfectly
 fine on NT. Seems something to do with Tomcat on UNIX platform. Appreciate
 if anyone can help...
 Thanks in Advance

 Bala Nemani







Re: Object Sharing

2001-09-20 Thread Vladimir Grishchenko

ServletContext.setAttribute()
ServletContext.getAttribute()

right?

--V.

- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, September 20, 2001 10:52 AM
Subject: Object Sharing



 Hi

   I want to have single instance of x class to be referenced in all the
 Servlets requests and applied singleton pattern. Right now one instance
for
 servlet is created. How can use single instance of X class in all the
 servlets.

 Thanks

 Rajesh





Re: Object Sharing

2001-09-20 Thread Vladimir Grishchenko

Nope. It's sometimes usefult to read api documentation:

quote

There is one context per web application per Java Virtual Machine. (A web
application is a collection of servlets and content installed under a
specific subset of the server's URL namespace such as /catalog and possibly
installed via a .war file.)
/quote

regards,

--V.



- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, September 20, 2001 12:33 PM
Subject: RE: Object Sharing




  If I set to context it will confined to single servlet right...


 -Original Message-
 From: Vladimir Grishchenko [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, September 20, 2001 12:13 PM
 To: [EMAIL PROTECTED]
 Subject: Re: Object Sharing


 ServletContext.setAttribute()
 ServletContext.getAttribute()

 right?

 --V.

 - Original Message -
 From: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Thursday, September 20, 2001 10:52 AM
 Subject: Object Sharing


 
  Hi
 
I want to have single instance of x class to be referenced in all the
  Servlets requests and applied singleton pattern. Right now one instance
 for
  servlet is created. How can use single instance of X class in all the
  servlets.
 
  Thanks
 
  Rajesh
 
 





Re: Jars in WEB-INF/lib and RMI stubs in WEB-INF/classes not found

2001-09-20 Thread Vladimir Grishchenko

Sounds like a beaten to death topic. Search TC archives for class loading.

--V.

PS: sorry for not being too helpful, but this question has been answered way
too many times.

- Original Message -
From: Joshua van Tonder [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, September 20, 2001 2:47 PM
Subject: Jars in WEB-INF/lib and RMI stubs in WEB-INF/classes not found


 How does classloading work in tomcat 3.2.2?

 In deploying my application I am having problems getting classes loaded
 aren't on the system classpath. I changed the tomcat.bat so that the
 generated classpath doesn't doesn't include the system classpath and only
 includes things built by the batch file.

 I have placed log4j.jar and crimson.jar into WEB-INF/lib for my app.

 For other reasons crimson.jar needs to be 1st on the classpath
(specifically
 b4 parser.jar) and I so try adding it by doing like so in batch file:

 set CP=%TOMCAT_HOME%\webapps\MYAPP\WEB-INF\lib\crimson.jar;%CP%

 But it isn't found. If I instead do: CP=%TOMCAT_HOME%\lib\crimson.jar it
 also isn't found.

 Only if I place it outside of %TOMCAT_HOME% and reference it are classes
 found.

 The wierd thing is that I can place log4j.jar in the %TOMCAT_HOME% and
have
 things work (but also can't find classes from it if it's added to
classpath
 referenced from WEB-INF/lib).

 This also extends to rmi stubs in the WEB-INF/classes directory. Other
 classes from our app in this dir our found except for the stubs.

 any ideas, I'm stu[bb|mp]ed...





Re: Jars in WEB-INF/lib and RMI stubs in WEB-INF/classes not found

2001-09-20 Thread Vladimir Grishchenko

Sounds like a beaten to death topic. Search TC archives for class loading.

--V.

PS: sorry for not being too helpful, but this question has been answered way
too many times.

- Original Message -
From: Joshua van Tonder [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, September 20, 2001 2:47 PM
Subject: Jars in WEB-INF/lib and RMI stubs in WEB-INF/classes not found


 How does classloading work in tomcat 3.2.2?

 In deploying my application I am having problems getting classes loaded
 aren't on the system classpath. I changed the tomcat.bat so that the
 generated classpath doesn't doesn't include the system classpath and only
 includes things built by the batch file.

 I have placed log4j.jar and crimson.jar into WEB-INF/lib for my app.

 For other reasons crimson.jar needs to be 1st on the classpath
(specifically
 b4 parser.jar) and I so try adding it by doing like so in batch file:

 set CP=%TOMCAT_HOME%\webapps\MYAPP\WEB-INF\lib\crimson.jar;%CP%

 But it isn't found. If I instead do: CP=%TOMCAT_HOME%\lib\crimson.jar it
 also isn't found.

 Only if I place it outside of %TOMCAT_HOME% and reference it are classes
 found.

 The wierd thing is that I can place log4j.jar in the %TOMCAT_HOME% and
have
 things work (but also can't find classes from it if it's added to
classpath
 referenced from WEB-INF/lib).

 This also extends to rmi stubs in the WEB-INF/classes directory. Other
 classes from our app in this dir our found except for the stubs.

 any ideas, I'm stu[bb|mp]ed...





Re: JDBC Connection Pool Theory ??

2001-09-20 Thread Vladimir Grishchenko

Professional Java server programming  from WROX had a chapter about it, as
far as I remember. I can't call it a comprehensive study, but it had some
meaningful explanations.

What's wrong with poolman btw? IMHO it is as simple as it gets, your
application doesn't even know it deals with pooled connections. Portable? As
portable as Java itself.

 My philosophy on such things is take it if it's available and concentrate
on your application domain issues and not the plumbing (plumbing in good
sense here...).

--V.


- Original Message -
From: Jon Shoberg [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, September 20, 2001 7:37 PM
Subject: JDBC Connection Pool Theory ??



 Can anyone suggest or point to readings on JDBC connection pool theory?
 Something that covers how a pool is implemented, best case / worst case
 scenarios, tips and traps.

 My next web application is looking to be very database (mysql) intensive.
 I would like a pooling mechanism that is VERY simple to use, VERY light,
low
 overhead, and portable.  Having looked at packages such as poolman, I
 decided I need to learn a bit more about JDBC and pooling in general.  Any
 thoughts ?

 Jon





off topic

2001-09-13 Thread Vladimir Grishchenko

Just wondering if someone on this list is familiar with WebSphere 4.0.
I'm looking for any info on how to add extended status code messages
to it. In TC I simply edited a properties file to associate status codes
with messages and everything was fine. WebSphere throws a NullPointer
whenever I try to use a non standard status code and nothing works.
I looked everywhere, no result. Looks like it's hard-coded...
Anyway, sorry for off-topic.

--V.



Re: interesting fault on toshiba laptop

2001-08-30 Thread Vladimir Grishchenko

Sounds weird. I don't think that hw is the problem, because if it was then
you'd get some sort of error in native code, but Tomcat not recognizing
sessions Most likely the problem lies in different network
configuration, like IP address, any http proxies you're using, etc.


--V.


- Original Message -
From: Jason Eacott [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, August 29, 2001 11:59 PM
Subject: interesting fault on toshiba laptop


 Hi,
 I have been trying to run Tomcat 3.x on a toshiba Satelite Pro
 4300 series running both NT4sp6 and W2000 Advanced Server.
 Tomcat 3.x behaves very strangely in both OS, the main symptom
 being that it fails to recognise sessions properly. Tomcat4 does not
 have this problem.
 I am thinking that this problem is due to hardware rather than
 software since it occurs ONLY on this machine and in both OS'
 that I've tried it on.

 Just thought Id share :)

 Jason.

 --
 Jason Eacott
 Hardlight Interactive
 http://www.hardlight.com.au

 Support bacteria - they're the only culture some people have.




Re: Memory used by java process

2001-08-26 Thread Vladimir Grishchenko

As long as the growing process stops at some point it's fine.
Java is dynamic by nature, meaning the classes are loaded
on demand, not proactively. Jsp pages are compiled
into servlets and get loaded only as needed, that's why
process size is growing with time. Try -verbose
options to see how many classes get loaded per request.
You're also generating objects yourself in servlets/Jsp's.
Some of them are long lived, which contributes to growing
heap/process size. Another thing is that VM doesn't give
all memory back even after it's reclaimed by GC.

 If it keeps growing
without bounds most likely you have a memory leak
somewhere, meaning some objects cannot be reclaimed by
GC because they are strongly reachable. 

Also, the -Xincgc option you use enables train or incremental
garbage collection, which from my experience makes
GC less aggressive in general (this is what it's meant for anyway),
 which translates into larger Java process/heap size but less
noticeable GC pauses.

Hope this helps,
--V.


- Original Message - 
From: Roy K. Mayr R. [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, August 25, 2001 6:25 PM
Subject: Memory used by java process


 Hi,
 
 I'm working with Solaris 8, Tomcat 3.3b, jdk 1.3.1, and Apache...
 
 When I start tomcat, java process use 16M and when I run JSP pages this
 process grow more, more, more
 
 I start java with options:
 
 export TOMCAT_OPTS= -server -verbosegc -Xincgc -Xmx150m
 
 What is wrong??
 
 Output of verbosegc is:
 
 [GC 2048K-315K(2368K), 0.0462030 secs]
 [GC 2363K-700K(2816K), 0.0608491 secs]
 [GC 2748K-892K(3072K), 0.0341915 secs]
 [Full GC 2532K-1166K(2944K), 0.1949014 secs]
 [Full GC 1182K-1166K(2944K), 0.1618361 secs]
 [Full GC 1182K-1166K(2944K), 0.1584852 secs]
 [Full GC 1182K-1165K(2944K), 0.1936703 secs]
 [Full GC 1181K-1165K(2944K), 0.1533219 secs]
 [Full GC 1181K-1165K(2944K), 0.1563846 secs]
 [Full GC 1181K-1166K(2944K), 0.1545294 secs]
 [Full GC 1182K-1165K(2944K), 0.1559197 secs]
 [Full GC 1181K-1165K(2944K), 0.1528804 secs]
 [Full GC 1181K-1166K(2944K), 0.1569995 secs]
 [Full GC 1182K-1165K(2944K), 0.1563494 secs]
 [Full GC 1181K-1165K(2944K), 0.1603762 secs]
 [Full GC 1181K-1165K(2944K), 0.1538769 secs]
 [Full GC 1181K-1165K(2944K), 0.1532354 secs]
 [Full GC 1181K-1165K(2944K), 0.1560933 secs]
 [Full GC 1181K-1165K(2944K), 0.1897674 secs]
 [Full GC 1181K-1165K(2944K), 0.1539893 secs]
 [Full GC 1181K-1165K(2944K), 0.1579279 secs]
 [Full GC 1181K-1165K(2944K), 0.1608534 secs]
 [Full GC 1181K-1165K(2944K), 0.1537858 secs]
 [Full GC 1181K-1165K(2944K), 0.1563487 secs]
 [Full GC 1181K-1165K(2944K), 0.1607285 secs]
 [Full GC 1181K-1165K(2944K), 0.1566505 secs]
 [Full GC 1181K-1165K(2944K), 0.1559282 secs]
 [Full GC 1181K-1165K(2944K), 0.1530489 secs]
 [Full GC 1181K-1165K(2944K), 0.1607813 secs]
 [Full GC 1181K-1165K(2944K), 0.1538563 secs]
 ...
 
 And finaly, every page that I see, output:
 
 [GC 6976K-6516K(7232K), 0.0142359 secs]
 [GC 7021K-6564K(7232K), 0.0164692 secs]
 [GC 7076K-6643K(7360K), 0.0208976 secs]
 
 
 What it means ??
 
 Roy
 
 



Re: How do I make Tomcat include needed jars for my servlet?

2001-08-24 Thread Vladimir Grishchenko

Well, I think you have 3 options:

1. Switch to Linux and use symlinks
2. Ask Sun to change servlet spec.
3. Write a script that will copy the files in one shot.

Cheers,
--V.

- Original Message -
From: Ju Yan Jery Qin [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Friday, August 24, 2001 1:58 AM
Subject: Re: How do I make Tomcat include needed jars for my servlet?


 First thank Vladimir Grishchenko and Rob S. for your help

 But in my case, since our product has its own framework and we just do
some customization. So the directory structure is fixed, it looks like this
 d:\vendor\webapp1\codebase\
 under this directory there are classes used by webapp1
 d:\vendor\webapp1\codebase\
 under this directory there are classes used by webapp2
 The two webapps has many other directories and also they have many similar
classes with the same package name.

 In our case,
 server.xml has these entries:

  Context path=/webapp1
   docBase=d:\vendor\webapp1\codebase
   debug=0
   reloadable=true 
   /Context
  Context path=/webapp2
   docBase=d:\vendor\webapp2\codebase
   debug=0
   reloadable=true 
   /Context
 Our developer is used to generate classes in d:\vendor\webapp1\codebase\
and d:\vendor\webapp1\codebase\

 If I can redirect d:\vendor\webappx\WEB-INF\classes to
d:\vendor\webappx\codebase\ just like symbolic link under UNIX, this problem
will be resolved. So I wonder if there is a place where we can define
CLASSPATH in our webapp instead of put our classes in a fixed place(
although it is relavant to our webapp ). I think this is a good feature if
implemented.




Re: How do I make Tomcat include needed jars for my servlet?

2001-08-24 Thread Vladimir Grishchenko

Yet another one:

Place codebase dirs on system classpath, you'll
have to restrat tomcat every time there's a change.

--V.

- Original Message -
From: Vladimir Grishchenko [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, August 24, 2001 7:38 AM
Subject: Re: How do I make Tomcat include needed jars for my servlet?


 Well, I think you have 3 options:

 1. Switch to Linux and use symlinks
 2. Ask Sun to change servlet spec.
 3. Write a script that will copy the files in one shot.

 Cheers,
 --V.

 - Original Message -
 From: Ju Yan Jery Qin [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Sent: Friday, August 24, 2001 1:58 AM
 Subject: Re: How do I make Tomcat include needed jars for my servlet?


  First thank Vladimir Grishchenko and Rob S. for your help
 
  But in my case, since our product has its own framework and we just do
 some customization. So the directory structure is fixed, it looks like
this
  d:\vendor\webapp1\codebase\
  under this directory there are classes used by webapp1
  d:\vendor\webapp1\codebase\
  under this directory there are classes used by webapp2
  The two webapps has many other directories and also they have many
similar
 classes with the same package name.
 
  In our case,
  server.xml has these entries:
 
   Context path=/webapp1
docBase=d:\vendor\webapp1\codebase
debug=0
reloadable=true 
/Context
   Context path=/webapp2
docBase=d:\vendor\webapp2\codebase
debug=0
reloadable=true 
/Context
  Our developer is used to generate classes in d:\vendor\webapp1\codebase\
 and d:\vendor\webapp1\codebase\
 
  If I can redirect d:\vendor\webappx\WEB-INF\classes to
 d:\vendor\webappx\codebase\ just like symbolic link under UNIX, this
problem
 will be resolved. So I wonder if there is a place where we can define
 CLASSPATH in our webapp instead of put our classes in a fixed place(
 although it is relavant to our webapp ). I think this is a good feature if
 implemented.
 




Re: How do I make Tomcat include needed jars for my servlet?

2001-08-23 Thread Vladimir Grishchenko

My setup is as follows:

d:\development\projectX\src - contains all source code
d:\development\projectX\WEB-INF\classes - compiled classes get here (use
javac -d ...)

server.xml has this entry:

 Context path=/foo
  docBase=d:\development\projectX
  debug=0
  reloadable=true 
  /Context

Any time there's a change TC should detect it and reload your webapp,
subject to TC limitations on classes/servlet reloading ...

In other words, don't use jars if your classes are changing frequently,
use ...\WEB-INF\classes as a target for your compilation.
If you really like jar files then some IDE's like JBuilder allow you to
set a jar file which will be updated as needed whenever you build
your projects.

CLASSPATH usually means system classpath, and webapp CLASSPATH
is ...\WEB-INF\classes;...\WEB-INF\lib\*.jar, afaik there's no way to change
it.

--V.

- Original Message -
From: Ju Yan Jery Qin [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, August 23, 2001 6:33 PM
Subject: How do I make Tomcat include needed jars for my servlet?


 Hi all,
 I have read this topics but it still can not resolve my problem.  Your
suggestion is to copy application related jar files into
%YourWebAppPath%/WEB-INFO/lib dirctory. But my application is under
development, so whenever I regenerated jar files for  my web app, I have to
copy them to that directory again. If under UNIX, you can use symbolic
links, but I use Windows 2000 as my server.  So my question is: is there any
way to define CLASSPATH variable for my web application independently so
that I don't need to copy them again and again.
 In fact, in my case, I have two web application which are derived from the
same base but should be installed independently. So these two web
application have many classes with the same package and name. And these
classes spreaded in two directory d:\vendor\webapp1 and d:\vendor\webapp2
but not in jar file. So I really need a way to define CLASSPATH in
application level instead of copy tons of variable classes into
d:\vendor\webapp1\WEB-INFO\classes and d:\vendor\webapp2\WEB-INFO\classes
again and again.

 Any clue is appreciated!

 Best Regards!

 Jerry Chin



multiple context paths pointing to the same doc base?

2001-08-22 Thread Vladimir Grishchenko

Hi there,

May be somebody can give me a quick answer with regards to T3.2.2.

I need to have multiple context paths to point to the same doc base,
say my server.xml has the following entries:

 Context path=/somectx
  docBase=d:/foo/bar
  debug=0
  reloadable=false 
 /Context


 Context path=/somectx1
  docBase=d:/foo/bar
  debug=0
  reloadable=false 
 /Context

Will the above config cause my webapp classes/servlets to be loaded
twice through different classloaders, or TC is smart enough to realize
it's the same webapp?

Thanks,
--V.



Re: multiple context paths pointing to the same doc base?

2001-08-22 Thread Vladimir Grishchenko

Thanks for the clarification, it makes sense.
Is it according to the spec or just a peculiarity of Tomcat?

Actually, I need just the opposite, is there any way to do this? Meaning
different context paths - one webapp and one class loader...

Thanks,
--V.

- Original Message - 
From: Craig R. McClanahan [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, August 22, 2001 9:41 AM
Subject: Re: multiple context paths pointing to the same doc base?


 
 
 On Wed, 22 Aug 2001, Vladimir Grishchenko wrote:
 
  Hi there,
 
  May be somebody can give me a quick answer with regards to T3.2.2.
 
  I need to have multiple context paths to point to the same doc base,
  say my server.xml has the following entries:
 
   Context path=/somectx
docBase=d:/foo/bar
debug=0
reloadable=false 
   /Context
 
 
   Context path=/somectx1
docBase=d:/foo/bar
debug=0
reloadable=false 
   /Context
 
  Will the above config cause my webapp classes/servlets to be loaded
  twice through different classloaders,
 
 Yes.
 
  or TC is smart enough to realize
  it's the same webapp?
 
 
 It is *not* the same webapp.
 
 Every webapp must have a unique context path, and you have just defined
 two different context paths here.  The fact that the document base is the
 same is just a coincidence.
 
  Thanks,
  --V.
 
 
 Craig
 
 
 



Re: multiple context paths pointing to the same doc base?

2001-08-22 Thread Vladimir Grishchenko

  Thanks for the clarification, it makes sense.
  Is it according to the spec or just a peculiarity of Tomcat?
 

 Servlet 2.3 PFD2, Section 3.1 (emphasis added by **):

   A ServletContext is rooted at *a* known
   path within the web server.  For example,
   a servlet context could be located at
   http://www.mycorp.com/catalog.  All requests
   that begin with the /catalog request path,
   known as the context path, are routed to
   the web application associated with the
   servlet context.


Well, I don't want to be picky but this quote doesn't emphasize
that context is the same thing as web application, nor does it
say that a web application cannot be shared by multiple contexts , it merely
says that all requests are routed to the app associated with
a particular context. In my understanding (which might be wrong btw)
a webapp is something you package and distribute in a *.war file meaning
classes, servlets, jsps, static html, and a webapp can be shared by
different
contexts. Isn't it more correct to have a class loader per *.war file
(logically) than per contextpath? Or have it configurable since  the spec
is somewhat vague on this point?

  Actually, I need just the opposite, is there any way to do this? Meaning
  different context paths - one webapp and one class loader...
 

 Not that I know of.

 Of course, that begs the question of *why* you need this -- if everything
 is identical (as it would be if you got your wish), then what's the point?

Without going into much details my particular application is relying on
combination
of context path and path info values to perform an internal lookup of some
data.
The data is cached and there's a cache maintanence thread running. So, I end
up
with as many caches and threads as many contexts I have configured. Of
course
I can try to interpret request URI's to extract the data I need, but using
context path
is much easier. Well, I guess I have no choice now :-|

--V.


  Thanks,
  --V.
 

 Craig


  - Original Message -
  From: Craig R. McClanahan [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Wednesday, August 22, 2001 9:41 AM
  Subject: Re: multiple context paths pointing to the same doc base?
 
 
  
  
   On Wed, 22 Aug 2001, Vladimir Grishchenko wrote:
  
Hi there,
   
May be somebody can give me a quick answer with regards to T3.2.2.
   
I need to have multiple context paths to point to the same doc base,
say my server.xml has the following entries:
   
 Context path=/somectx
  docBase=d:/foo/bar
  debug=0
  reloadable=false 
 /Context
   
   
 Context path=/somectx1
  docBase=d:/foo/bar
  debug=0
  reloadable=false 
 /Context
   
Will the above config cause my webapp classes/servlets to be loaded
twice through different classloaders,
  
   Yes.
  
or TC is smart enough to realize
it's the same webapp?
   
  
   It is *not* the same webapp.
  
   Every webapp must have a unique context path, and you have just
defined
   two different context paths here.  The fact that the document base is
the
   same is just a coincidence.
  
Thanks,
--V.
   
  
   Craig
  
  
  
 





Re: multiple context paths pointing to the same doc base?

2001-08-22 Thread Vladimir Grishchenko


 One option you have is to put the classes that actually cache things into
 a common directory ($TOMCAT_HOME/lib or $CATALINA_HOME/lib).  Such classes
 are shared across web apps, so this should accomplish your goal of having
 a single cache.  They are loaded from a (common) parent class loader to
 the one for each web app.


I'm not using the latest servlet spec (2.3). Anyway, the simplest solutuion
will be to put all my classes
on the system classpath, this should  work. I have no jsp's and don't need
dynamic class
reloading in production, so I beleive it's perfectly legal in my case.

Thanks and regards,

--V.




Re: ClassLoader Reloading issues

2001-08-19 Thread Vladimir Grishchenko

somewhat related issue I've found with T3.2.2.
After class reloading the old class isn't GC'ed, is a reference to previous
class that's kept around somewhere? Actually I noticed it because I had a
cleanup thread running infinitely, and after the class reload I ended up
having two threads running.

Could also be that runtime keeps a reference to a running Thread (which is
the inner class) preventing a class (outer class) from being GC'ed? Sounds
like a good explanation...

--V.



- Original Message -
From: Craig R. McClanahan [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, August 19, 2001 8:25 PM
Subject: Re: ClassLoader  Reloading issues




On Mon, 20 Aug 2001, Andrés Aguiar wrote:

 I have a JAR file in my web-inf\lib directory that has an object pool. The
 pool is kept as a singleton, so, I have a static member with it.


And because the class itself is loaded by the webapp class loader, the
static is in fact global *only* within this particular web app.

 The problem is that when a class in web-inf\classes is reloaded, it seems
to
 use a new classloader,

That's correct -- there is no way to unload a class in Java except for
throwing away the class loader that loaded it (and therefore all of the
classes loaded by that old class loader).

 so the static member is gets not the same as it was,
 and I end having multiple object pool instances.

 If I put the .JAR in the Tomcat classpath, it obviously works ok.

 The problem is that I must keep running in the same servlet-engine
instance
 several applications each of which could a have a different version of my
 .JAR file, so I can't put it in the classpath.

 The same happens running the app in Resin.

 Now, in the servlet spec says:

 'Although a Container Provider implementation of a class reloading scheme
 for ease of development is not required, any such implementation must
ensure
 that all servlets, and classes that they may use, are loaded in the scope
of
 a single class loader. This requirement is needed to guarantee that the
 application will behave as expected by the Developer.

 As a development aid, containers are encouraged to maintain the full
 semantics of notification to session binding listeners if they
 determine to terminate sessions in order to reload classes.

 Previous generations of containers created new class loaders to load a
 servlet, distinct from class loaders used to load other servlets or
classes
 used in the servlet context. This could cause object references within a
 servlet context to point at unexpected classes or objects, and cause
 unexpected behavior.'


Very early containers used a different class loader for every servlet, not
for every web app.  To ensure consistent behavior, this is no longer
allowed.

 I'm not sure if this paragraph is referring to the case I'm describing,
but
 if not, it seems pretty close...

 Any ideas? Is this the way it's supposed to work?


Yes, it is working the way it is supposed to work (given the limitations
on what Java allows for class reloading).

What you need to do is make sure that your class is aware of when the
application is being shut down and started up again, so that you can save
away the contents of the object pool (at shutdown time) and restore them
(at startup time).  At shutdown time, you'll need to save the state of the
object pool in some fashion that can be used to reconstruct it upon the
subsequent startup.  A common technique is to serialize the pooled objects
to a sequential file (Tomcat 4 does this with all of the currently active
sessions when you shut it down or do an application reload).

To make sure your object pool class is notified, you've got a couple of
choices:

* [Servlet 2.3 only] You can use the new application event listener
  APIs and make sure your class is notified on the application startup
  and application shutdown events.  This will work in Tomcat 4 and other
  containers that implement the new servlet spec.

* You might have a servlet defined as load-on-startup that initializes
  the object pool in its init() method and saves it away in its destroy()
  method.  This depends on the servlet container *not* removing this
  servlet from service at any time *other* than application shutdown --
  while commonly implemented that way, this is not guaranteed by the
  servlet spec (it would work in all versions of Tomcat, though).

 Thanks.

Craig McClanahan






Re: ClassLoader

2001-08-14 Thread Vladimir Grishchenko

I don't fully understand your setup from the messages you sent but if you
have a custom class loader then you should register webapp class loader to
be the parent of your custom class loader. So, if your custom class loader
lives in webapp directory its constructor should look like:

public class CustomClassLoader
{
   public CustomClassLoader()
   {
super(this.getClass().getClassLoader()  //1
   }
}

and then load your classes like

CustomClassLoader ccl = new CustomClassLoader();
Class clazz = Class.forName(xyz.zyx.Foo, true, ccl);

if you skip lilne 1 or have just call to super() then there's simply no way
you can load classes from webapp directory through this classloader, unless
it's implemented that way (btw it's a bad idea) , because system class
loader is set as the parent of ccl, and sys class loader has no clue of how
to load classes from webapp directory.
So, if you write your class loader the above way ccl will first try to
delegate class loading up the class loader tree, which will fail, so it'll
try to load the class itself. As the result of loading class xyz.zyx.Foo any
intefaces loading it implements will be unitiated through ccl, which will be
delegated to webapp class loader, so there should be no problem finding them
in jar files located in webapp directory. There's also a possibility you can
get nasty ClassCast exceptions because of the fact JVM considers  a class to
be a combination of class and its class loader, so the same byte array
represineting a class loaded through different class loaders is not the same
class to the JVM.

--V.


- Original Message -
From: jochen mader [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, August 13, 2001 6:16 AM
Subject: Re: ClassLoader



  Moving things from Tomcat's internal classes (any version) into your
  /WEB-INF/lib is *not* going to work.
 
  What are you trying to accomplish that the standard class loading model
  does not support?  Just saying I want to use a classloader inside my
  servlet does not help much in getting useful suggestions.
 
   Thanks in advance
   Jochen
 
  Craig McClanahan

 I'm trying to allow my servlet to download classes from another server via
 RMI and to use those classes. The problem now is that when I downloaded
the
 classes and I try to define the class via the ClassLoader the ClassLoader
 tells me that it can't find the required interface classes (which are
stored
 in the jars inside the WEB-INF/lib directory). By looking through your
 archive I found the following post:

 http://w6.metronet.com/~wjm/tomcat/2001/Feb/msg00096.html

 *snip*

 
  Am I just screwed or is there some cool trick that I am missing?  Of
course
  I could change the deployment scheme to put a copy of the dispatcher
  servlet into each apps WE-INF/classes, but this seems a bit clunky.
 

 It's not clunky -- its required by virtue of the fact that classloaders
know
 how to delegate upwards but not downwards.  For lots of security related
 reasons, that is actually a Good Thing.

 *snip*

 Is this post wrong and is there another sollution?
 And if not: which of all those classes is the dispatcher servlet?

 Thx
 Jochen





Re: Restarting Tomcat/Apache

2001-08-13 Thread Vladimir Grishchenko

Had the same problem, never figured out how to get rid of it.
I used it stand alone.

-V.


- Original Message -
From: Simon Hardingham [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, August 13, 2001 10:27 AM
Subject: Restarting Tomcat/Apache


 Hi,

 I am having problems restarting Tomcat.  It can be a real problem to get
 Tomcat to shutdown (often requiring a killall java).  Even then starting
up
 can be intermittent.  Has anyone else had any problems with starting and
 stopping Tomcat.  System details are:

 RedHat Linux 7.1 on Intel
 Tomcat 3.2.3
 mod_jk (from 3.2.3)
 Apache 1.3.19
 servlets with JDBC to PostgresSQL 7.1.2

 Any thoughts? Development is difficult when restarting is such an effort!

 Many thanks

 Simon

 _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
 _/ Simon Hardingham - netXtra Ltd - UK  _/
 _/  Direct Dial: +44 (0) 1787 314890_/
 _/ Tel: +44 (0) 1787 319393Fax: +44 (0) 1787 319394 _/
 _/ http://www.netxtra.co.uk [EMAIL PROTECTED] _/
 _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/





RE: Dynamic Class Loading - Reflexion failure

2001-08-03 Thread Vladimir Grishchenko



 -Original Message-
 From: Frank Bourdache 
 [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, August 02, 2001 12:45 AM
 To: [EMAIL PROTECTED]
 Subject: Dynamic Class Loading - Reflexion failure
 
 
 Hi,
 
 I am facing problems while loading dynamically classes in my 
 servlet. For my application's purposes, I have to generate 
 java code and compile it on the fly, then use it.
 Using standard reflexion mecanisms, I try to instanciate a 
 new testClass object. If it fails, I fork a new process to 
 generate the class, and retry to instanciate this object again.
 If testClass.class is not present when I'm starting Tomcat 
 4.0b6, there is no way i can instanciate a testClass Object. 
 (exceptions are raised in both blocks)

ok, see comments below


 If I comment out the first block (I always generate the 
 testClass.class file), then everything works fine, but this 
 is unacceptable.

If this works the first scenario should work too. Are you sure
you attempt to instantiate a new class after .class file is actually
generated and not prematurely?

After you figure out what is the problem you might consider compling
bytecodes without forking a new process and avoid the unnecessary overhead.
That's how jsp are compiled in tomcat (or JaSPER?).

Also my impression is that Tomcat (at least 3.2) reloads all the classes 
in web application regardless of which class has changed, so if you
generate a new .class and try to instantiate it through webapp class
loader it will cause all classes in webapp to reload (correct me if
I'm wrong) = overhead. What you could do instead is to use an instance of
URLClassLoader to load your generated file. Keep in mind that if you
decide to do that you'll have to put your generated class outside of
system classpath.
If you put it on the system classpath no class reloading is possible.
The problem with URLClassLoader approach is that your newly generated
class will not be able to find any of the classes in your webabapp 
directory.
No matter what you do it's not gonna be pretty, unless the class
you're trying to reload is pretty much isolated.


--V


 I also tried using classLoader, but failed again.
 
 Don't know if it really is Tomcat related. Any clues ?
 Thanks for the help !
 
 Regards,
 /Frank
 
 
 public class LoadClassSample extends HttpServlet {
 ...
 try {
 Class testObjClass = Class.forName(testClass);
 Object testObject = testObjClass.newInstance();
 } catch( ClassNotFoundException CNFException ) {
 
 try {
 Process _proc = 
 Runtime.getRuntime().exec(/usr/lib/java/bin/javac 
 /tmp/testClass.java -d 
 /usr/local/jakarta-tomcat-4.0-b6/webapps/examples/WEB-INF/classes/);
 _proc.waitFor();
 Class testObjClass = Class.forName(testClass);
 Object testObject = testObjClass.newInstance();
 ...
 } catch( Exception PROCException ) {
 ...
 }
 ...
 


***
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. Any unauthorized review, use, disclosure or distribution
is prohibited. If you are not the intended recipient, please contact
the sender by reply e-mail and destroy all copies of the original
message.
***



RE: viewing application/msword using TOMCAT

2001-08-02 Thread Vladimir Grishchenko

if your question is how to launch WORD automatically when opening a doc file
from web browser then the answer is to configure mime-types on TOMCAT side,
was it web.xml where you do it? don't remember...

--V

 -Original Message-
 From: jingi [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, August 02, 2001 4:34 PM
 To: [EMAIL PROTECTED]
 Subject: viewing application/msword using TOMCAT
 
 
 how to view  application/msword file on browser side using 
 TOMCAT ?
 thanks for help in advance.
 
 -jingi
 


***
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. Any unauthorized review, use, disclosure or distribution
is prohibited. If you are not the intended recipient, please contact
the sender by reply e-mail and destroy all copies of the original
message.
***



RE: ServletContext.log() - where does it go?

2001-07-27 Thread Vladimir Grishchenko

change verbosity level/path in server.xml?

--V.

-Original Message-
From: chris brown [mailto:[EMAIL PROTECTED]]
Sent: Friday, July 27, 2001 3:15 AM
To: tomcat-user
Subject: ServletContext.log() - where does it go?


I've tried some simple logging using the following code in some servlets
running under Tomcat 3.2.3.

getServletContext().log(some message);

Normally, I would have expected this to appear in the servlet.log file,
but this file remains empty.  It's created correctly by Tomcat whenever
Tomcat starts, but seems empty.

Any ideas as to what I should do to make the messages appear?

Thanks,
Chris


***
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. Any unauthorized review, use, disclosure or distribution
is prohibited. If you are not the intended recipient, please contact
the sender by reply e-mail and destroy all copies of the original
message.
***



how to check if a url maps to Tomcat space?

2001-07-27 Thread Vladimir Grishchenko

I'm trying to find the most effective way to determine (in servlet) if
a particular url will be served by the same tomcat instance
that the current servlet is running in. I could use java.net.InetAddress
and check host names or ip addresses, but it seems to be an overkill plus
I'm not sure how to handle port numbers in this case.

Thanks for any clues,

--V.


***
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. Any unauthorized review, use, disclosure or distribution
is prohibited. If you are not the intended recipient, please contact
the sender by reply e-mail and destroy all copies of the original
message.
***



RE: Custom HTTP status code

2001-07-25 Thread Vladimir Grishchenko



extract 

org/apache/tomcat/core/LocalStrings.properties

(or org/apache/tomcat/service/LocalStrings.properties ??
don't remember exactly which one did it for me..)

from webserver.jar, add/edit status codes  you want, put it
back and restart Tomcat. You should be running fine now.
This should work on 3.2.2, not sure about T4.

--V.




---
Hi!

I'm developing an application not targeted to the web, but still I need to
use the HTTP as the protocol. I've chosen to specify five new status code,
to report some kind of errors I may generate and that aren't covered by
existing ones. These codes are 601, 602, 603, 605, 606. The problem is that
using JRun it just ignored the error code, and reported the page normally;
tomcat, on the other hand, throws an exception everytime my application
reports one such code. This degrades performances very much...

Is there a way to specify these new codes as valid? And, in case, to bind a
string to them as a description, just as for the other ones? I saw there are
some LocalString.properties files, but I can't get them to work; and I think
they're just for localization...

Many thanks,

Germano Rizzo


***
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. Any unauthorized review, use, disclosure or distribution
is prohibited. If you are not the intended recipient, please contact
the sender by reply e-mail and destroy all copies of the original
message.
***



RE: newbie (or a dummy?)

2001-07-25 Thread Vladimir Grishchenko

I don't know the exact answer but here are some clues:

1. what jdk are you running on? upgrade to 1.2/1.3 if it's = 1.1
2. check your java.security file, make sure you have the following
   entry:
security.provider.1=sun.security.provider.Sun
   I guess if you're using non-sun jdk it could be something else.
3. read this

http://java.sun.com/products/jdk/1.2/docs/guide/security/HowToImplAProvider.
html
   to understand Java security provider mechanisms

Hope this helps.

--V.


-Original Message-
From: Henderson, Kevin CECOM RDEC STCD
[mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 25, 2001 8:41 AM
To: '[EMAIL PROTECTED]'
Cc: Lange, Mark A CECOM RDEC STCD
Subject: RE: newbie (or a dummy?)


This is so frustrating.  I got JCE, stuck all the jars in jdk/jre/lib/ext,
and no dice.  I have been reading thru forums for 2 weeks now, and it seems
that everytime someone had a 'SHA-1 not avail' error, nobody replied.  I
don't know where to start.  PLEASE HELP me  8(


-Original Message-
From: Vladimir Grishchenko [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 25, 2001 4:21 AM
To: '[EMAIL PROTECTED]'
Subject: RE: newbie (or a dummy?)


Just a wild guess: may be you are missing SHA-1 security provider?
See if you can get it in a separate download from Sun.

--V.

-Original Message-
From: Henderson, Kevin CECOM RDEC STCD
[mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 24, 2001 8:35 AM
To: '[EMAIL PROTECTED]'
Subject: newbie (or a dummy?)


I am trying to run tomcat 3.2.2 and cocoon 1.8.2 on a win2k box.
I followed all instructions to setup tomcat to work with cocoon, and when I
try to run tomcat (w/ tomcat run, cause a new window closes to fast!) , the
output looks normal up until this:

Exception in thread main java.lang.InternalError: internal error: SHA-1
not available
at sun.security.provider.SecureRandom.init(SecureRandom.java:89)

... the error stack goes on for twenty or so lines...

I really would like to get this shtuff working!  what have I overlooked?
THANK YOU  ;P

{then when I try to put the error trace to a file for the sake of my hand-
(tomcat run err.txt), the output is there up until the errors, then it says
error report can be found inTOMCAT_HOME/logs/tomcat.log ... but its
not there!}


***
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. Any unauthorized review, use, disclosure or distribution
is prohibited. If you are not the intended recipient, please contact
the sender by reply e-mail and destroy all copies of the original
message.
***



RE: newbie (or a dummy?)

2001-07-24 Thread Vladimir Grishchenko

Just a wild guess: may be you are missing SHA-1 security provider?
See if you can get it in a separate download from Sun.

--V.

-Original Message-
From: Henderson, Kevin CECOM RDEC STCD
[mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 24, 2001 8:35 AM
To: '[EMAIL PROTECTED]'
Subject: newbie (or a dummy?)


I am trying to run tomcat 3.2.2 and cocoon 1.8.2 on a win2k box.
I followed all instructions to setup tomcat to work with cocoon, and when I
try to run tomcat (w/ tomcat run, cause a new window closes to fast!) , the
output looks normal up until this:

Exception in thread main java.lang.InternalError: internal error: SHA-1
not available
at sun.security.provider.SecureRandom.init(SecureRandom.java:89)

... the error stack goes on for twenty or so lines...

I really would like to get this shtuff working!  what have I overlooked?
THANK YOU  ;P

{then when I try to put the error trace to a file for the sake of my hand-
(tomcat run err.txt), the output is there up until the errors, then it says
error report can be found inTOMCAT_HOME/logs/tomcat.log ... but its
not there!}


***
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. Any unauthorized review, use, disclosure or distribution
is prohibited. If you are not the intended recipient, please contact
the sender by reply e-mail and destroy all copies of the original
message.
***



RE: Authentication with NT4.0 login and password

2001-07-23 Thread Vladimir Grishchenko



Take a 
look at JAAS, Sun has released NT auth. module under JAAS 
umbrella.

--V.

  -Original Message-From: João Folha 
  [mailto:[EMAIL PROTECTED]]Sent: Monday, July 23, 2001 7:51 
  PMTo: [EMAIL PROTECTED]Subject: 
  Authentication with NT4.0 login and password
  Hi there,
  
  I want to make an authentication process with NT 
  login and password, can you help me please?
  
  How can i do that?
  
  cheers
  João Folha

***
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. Any unauthorized review, use, disclosure or distribution
is prohibited. If you are not the intended recipient, please contact
the sender by reply e-mail and destroy all copies of the original
message.
***



RE: java.lang.SecurityException: sealing violation?

2001-07-13 Thread Vladimir Grishchenko

as far as I know it means that you have a class name collision in two jars
and one of them is sealed, I had a similar problem when using xml packages.
Try to put jars foreign to tomcat in the begining of the classpath, or at
the end... classpath reordering did it for me..

--V.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, July 13, 2001 11:46 AM
To: [EMAIL PROTECTED]
Subject: java.lang.SecurityException: sealing violation?


Okay, I gave up on my tomcat installation. I wiped
everything clean and then got all the source in the
hopes that it might work better if I compiled
vs. dropping binaries.

So, there are many confusing aspects of the
installation instructions regarding building the
source. Seems like maybe the docs don't match up with
the behavior of the current releases?

Anyway, I plodded thru, I think I got everything
straight. BUT, when I run startup.sh, I get the
following:

java.lang.SecurityException: sealing violation

I followed the install instructions that came with the
JSSE from Sun. Have no idea what this error means.

Can anyone help?

Thanks.

 - Jeremy


***
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. Any unauthorized review, use, disclosure or distribution
is prohibited. If you are not the intended recipient, please contact
the sender by reply e-mail and destroy all copies of the original
message.
***



RE: Tomcat 4.0b5 keeps shutting down

2001-07-11 Thread Vladimir Grishchenko

doesn't look like a tomcat problem. VM bug?

-Original Message-
From: Jakarta Jakarta [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 11, 2001 7:32 AM
To: [EMAIL PROTECTED]
Subject: Tomcat 4.0b5 keeps shutting down


I am running Tomcat 4.0b5 in standalone mode on a Sun
Solaris 8 system, running the latest patches and the
currest Sun Java 1.3.1.  Tomcat starts up ok, and will
run for the better part of a day of testing, however
the next morning, when I get up, the system is down
again.  Not sure if it's because I log out of the
system or what it is.  I have the following error I
believe assuming the catalina.out file is written to
the top instead of the end of the file:

Starting service Tomcat-Standalone
Apache Tomcat/4.0-b5
SIGSEGV   11*  segmentation violation
si_signo [11]: SIGSEGV   11*  segmentation
violation
si_errno [0]: Error 0
si_code [1]: SEGV_MAPERR [addr: 0x28]

stackpointer=FFBED230

Exiting Thread (sys_thread_t:0xff363df0) : no stack

Exiting Thread (sys_thread_t:0x4191a0) : no stack
Finalizer (TID:0x13b604, sys_thread_t:0x13b548,
state:CW, thread_t: t@6, threadID:0xfecb1d78,
stack_bottom:0xfecb2000, stack_size:0x2) prio=8

[1]
java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:106)
[2]
java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:128)
[3]
java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:175)
---
Reference Handler (TID:0x149a94,
sys_thread_t:0x1499d8, state:CW, thread_t: t@5,
threadID:0xfece1d78, stack_bottom:0xfece2000,
stack_size:0x2) prio=10

[1] java.lang.Object.wait(Object.java:424)
[2]
java.lang.ref.Reference$ReferenceHandler.run(Reference.java:107)
---
Signal dispatcher (TID:0x139284,
sys_thread_t:0x1391c8, state:MW, thread_t: t@4,
threadID:0xfed41d78, stack_bottom:0xfed42000,
stack_size:0x2) prio=10

---
main (TID:0x385c4, sys_thread_t:0x38508, state:R,
thread_t: t@1, threadID:0x25118,
stack_bottom:0xffbf, stack_size:0x2) prio=5
*current thread*

[1]
org.apache.catalina.loader.StandardLoader.start(StandardLoader.java:586)
[2]
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1092)
[3]
org.apache.catalina.core.StandardContext.start(StandardContext.java:3155)
[4]
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1092)
[5]
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1092)
[6]
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:278)
[7]
org.apache.catalina.core.StandardService.start(StandardService.java:341)
[8]
org.apache.catalina.core.StandardServer.start(StandardServer.java:447)
[9]
org.apache.catalina.startup.Catalina.start(Catalina.java:725)
[10]
org.apache.catalina.startup.Catalina.execute(Catalina.java:647)
[11]
org.apache.catalina.startup.Catalina.process(Catalina.java:177)
[12] java.lang.reflect.Method.invoke(Native Method)
[13]
org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:114)
---


Any help would be appreciated as I need this working
full time.  Thanks.

JR


__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/


***
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. Any unauthorized review, use, disclosure or distribution
is prohibited. If you are not the intended recipient, please contact
the sender by reply e-mail and destroy all copies of the original
message.
***



RE: getServletContext() throws NullPoinetException

2001-07-10 Thread Vladimir Grishchenko

Did you override init(ServletConfig config) method?
YOu must call super(config) if you did...

--V.

-Original Message-
From: Stefanos Karasavvidis [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 10, 2001 7:46 AM
To: [EMAIL PROTECTED]
Subject: getServletContext() throws NullPoinetException


I've just installed tomcat 3.2.2 and have the following problem.

I want to call getServletContext() from a servlets service method but 
get the folowing exception
*Internal Servlet Error:*

java.lang.NullPointerException
at
javax.servlet.GenericServlet.getServletContext(GenericServlet.java:205)
at TestServlet.service(TestServlet.java:32)
at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
at org.apache.tomcat.core.Handler.service(Handler.java:287)
at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79
7)
at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
at
org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection
(Ajp12ConnectionHandler.java:166)
at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
at java.lang.Thread.run(Thread.java:484)


Moreover the getServletConfig() returns null which is probably the main 
reason for this problem

Any ideas??

Stefanos



***
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. Any unauthorized review, use, disclosure or distribution
is prohibited. If you are not the intended recipient, please contact
the sender by reply e-mail and destroy all copies of the original
message.
***



RE: Reloading

2001-07-10 Thread Vladimir Grishchenko

Make sure the classes you're trying to reload are not on the system
classpath

--V.

-Original Message-
From: Hector Adolfo Alonso [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 10, 2001 7:44 AM
To: [EMAIL PROTECTED]
Subject: Reloading


Hi servleters:
   I've making some tests trying to resolve when and how Tomcat does
a servlet reloading. The spec says that when a servlet container makes
a servlet reloading, it must discard all classes previouslly loaded for its
context. This really works for Tomcat, but it doesn't work very well, at
least for me. For example, if I change two servlets and some utility
classes,
one of the servlets and the utility classes, are reload, but no both of the
servlets (not every time). I'm using Tomcat 3.2.2 with mod_jk / ajp13,
Windows NT 4.0 SP6, JDK 1.2.2_008, Apache 1.3.20. I've read the
release notes too.
   Does anybody know where I can find some useful information about
this topic.
   Thanks in advance.

Hector Adolfo Alonso
Consist Teleinformatica S. A.



***
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. Any unauthorized review, use, disclosure or distribution
is prohibited. If you are not the intended recipient, please contact
the sender by reply e-mail and destroy all copies of the original
message.
***



RE: AccessControlException in Tomcat

2001-07-09 Thread Vladimir Grishchenko

Make sure you enable permissions for your application,
in your case you should have something like this in your
security file (default is conf/tomcat.security when using -security flag):

grant codeBase file:${tomcat.home}/webapps/ip {

permission  java.io.FilePermission
C:\work\tomcat\webapps\ip\WEB-INF\lib\PerlTools.jar, read;
};

if this exception originates from your code. You didn't include complete
stack trace, so I dunno where it started. In a nutshell all
ProtectionDomain's (codebases) should have this permission. In case of
Tomcat this generally means that the permission should be granted to all
jars in ${TOMCAT_HOME}/lib, all files in ${TOMCAT_HOME}/classes and to
directory contatining WEB-INF of your application. BTW if you don't need to
run Tomcat in secure VM, just turn it off.

Regards,
V.

-Original Message-
From: Brian Lenz [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 09, 2001 2:09 PM
To: [EMAIL PROTECTED]
Subject: AccessControlException in Tomcat


Hello,

I am running Tomcat 3.3 milestone 4 as an out-of-process servlet container
along with Apache Web Server.  When I start up Tomcat, my application
initializes correctly.  Additionally, I can successfully make requests to
the application through the web server.

However, before each request is fulfilled, Tomcat throws an
AccessControlException.  The exception states that access is denied to one
of the included libraries (jar).  The error is a java.io.FilePermission
error.  Each time that this particular library is referenced, Tomcat throws
this exception and the application fails to handle the request.  I can run
this identical application through Apache JServ and avoid this error, but I
would like to get it up and running in Tomcat as well.  Does anyone have any
idea why a file access error might be happening in Tomcat?  I've checked all
of the necessary file permissions, and they are all set up correctly.  Is it
possible that Tomcat has tried to open the file twice and caused a file read
exception on its own?  I have included the stack trace below for reference.
Also, I tried running the application in Tomcat 3.2.2 and ran into the same
problem.

I would appreciate any help anyone can give to me!

Thanks!

Brian

java.security.AccessControlException: access denied (java.io.FilePermission
C:\w
ork\tomcat\webapps\ip\WEB-INF\lib\PerlTools.jar read)' at
java.security.AccessControlException: access denied (java.io.FilePermission
C:\w
ork\tomcat\webapps\ip\WEB-INF\lib\PerlTools.jar read)
at
java.security.AccessControlContext.checkPermission(AccessControlConte
xt.java:279)
at
java.security.AccessController.checkPermission(AccessController.java:
405)
at
java.lang.SecurityManager.checkPermission(SecurityManager.java:551)
at java.net.URLClassLoader$4.run(URLClassLoader.java:468)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.getPermissions(URLClassLoader.java:466)
at
java.security.SecureClassLoader.getProtectionDomain(SecureClassLoader
.java:168)
at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:11
7)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
at java.net.URLClassLoader.access$300(URLClassLoader.java:69)
at
java.net.URLClassLoader$ClassFinder.run(URLClassLoader.java(Compiled
Code))
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java(Compiled
Code))

at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
at
java.net.FactoryURLClassLoader.loadClass(URLClassLoader.java(Compiled
 Code))
at java.lang.ClassLoader.loadClass(ClassLoader.java:257)
...


***
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. Any unauthorized review, use, disclosure or distribution
is prohibited. If you are not the intended recipient, please contact
the sender by reply e-mail and destroy all copies of the original
message.
***



webapp classloader ProtectionDomain (running secured tomcat)

2001-07-06 Thread Vladimir Grishchenko

Hi all,

It seems that webapp classloader puts all classes loaded from
a webapp directory into the same ProtectionDomain regardless
of the location where the class was loaded from (like classes
dir or a jar file). It means that any security grant entry granting
permssions to a webapp codesource effectively grants the same set
of permissions to each and every class in web application. This
is probably fine in most cases but leaves no possibility to fine
tune security within web-application. My particular problem is
that I'm trying to use JAAS to enable access control with custom
JAAS policy implementation. CodeSOurce partitioning that Sun
suggests requires that the code sensitive to user-based
 operations shoud be put into separate ProtectionDomain for JAAS
mechanisms to work. The only way to do this with Tomcat is to put
classes someplace out of webapp directory, so they don't inherit
any permissions assigned to webapp ProtectionDomain. I think that
webapp class loader should put classes loaded from class directory
and every jar file into diffrent protection domains, like class
loaders that load classes from the system classpath in Java.

Well, if all that makes any sense to you may be there's something
I'm missing here?
Just wanted to get other people's opinions...

--Vlad.


***
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. Any unauthorized review, use, disclosure or distribution
is prohibited. If you are not the intended recipient, please contact
the sender by reply e-mail and destroy all copies of the original
message.
***



digest authentication using servlets

2001-06-20 Thread Vladimir Grishchenko

Hi all,

I need to implement digest authentication using servlets.
Just wondering if anyone came across something that can be reused.
Is there any support for it in Tomcat? how do i use it if so?
I'm also not sure if JDK itself provides any support for it. I see there's
a class sun.net.www.protocol.http.DigestAuthentication but not sure how I
can use it,
it seems that it must be used on client side. Any pointers/clues will be
greatly appreciated.

Thanks,
--Vlad.


***
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. Any unauthorized review, use, disclosure or distribution
is prohibited. If you are not the intended recipient, please contact
the sender by reply e-mail and destroy all copies of the original
message.
***



Re: Login Servlet

2001-03-23 Thread Vladimir Grishchenko

 
 ps I'm surprised "boolean found = rs.next()" works if result set is empty.
 I'd kind of expect a null pointer exception. I always do
 if (rs != null  rs.next()) {
   // assign something
 }
 if i'm expecting a single row.

I guess there's a difference between an empty ResultSet and no ResultSet :)

--V.



Re: Tomcat startup problem

2001-03-23 Thread Vladimir Grishchenko

It might be that you don't set $TOMCAT_HOME.
The following script works on Linux, set vars to your values:

#!/bin/sh

TOMCAT_HOME=/usr/local/tomcat
export TOMCAT_HOME

JAVA_HOME=/opt/IBMJava2-13
export JAVA_HOME

case "$1" in
  start)
echo -n "Starting Tomcat: "
$TOMCAT_HOME/bin/startup.sh
echo
;;
  stop)
echo -n "Shutting down Tomcat: "
$TOMCAT_HOME/bin/shutdown.sh
echo
;;
  *)
echo "Usage: $0 {start|stop}"
exit 1
esac

exit 0


 Jon Small wrote:
 
 O/S: HP-UX 11.0
 Apache: 1.3.12
 Tomcat: 3.1
 
 Anyone have/had the same problem? I can start Tomcat manually just fine, but
 not successfully with an init script. It seems that the "java" process
 starts initially, but at some point dies. I think that it dies when the init
 script exits. We have it running fine with Linux, but it uses a "daemon"
 command to make the "java" process a daemon. Any clues?
 
 I use the standard SystemV init script:
 
 case "$1" in
start)
  echo -n "Starting tomcat: "
  /usr/local/tomcat/bin/startup.sh
  ;;
stop)
  echo -n "Shutting down tomcat: "
  /usr/local/tomcat/bin/shutdown.sh
  ;;
*)
  echo "Usage: $0 {start|stop}"
  exit 1
 esac
 
 exit 0



JDBCRealm reconnect problems?

2001-03-16 Thread Vladimir Grishchenko

Has anyone experienced JDBCReconnect problems???
Looks like mysql db connection times out and JDBCRealm cannot
reopen it for some reason. 
Actually it tries to reopen it and somehow is able to authenticate
a user, but then dies completely...
Any ideas what can be wrong?

This is the error/exceptions from tomcat log file:


2001-03-16 11:20:33 - ContextManager: JDBCRealm: The database connection is null or was
found to be closed. Trying to re-open it.
2001-03-16 11:20:33 - ContextManager: JDBCRealm: There was an SQLException while in
authenticate: null
2001-03-16 11:20:33 - ContextManager: JDBCRealm: SQLException: java.sql.SQLException:
Error during query: Unexpected Exception: java.sql.SQLException message given:
Communication link failure: java.io.IOException
2001-03-16 11:20:38 - ContextManager: JDBCRealm: The database connection is null or was
found to be closed. Trying to re-open it.
2001-03-16 11:20:38 - ContextManager: JDBCRealm: JDBCRealm.authenticate: SELECT 
password
FROM profiles WHERE username = ?
2001-03-16 11:20:38 - ContextManager: JDBCRealm: Authentication unsuccessful for user 
null
2001-03-16 11:20:47 - ContextManager: JDBCRealm: Authentication successful for user 
Walter
2001-03-16 11:20:47 - ContextManager: JDBCRealm: Auth ok, user=Walter
2001-03-16 11:20:47 - ContextManager: JDBCRealm: Controled access for Walter R( 
/ngs_web +
/entering/buttons.jsp + null) Ct (jsp(org.apache.jasper.servlet.JspServlet/null) )
2001-03-16 11:20:47 - ContextManager: JDBCRealm: There was an SQLException while in
getUserRoles: Walter
2001-03-16 11:20:47 - ContextManager: JDBCRealm: SQLException: java.sql.SQLException:
Error during query: Unexpected Exception: java.sql.SQLException message given:
Communication link failure: java.io.IOException
2001-03-16 11:20:47 - ContextManager: JDBCRealm: Auth ok, user has no roles
2001-03-16 11:20:47 - ContextManager: JDBCRealm: UnAuthorized Y
2001-03-16 11:20:55 - ContextManager: JDBCRealm: The database connection is null or was
found to be closed. Trying to re-open it.
2001-03-16 11:20:55 - Ctx( /ngs_web ): Exception in: R( /ngs_web + 
/entering/buttons.jsp +
null) - java.lang.NullPointerException
at org.gjt.mm.mysql.PreparedStatement.executeQuery(PreparedStatement.java:198)
at org.apache.tomcat.request.JDBCRealm.authenticate(JDBCRealm.java:307)
at org.apache.tomcat.request.JDBCRealm.authenticate(JDBCRealm.java:482)
at 
org.apache.tomcat.core.ContextManager.doAuthenticate(ContextManager.java:837)
at org.apache.tomcat.core.RequestImpl.getRemoteUser(RequestImpl.java:341)
at org.apache.tomcat.request.JDBCRealm.authorize(JDBCRealm.java:503)
at org.apache.tomcat.core.ContextManager.doAuthorize(ContextManager.java:855)
at 
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:789)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:210)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
at java.lang.Thread.run(Thread.java:498)

2001-03-16 11:21:00 - Ctx( /ngs_web ): Exception in: R( /ngs_web + 
/display/ngs_home.jsp +
null) - javax.servlet.ServletException
at java.lang.Throwable.init(Throwable.java:96)
at java.lang.Exception.init(Exception.java:44)
at javax.servlet.ServletException.init(ServletException.java:161)
at
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:459)
at
display._0002fdisplay_0002fngs_0005fhome_0002ejspngs_0005fhome_jsp_4._jspService(_0002fdisplay_0002fngs_0005fhome_0002ejspngs_0005fhome_jsp_4.java:2404)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:177)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
at org.apache.tomcat.core.Handler.service(Handler.java:286)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at 
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:210)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at 

Re: ClassCastException :(

2001-03-15 Thread Vladimir Grishchenko

I don't see how this would work... It doesn't matter what stores, it matters
what creates them... Probably, Context uses some sort of Hashtable
internally to store all objects, which is a core class by itself, and it
doesn't help the problem. So, I don't get
it. May be you can give more details?

Regards,
--VG

Allen Akers wrote:
 
 I ran into the same problem and found the only good solution was to take
 a look at my custom classes and strip away what was "custom" about them
 and only save core Java objects to the context.  When I need my custom
 class, I create an instance of it and pass the references to the core
 Java objects saved in the context to the class in the constructor so
 that it is pointing to the objects in the shared context.  There are
 some limitations to this, but it works in all situations given a little
 thought.  Let me know if you need more clarification.
 
Allen Akers
Programmer Analyst
Strategic Web and Voice Development

[EMAIL PROTECTED]
 
  [EMAIL PROTECTED] 03/15/01 09:46AM 
 Hello Vladimir,
 
 Thank you for your help with classloaders. :)
 
 I tried to put my "shared" classes in the classpath. But this approach
 failed too. I cannot understand.
 
 In this case my "shared" classes loaded by "Bootstrap class loader
 (Java system classes)" and in case any references to them should use
 above classloader. Even in case servlet reloading. Of course, I
 removed
 these classes from web-inf/classes directory.
 
 May-be I need to load this "shared" class before loading my servlet,
 that uses
 this "shared" object? May-be it is loaded by "Webapp class loader
 (contents of WEB-INF/classes)"? I don't know.
 
 This situation doesn't hurt me. I just want to know, how other Tomcat
 users deal with such problem. I think many projects use "shared"
 objects between servlets. This situation may be happen only in
 "development
 stage" and never in "production". But let me know, how do you deal
 with it?
 
 Wednesday, March 14, 2001, 7:10:01 PM, you wrote:
 
 VG Bo Xu wrote:
 
  Andrey Myatlyuk wrote:
 
   Hello Vladimir,
  
   Thank you for your help.
  
   And I'm still have some questions.
  
   Why do we need to implement "some interface"? java.io.Serializable
 I
   think? But anyway I implemented this interface - it doesn't work.
 This
   approach works for EJB. :)
  
   And my question is: Is there any way to use "some shared" object
 with
   reloadable servlets without Tomcat restart?
  
   Thanks.
  
 
 VG After reading this message and some thinking I can say that the
 problem is
 VG harder than I thought. There's no way to trick it, at least there's
 no interface
 VG you can create/implement to fix it... And of course it wasn't the
 Serializable
 VG one...
 VG Sorry, for misleading... But... what about this:
 
 VG Object _statesBean =
 VG
 getServletContext().getAttribute(StatesBean.STATES_BEAN_NAME);
 
 VG Class sBeanClazz = _statesBean.getClass();
 VG Method m = sBeanClazz.getMethod("foo", new Class[] {/*args*/});
 VG m.invoke(_statesBean, new Object{ /*params*/ });
 
 VG he-he, ugly :) Not sure if it'll work...
 
 VG Regards,
 VG VG.
 
   Wednesday, March 14, 2001, 3:16:45 PM, you wrote:
  
   VG I think you're experiencing a standard Java class loader
 problem.
   VG Java treats classes loaded into different classloaders as
 different
   VG classes, even though they share the same full. qual. name.
   VG Your recompiled servlets are reloaded by a brand new class
 loader
   VG to make sure the old classes are garbage collected. What you
 get
   VG from the context is actuially an instance of a class loaded
 into
   VG a different classloader, and (StatesBean) part in your
 statement
   VG causes StatesBean to be loaded again by this new classloader
 that
   VG reloaded your servlet, so
   VG VM complains that you cannot cast objects since it thinks
 they
   VG are instances of 2 completely different classes. No matter
 where
   VG you place your files you'll have the same problem.
  
   VG You can avoid this problem by writing some extra code and have
 your
   VG bean to implement some interface Extra work, just restart
   VG Tomcat every time...
  
   VG Regards,
   VG VG.
  
   VG Andrey Myatlyuk wrote:
   
Hello Tomcat users,
   
I'm in a trouble. I share some object(StatesBean) between
 servlets. And when I
recompile _servlet_, I got ClassCastException about shared
 object.
   
_statesBean=
   
 (StatesBean)getServletContext().getAttribute(StatesBean.STATES_BEAN_NAME);
   
   
Classfile for this object is placed in the same directory,
 where
servlets do - web-inf/classes. Where I need to place classfile
 for
this object to prevent Tomcat exceptions?
   
Of course, if I reload Tomcat everything is OK.
   
Thank you in advance!
   
--
Best regards,
 Andrey
 mailto:[EMAIL PROTECTED]
   [...]
 
  Hi :-)  I am not sure, I 

Re: ClassCastException :(

2001-03-15 Thread Vladimir Grishchenko

What you describe should work... Unless Tomcat web-app CL doesn't
adhere to standard CL delegation rules. Where did you put your classes?
I think $TOMCAT_HOME/classes is automatically appended to system classpath
by startup script.
I don't think _bootstrap_ CL is the one
that's loading classes if you put them on system classpath.
Probably it's SystemClassLoader. You can test
it like this from your servlet to find out what's going on:

_statesBean=
 getServletContext().getAttribute(StatesBean.STATES_BEAN_NAME);
ClassLoader cl = _statesBean.getClass().getClassLoader();
if (cl.getParent() == null)
  System.out.println("Bootstrap Class Loader");
if (cl == ClassLoader.getSystemClassLoader())
  System.out.println("System Class Loader")
if (cl == this.getClass().getClassLoader())
  System.out.println("Current WebApps Class Loader");

If nothing is printed it means that your class is loaded by
some other class loader or a previous web-apps class loader ...

BTW, did you try to use reflection like I suggested before
(scroll down...)?

--VG.


Andrey Myatlyuk wrote:
 
 Hello Vladimir,
 
 Thank you for your help with classloaders. :)
 
 I tried to put my "shared" classes in the classpath. But this approach
 failed too. I cannot understand.
 
 In this case my "shared" classes loaded by "Bootstrap class loader
 (Java system classes)" and in case any references to them should use
 above classloader. Even in case servlet reloading. Of course, I removed
 these classes from web-inf/classes directory.
 
 May-be I need to load this "shared" class before loading my servlet, that uses
 this "shared" object? May-be it is loaded by "Webapp class loader
 (contents of WEB-INF/classes)"? I don't know.
 
 This situation doesn't hurt me. I just want to know, how other Tomcat
 users deal with such problem. I think many projects use "shared"
 objects between servlets. This situation may be happen only in "development
 stage" and never in "production". But let me know, how do you deal
 with it?
 
 Wednesday, March 14, 2001, 7:10:01 PM, you wrote:
 
 VG Bo Xu wrote:
 
  Andrey Myatlyuk wrote:
 
   Hello Vladimir,
  
   Thank you for your help.
  
   And I'm still have some questions.
  
   Why do we need to implement "some interface"? java.io.Serializable I
   think? But anyway I implemented this interface - it doesn't work. This
   approach works for EJB. :)
  
   And my question is: Is there any way to use "some shared" object with
   reloadable servlets without Tomcat restart?
  
   Thanks.
  
 
 VG After reading this message and some thinking I can say that the problem is
 VG harder than I thought. There's no way to trick it, at least there's no interface
 VG you can create/implement to fix it... And of course it wasn't the Serializable
 VG one...
 VG Sorry, for misleading... But... what about this:
 
 VG Object _statesBean =
 VG  getServletContext().getAttribute(StatesBean.STATES_BEAN_NAME);
 
 VG Class sBeanClazz = _statesBean.getClass();
 VG Method m = sBeanClazz.getMethod("foo", new Class[] {/*args*/});
 VG m.invoke(_statesBean, new Object{ /*params*/ });
 
 VG he-he, ugly :) Not sure if it'll work...
 
 VG Regards,
 VG VG.
 
   Wednesday, March 14, 2001, 3:16:45 PM, you wrote:
  
   VG I think you're experiencing a standard Java class loader problem.
   VG Java treats classes loaded into different classloaders as different
   VG classes, even though they share the same full. qual. name.
   VG Your recompiled servlets are reloaded by a brand new class loader
   VG to make sure the old classes are garbage collected. What you get
   VG from the context is actuially an instance of a class loaded into
   VG a different classloader, and (StatesBean) part in your statement
   VG causes StatesBean to be loaded again by this new classloader that
   VG reloaded your servlet, so
   VG VM complains that you cannot cast objects since it thinks they
   VG are instances of 2 completely different classes. No matter where
   VG you place your files you'll have the same problem.
  
   VG You can avoid this problem by writing some extra code and have your
   VG bean to implement some interface Extra work, just restart
   VG Tomcat every time...
  
   VG Regards,
   VG VG.
  
   VG Andrey Myatlyuk wrote:
   
Hello Tomcat users,
   
I'm in a trouble. I share some object(StatesBean) between servlets. And when 
I
recompile _servlet_, I got ClassCastException about shared object.
   
_statesBean=

(StatesBean)getServletContext().getAttribute(StatesBean.STATES_BEAN_NAME);
   
   
Classfile for this object is placed in the same directory, where
servlets do - web-inf/classes. Where I need to place classfile for
this object to prevent Tomcat exceptions?
   
Of course, if I reload Tomcat everything is OK.
   
Thank you in advance!
   
--
Best regards,
 Andreymailto:[EMAIL PROTECTED]
   [...]
 
  Hi :-)  I am not sure, I guess:
   * perhaps the problem is:
  

Re: ClassCastException :(

2001-03-15 Thread Vladimir Grishchenko


 BX *  is StatesBean.STATES_BEAN_NAME.hashCode()  the same one
 BX before/after MyServlet reloading?
 before:
 hash code in state servlet=-24382515
 hash code in name servlet=-24382515
 hash code in city servlet=-24382515
 
 after:
 hash code in state servlet=-24382515
 hash code in name servlet=-24382515
 hash code in city servlet=-24382515
 

What did you expect??? hashCode() for string is overriden and will
always return the same number., even in different VM's...

 
 public class StatesBean {
 
 public static final String STATES_BEAN_NAME = "STATES_BEAN";




Re: Form based auth. again...

2001-03-14 Thread Vladimir Grishchenko

Christian Rauh wrote:
 
 Vladimir Grishchenko wrote:
 
  "Craig R. McClanahan" wrote:
  
   * Have the link on your home page exactly has you describe, but have
 the link point at a "Welcome To My Application" page inside the
 protected area.  The fact that this page is protected will trigger
 the authentication dialog, and once the user has identified themselves,
 they will be welcomed to your app.  From then on, they will have
 already been authenticated.
 
  The interface I want to use is similar to one found here:
  http://groups.google.com/
 
  or here:
 
  http://developer.java.sun.com/developer/?frontpage-main
 
  You can see a login box on the first page, so I cannot really have a link to
  some page in protected area and make sure login form triggered...
 
  I just want to know if there are any tricks I can play to make it work
  with built in authentication, and form-based a. seems to be almost what I
  want, except the fact it must be triggered by a request to a protected resource.
 
 I am also facing the same problem and had an idea while reading your
 post. Maybe you can set a frame on your main page where you want the
 login to appear. That frame links to that welcome page proposed by
 Craig. What would actually be loaded on the frame is the login page.
 

I'm thinking along the same lines... You could also embed a tiny invisible
image in protected area to your front page (named /welcome, for example)
and define your login form as /welcome?mode=login, so whenever you're not
authorized welcome page is smart to display you a login form... The problem
here is that it's difficult to display a meaningful message that a user needs 
to login whenever (s)he actually tries to get a real protected page since
it'll always display /welcome?mode=login. Something like that...

 Havent tried it, tell me if it works if you do. And if you got any
 workaround by the way.
 
 I also seem to have read somewhere that you can do what you want using
 the  JDBCRealm. Have you tried anything on that line?

As far as I understand JDBCRealm has little to do with it. It's just a mechanism
facilitating authentication, you give it [name, password, role] and it tells you
if you're good to go using a database instead of tomcat-users.xml. that's it.

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

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




Re: Form based auth. again...

2001-03-14 Thread Vladimir Grishchenko

Daniel Lopez wrote:
 
 Hi Vladimir,
 
 snipped for brevity
 
  I'm thinking along the same lines... You could also embed a tiny invisible
  image in protected area to your front page (named /welcome, for example)
  and define your login form as /welcome?mode=login, so whenever you're not
  authorized welcome page is smart to display you a login form... The problem
  here is that it's difficult to display a meaningful message that a user needs
  to login whenever (s)he actually tries to get a real protected page since
  it'll always display /welcome?mode=login. Something like that...
 
 On that regards. Whe we developed our own authentication mechanisms, we also took 
into
 account this
 specific problem and what we did was the following:
 .- The authentication system tries to authorise the user.
 .- If it fails, it returns a meaningful error code as no_log_in, wrong_password,
 session_timed_out...
 .- The system then checks if there's a specific forward page  for the error code,
 somewhere in the configuration file
 (something like forward.page.wrong_password="/check_pass.html")
 .- If it exists, it forwards control to the specific page, otherwise it forwards 
control
 to the default page which would
 be the login page.
 This way, if you want to return a meaningful message you just have to create an html
 file with the proper message
 and configure it appropriately. It's not mandatory but in some situations and 
depending
 on the "level of knowledge"
 of your users, this is a very useful feature.
 Of course, this would imply a more complex authentication system, even though not 
much,
 and it would be something
 outside the spec.

I understand that you can write your own authentication mechanism, but I was looking 
into
container based authentication... I think the scope of the original question is 
escaping
from this thread

Thanks anyway...


 
 Just my 2c,
 Dan
 
   Havent tried it, tell me if it works if you do. And if you got any
   workaround by the way.
  
   I also seem to have read somewhere that you can do what you want using
   the  JDBCRealm. Have you tried anything on that line?
 
  As far as I understand JDBCRealm has little to do with it. It's just a mechanism
  facilitating authentication, you give it [name, password, role] and it tells you
  if you're good to go using a database instead of tomcat-users.xml. that's it.
 
  
   Christian Rauh
  
   [EMAIL PROTECTED]
   NewTrade
  
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, email: [EMAIL PROTECTED]
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, email: [EMAIL PROTECTED]
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, email: [EMAIL PROTECTED]

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




Re: ClassCastException :(

2001-03-14 Thread Vladimir Grishchenko

I think you're experiencing a standard Java class loader problem.
Java treats classes loaded into different classloaders as different
classes, even though they share the same full. qual. name.
Your recompiled servlets are reloaded by a brand new class loader
to make sure the old classes are garbage collected. What you get
from the context is actuially an instance of a class loaded into
a different classloader, and (StatesBean) part in your statement
causes StatesBean to be loaded again by this new classloader that
reloaded your servlet, so
VM complains that you cannot cast objects since it thinks they
are instances of 2 completely different classes. No matter where
you place your files you'll have the same problem.

You can avoid this problem by writing some extra code and have your
bean to implement some interface Extra work, just restart
Tomcat every time...

Regards,
VG.

Andrey Myatlyuk wrote:
 
 Hello Tomcat users,
 
 I'm in a trouble. I share some object(StatesBean) between servlets. And when I
 recompile _servlet_, I got ClassCastException about shared object.
 
 _statesBean=
 (StatesBean)getServletContext().getAttribute(StatesBean.STATES_BEAN_NAME);
 
 
 Classfile for this object is placed in the same directory, where
 servlets do - web-inf/classes. Where I need to place classfile for
 this object to prevent Tomcat exceptions?
 
 Of course, if I reload Tomcat everything is OK.
 
 Thank you in advance!
 
 --
 Best regards,
  Andreymailto:[EMAIL PROTECTED]
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, email: [EMAIL PROTECTED]

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




Re: Form based auth. again...

2001-03-14 Thread Vladimir Grishchenko

Christian Rauh wrote:
 
 Vladimir Grishchenko wrote:
 
  Christian Rauh wrote:
  
   Vladimir Grishchenko wrote:
   
   I am also facing the same problem and had an idea while reading your
   post. Maybe you can set a frame on your main page where you want the
   login to appear. That frame links to that welcome page proposed by
   Craig. What would actually be loaded on the frame is the login page.
  
 
  I'm thinking along the same lines... You could also embed a tiny invisible
  image in protected area to your front page (named /welcome, for example)
  and define your login form as /welcome?mode=login, so whenever you're not
  authorized welcome page is smart to display you a login form... The problem
  here is that it's difficult to display a meaningful message that a user needs
  to login whenever (s)he actually tries to get a real protected page since
  it'll always display /welcome?mode=login. Something like that...
 
 I guess that what we both want is a way to call an url with the
 authentication parameters (user, password) and a page to redirect if
 everything is ok. Then Tomcat would do the authentication.
 
 I think that this behaviour may be emulated by creating a flash movie or
 applet that:
 
  1 - Gets the username and password from the user
  2 - Try to load any protected resource. This will put tomcat
  on "authentication state". This loading would be internal and
  not shown in the browser window.
  3 - Then load j_security_check passing the appropriatte
  username and password variables obtained in 1.
  4 - load the protected resource that you want on the browser window,
  a frame or _parent.
 

 
IMO this
sounds like more work than just writing your own authentication servlet...
This applet should parse an incoming login page and emulate sending a post from
j_security_chek...


 This may work. If I get the time I will try to implement it.
 
   I also seem to have read somewhere that you can do what you want using
   the  JDBCRealm. Have you tried anything on that line?
 
  As far as I understand JDBCRealm has little to do with it. It's just a mechanism
  facilitating authentication, you give it [name, password, role] and it tells you
  if you're good to go using a database instead of tomcat-users.xml. that's it.
 
 yes, thats it. What I meant was that you may give a look into the
 JDBCRealm classes and create your own authentication mechanism. Dont
 know if it is possible though. Heard that some people were going into
 this direction.
 
 Christian
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, email: [EMAIL PROTECTED]

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




Re: javax.servlet.ServletException: sealing violation

2001-03-14 Thread Vladimir Grishchenko

Not sure if this is your case, but I had a similar problem
when using JAXP 1.1. The problem is there's some sort of
class name collision between jar files... I had to
reorder the CLASSPATH for tomcat to get rid of this problem.

Regards,
VG.



Mandar Joshi wrote:
 
 I just moved my server side java class to another directory and altered the
 classpaths to the new directory. I am getting follwoing exception while
 calling my jsp
 
 javax.servlet.ServletException: sealing violation
  at
 org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
 l.java:459)
  at
 jsp.dates._0002fjsp_0002fdates_0002fnewdate_0002ejspnewdate_jsp_0._jspServic
 e(_0002fjsp_0002fdates_0002fnewdate_0002ejspnewdate_jsp_0.java:91)
  at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
  at
 org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
 va:177)
  at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
  at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
  at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
  at org.apache.tomcat.core.Handler.service(Handler.java:286)
  at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
  at
 org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79
 7)
  at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
  at
 org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
 onnectionHandler.java:210)
  at
 org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
  at
 org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
  at java.lang.Thread.run(Thread.java:484)
 
 Root cause:
 java.lang.SecurityException: sealing violation
  at java.net.URLClassLoader.defineClass(URLClassLoader.java:234)
  at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
  at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:286)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
  at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
  at
 com.commerceroute.rosettanet.xml.template.BaseTemplate.(BaseTemplate.java:14
 )
  at com.commerceroute.rosettanet.xml.template.CRMsg.(CRMsg.java:26)
  at com.commerceroute.sxmsgr.MsgCreator.(MsgCreator.java:31)
  at
 jsp.dates._0002fjsp_0002fdates_0002fnewdate_0002ejspnewdate_jsp_0._jspServic
 e(_0002fjsp_0002fdates_0002fnewdate_0002ejspnewdate_jsp_0.java:62)
  at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
  at
 org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
 va:177)
  at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
  at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
  at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
  at org.apache.tomcat.core.Handler.service(Handler.java:286)
  at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
  at
 org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79
 7)
  at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
  at
 org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
 onnectionHandler.java:210)
  at
 org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
  at
 org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
  at java.lang.Thread.run(Thread.java:484)
 
 Any idea why is this happening ?
 
 TIA
 Mandar
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, email: [EMAIL PROTECTED]

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




Re: ClassCastException :(

2001-03-14 Thread Vladimir Grishchenko

Bo Xu wrote:
 
 Andrey Myatlyuk wrote:
 
  Hello Vladimir,
 
  Thank you for your help.
 
  And I'm still have some questions.
 
  Why do we need to implement "some interface"? java.io.Serializable I
  think? But anyway I implemented this interface - it doesn't work. This
  approach works for EJB. :)
 
  And my question is: Is there any way to use "some shared" object with
  reloadable servlets without Tomcat restart?
 
  Thanks.
 

After reading this message and some thinking I can say that the problem is
harder than I thought. There's no way to trick it, at least there's no interface
you can create/implement to fix it... And of course it wasn't the Serializable
one...
Sorry, for misleading... But... what about this:

Object _statesBean =
 getServletContext().getAttribute(StatesBean.STATES_BEAN_NAME);

Class sBeanClazz = _statesBean.getClass();
Method m = sBeanClazz.getMethod("foo", new Class[] {/*args*/});
m.invoke(_statesBean, new Object{ /*params*/ });

he-he, ugly :) Not sure if it'll work...

Regards,
VG.

  Wednesday, March 14, 2001, 3:16:45 PM, you wrote:
 
  VG I think you're experiencing a standard Java class loader problem.
  VG Java treats classes loaded into different classloaders as different
  VG classes, even though they share the same full. qual. name.
  VG Your recompiled servlets are reloaded by a brand new class loader
  VG to make sure the old classes are garbage collected. What you get
  VG from the context is actuially an instance of a class loaded into
  VG a different classloader, and (StatesBean) part in your statement
  VG causes StatesBean to be loaded again by this new classloader that
  VG reloaded your servlet, so
  VG VM complains that you cannot cast objects since it thinks they
  VG are instances of 2 completely different classes. No matter where
  VG you place your files you'll have the same problem.
 
  VG You can avoid this problem by writing some extra code and have your
  VG bean to implement some interface Extra work, just restart
  VG Tomcat every time...
 
  VG Regards,
  VG VG.
 
  VG Andrey Myatlyuk wrote:
  
   Hello Tomcat users,
  
   I'm in a trouble. I share some object(StatesBean) between servlets. And when I
   recompile _servlet_, I got ClassCastException about shared object.
  
   _statesBean=
   (StatesBean)getServletContext().getAttribute(StatesBean.STATES_BEAN_NAME);
  
  
   Classfile for this object is placed in the same directory, where
   servlets do - web-inf/classes. Where I need to place classfile for
   this object to prevent Tomcat exceptions?
  
   Of course, if I reload Tomcat everything is OK.
  
   Thank you in advance!
  
   --
   Best regards,
Andreymailto:[EMAIL PROTECTED]
  [...]
 
 Hi :-)  I am not sure, I guess:
  * perhaps the problem is:
 - let use suppose:   classloaderA - classA - instanceA
   then you "setAttribute"  instanceA into ServletContext of
   this wepapp, so now ServletContext holds a reference to
   instanceA.
 - after a while, your Sevlet class is reloaded, with
   jakarta-tomcat-4.0-b1, now classloaderA is not there,
   so classA is not there, But instanceA is there: because
   at least there is One reference of instanceA is being holded
   by ServletContext, so it will not be GCed, and getAttribute()
   will not return null.
- but now instanceA doesn't has "its original class" and "its
  original classloader", I am not sure, but I guess perhaps it is
  the reason.
 
 *  IMHO, I guess:  if you can find a way to load classA from a
 special classloader which will not be destroyed when/even if
 your Servlet class is reloaded, then you can solve the problem.
 It means that our Servlet class and some Helper classes are
 loaded by several classloaders in "diferent layer". if we don't
 want to keep a Attribute "across Servlet reloading", perhaps
 we don't need to it; but if we want, and we are sure that the
 "webapp classloader" will be destroyed and re-made, than I
 guess perhaps we have to use classloaders which are in
 "diferent layer".
 
 *   the following is a good email about the classloader:
 
 //  good email 
 On Sat, 10 Mar 2001, David Wall wrote:
 
  There appears to be a serious problem with the classpath/classloader with
  Tomcat 3.2.1.
 
  It may be related to the Jasper engine, which outputs a dynamic classpath
  name that includes all of the classes and jars in the WEB-INF directory, as
  expected.  But is the same classloader used when servlets are loaded at
  startup according to the web.xml file?
 
 
 The same class loader is used to load all classes within a particular web
 application, but there is more to the story than that.  See below.
 
  Anyway, I'm not sure where the problem resides, but I have found that by
  setting the CLASSPATH to the same thing Jasper sets up (specifically those
  files in WEB-INF/classes and WEB-INF/lib), 

Re: Tomcat Security example and Admin Tool

2001-03-14 Thread Vladimir Grishchenko

Yep, for Context admin add a user with role admin to tomcat-users.xml

Boon Yeo wrote:
 
 Has anyone successfully got the Tomcat JSP Security
 example running?  What about Tomcat Context Admin
 Tools?
 
 -Boon



Re: xml reader

2001-03-13 Thread Vladimir Grishchenko

Download JBuilder 4 foundation.
It has tree-like view of XML/HTML docs...

JEdit might be good also...

IE5 can show XML in tree-like form

[EMAIL PROTECTED] wrote:
 
 can anyone suggest the best compatible xml reader. Currently I am using word
 but it is really slow and takes time to browse through...
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, email: [EMAIL PROTECTED]

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




Re: PLEASE HELP TO REMOVE ME FROM THE LIST

2001-03-12 Thread Vladimir Grishchenko

Did you try to fool it?
It might not work if you use MS Exchange server or such, but for plain SMTP
messaging you can (well, ising Netscape mail, MS mail clients should have
similar options) go to 
Edit-Preferences-MailNewsgroups-Identity
and change your e-mail address to whatever you want ([EMAIL PROTECTED]).
Then send mail to [EMAIL PROTECTED]

Hope this helps.



"Xu, Lifeng" wrote:
 
 My email system changed my address. So I am having problem to unsubscribe
 myself. Please help to remove me from the list.
 
 My current address on the list is [EMAIL PROTECTED] (or [EMAIL PROTECTED]), and my new
 address with our mailing system is [EMAIL PROTECTED]
 
 Thanks
 
 Lifeng
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, email: [EMAIL PROTECTED]

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




Form based auth. again...

2001-03-11 Thread Vladimir Grishchenko

Hi,

Just wondering if it's possible to get built-in form based authentication to
work without the user actually trying to access a protected resource? I want to
have a login box on the first page  that users can use to authenticate
themselves at my web-site. As you can guess simply specifying "j_security_check"
as form's action won't work. So, is there any way to accomplish this just using
Servlet 2.2 specified form based auth. mechanism or I need to resort to some
sort of custom security/session checker servlet??? Briefly looked through the
mailing list archives and couldn't find any info.

Thanks in advance,
VG.

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




Re: getPathInfo() returns null

2001-03-05 Thread Vladimir Grishchenko

OK, I haven't tried it yet, but this is certainly my problem.
I have neither of the solutions implemented (/* or SerfvletPath)
in my case.
I'll give it a try.

Thanx,
Vlad.


Karl Martino wrote:
 
 The following code will take care of your troubles.  It was explained
 to me recently that URL patterns to servlets like "/*" are actually
 inccorret.  They mask *.jsp and other possible extentions.
 
 You should, when you have to, map a servlet to a path ending with
 "/".  But pathInfo disappears then.  The following code should handle
 BOTH mappings for you:
 
 String servletPath = req.getServletPath();
 String pathInfo = req.getPathInfo();
 if (pathInfo == null) {
 pathInfo = servletPath;
 }
 
 servletPath has the same data as pathInfo when a servlet is mapped to
 "/".
 
 Giver a try.
 
 --- Marc Saegesser [EMAIL PROTECTED] wrote:
  I tested this in 3.2.2b1 using the SnoopServlet that comes with the
  examples
  web app and it seems to work fine.
 
  To test test it yourself you'll need to make a small modification
  to
  examples/web-inf/web.xml.  Change the url-pattern for snoop to be
  /snoop/*
  instead of /snoop.  Then you can try the following URLs and see if
  the
  pathinfo appears correctly in both cases.
 
  http://localhost:8080/examples/servlet/SnoopServlet/pathinfo
 
  and
 
  http://localhost:8080/examples/snoop/pathinfo
 
   -Original Message-
   From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
   Sent: Friday, March 02, 2001 6:45 PM
   To: [EMAIL PROTECTED]
   Subject: Re: getPathInfo() returns null
  
  
   "Craig R. McClanahan" wrote:
   
Vladimir Grishchenko wrote:
   
 Hi,

 I'm new to Tomcat and servlets and need some help.
 Would somebody clarify  why getPathInfo() returns null when a
   servlet accessed via:

 http://server/context/servletalias/pathinfo

 and it returns "pathinfo" when the same servlet accesses via:

   
It actually returns "/pathinfo", right?
  
   yes
  
   

 http://server/context/servlet/servletalias/pathinfo

 Both invocatoin options seem to work (except the Pathinfo
   part), which is the "correct"
 way to call servlets? What is the difference?

   
What version of Tomcat does this?  You are correct -- you
   should be able to retrieve the
path info in either case.
  
   3.2.1
   Could my configuration be messed up???
  
   

 Thanx,
 Vlad.

   
Craig McClanahan
   
   
 
 -
To unsubscribe, e-mail:
  [EMAIL PROTECTED]
For additional commands, email:
  [EMAIL PROTECTED]
  
  
 
 -
   To unsubscribe, e-mail:
  [EMAIL PROTECTED]
   For additional commands, email:
  [EMAIL PROTECTED]
 
 
 
 -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, email: [EMAIL PROTECTED]
 
 
 __
 Do You Yahoo!?
 Get email at your own domain with Yahoo! Mail.
 http://personal.mail.yahoo.com/
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, email: [EMAIL PROTECTED]

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




Re: QuickSorting Vectors

2001-03-05 Thread Vladimir Grishchenko

Ooops...
Replace

java.util.Arrays.sort(elementData, 0, elementCount - 1);

with

java.util.Arrays.sort(elementData, 0, elementCount);







I claim this is faster (inspired by the Vector's source code, he-he):

public class VladsVectorSort  {

SortableVector vec = new SortableVector();

public static void main(String[] args)  {
VladsVectorSort v = new VladsVectorSort();
v.arraySimpleSort();
}

void arraySimpleSort()  {
vec.add(new String("abbot"));
vec.add(new String("silium"));
vec.add(new String("randy"));
vec.add(new String("goofy"));
vec.add(new String("zenia"));
vec.add(new String("pokie"));
vec.add(new String("xylaphone"));
vec.add(new String("dogface"));
vec.add(new String("friggen-joe"));
vec.add(new String("penuckle"));
vec.add(new String("charlie"));
vec.add(new String("manna"));

System.out.println("before: " + vec);
vec.sort();
System.out.println("after :0) : " + vec);
}

class SortableVector extends java.util.Vector
{
  public synchronized void sort()
  {
java.util.Arrays.sort(elementData, 0, elementCount - 1);
  }
}
}


This is it (at least it seems to be!)
Of course you need to make sure all Vector elements are mutually
Comparable...

--V.



Craig O'Brien wrote:
 
 Vlad and I were thinking along the same lines.  This is easy but may not be
 the best for commercial applications.
 
 Here is a simple program I just wrote:
 
 class CraigsVectorSort  {
 
 Vector vec = new Vector();
 
 public static void main(String[] args)  {
 CraigsVectorSort v = new CraigsVectorSort();
 v.arraySimpleSort();
 }
 
 void arraySimpleSort()  {
 vec.add(new String("abbot"));
 vec.add(new String("silium"));
 vec.add(new String("randy"));
 vec.add(new String("goofy"));
 vec.add(new String("zenia"));
 vec.add(new String("pokie"));
 vec.add(new String("xylaphone"));
 vec.add(new String("dogface"));
 vec.add(new String("friggen-joe"));
 vec.add(new String("penuckle"));
 vec.add(new String("charlie"));
 vec.add(new String("manna"));
 
 System.out.println("before: " + vec);
 Object[] obArr = vec.toArray();
 Arrays.sort(obArr);
 vec.removeAllElements();
 for (int i = 0; i  obArr.length; i++)  {
 vec.add(obArr[i]);
 }
 obArr = null;
 System.out.println("after :0) : " + vec);
 }
 }
 
 It works efficiently.  You may want to consider using one of the collections
 rather then Vector.  You may not need the synchronization so an ArrayList
 would be faster.  Many many considerations.
 
 Let me know what you think.
 
 Regards,
 Craig O'Brien
 
 Java Programmer/Web Developer
 [EMAIL PROTECTED]
 
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Friday, March 02, 2001 6:40 PM
 To: [EMAIL PROTECTED]
 Subject: Re: QuickSorting Vectors
 
 Don't have a sample but you can
 take a look at the java.util.Arrays's sort(Object[]) method.
 May be you can use that in combination with Vector.toArray()
 which calls System.arraycopy, so this should be fast, may be
 even faster than iterating over Vector's elements during
 custom sort if you decide to sort Vectors directly.
 
 method...
 
 --V.
 
 Ryan wrote:
 
  I am a student but this is not for a class.. I am trying to keep a thread
  running that holds files in a directory. I just want to maximize my
 bandwith
  and CPU usage for my web site.
 
  -ryan
 
  - Original Message -
  From: "Stefn F. Stefnsson" [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Friday, March 02, 2001 5:21 PM
  Subject: RE: QuickSorting Vectors
 
   R U a student?
  
   When is the deadline?
  
   -Original Message-
   From: Ryan [mailto:[EMAIL PROTECTED]]
   Sent: 3. mars 2001 00:46
   To: [EMAIL PROTECTED]
   Subject: QuickSorting Vectors
  
  
   Does anyone have a quicksorting class that sorts Vectors containing
   Strings that wouldn't mind letting me look at?
  
  
   -ryan
  
  
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, email: [EMAIL PROTECTED]
  
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, email: [EMAIL PROTECTED]
 
 

Re: QuickSorting Vectors

2001-03-05 Thread Vladimir Grishchenko

I missed that Array.sort() excludes last index from sorting


Craig O'Brien wrote:
 
 Hey,
 
 Good job.  Nice trick. I messed around with an ArrayList and
 Collections.sort which was faster then my original (the 15 minute job) but
 yours was still faster.  I tried your trick only to find out that in
 ArrayList the elementData field is private.  :0(  Short of customizing an
 implementation  List myself you win.  for now
 
 What was the deal with making your array 1 element shorter then mine?
 Competitive edge right?
 
 Good luck and thanks for the idea.
 
 By the way, how is your Tomcat doing?  hehe
 
 Got to get back to work.
 
 Regards,
 Craig
 
 --The comparison code -- (includes ArrayListSort)
 
 import java.util.*;
 
 class TestVectorSort{
 
 Vector vec = new Vector();
 SortableVector vVec = new SortableVector();
 ArrayList arrList = new ArrayList();
 
 public static void main(String[] args)  {
 TestVectorSort v = new TestVectorSort();
 v.arraySimpleSort();
 }
 
 void arraySimpleSort()  {
 // the hack...hehe
 for (int i = 1; i 0; i--)  {
 vec.add(new String("" + i));
 }
 long timeIn = System.currentTimeMillis();
 Object[] obArr = vec.toArray();
 Arrays.sort(obArr);
 vec.removeAllElements();
 for (int i = 0; i  obArr.length; i++)  {
 vec.add(obArr[i]);
 }
 long timeOut = System.currentTimeMillis();
 obArr = null;
 System.out.println("Time to sort CraigsVectorSort: " + (timeOut - 
timeIn)
 + " ms");
 
 // VladsVectorSort
 for (int i = 1; i 0; i--)  {
 vVec.add(new String("" + i));
 }
 long timeIn2 = System.currentTimeMillis();
 vVec.sort();
 long timeOut2 = System.currentTimeMillis();
 System.out.println("Time to sort VladsVectorSort: " + (timeOut2 - 
timeIn2)
 + " ms");
 
 // ArrayListSort
 for (int i = 1; i 0; i--)  {
 arrList.add(new String("" + i));
 }
 long timeIn3 = System.currentTimeMillis();
 Collections.sort(arrList);
 long timeOut3 = System.currentTimeMillis();
 System.out.println("Time to sort ArrayList: " + (timeOut3 - timeIn3) 
+ "
 ms");
 
 arrList = null;
 vVec = null;
 vec = null;
 System.gc();
 }
 }
 
 class SortableVector extends java.util.Vector
 {
   public synchronized void sort()
   {
 java.util.Arrays.sort(elementData, 0, elementCount);
   }
 }
 
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Monday, March 05, 2001 9:59 AM
 To: [EMAIL PROTECTED]
 Subject: Re: QuickSorting Vectors
 
 Ooops...
 Replace
 
 java.util.Arrays.sort(elementData, 0, elementCount - 1);
 
 with
 
 java.util.Arrays.sort(elementData, 0, elementCount);
 
 
 
 I claim this is faster (inspired by the Vector's source code, he-he):
 
 public class VladsVectorSort  {
 
 SortableVector vec = new SortableVector();
 
 public static void main(String[] args)  {
 VladsVectorSort v = new VladsVectorSort();
 v.arraySimpleSort();
 }
 
 void arraySimpleSort()  {
 vec.add(new String("abbot"));
 vec.add(new String("silium"));
 vec.add(new String("randy"));
 vec.add(new String("goofy"));
 vec.add(new String("zenia"));
 vec.add(new String("pokie"));
 vec.add(new String("xylaphone"));
 vec.add(new String("dogface"));
 vec.add(new String("friggen-joe"));
 vec.add(new String("penuckle"));
 vec.add(new String("charlie"));
 vec.add(new String("manna"));
 
 System.out.println("before: " + vec);
 vec.sort();
 System.out.println("after :0) : " + vec);
 }
 
 class SortableVector extends java.util.Vector
 {
   public synchronized void sort()
   {
 java.util.Arrays.sort(elementData, 0, elementCount - 1);
   }
 }
 }
 
 This is it (at least it seems to be!)
 Of course you need to make sure all Vector elements are mutually
 Comparable...
 
 --V.
 
 Craig O'Brien wrote:
 
  Vlad and I were thinking along the same lines.  This is easy but may not
 be
  the best for commercial applications.
 
  Here is a simple program I just wrote:
 
  class CraigsVectorSort  

getPathInfo() returns null

2001-03-01 Thread Vladimir Grishchenko

Hi,

I'm new to Tomcat and servlets and need some help.
Would somebody clarify  why getPathInfo() returns null when a servlet accessed via:

http://server/context/servletalias/pathinfo

and it returns "pathinfo" when the same servlet accesses via:

http://server/context/servlet/servletalias/pathinfo


Both invocatoin options seem to work (except the Pathinfo part), which is the "correct"
way to call servlets? What is the difference?

Thanx,
Vlad.

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