Re: different uid per host or perhaps something else

2005-09-18 Thread QM
On Sat, Sep 17, 2005 at 03:39:22PM -0700, Alexander Kabanov wrote:
: I have a bundle apache - mod_jk - tomcat working and virtual hosts
: properly configured,
: everything is nice, but with a few small issues. In addition to this
: configuration - each virtual
: host represents different users which don't trust each other.
: [rest of post deleted]

Generally speaking, if your app owners (users) don't trust one another
at the OS level, run their apps in separate instances of Tomcat.

This lets you run Tomcat as a different user for each container and, in
turn, use OS-level file perms to prevent unwanted access between apps.

-QM


-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: HTTP status code 404

2005-09-05 Thread QM
On Mon, Sep 05, 2005 at 06:28:05PM +0100, Paul Singleton wrote:
: But we want *no* error page, just a 404 status returned to
: the browser, which will then presumably present this failure
: to the user in its own way.  Or have I musunderstood 404s?

Yes and no.  Browsers are free to interpret 404s (and any other error
code) as they see fit.  For example, IE's friendly error messages will
interpret the status code and show the user its own not found page
instead of the data returned by the server.


: Exactly what error-page element will achieve this, and
: where should we call ...setStatus(...NOT_FOUND)?

If you *really* want to leave this up to the browser, map the
error-page to a JSP that simply sets a 404 response and returns no
data.  (I forget the exact API call for this, but it's in the
HttpServlet or HttpServletRequest JavaDoc.)

Another alternative would be to have the error-page redirect people to
the site's landing page.  (The idea is, if you've hit an invalid URL,
go back to the beginning.)  I've done this before for certain sites.

The real question is, do you really want to do this?

Unless you're writing a highly specialized app, it's not nice to fool
the end-user on error conditions.  The JSP that just sends a 404 may
yield document contains no data errors from the browser; and
redirecting people to the landing page may hide broken links (read:
developer error) and/or frustrate the user.

-QM

-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: configuration files for war deployments

2005-08-27 Thread QM
On Fri, Aug 26, 2005 at 11:47:54PM -0700, Patrick Lacson wrote:
: jdbc config options, common file system info, http urls for external
: sites, things of that nature.  we have a complex multitenant system
: that needs to be configured by our sysadmins.

What about having separate config files that can be compiled into the
WAR at build time?  A little Ant magic, a few replacement rules, and
you're in business.  Your sysadmins will (hopefully) like that more
because there would be less for them to do.


: currently we are hosting it on tomcat and later possibly websphere.  i
: was wondering if there was a way to do this portably.

Portability is a broad term; you must decide the direction and depth
of your portability and go from there.  For example: using an external
file means you have to specify an absolute path.  That's portable
between containers but not OS flavors.


: how about reading comments from an external url?  has this been done before?

URL is also an option, silly me for not having mentioned it.  -but
again, your app has to somehow bootstrap this information, which means
you must include the URL in your app at build time.  Furthermore, the
service that responds to the URL call must be available at all times or
your webapps won't start. =)

You could get creative with the URL bit: include the context name as a
parameter, let the remote service analyze the incoming IP address,
etc... but that would require some serious planning and design such that
you don't end up with a nightmare long-term.

Using an exploded-dir format webapp would require the least work on your
part.  While it's not techically required by the spec (only WAR files
are required, when I last checked), I'd doubt there are any containers
that don't support it.

Pick your poison.

-QM

-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/


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



Re: configuration files for war deployments

2005-08-26 Thread QM
On Fri, Aug 26, 2005 at 02:16:26AM +0800, Patrick Lacson wrote:
: I know that's typically where they go, but if the file is inside the
: .war, how is the file going to be configured by the sysadming folks?

Webapps are meant to be fairly standalone.  If you require that one be
configured after it has been compiled, you really have two options:

1/ give it to the sysadmins in exploded-dir format so they can tweak the
files, then just run the app as such

2/ create some resource outside of the app (database, file) that the app
knows to load on startup.

The downside to #2 is that it still requires your app to have some
knowledge of the filesystem outside of itself. That inhibits
portability, not to mention running separate instances of the app (with
separate configurations, that is).

Furthermore, to be completely portable across containers (though not
necessarily operating systems) your app must operate on the
fully-qualified path to the external file.  There's no such idea as a
relative file location when it comes to webapps.


What would be in this external config file?

-QM

-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: how to update tomcat?

2005-08-24 Thread QM
On Wed, Aug 24, 2005 at 07:10:10PM +0530, subi wrote:
: I am using Tomcat 4.1. How can i update to 5.x?

I have a couple of brief guides on my website:

4.x - 5.0
http://www.brandxdev.net/misc/tomcat_upgrade.site

5.0 - 5.5
http://www.brandxdev.net/misc/tomcat_upgrade_50_55.site

-QM

-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: webapp loading order...

2005-08-16 Thread QM
On Tue, Aug 16, 2005 at 03:23:16PM -0700, Joe R. Lindsay wrote:
: We have two webapps that communicate via jndi and
: we need to have app2 wait for app1 to load before continuing.
: Is there a way to force the order in which the webapps
: are started?

You could run the apps in separate Tomcat instances.  In that case, you
would explicitly define load order: the start script would start app1 in
instance1, then app2 i instance2.

That said, the spec doesn't cover this, as well it shouldn't -- apps should
be fairly self-sufficient such that load order is irrelevant.

-QM

-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: timeout, but not session

2005-07-30 Thread QM
On Fri, Jul 29, 2005 at 12:15:13PM -0400, joelsherriff wrote:
: We've got a servlet problem that we're trying to track down.  The problem
: causes one of the threads to spin.

What kind of thread is this, user-managed (i.e. you created it yourself)
or container-managed (Tomcat keeping track of servlets and such)?


: Until we can solve the problem,
: can anyone suggest anything that can timeout these out-of-control threads?
: Session timeouts timeout on inactivity, correct?  I don't know if that
: will work in this case...but I might try it anyway.

Let's take a step back: specifically, what are the symptoms of the
problem?  What do you mean by out of control? -and how is the
are the threads being allocated/defined?

-QM


-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: AW: Load all JSP pages on startup

2005-06-29 Thread QM
On Wed, Jun 29, 2005 at 04:49:10PM +0200, Bernhard Slominski wrote:
: When thinking about it again I assume that the precompiled webapp with
: Tomcat should also work in any other JSP container, as long as you have the
: Tomcat libraries in your classpath, because in the end your compiled JSPs
: are just normal servlets.

It's even better than that: the webapp itself is portable, without the
Tomcat libraries.  The precompilation process just churns your JSPs into
servlets at build time instead of runtime.

(The container-specific precomps don't involve web.xml mappings for the
generated servlets.  That's why, for example, I can precomp in WebLogic
and but still change my JSP on the fly. Maybe that's what you were
thinking?)

-and it's not as though you'd lose your custom web.xml configuration;
there are ways to fold the generated servlet/mapping sets (from the JSP
precomp) in with your original web.xml at build time.

I don't have such an example readily available... there should be plenty
in the archives, though.

-QM

-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: tomcat does not like cmdline args of wget?

2005-06-13 Thread QM
On Mon, Jun 13, 2005 at 11:04:03AM +0200, Holger Klawitter wrote:
: what might be the reasion that
:   wget http://theUser:[EMAIL PROTECTED]/someURL
: is working, whereas
:   wget --http-user=theUser --http-passwd=thePass http://theHost/someURL
: yields Authorization failed (401)? (I also tried --cookies=on)

I don't know off the top of my head, but you could (temporarily) enable
RequestDumperValve and compare the two requests.

-QM

-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: Reject access to some files

2005-06-13 Thread QM
On Mon, Jun 13, 2005 at 06:57:21AM +0200, Rene Guenther wrote:
: how to reject access to files? E.g. I got property files and war files in my
: root directory and I they must not be readable via HTTP Request.

Use a servlet filter.

Also, you received some sage advice from another poster: put your
properties files, or anything else you don't want served to clients,
under WEB-INF. 

I don't have the servlet spec in front of me right now, but I'm pretty
sure it mandates that compliant containers don't (directly) serve files
out of WEB-INF to clients.


So you could use a filter as a holdover, then move your files under
WEB-INF.


(As a side note, how are you loading these properties files?  If you put
them under WEB-INF/classes, you can use the classloader...)

-QM


-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: Jserv to Tomcat migration

2005-06-08 Thread QM
On Wed, Jun 08, 2005 at 04:18:30PM +0530, gaurav wrote:
:We thinking migrating some legacy code from Jserv 1.1.2  to
: tomcat 5.
: I am looking around some practical insightful  tips/ guidance on this
: matter ...it there is any Jserv to Tomcat migration guide book or any
: other documentation  which I can refer to or if any one ever   faced
: some problems then pl share with me :-)

The process is the same for migrating between any two servlet
containers:
1/ make note of any vendor-specific hooks you use in your current app.
Don't expect them to be in the other container.  Rewrite your app to
work without them.

2/ Review the servlet spec that fits the destination container (v2.4 for
Tomcat 5).  If it's not the same servlet spec version as your current
container, make note of any deprecations (such as SingleThreadModel) or
other changes.  Code your app to work per the spec.

3/ Note how the new container provides services (such as database
pooling).


That's about it. =)

All jokes aside, the point of the spec is that 100% spec-compliant apps
should be able to migrate between spec-compliant containers without much
hassle.  If you've stuck to the spec this whole time, your migration
shouldn't be a problem.

-QM

-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: Realm implemenation, passing additionnal informations to webapplication

2005-06-06 Thread QM
On Mon, Jun 06, 2005 at 11:36:11AM +0200, delbd wrote:
: I had to write my own realm implementation to authenticate users.
: Now am faced with a problem, this realm contains additionnal datas on the 
: user, like email, fullname, office telephone number.
: I'd like to pass this informations to the webapplication, however am not sure 
: how to do this.

Let's take a step back: is the extra info used to authenticate the user?
or is it used by the webapp itself, after the user has logged in?

In the latter case, you can store a user-specific object in the session
after the user logs in.  Many people write a ServletFilter that checks
for said object and, if it doesn't exist, creates/populates it.

(Of course, the filter should only be mapped to protected areas; it is
otherwise of limited value ;)

-QM


-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: RemoteAddrValve

2005-06-02 Thread QM
On Thu, Jun 02, 2005 at 12:45:15PM +0100, Janet Dickson wrote:
: I'm trying to use RemoteAddrValve to restrict access to a website to a 
: subnet in Tomcat 4.1

You may want to use a ServletFilter instead.  This is supported by the
2.3 servlet spec, which means it will be portable among containers and
will thus ease your migration to Tomcat 5.x in the future.

Using a Filter would also solve the other problem you mention, that you
find you can't put multiple addresses in the allow section.


: Valve className=org.apache.catalina.valves.RemoteAddrValve
: allow=xxx.xxx.xxx.xxx/25 /
: but it doesnt seem to work as access from one of my IP addresses is 
: forbidden.

If possible, could you share the real IP addresses?  (If they're
internal-only (such as 10.x, 192.168.x, 172.16.x) then you won't expose
any private information posting them here.)  This may be as simple as a
typo.


: Also, can someone confirm whether it is necessary to restart the Tomcat 
: server (version 4.1) if I modify an .xml file in the webapps directory ?

Depends on which XML file.  If it's one of the files that's used by the
container -- context.xml, web.xml, and so on -- then yes, you'll have to
restart.   If it's a file that's loaded by your app on request, then
it's up to your code to decide whether to cache it or reload it every
time.

-QM


-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: Shared web.xml

2005-06-02 Thread QM
On Thu, Jun 02, 2005 at 02:01:15PM -0500, Trice, Jim wrote:
:I inherited a tomcat installation with two tomcat servers running RedHat
: Enterprise 3 and tomcat 4.1. They are being load balanced behind a netscaler.
: The webapps directory and thus the web.xml files for each context are shared
: via NFS.

This will hurt.  What's the point of load-balancing the two Tomcat
instances (eliminating a single point of failure), if they are
susceptible to a problem with the NFS server (introducing a single point
of failure)?

I realize it's more of a headache to manage two installs than one; but
it's even more painful to manage nothing when the shared storage goes
south. =)


Read on:

: The problem I have is that any time the web.xml is updated for a
: context that context is reloaded. Since the web.xml file is shared that means
: both servers reload the context at the same time. That means downtime. I know
: I can set up a local copy of web.xml and create a link to that but this makes
: things more complicated. Is there any way to force tomcat 4 to wait to reload
: the class until a reload is requested? I have tried reloadable=false for
: each context.


Setting reloadable=false (inside the Context/ attribute of
server.xml, or inside context.xml) and restarting Tomcat should have
done it.  

You mention you inherited this setup.  Perhaps the old admins had setup
a watchdog job, and that's what triggers restarts?

-QM


-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: Tomcat + HP-UX = NoSuchMethodError java.lang.String.contains(Ljava/lang/String;)

2005-06-02 Thread QM
On Thu, Jun 02, 2005 at 05:37:23PM -0700, Wendy Smoak wrote:
:  Any idea why String.contains(String) wouldn't work within Tomcat 4.1 on
:  HP-UX and Java 1.5?

Doesn't Tomcat 4.1 even support JDK 1.5?

Are you using 1.5 to build, run, or both?


-QM

-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: Apache Integration

2005-05-30 Thread QM
On Mon, May 30, 2005 at 08:28:32AM -0400, [EMAIL PROTECTED] wrote:
: connect both Tomcat 4 and Tomcat 5 to the httpd server.
: 
: If I use mod_jk, I have to specify the path to a tomcat installation in the
: workers.properties in the Apache2/conf/httpd.conf file. So, there's no way to
: connect both and relay to the right server using the appropriate folder
: alias.

Are you using JK1 (supported) or JK2 (deprecated)?

I use JK1 and there's no explicit path to the Tomcat install in the
config file.  Tomcat isn't even installed on the Apache/httpd machine.
=)

So what do you mean by path to a tomcat installation?

-QM

-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: looking for insight on invoking Thread.sleep() from a tomcat servlet

2005-05-30 Thread QM
On Sun, May 29, 2005 at 03:08:28PM -0700, Clark O'Brien wrote:
: Can someone provide insight on the adverse affects of
: invoking sleep() from a servlet.

It's more a question of, why would you want to invoke sleek() from a
servlet?


: I understand that the
: J2EE explicitly forbids invoking sleep from within a
: servlet

Well, then, don't do it.  When you have a case that leaves you no choice
but to break the standards, then do it.  Otherwise, don't.

-QM

-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: OutOfMemory on FreeBSD

2005-05-22 Thread QM
On Sun, May 22, 2005 at 04:14:30PM -0500, Lane wrote:
: I'm trying to find how to send jvm parameters (-Xm128m) to the JVM during 
: tomcat startup.  I have an application (openreports) that fails with 
: outofmemory exception intermittently.

You can set the environment variable JAVA_OPTS, e.g.
export JAVA_OPTS='-Xm128m'

Note that this would require writing a wrapper script to call the Tomcat
scripts, since it'd be silly to do this by hand all the time.

The extra script may sound like a pain, but it actually makes your setup
less sensitive to Tomcat upgrades because you won't have to modify
anything in the Tomcat tree.

-QM


-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: tomcat

2005-05-19 Thread QM
On Fri, May 20, 2005 at 08:33:42AM +0800, . . wrote:
: Where is there a good clean download unpack install doc for installing jdk
: 1.4.2 on solaris 9 with tomcat 5.0?

The JDK install instructions should be on the same site as the JDK
download. =)

I recall Sun ships JDKs as shell archives, so you can just run
sh {archive file}

to extract the bundle.  (Change to the directory where you want the JDK
installed, of course.)


Same for Tomcat: notice, it ships as a zip or tar.gz file.  Change to
your chosen install directory, extract, run.


: Also what happens when you set apache DocumentRoot to /tomcat/webapps? this
: seems like a nice trick but will it cause problems?

Problems is too strong a term; but it can lead people to equate
Tomcat webapps directory with webserver document root.  This is not
always the case; and to not think in a J2EE frame of mind when setting
up a Tomcat environment can lead to long-term architectural problems.


: Does anyone here use tomcat by itself for major production site?  The docs say
: it can use SSL, and the gentleman above said that it can be made secure.

Search the archives.  This question comes up every so often, and plenty
of people chime in with responses.


-QM

-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: monitoring open connections that are not removed with removeAbandoned param set to ture

2005-05-15 Thread QM
On Sun, May 15, 2005 at 05:50:33PM +0200, Amir S wrote:
: How can I monitor my open connections to know which JSP opened which
: connection?

Sort of a sideways response to your question: 
exactly how are the connections opened?  From the JSP itself, or does
the JSP call some centralized data tier?

For pure bug-hunting purposes, someone on the list once recommended
(temporarily) setting the min/max connections to 1.  Click around your
site for a bit.  When you hit a page that can't get a connection, you
know the previous one left it open. ;)

-QM



-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: question about load-on-startup in web.xml

2005-05-12 Thread QM
On Wed, May 11, 2005 at 08:53:43PM -0500, Caldarale, Charles R wrote:
:  any one know if there's a way to make webappY get installed before
:  webappX?
: 
: If you want to synchronize application deployment, I think you're going
: to have to do that within the app itself, possibly with context
: listeners to minimize inter-app dependencies.

What about separating each app into its own Tomcat instance (see the
docs on CATALINA_BASE vs CATALINA_HOST)?  You could then have a single
master script that starts them in the order you require?

-QM


-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: tomcat System Administrator's Guide and SysAdmin tools

2005-05-10 Thread QM
On Mon, May 09, 2005 at 03:42:22PM -0700, Steve Jacobson wrote:
:  We have been looking for a comprehensive System Administrator's Guide 
: for Tomcat, that looks at Tomcat from the perspective of a System 
: Administrator that needs to deploy tomcat and applications on tomcat.  

So far, so good...


: Most of what we have googled concentrates on deploying tomcat for a 
: developer, or a development environment.  Many SysAdmins don't actually 
: speak java, though, and would be looking for a guide to be able to 
: support java applications on their servers without having to become java 
: experts themselves.

Here's the catch: there's a lot of Java in J2EE/Tomcat.  Tuning memory
heap sizes, configuring JDBC pools, analyzing a failed WAR deployment,
etc.

What you have to know ultimately depends on those situations for which
you will be held responsible.



:  We are also looking for any tools that might be used to verify a 
: successful installation of tomcat, beyond the index.jsp, and manager and 
: admin tools.  Has anyone written anything that goes through and makes 
: sure that tomcat is installed correctly, and that everything is set up 
: properly, as an installation verification tool?


Successful install: the file unzips without error.  =)

Setup properly: depends on your app. =)


-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: Simple JavaBeans applications not working (newbie question)

2005-05-08 Thread QM
On Sat, May 07, 2005 at 01:39:50PM -0400, Anoop kumar V wrote:
: Another thing I noticed that you have placed your bean as a jar in the
: WEB-INF/lib directory - while this works perfectly the practice is to put
: custom class files in the WEB-INF/classes directory as just .class files
: under their respective folders (as per package declaration)..

What practice would this be?

Some would argue that placing your classes in JAR files permits better
organization/grouping than a flat space under WEB-INF classes.

Per the spec, the only difference between WEB-INF/classes and
WEB-INF/lib is that the former is searched first.

-QM

-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: tomcat 5.5; context-path

2005-05-06 Thread QM
On Fri, May 06, 2005 at 10:07:32AM +0200, Pfingstl Gernot wrote:
: This seems to me to have only context path with has the same value as the name
: of the context.xml file.
: I want to use context.xml files and not put context information into
: server.xml.
: So isn't it possible to depoly apps in tomcat 5.5 with a context path that has
: subdirectories?

Yes, it is possible. Search the archives for the specifics.  You have to
name your context's XML file a certain way: a special character
represents the dir separators.  

So to map a context to

/path1/path2/path3

your context XML would be named

path1{char}path2{char}path3.xml

I think {char} is a # but don't quote me on that...

-QM

-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: Amount of free disk space

2005-05-04 Thread QM
On Wed, May 04, 2005 at 09:09:53AM +0100, Peter Crowther wrote:
:  From: Mark Benussi [mailto:[EMAIL PROTECTED]
:  Is there a Java API call I can make to detect how much disk
:  space has been
:  allocated to my account and the current amount used?
: 
: Depending on how hard they've nailed down the lid on Tomcat, you *might*
: be able to invoke UNIX executables using Runtime.exec().

For the OP -- does the code have to be Java?

If the provider permits cronjobs, write a shell/perl/PHP script to
periodically check your disk usage and dump it to a database (or some
other place the Java app can get to it).

-QM

-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: Question on JNDI configuration

2005-05-02 Thread QM
On Mon, May 02, 2005 at 04:23:05PM -0700, John MccLain wrote:
: Is it possible to add a datasource to JNDI AFTER the server has started?

If you create the DataSource yourself, yes, you can bind it.

I had to test the same thing tonight, so I'll share an excerpt of my
stub code.  The short story is, get the InitialContext and call bind().

IIRC, java:comp/env isn't writable, but any other path should be...


  public void contextInitialized(ServletContextEvent sce) {

try{

  // StoreMe is a serializable class created just
  // for this experiment...

  final String bindPath = /some/SomeObject ;
  final StoreMe original = new StoreMe() ;
  original.setProperty1( x ) ;
  original.setProperty1( Z ) ;
  
  Context ctx = new InitialContext() ;

  ctx.bind( /some , new InitialContext() ) ;
  ctx.bind( bindPath , original ) ;

  StoreMe fromJndi = (StoreMe) ctx.lookup( bindPath ) ;
  log.info( Do the objects match?  + original.equals( fromJndi ) ) ;
  
  
}catch( final Exception rethrow ){
  log.error( rethrow ) ;

  // yank the context if this fails...
  throw( new RuntimeException( rethrow ) ) ;
}

  } // contextInitialized()


-QM

-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: [OT] : How to get a connection from Tomcat DBCP from a remote application?

2005-05-01 Thread QM
On Sun, May 01, 2005 at 05:46:22PM -0700, appa rao wrote:
: However if I try to get the connection from the Pool from an application 
which is not deployed in Tomcat (remote client), I am getting not bound 
exceptions.

This makes sense.  Keep in mind, JNDI is just a lookup/storage service
for objects.  The container maintains its own (internal) JNDI service,
and one object it stores there is the DataSource that represents your
connection pool.

When last I checked (admittedly, it's been a while), Tomcat's JNDI
service is not available outside of the container.

So ask yourself this:
does your non-webapp code really need a DataSource pulled from JNDI?
(find a JNDI service, create a DataSource, store it)

or does it just need access to a DataSource, period?
(abstract your data access into a separate layer, such that your code
 doesn't know from where its gets Connection objects)


Either way, someone will have to configure the connections for the
non-webapp code; one convenience provided by containers is that they
take care of instantiating/configuring the DataSource for you (based on
your entries in server.xml/context.xml).

-QM


-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: Non-Sequitor Stack Trace with no log entry

2005-04-30 Thread QM
On Sat, Apr 30, 2005 at 09:33:11AM -0400, Mark Leone wrote:
: I have a servlet in Tomcat that makes a static call to 
: XMLUtils.newDocument(). This is a utility class provided with apache 
: axis, and I have axis.jar in %catalina_home%\shared\lib.

Before we even begin -- why is axis.jar in shared/lib?  Why not the
webapp's WEB-INF/lib?

A NoClassDefFound error means a class was present at compile time, but
isn't available at runtime; in turn, this usually boils down to a
classloader/visibility issue (if said JAR is somewhere in the
classpath).


: newDocument() I get a Tomcat error page (see text below) with a partial 
: stack trace indicating a missing class definition for 
: javax.xml.soap.SOAPException.

Which JAR holds this class def?  -or are there multiple JARs that do
this?  Do they  exist in multiple classloaders?

-QM

-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: Trying to execute my first servlet, but HTTP Status 404.

2005-04-30 Thread QM
On Sat, Apr 30, 2005 at 09:01:02PM -0300, Vinicius wrote:
: I'm trying to execute my first servlet, but it's not working.
: [snip: description of setup]

You mention everything but actually mapping the servlet, such that the
container associates your servlet class with a URI.  (hint: web.xml)

What documents are you reading/following?  Beware older docs that assume
Tomcat has the invoker servlet enabled (it lets you call servlets
without an explicit mapping); the invoker hasn't been enabled by default
in quite some time.

Finally, if you're working with servlets, do yourself a favor and grab a
copy of the servlet spec.  It's a free PDF download from java.sun.com.
Familiarity with the spec is key for any servlet/J2EE developer.

-QM

-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: Missing JNDI resource params after deployment.

2005-04-24 Thread QM
On Thu, Apr 21, 2005 at 10:25:55AM -0400, David C. Hicks wrote:
: I have the following in a file called ems.xml in my META-INF 
: directory.  After deploying this application, the JNDI resource is 
: listed for the application in the administration screen, but none of the 
: ResourceParams are associated with it.  Have I got something wrong in 
: the context file?

Where is the context file, inside a WAR or in an exploded-directory
webapp?

For the former, it should be called context.xml.

For the latter, it should be in
{catalina_home}/conf/{server}/{engine}/{host}/{name.xml}

-QM

-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: Many hosts sharing servlets

2005-04-20 Thread QM

Please post a *new* message when writing to the list.  Replying to
an old (unrelated) message confuses thread-aware mailers, which makes
your question harder to find (and thus answer).


On Wed, Apr 20, 2005 at 05:06:00PM +1000, Bill Sutton wrote:
: I have 100+ servlets and classes that I want to be available to up to 100 
: virtual hosts.

: So I have tried to put all the classes into /var/tomcat4/shared/classes.
: In each host, I deploy a servlets.war file that contains only the following 
: [snip: web.xml with Invoker servlet]
: Questions
: Is there a better way to do this ?

Better depends on your goals, but most a lot of people would say that
using the invoker has its pros and cons.  Mostly cons. =) (See the
archives for why.)

You could just JAR up the 100+ servlet classes and drop them in each
webapp's WEB-INF/lib.  Next, write something to create a set of proper
servlet/ and servlet-mapping/ entries for those servlets.  This is a
one-time hit that will pay off long-term.


: Will tomcat be using hugely more memory than jserv was ?

Depends on your app.  Only a load test + profiling will let you know.

-QM


-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: Using digester

2005-04-20 Thread QM
On Wed, Apr 20, 2005 at 12:02:44PM +0200, Henrique, Manuel wrote:
: 1 - Where I indicate the XML file that my digester needs to read?
: 2 - Once it's done, how can I retrieve the needed value from my XML file
: into my code???

Which Digester documentation did you read?  It's been a while, but I
recall these points are explained (either in the main docs or in the
various Digester articles on the web).

The short version:
1/ Digester#parse()

2/ Digester#parse()

-QM

-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: Plain text mime-mapping and IE

2005-04-19 Thread QM
On Tue, Apr 19, 2005 at 03:18:22PM -0600, Tim Sodergren wrote:
: I've never done filters before. I know how to do the filter-mapping from
: web.xml and know Java programming but not how to make filters for Tomcat.
: Could you point me in the right direction? 

Sure -- it may be confusing because filters aren't part of Tomcat;
they're part of the Servlet Spec (which Tomcat implements).  

Search the web for servlet filter or just check out the Servlet Spec
(available from Sun.com) for details.

-QM

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



Re: Reflection for custom taglibs killing performance...

2005-04-18 Thread QM
On Mon, Apr 18, 2005 at 02:19:15PM -0700, Kevin Burton wrote:
: So its clearly not JUST reflected methods its something else on top of 
: it

What does your profiler report?

-QM

-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: Set group id using jsvc?

2005-04-18 Thread QM
On Mon, Apr 18, 2005 at 12:50:26PM -0400, Nick Johnson wrote:
: I know that jsvc will let you set the user id of the tomcat process,
: but will it also let you set the group id of the process?

Off the top of my head I don't know; but you can grep the source code
for setgid()  (or even setegid()).  That call sets group membership. 

Do you need jsvc to run Tomcat on a privileged port?  If not, you could
use erni[1] for fine-tuned group membership.

-QM

[1] = http://www.brandxdev.net/erni/index.site


-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: Need help exporting contexts not under webapps/

2005-04-18 Thread QM
On Mon, Apr 18, 2005 at 01:16:04PM -0500, J. Ryan Earl wrote:
: So my question is, in short, given a directory structure of static files,
: how do you get Tomcat to serve said static content off of an arbitrary URI?

So, are you trying to
1/ have a Tomcat-run webapp serve content that exists outside of the
context path?

2/ setup the static content as its own webapp (context)?


For #1, the (portable, spec-friendly) way is to write a servlet or
filter to intercept requests for a given URI, open the matching file as
an InputStream, and push the data to the client via the Response
OutputStream.

For #2, I don't remember the exact syntax off the top of my head so I
won't waste your time with something that may not work. =) But it's
definitely possible for a webapp to not exist under the webapps/
directory.

Just make sure said webapp has a WEB-INF directory and a web.xml.  Even
a web.xml of just
web-app/
should do.

-QM

-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: How to change a running Tomcat with root user to other user.

2005-04-17 Thread QM
On Fri, Apr 15, 2005 at 08:37:14AM -0600, Lorenzo Jim?nez wrote:
: Today we saw that our Tomcat 5.0.28 had been installed and it is running with
: the root user.
: how can I change it to other less dangerous user?, and
: what privileges needs to have in order to work?

You've already gotten some wise advice from other posters, so I'll just
add this:

if Tomcat doesn't need to bind to a privileged port (below 1024) then
you don't have to use jsvc or netfilter.  You can write an init script
that does one of the following:

1/ su - {user} -c {path to tomcat's startup.sh}
2/ use erni instead of su
3/ use sudo instead of su

In all three cases, the init script (running as root) will change to the
Tomcat user before starting Tomcat.


btw, if Tomcat's been running as root all this time, you'll have to do
some fine-tuning with the permissions to get it to work.  You *could*
just recursively chown the Tomcat dir to the nonroot user; but as long
as you're interested in security, you could determine which files need
to be writable and only chown those.  (Hint: logs, work dir, and maybe
the webapps dir depending on how strict is your deployment process.)

Write back if you want more info.  I've done this before, I just don't
have any examples right in front of me.

-QM

-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: jsvc.exec error: syscall failed in set_caps

2005-04-17 Thread QM
On Sun, Apr 17, 2005 at 10:33:56AM +0200, Georges Roux wrote:
: I can't start tomcat 5.5.9 as a daemon on linux on port 8080 (default 
: configuration)
: nothing is running on this port
: and have only thi error in logs/catalina.err
: 
: jsvc.exec error: syscall failed in set_caps
: jsvc.exec error: Service exit with a return value of 4


Do you call jsvc as root?

A long time ago, there was a bug that would cause jsvc to fail unless
called as root.  IIRC set_caps() is the function that calls
setuid()/setgid().  Those calls require root privs, so they would fail;
and in turn, the whole program bailed out.

(The other option would have been for jsvc to see whether the requested
and calling user were the same.)

-QM

-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: jsvc.exec error: syscall failed in set_caps

2005-04-17 Thread QM

On Sun, Apr 17, 2005 at 07:34:49PM +0200, Georges Roux wrote:
: and after as root with only
: -Djava.io.tmpdir=/tmp
: the problem was the write permissions on the sessions files in /tmp


Thanks much for sharing your solution with the group -- this will help
people when they search the archives.

-QM


-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: Symlinked subdirectories of webapps

2005-04-17 Thread QM
On Sun, Apr 17, 2005 at 02:30:16PM -0400, Nick Johnson wrote:
: (with respect to tomcat 5.0.28)
: I have a bunch of JSP files which work hapily when located in a
: subdirectory of webapps/ROOT.  However, whenever I want to move that
: directory, and then leave a symlink to that directory in webapps/ROOT,
: it all falls apart.

As in, a symlink inside the webapp?  I wouldn't rely on this... it's not
supported by the spec (likely because it's not cross-platform), and
allowLinking is just a Tomcat convenience feature.  



: I searched around, and the closest think I can find is the
: allowLinking=true flag.  but, I cannot figure out where to put
: this...

It's an attr, I think for Context/.  Scan the online docs for
allowLinking and it should turn up.

-QM

-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: Reflection for custom taglibs killing performance...

2005-04-17 Thread QM
On Sun, Apr 17, 2005 at 03:44:59PM -0700, Kevin Burton wrote:
: We've had a few bottlenecks in our code that have since been removed but 
: the remaining big bottleneck is Tomcat.  The JSP engine is creating 
: compiled code that is heavily relying on reflection.
: [snip]
: 
: Is there ANY way to get Tomcat to not use reflection in this situation.

How could a tag work without reflection?
For example, if you use any of the expression-language features, how is
Tomcat supposed to react to, say,

${request.somvar.something}

without dynamic invocation?

While I doubt you could make Tomcat not use reflection (without
completely hacking the source) perhaps you could share more details of
what you're doing... that may give the rest of us insight to help you
trim the bottlenecks more.  i.e. you mention lots of looping and
tag nesting; is there any way to change how that's done?

-QM


-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: Handling requests for .asp files

2005-04-17 Thread QM
On Mon, Apr 18, 2005 at 03:03:45AM +0200, Martin Lidgard wrote:
: I am trying to get Tomcat to respond to requests for files with an .asp
: extension in order to let Turbine handle the request and redirect to the
: appropriate Velocity page.
: [snip]  
: The problem is that Tomcat does not seem to respond at all to requests for
: urls with .asp as an extension.  The extensions .as and .aspp work
: fine.

How are you mapping the .as and .aspp extensions?  Through a servlet
mapping in yoru webapp's web.xml?

You could also check the global web.xml. That one defines the mapping
for .jsp files; maybe someone at your site put in a mapping for .asp as
well...?

Another thought -- do you access Tomcat directly, or do you go through
Apache as an intermediary?


-QM

-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: Tomcat Cluster + File Sharing

2005-04-12 Thread QM
On Tue, Apr 12, 2005 at 04:41:54PM -0400, Michael Marrotte wrote:
: Am I posting this question to the wrong groups or a little too impatient?

1/ cross-posting to both tomcat-dev@ and tomcat-user@ is considered
a breach of etiquette

2/ perhaps people don't know the answer, or have no thoughts on your
situation

3/ perhaps people think your idea is interesting, but want you to take
the hit for the RD

4/ If you're worried about JSP compilation, just JSP precompilation

5/ Based on my own experience, I prefer to make app servers as
independent as possible.  Give each one its own WAR file, such that when
the netapp has problems your app stays afloat.

-QM


: -Original Message-
: From: Michael Marrotte [mailto:[EMAIL PROTECTED] 
: Sent: Tuesday, April 12, 2005 10:01 AM
: To: tomcat-dev@jakarta.apache.org
: Subject: Tomcat Cluster + File Sharing
: 
: My post to the user list didn't get any response.  I'm thinking the
: developers might provide a little more feedback.  I'm just looking for a
: sanity check.  I'd like to cluster multiple Tomcat instances to share the
: same file system (a NetApp).  I'm thinking something like a master/slaves
: type architecture where the master deploys wars compiles JSP, etc and the
: slaves just read and execute.  I'm picturing the architecture implemented by
: the use of two server.xml files (e.g. masterServer.xml and slaveServer.xml).
: However, before I dig too deep into it, I would just like to get any
: feedback on the idea.  Any info is greatly appreciated; at the least maybe
: point me to some docs that discuss the idea.

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



Re: Application-level control of web-resources

2005-04-10 Thread QM
On Sat, Apr 09, 2005 at 02:45:46PM -0700, Robert Koberg wrote:
: I know what you say is the prevailing wisdom.

Prevailing wisdom, bah! =) It's just what's common at the moment.
When a person strays from that norm, they either end up in a world of
hurt or they create something that revolutionizes how things are done..
which means, over time, *that* becomes what's common at the moment. =)


: to know your thoughts regarding pregenerating JSP or velocity templates 
: such that the decoration (and content inclusion) happens prior to runtime.

I don't think I understand what you're after here, but it's a little
early in the morning for me =) 

Please, explain again.


: For example, we use XSLT to pregenerate the pages (managed through our 
: CMS) so that as much as possible exists in the page/template. This 
: leaves only what is *required* to be dynamic for runtime. Thoughts? (I 
: can take it :)

I suppose what I don't understand is, what is dynamic here?  Are you
talking a menu that's regenerated at each request (in case new menu
items have been added) or something else?

-QM

-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: Application-level control of web-resources

2005-04-10 Thread QM
On Sun, Apr 10, 2005 at 12:28:26AM +0200, Morten Sabroe Mortensen wrote:
: -Because real pages has more power over them than, say, a more simple
: wiki-page parsed to an XML-format and XSLT'et to HTML/XHTML/WML/XHTML-MP
: -whatever.

Depends on your perspective.

Some people would say, they don't want the pages themselves to have
power.  Common thought these days is to make the pages -- or any other
component -- as dumb as possible.  They should know just enough to do
their job, which in the case of a page is usually, make the pretty
HTML. =)


: I want to be free to stash the content in a database, the file-system or
: some other WAR-external resource.

I don't see what's stopping you from doing this..?   WAR-external content
is nothing new.  People are regularly advised to do this if their content
(say, dynamically-served images) and code (webapp) must vary independently.


: I want to be free to have my hieracial
: wiki-like system deliver content by different means of processing -
: dynamic JSP's being the missing link.

What is a dynamic JSP?


: Up until now, no filter or front-controller can control the origin or
: WAR-resources. 

?
Please explain.

-QM


-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: Application-level control of web-resources

2005-04-09 Thread QM
On Sat, Apr 09, 2005 at 06:35:51PM +0200, Morten Sabroe Mortensen wrote:
: This would open up for e.g. creating a wiki-like application, where each
: wiki-page is a valid JSP-page, which is created dynamically and stored
: elsewhere than within the deployed WAR-file.

Why use real pages?  Those are a pain to manage, especially in Java
webapps (which are supposed to be sealed applications).

Many such systems (think blogs) stash the content in a database (or some
other data store) and map URIs to those entries.  In turn, accessing a
URL merges the content and a static template at runtime.  The end-user
doesn't know they're hitting a virtual resource and, quite frankly, they
shouldn't care.

Read up on the Front Controller, Page Controller, and Decorator
design patterns for insight.

-QM

-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: axis tomcat5.5

2005-04-04 Thread QM
On Mon, Apr 04, 2005 at 05:55:31AM -0400, kalin mintchev wrote:
: i was reading the axis documentation on the apache site and it says there
: in the introduction section that If you are installing Tomcat, get the
: latest 4.1.x
: i was wondering if this hasn't been updated lately or axis 1.2 RC3 and
: tomcat 5.* are not usable for production...

Sounds like a lack of doc update.  I use Axis with Tomcat 5.0 without a
problem... and 5.5 implements the same servlet spec as 5.0.  

In theory, then, Tomcat 5.5 and Axis 1.2 should be a happy pair.

-QM

-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: Connector on Solaris 10

2005-04-04 Thread QM
On Mon, Apr 04, 2005 at 10:59:52AM -0500, jefou wrote:
: I have setup Solaris 10 OS on AMD64 and I am trying to build the JK connector 
for Apache2 with Tomcat5, but I am not having any success at all with neither 
the Solaris nor the GNU gcc compiler.

What errors do you see?

-QM

-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: connection pooling basic help please

2005-04-02 Thread QM
On Sat, Apr 02, 2005 at 08:21:24PM +0100, Krishnakant Mane wrote:
: the example in tomcat documentation is on a jsp based
: applicatio.  but I don't understand how I use a pooled
: connection in a servlet.
: [snip]
: should I initialise the connection in the Init method?
:  how and when should I close the connection?


1/ please post a *new* message when writing to the list.  Replying to
an old (unrelated) message confuses thread-aware mailers, which makes
your question harder to find (and thus answer).


2/ I don't have the JSP sample in front of me, but there should be
plenty of examples of using a DataSource out on the web.  A little
Googling should turn them up.  The short version is:
 - perform a JNDI lookup to find the DataSource
 - pull a Connection from that data source
 - use the Connection to talk with a databse
 - call close() on that connection

You should hold on to the Connection for as short a period of time as
possible.  This is easier to manage if all of the database calls are
done from a particular set of objects (a data layer).

Having all of your components do the JNDI lookup, etc can get messy and
tough to maintain.  Isolate all of your data calls to a separate object
(or set of objects).  You could initialize these objects in a
ServletContextListener and either store them under Application scope or
in a singleton such that they would be globally available.

-QM


-- 
software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: [OT] Proper way to open threads in a servlet

2005-04-01 Thread QM
On Fri, Apr 01, 2005 at 11:45:40AM +0100, Mark Benussi wrote:
: I would place your e-mail in a MailManager that queues the messages and
: sends them out on a TimerTask (Every 10 seconds???).

Why not just use JMS?  The servlet puts messages in a queue and returns
to the user. In turn, a queue listener turns those messages into
e-mails.  [solves the problem of delaying the user response while
e-mails are sent]

If you don't have a separate server/service to run the queue listener,
do that inside a single Tomcat thread that is created/destroyed by a
ServletContextListener. [solves the thread hanging problem, as well as
the too-many-threads problem.]

-QM

-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



[OT] Server / Broswer interaction question

2005-04-01 Thread QM

I've renamed your subject as [OT] because it's not specifically about
Tomcat.


On Fri, Apr 01, 2005 at 08:47:59AM -0400, James Sherwood wrote:
: Is there a way to have tomcat monitor a port or socket for incomming events,
: then from those events, talk to a currently open broswer in javascript
: events?

This is not directly possible, based on the stateless notion of HTTP
requests: a browser hits a site, fetches data (some resource based on the
URL and other params), and disconnects.

I say directly because there's usually some indirect workaround.

Your best bet is to find some way for the data to be there when the browser
makes its request.  One such way would be to have a self-refreshing iframe
(or whatever) that keeps contacting the server.  That would be quite
chatty, however, so it may or may not be suitable for your situation.

-QM

-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: How could I autodeploy my webapps onto arbitrary path -s?

2005-03-31 Thread QM
On Wed, Mar 30, 2005 at 06:11:38PM +0200, Zoltan Kanizsai wrote:
: In 5.5.7, the path= parameter is forbidden with these
: context xml files. The path will be derived from the
: file name. Subdirectories are not processed, not even in
: the $CATALINA_HOME/conf/[enginename]/[hostname] folder.
: 
: How could I autodeploy my webapps onto arbitrary path -s?

There was a recent thread on just this subject.  You have to put special
chars in the filename, which are interpreted as / characters as the file
is processed.

I don't recall the exact character, but you should be able to find it in
the archives.

-QM

-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: Embedded tomcat ussage

2005-03-31 Thread QM
On Thu, Mar 31, 2005 at 03:18:30PM +0200, Renat Zubairov wrote:
: I have a question concerning embedded tomcat.
: How to make it even more embedded as it is?
: I.e. do not extract war file somewhere but getting a files from it directly?
: Is there any standart way to acomplish it?

It depends on what you mean by extract war file:
1/ did you specify unpackWars=true in server.xml?  If so, Tomcat will
unpack the WAR file because you asked it to.  Set that attribute to
false and see what happens.

2/ or do you mean that Tomcat unpacks certain files to a temporary
space?  I don't think there's a way around this; so just specify (a
subdirectory of) java.io.tmpdir as the work directory, and that should
(sort of) cover you.

-QM


-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: Need Help w. Servlet Images.

2005-03-31 Thread QM
On Thu, Mar 31, 2005 at 02:42:10PM -0500, Steve R. Burrus wrote:
: Can someone/somebody please tell me just how exactly I go about viewing an 
image using both of the FileInputStream and the FileOutputStream classes in 
connection with the method getRealPath()??

Share your code, and we can help point out bugs.

Better yet: what does the stack trace indicate is the source of the
error?


: I have been failing to view the images due to always getting a 
java.lang.NullPointerException every time that I try to see the images in my 
browser. 

I recall getRealPath() doesn't work quite well inside packed WAR files,
if that's how you're running.  

If you're streaming images, why not place them outside of the webapp?
That lets the images and the webapp vary independently.

-QM

-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: Data file owner and group difficulties

2005-03-30 Thread QM
On Tue, Mar 29, 2005 at 09:31:42PM -0500, James T. Studebaker wrote:
: My servlets create data files.  The webapp is running on a Linux system.  The
: app user is jims and my group is jims.  I have to set permissions to 777 in
: order for tomcat to read data files.  When data files are created, the user is
: tomcat and the group is nobody.

This last sentence would imply that Tomcat is running as tomcat:nobody,
and not as jims:jims as you suspect.  Run 'ps' to confirm.  Also, check
how you start Tomcat and see whether a user switch occurs there.


: Is the a configuration parameter that will result in data
: files created with a user of jims and a group of jims.  Is there configuration
: parameters that result in tomcat being able to read data files with the user
: jims and the group jims.

This wouldn't be set in Tomcat, but in the JVM itself.  In turn, (IIRC)
the base JVM has no way of setting ownership/permissions.

-QM


-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: Re: Installing Tomcat service: Unable to manually insert values for JvmMx and JvmMs in registry

2005-03-30 Thread QM
On Wed, Mar 30, 2005 at 10:02:50AM +0530, Lakshmi Narayanan K. wrote:
: No replies yet??? :(
: Is it possible that this is a possible bug in the tomcat5.exe
: executable? Can this thread be forwarded to the other mailing list,
: the tomcat-developers one???

Rest assured, there are several developers on this list.

If you really think you've found a bug, wrap it up in a test case and
file a Bugzilla report.

-QM

-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: multiple domain name support for https

2005-03-30 Thread QM
On Wed, Mar 30, 2005 at 12:40:34AM -0600, Sasisekar S Sundaram wrote:
: Few browsers (like Mozilla) are giving a warning message ==  Security Error:
: Doamin Name Mismatch  with https.
: [snip]
: It is important for me to over ride this Warning
: message in our production environment. I read somewhere that I can override
: the HostnameVerifier interface and achieve the solution. Can some one guide me
: about how to modify it and integrate with Tomcat. I appreciate your time.

The SSL cert warning comes from the browser side, not the server side.
(SSL-enabled clients get a copy of the server cert during the handshake,
and can run any sort of tests against it.)  So you'd have to modify the
source of the client browser, not Tomcat.

If one could override this behavior at the server side, that would
defeat that whole verification feature of SSL. =)

Someone else suggested you do a redirect to the host for which the cert
is named.  You can do this as long as the redirect happen in cleartext
mode. Again, since the SSL cert exchange happens during the handshake --
before the server gets a chance to respond with a 30x redirect message
-- you can't do this if the client first connects to the SSL-enabled
port.


-QM

-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: JDK usage with Tomcat

2005-03-30 Thread QM
On Wed, Mar 30, 2005 at 12:33:52PM +0530, Gurunandan G Rao wrote:
: Which JDK is mostly used with Tomcat in production environment?.

My guess is that most people use the standard Sun JVM, but that really
depends on the OS.  (For example: I don't think Sun makes a JVM for
HP-UX, so that's not an option for HP-UX users.  BEA JRockit is for i386
only, so someone running a Sparc machine can't use it.  etc.)


: Is Tomcat certified with any JDK vendor?.

Tomcat just rides the JVM; so if the JVM itself is stable/unstable,
Tomcat's sure to follow. =)  You may want to check which JVMs are
suitable for a given OS and go from there.

-QM

-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: Data file owner and group difficulties

2005-03-30 Thread QM
On Wed, Mar 30, 2005 at 08:23:04AM -0500, James T. Studebaker wrote:
: Yes, Tomcat runs as tomcat:nobody.  I can not run Tomcat as jims:jims since
: jims is a virtual host account.  I should have mentioned this in my initial
: email.

Yes, since the statement The app user is jims and my group is jims may
lead someone to believe that Tomcat runs as jims:jims (or at least that
the user is jims).



: However Tomcat runs as tomcat:nobody, the default configuration.  All users
: need to have the ability to create and read data files with the owner:group
: of their own accounts.  Can this be done?

Directly? no.

Independence from the underlying OS is a big part of Java, not to
mention Java webapps.  

With a layer of abstraction? Likely.

You could move all needed auth/security to the database layer, if you
get a private database (or at least private tables).   That would mean
you'd store the files in the database.

This setup wouldn't sync with the existing (system) user/password
tables, but for most of the webapps I've seen/written, this is a
feature. =)

-QM

-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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


Re: caching pattern

2005-03-28 Thread QM
On Mon, Mar 28, 2005 at 04:47:30PM +, Didier McGillis wrote:
: Im looking for an idea of how to setup a caching pattern?

That's awful vague ;)

What sort of caching?  Content, data, other?

Depending on what you're trying to do, and your desire/willingness to
use third-party tools, you may not have to write it yourself from
scratch.

-QM

-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: Problem with Tomcat Upgrade 4.0 to 5.5

2005-03-25 Thread QM
On Fri, Mar 25, 2005 at 09:08:15AM -0500, Beau Hebert wrote:
: I am in the processs of upgrading from Tomcat 4.0 to Tomcat 5.5. I have an
: application that runs on Linux-Java-Tomcat-MySQL.
: [snip]
: javax.servlet.ServletException: javax/mail/Message

As someone else already pointed out, you no longer have to (nor should)
set your own classpath.

Second, Tomcat no longer ships with the JavaMail JARs; either copy those
from your old install or just download new ones from java.sun.com.

Third, I have a brief Tomcat 4.x - 5.x upgrade guide on my website:

http://www.brandxdev.net/misc/index.site

Feel free to give that a skim.

-QM


-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: url of caller?

2005-03-23 Thread QM
On Wed, Mar 23, 2005 at 07:56:01AM -, Pawson, David wrote:
: for this use, internal to my organisation, Norton isn't installed
: luckily!
: 
: Another Gotcha worth noting though, thanks Mark.

This may have been mentioned already, but some browsers can be
configured to not provide referrer information (for privacy reasons).

Like anything else that can be disabled by the end-user, be careful
about code that assumes the referrer field is available.

-QM

-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: jsp imports

2005-03-23 Thread QM
On Wed, Mar 23, 2005 at 11:49:38AM -, Pawson, David wrote:
:   Is there any logic in that?
:If tomcat searches %servlet%/WEB-INF/classes/package/class
:why can't it search without the package layer?

It's got naught to do with a Tomcat failing; packageless classes are
considered a poor programming practice.  As such, they're not allowed
under servlet spec 2.4.

Is this question in the wiki/FAQ?  (I can't check right now.)
It seems to come up often enough.

-QM

-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: Wild Card Hosting

2005-03-23 Thread QM
On Wed, Mar 23, 2005 at 11:42:09AM -0700, George Sexton wrote:
: Does anyone know if Tomcat supports Wild card hosting? Can I specify a
: pattern say
: 
: *.domain.com
: 
: And have all requests get forwarded to a specific host?

Not possible with a stock Tomcat install.
Perhaps possible with some source tweakage, but then you have the fun of
running a custom install.

-QM

-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: clientAuth=true; non-SSL?

2005-03-23 Thread QM
On Wed, Mar 23, 2005 at 01:21:11PM -0800, Sweeney, Bill wrote:
: The question is this:  Do I need an SSL connection in order to get
: Tomcat to force the presentation of a client side certificate?  In other
: words, I only want to force authentication, not wrap the connection in
: SSL.

If you want to force authentication using certs (which is what
clientAuth is all about) then I don't see a way around SSL.  The cert
exchange takes place during the SSL handshake.

If you want to just protect access to certain areas of the webapp, check
the Tomcat docs for realms and skim the servlet spec for FORM
authentication.

-QM

-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: post processing operations after servlet response is sent

2005-03-21 Thread QM
On Mon, Mar 21, 2005 at 05:43:40PM -0800, Garth Patil wrote:
: I've got some operations I'd like to do (transaction logging and some
: web service calls) after the servlet response is sent to the user.
: Rather than creating a new thread every time, is there a way to do
: this in my servlet so that it uses tomcat's processor thread, but is
: executed after the response is sent?

Why not offset the extra processing (the logging and ws calls) to
another system?  You could package up the needed info and either put it
in:

1/ a database to be processed by a scheduled job
(in-container or external)

2/ a JMS message, to be handled by a dedicated listener
(again, in-container or otherwise)

These solutions have the added benefits of not being tied to your
servlet code.  (Think modularity and ease of testing, among other
things.)

-QM


-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

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



Re: Rookie needs help resolving HTTP Status 500 error message

2005-03-20 Thread QM
On Sun, Mar 20, 2005 at 03:45:23PM -0500, Barry Kimelman wrote:
: An error occurred at line: 8 in the jsp file: /logon.jsp
: Generated servlet error:
: DatabaseBean cannot be resolved or is not a type
: [snip]
: jsp:useBean id=foobar scope=session class=DatabaseBean /
: [more snip]

The error message indicates that the class DatabaseBean is not in a
package, such as
com.someproject.DatabaseBean

Packageless classes are discouraged, and will not load under Tomcat 5.x
and later (aka servlet spec 2.3 and later).

Put your DatabaseBean class in a package and this error should fade
away.

-QM

-- 

software   -- http://www.brandxdev.net
tech news  -- http://www.RoarNetworX.com

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



Re: [Slightly OT] MVC approach when JSP are not allowed

2005-03-19 Thread QM
On Fri, Mar 18, 2005 at 11:33:02PM -0500, Elihu Smails wrote:
: I am working on a project that uses servlets exclusively.  I would
: like to take advantage of a Model-View-Controller system in order to
: develop my servlets.
: [snip]
: So I ask the question.  Since the requirement that I have is to use
: servlets only, can I use something like Struts or Java Server Faces? 
: I am reading some information and it looks like they both rely on JSP
: to ge the job done.

Yes and no.  Struts separates the calls business logic (Action classes)
to the formatting of the display.  The formatting defaults to JSP, but
really, can be any resource in your context: another servlet, a Velocity
template, etc.

The real question is why the JSPs have been banned.  If all such display
components are not permitted in your project, handling raw HTML inside a
servlet will be a maintenance nightmare.  That's why JSPs were invented!

-QM

-- 

software   -- http://www.brandxdev.net
tech news  -- http://www.RoarNetworX.com

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



Re: memory usage

2005-03-18 Thread QM
On Fri, Mar 18, 2005 at 07:43:41PM +0100, t.n.a. wrote:
: rough measurements). The memory usage seems to grow up to a 100 MB 
: (Cayenne accesses a single table of about fifty attributes and a 1000 
: rows - don't ask) and sometimes - I can't reproduce the problem now - 
: the app brakes when trying to open a new page. The exception says 
: something about not having enough memory.
: Ring any bells, anyone?



Yes -- if a Java app is out of memory,

1/ invest in a profiler to see whether there's a resource leak
2/ increase the heap such that the JVM has more space in which to create
objects

btw, please post a *new* message when writing to the list.  Replying to
an old (unrelated) message confuses thread-aware mailers, which makes
your question harder to find (and thus answer).

-QM

-- 

software   -- http://www.brandxdev.net
tech news  -- http://www.RoarNetworX.com

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



Re: tomcat 5.5 connector

2005-03-17 Thread QM
On Thu, Mar 17, 2005 at 11:18:00AM +0100, Rahman, Hamdur wrote:
: As tomcat provide coyote connector that is http based,
: Is there any connector available that are non-http based
: And how we can use in our project when we are using tomcat 5.5
: As both web server and servlets engine,
: Or can we make our own connector that is non-http(say telnet)
: And how we can implement it

I'm not sure I understand the question.  What are you trying to do?
Sharing that may give the rest of us ideas on how to help you.

As for implementing your own Connector, the sources for Tomcat and Jk are
available to the public.  Download and code away!

-QM

-- 

software   -- http://www.brandxdev.net
tech news  -- http://www.RoarNetworX.com

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



Re: Reload webapp and context

2005-03-17 Thread QM
On Thu, Mar 17, 2005 at 08:32:54AM +0100, Roland Carlsson wrote:
: do I force tomcat to re-load the context? Right now the only way I know
: about is to reboot tomcat witch leads to a full stop of all my web-apps
: instead of only one witch in turn leads to more complaints from my users.

Perhaps a non-technical solution would help:

1/ schedule regular deployment times.  Apps expect downtime during these
windows, and you're free to start/stop at will.

2/ Put each app in its own JVM.  Such isolation solves several
headaches, not the least of which is the ability for each app to choose
its own downtime window.

-QM


-- 

software   -- http://www.brandxdev.net
tech news  -- http://www.RoarNetworX.com

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



Re: SV: Reload webapp and context

2005-03-17 Thread QM
On Thu, Mar 17, 2005 at 02:12:06PM +0100, Roland Carlsson wrote:
: Do I read you correctly that there are no solution but to restart Tomcat to
: reload the context completly?

That's not at all what I said.  I can't provide an authoritative answer
to that question as I didn't write Tomcat. ;)

With that in mind, context isoliation and scheduled maintenance/downtime
windows are fairly standard practices in the J2EE realm.  While they
don't directly address your concern of completely reloading a context,
they tangentially address your desire to start and stop Tomcat whenever
you please.

-QM

-- 

software   -- http://www.brandxdev.net
tech news  -- http://www.RoarNetworX.com

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



Re: POST no longer working

2005-03-17 Thread QM
On Thu, Mar 17, 2005 at 06:45:56AM -0800, Jimmy Ray wrote:
: Tomcat 5.0.28 on HP UNIX:  I was using a filter
: (jcfifs) in one of my web.xml files.  I have since
: removed the filter and all code refering to it.  Now
: web forms can not post to servlets in this app.  GET
: methods work fine, but POST does not.

1/ at the risk of sounding flippant, diff the two code bases and see
what changed

2/ you'll have to elaborate on what doesn't work: error messages in the
browser, log messages, etc.

-QM

-- 

software   -- http://www.brandxdev.net
tech news  -- http://www.RoarNetworX.com

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



Re: Start and stop Tomcat + Cron

2005-03-17 Thread QM
On Thu, Mar 17, 2005 at 05:24:59PM +0100, C?dric Buschini wrote:
: I'd like to stop and start my tomcat using cron so I added this in the 
: root's crontab and /etc/crontab :
: 00 22 * * * root /PATH/TO/JAKARTA/bin/shutdown.sh
: 02 22 * * * root /PATH/TO/JAKARTA/bin/startup.sh

1/ please post a *new* message when writing to the list.  Replying to
an old (unrelated) message confuses thread-aware mailers, which makes
your question harder to find (and thus answer).

2/ does Tomcat always run as root?  That's just a side concern, but you
probably don't want to do that.

3/ You mentioned that all of the proper environment variables are set,
but are they set just in root's shell? Keep in mind, cron is a barebones
environment.  You'd do well to use wrapper scripts for cron jobs, such
that the wrapper can set any needed env vars.

4/ What are the messages in the error logs, cron logs, etc?  What
doesn't work?

-QM

-- 

software   -- http://www.brandxdev.net
tech news  -- http://www.RoarNetworX.com

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



Re: localhost ok - how I set up in a real host?

2005-03-17 Thread QM
On Thu, Mar 17, 2005 at 05:24:12PM -0300, [EMAIL PROTECTED] wrote:
: I succesfully executed a tutorial form servlet in the computer. Now I want to 
try it on a web host.
: But, I am using a free host (beplaced.com) that I don't know if accepts java 
servlets. Questions:
: 
: 1) How do I know if the server accepts java servlets?

Just ask them.  If they don't boast about it in their list of offerings,
though, then it's probably not available.

There's far less Java web hosting out there than there is standard
HTML/PHP/CGI hosting.  I'd be surprised to see a free host do it.

(Not to say that I've never been surprised, though... ;)

-QM


-- 

software   -- http://www.brandxdev.net
tech news  -- http://www.RoarNetworX.com

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



Re: book for servlet programming

2005-03-17 Thread QM
On Thu, Mar 17, 2005 at 04:24:57PM -0800, brian wrote:
: Please let me know your experiences about a good book to for
: servlet programming. (shall be using Tomcat primarily)

1/ Inside Servlets, by Dustin Callaway.  I tried a few other servlet
books, but this is the one that really worked for me.  It remains a
valuable reference.

2/ Go to your local bookstore and skim some texts to see what authors
resonate with you.  I have a tough time following a book if the style
bothers me.

3/ Download a copy of the servlet spec (java.sun.com) and give it a good
skim.  It's dry -- it's a spec, after all -- but it contains what every
servlet developer should know.  Sticking to spec-compliant code will
make your apps container-agnostic, such that you can use Tomcat,
WebLogic, etc with little difficulty.

-QM

-- 

software   -- http://www.brandxdev.net
tech news  -- http://www.RoarNetworX.com

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



Re: {OT] Re: Jumping in and out of JSP

2005-03-15 Thread QM
On Tue, Mar 15, 2005 at 01:31:38PM -0600, Charles P. Killmer wrote:
: Is there a better way to template a site.  I don't like the method of
: including sections into each jsp file.  This makes adding new sections
: to every page difficult.

You could look into Tiles.  That may require Struts, but if not, it's
pretty much what you're after: it applies the GoF Decorator pattern to
web content.

If Tiles is indeed Struts-specific, you could look into other templating
frameworks (none come to mind, but they do exist).  

Finally, you can implement your own (Front Controller pattern) but given
the overhead that may be overkill if you use it just for site branding.

-QM

-- 

software  -- http://www.brandxdev.net
tech news -- http://www.RoarNetworX.com


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



Re: DataSource using Commons libraries 5.5.7

2005-03-14 Thread QM
On Mon, Mar 14, 2005 at 08:55:35AM -0800, sven morales wrote:
:I am not exactly sure what you meant by you don't
: have to do that ?  For example, how would a class
: differentiate between
: org.apache.commons.dbcp.BasicDataSourceFactory and
: org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory
: without doing anything?

That's the idea -- it won't have to. =)

Tomcat repackaged the classes to essentially give itself private copies.
In turn, if your code was using those classes, simply include the proper
JAR files in WEB-INF/lib and you're done.  Developer code shouldn't rely
on the Tomcat-specific classes.



: My usage of it was
: container manage and requires reformatting Resource
: therefore I don't have the need for recompilations. 

Now I see what you mean.  I originally thought your code was
directly calling the (now-repackaged) classes.

-QM



-- 

software  -- http://www.brandxdev.net
tech news -- http://www.RoarNetworX.com


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



Re: Restriction of pages?

2005-03-14 Thread QM
On Mon, Mar 14, 2005 at 08:50:10AM -0700, Chris Cherrett wrote:
: I would like to restrict access to certain pages within a webapp to certain 
IP 
: addesses but not to the whole webapp. What is the best way to do this or do I 
: need to take another approach?

You don't state what version of Tomcat you run; but if it's 4.1 or later
(maybe 4.0 and later?) you can take advantage of servlet filters.
They're part of the servlet spec (2.3 and later) so using them won't tie
you to Tomcat.

-QM


-- 

software  -- http://www.brandxdev.net
tech news -- http://www.RoarNetworX.com


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



Re: Redhat Tomcat support

2005-03-14 Thread QM
On Mon, Mar 14, 2005 at 03:57:28PM -0600, Trice, Jim wrote:
:I'm relatively new to Tomcat support. Has any had any experience with
: RedHat support for Tomcat? We're currently running Tomcat 4.1 and would have
: to upgrade to 5.5 to get support from RedHat. Is it worth it?

I've never used RedHat's Tomcat support.  One question to ask yourself,
though, is whether you need support beyond the mailing list and your own
RD.  

True, there's no guarantee the list will solve any and all questions
you send in; but if you follow the list (to keep note of trends, bugs,
and general advice) and are conservative about upgrades (to avoid being
the first to encounter a bug) then maybe you'll do alright on your own.

(Well, it also helps to keep up with the servlet spec and follow best
practices for J2EE development, but that goes for any container ;)

-QM

-- 

software  -- http://www.brandxdev.net
tech news -- http://www.RoarNetworX.com


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



Re: Redhat Tomcat support

2005-03-14 Thread QM
On Mon, Mar 14, 2005 at 03:57:28PM -0600, Trice, Jim wrote:
: [snip]
: RedHat support for Tomcat? We're currently running Tomcat 4.1 and would have
: to upgrade to 5.5 to get support from RedHat. Is it worth it?

by the way, in response to your question Is it worth it? -- did you
mean RedHat's Tomcat Support or just upgrading from 4.1 - 5.5?

The upgrade has several benefits, including all of the new servlet spec
2.4/JSP 2.0 features.  That, and sticking with a recent release
increases your chances of list-based support (because you'd be running
the same version as most other list members).

-- 

software  -- http://www.brandxdev.net
tech news -- http://www.RoarNetworX.com


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



Re: Why so much virtual memory?

2005-03-14 Thread QM
On Mon, Mar 14, 2005 at 04:12:16PM -0600, Montz, James C. (James Tower) wrote:
: On a related note, It would appear to me that java is not adhering to
: the -Xmx option;
: 
: I have several instances that report using 3-4X RSS Memory what -Xmx is
: set to.

Keep in mind, -Xmx and -Xms are options for the heap.  In turn, the heap
is the raw memory space where the JVM creates objects. 

The JVM often uses more memory than the heap for its internal
housekeeping and such.  I don't recall having seen it use as much as 3-4
times the heap allocation, but I suppose it's possible.

-QM

-- 

software  -- http://www.brandxdev.net
tech news -- http://www.RoarNetworX.com


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



Re: Multiple instances of tomcat

2005-03-12 Thread QM
On Sat, Mar 12, 2005 at 12:21:10AM -0800, Darek wrote:
:  I have a tomcat 4-1-27 running on RedHat 2.4.21. Normally
: when you startup tomcat it will create a single instance, I
: have however about 28 created right away. I understand that
: they all share the same memory, but I don?t think this is a
: normal behavior. What can be causing this? 

1/ please post a *new* message when writing to the list.  Replying to
an old (unrelated) message confuses thread-aware mailers, which makes
your question harder to find (and thus answer).

2/ Are these separate Tomcat instances, or just PIDs?  Pre-NPTL Linux
kernels show threads as separate processes.  That's likely what you're
seeing.

-QM

-- 

software  -- http://www.brandxdev.net
tech news -- http://www.RoarNetworX.com


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



Re: Connection pooling verse one connection per session

2005-03-10 Thread QM
On Thu, Mar 10, 2005 at 10:31:41AM -0800, Mark Winslow wrote:
: Hi, I have a sort of theoretical question.  I'm
: wondering about the pros and cons of using a one
: connection per tomcat session strategy for connecting
: to a Postgresql server rather than connection pooling.

The great benefit of pooling is that objects that aren't being
(actively) used by one person/login/etc can be used by another.  
Put another way, the Connection objects aren't specific to a user, so
there's no need to treat them as such.  (If you've done any EJB, think
of Stateless vs Stateful Session Beans.)

You say your users are logged into your app all day; but are they
constantly streaming data from the minute they login to the minute they
logout?  If not, then holding open the DB connection for them isn't
helping much.  (I'd hesitate to say it's doing harm or anything bad,
just that it's not helping.)

For this same reason, pooling also helps in scalability: when a
Connection is idle (not being used by anyone), someone else can use it.  



: 1.  Can cache prepared statements, something that is
: more problematic to do with a generic connection pool.

True; but have you seen a significant performance gain due to prepared
statement caching?


: 2.  Have better control of connection releases via the
: finalize() method in a session helper class that
: contains the one single connection.

I'm not sure I understand this.  If your app is written such that
data-access code fetches a Connection as needed, then returns it to the
pool when it's done (Connection#close()), then what other control would
you need?

You realize, for a pooled connection, close() doesn't really shutdown
the network connection.  It just sends the Connection object back to the
pool.


: 3.  Easier to code and implement than connection
: pooling.

Again, I don't understand this.  Please explain.


: 4.  Potentially faster than connection pooling because
: of only one connection open per session.  

Yes and no. The connection pool keeps the connection open all the time;
so users who go through a pooled Connection object don't suffer any
first time access hits.

-QM


-- 

software  -- http://www.brandxdev.net
tech news -- http://www.RoarNetworX.com


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



Re: Access Threads informations/state

2005-03-10 Thread QM
On Thu, Mar 10, 2005 at 08:47:25PM +0100, David Causse wrote:
: I store my jdbc connections inside the user session, and I create thanks 
: to a Filter one connection per thread (cause we encountered multithread 
: issues with the oracle JDBC driver, and we use frames).

Is there a way to refactor your app, to move the thread-safety outside
of the Connection objects?   Put another way, it sounds as though you
could insert a data layer between the Filter / Session objects and the
Connection objects.


: When the user hit the Home link I have to clean all the session 
: attributes, but I don't want to clean the Connections if they are in use.
: In normal condition and in a perfect world no Connection should be 
: present in the session when home is called, but it is a very big app...
: The session attribute name is like 
: Connection+Thread.currentThread().getName().

The problem you may run into, long-term, is that a Java webapp isn't
supposed to rely on container-specific features, especially something as
low-level as the thread model.  


I don't see a quick solution to this.  Just about anything you find
right now will be a short-term holdover, and will eventually bite you
down the line.  If at all possible, consider refactoring the data access
of your app such that this isn't an issue.


-QM

-- 

software  -- http://www.brandxdev.net
tech news -- http://www.RoarNetworX.com


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



Re: Connection pooling verse one connection per session

2005-03-10 Thread QM
On Thu, Mar 10, 2005 at 12:30:22PM -0800, Mark Winslow wrote:
: 
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/printer/jndi-datasource-examples-howto.html#Database%20Connection%20Pool%20(DBCP)%20Configurations
: 
: There is one problem with connection pooling. A web
: application has to explicetely close ResultSet's,
: Statement's, and Connection's.

I'd hardly say that's a problem; that's just good coding practice. =)
(example: When I'm done cooking, I should turn off the stove.  Is that a
problem with stoves, or just how stoves work?)

Connection cleanup maintenance is straightforward: liberally sprinlke
finally{} blocks around data access code.  -and if that's abstracted out
into a layer, and a separate set of objects, you shouldn't have to look
in that many places to insert said finally{} blocks.



: For instance can you assume that the
: overhead to create a Pooled Connection based an an
: already established connection is negligable? 

A pooled connection usually *is* an established connection.  The idea of
pooling (any sort of object pooling) is that the app (here, Tomcat)
instantiates some number of said objects ahead of time, such that
they're ready to use when needed.  In some cases the objects are created
on-demand but then kept around for future use.

Pooled Connection objects are wrapped in another object (that also
implements Connection) that intercepts close() calls.  Instead of
actually closing the connection, it returns the object to the pool.


: There are threading
: issues involved with connection pools.

Such as...?  As long as you treat a Connection as a hot potato -- hold
on to it only as long as you need, then pitch it -- there should be no
such threading issues. -and as long as you only fetch Connection objects
from the DataSource, then you should never run into an issue where two
sections of code get the same Connection.


: It's sort of a non-standard thing to
: do and maybe not worth any potential cpu/memory
: benefits.  I think I'm probably trying to talk myself
: into droping my strategy and implementing connection
: pools.

For me, it's mostly a design issue.  I design my apps such that I can
switch the connection source (pooled, one-off, etc) and the code is none
the wiser.  It just knows, I get a Connection here, and I call close()
on it when I'm done.  Whether close() really terminates a network
connection/DB session, or just returns an object to the pool, it doesn't
matter...

-QM

-- 

software  -- http://www.brandxdev.net
tech news -- http://www.RoarNetworX.com


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



Re: Connection pooling verse one connection per session

2005-03-10 Thread QM

On Thu, Mar 10, 2005 at 01:52:02PM -0800, Mark Winslow wrote:
: I'm still not entirely sure about this issue.  The
: close/=null + finally blocks make for pretty ugly and
: error prone code if you ask me.

Well, certainly no one's forcing you to code that way.  It's just a
fairly standard practice in Java webapps to pool DB connections and to
use try/catch/finally blocks where appropriate. ;)


: Why doesn't the connection pool encapsulate closing
: anyway?

It seems you're missing the point of the pool.  Pooled connections
remain open (logged in to the remote DB).  The close() method on the
Connection wrapper object puts the (underlying) Connection object back
in the pool so others can use it.



: Can't it encapsulate closing into the
: finalize() methods?

Maybe it does; but there's no guarantee finalizers will be called.
Besides, do you want to wait for gc to run to free up connections?


: Are there ordering issues for
: closing ResultSets, Statements, and Connections?

This is in the docs...  I *think* closing a Connection closes all
underlying Statement and ResultSet objects, but it's good form to just
close them when you're done with them.


: Is infrequent garbage collection an issue?

If you're waiting for finalizers to do your cleanup work for you, yes.  


: I'm asking about encapsulating into the finalize()
: methods because I don't like the asthetics of all the
: close/=null + finally statements.

Again, your call.


-QM

-- 

software  -- http://www.brandxdev.net
tech news -- http://www.RoarNetworX.com


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



Re: Equivalent of Resin run-at servlet configuration

2005-03-03 Thread QM
: I am developing a Java web application, and one of the requirements is to run 
: a particular servlet periodically, or even at specified times.  Resin 
provides 
: this ability via its run-at configuration element for servlets in web.xml

Tomcat doesn't have this.

Are you trying to run that particular servlet, or just the business
logic called by that servlet?

Look into a scheduler (such as Quartz) to call that business logic for
you at given times.

You could also use Java's builtin TimerTask class, but (IIRC) that takes
a Runnable or a Thread, so it's up to you to make sure those threads are
properly terminated at container shutdown.  Tomcat won't do that for
you.

-QM

-- 

software  -- http://www.brandxdev.net
tech news -- http://www.RoarNetworX.com


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



Re: Include other contexts

2005-03-01 Thread QM
On Wed, Mar 02, 2005 at 11:53:52AM +1100, Peter Johnson wrote:
: I was just wondering if it was possible to pass a request to another 
: context within the same host and capture the output. If it is, any 
: suggestions on the best way to do so?

You could make a URL call to the app (java.net.URL and other similar
implementations).  Either that, or RequestDispatcher#include()
(Though something tells me that requires an in-context URL.  Check the
docs to be sure.)

It sounds like you're screen scraping, though, in which case you'd be
better off trying to find some common data format that app A and app B
can share.  (If, of course, you have some control or influence over App
A.)

If app A changes the format of the data (common with websites) then app
B has to play catch-up with its parsing.


: Basically, I am planning to use SiteMesh for site templating however 
: would prefer to deploy many of the apps as individual apps. So somehow I 
: would like to call another context and then have SiteMesh decorate the 
: response.

Are you using this setup for branding, then, or something else?  I may
have some suggestions, but knowing your end-goal may help.

-QM

-- 

software  -- http://www.brandxdev.net
tech news -- http://www.RoarNetworX.com


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



Re: can I develop dan deploy myapps as regular user at linux?

2005-02-22 Thread QM
On Tue, Feb 22, 2005 at 09:47:51PM +0800, Mohd. Jeffry wrote:
: Hi, I'm pretty new with tomcat, 1 month to be exect. So what are the
: standart operating procedure to develop and deploy at linux
: environtment? For the time being this is what I do and it's kinda
: troublesome.
: 
: 1. compile my app at /home/devel/myapps
: 2. su as root and move it to /usr/local/tomcat/webapps/myapps
: 3. and chown myapps for tomcat:tomcat.
: 4. and restart tomcat

You could look into setting up a private Tomcat instance for yourself.
This uses a single Tomcat install on the machine, but leaves the
relevant files writable by you.  Look into $CATALINA_HOME vs
$CATALINA_BASE, it's in the docs.

: If possible I don't want to use any IDE tools for time being because I
: want to focus on servlet/jsp and not on IDE.

Good call.  I've seen container/IDE integration cause all sorts of
problems.  Until you're familiar with Tomcat and know what to look for,
this is the way to go.


-QM


-- 

software  -- http://www.brandxdev.net
tech news -- http://www.RoarNetworX.com


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



Re: Merge webapp doc roots

2005-02-22 Thread QM
On Tue, Feb 22, 2005 at 02:08:50PM -0800, Bill Lynch wrote:
: Resin has a new merge() function which will merge together different
: doc roots for a webapp:
:  [snip]
: web-app id=/foo
: document-directory=merge:(c:\webapp;c:\webapp-editionA); .. /
: 
: This means everything in webapp-editionA will override what's in
: webapp. I do this right now and it works perfectly for development.
: 
: My question is -- is this possible in Tomcat?


To my knowledge, no, this is not possible using Tomcat alone.  Tomcat
expects a standard webapp (that is, either wrapped in a WAR file or in
exploded-dir format).

You can achieve what you're after by moving the merge into your build
process -- that is, have Ant (or whatever you use) create the dir/WAR by
copying all of those webapps to it (that is, copy them over one
another).

-QM


-- 

software  -- http://www.brandxdev.net
tech news -- http://www.RoarNetworX.com


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



Re: moving all classes to shared

2005-02-21 Thread QM
On Sat, Feb 19, 2005 at 06:38:03PM -0800, Oleg wrote:
: If I have 200 users deployed on tomcat with 99% using identical
: classes, would it be ok to move all classes to shared/classes
: directory? Will that give better memory usage? Also, can I later add
: the classes that are different directly to WEB-INF/classes and will
: they be given priority?

You've already received answers to the other points, so I'll address
just the last question:

it depends

With hierarchical classloaders, you can get yourself into a right snit
when 1/ there's version skew between the per-webapp class and the one in
shared/lib; and 2/ when a class in shared/lib depends on a class that's
in the per-webapp area (that is, it can't see a dependent class because
it's out of the scope of the current classloader).  

IIRC, both result in NoClassDefFoundError, and both can be a mess to
sort out if you don't know in advance where to start looking.

-QM

-- 

software  -- http://www.brandxdev.net
tech news -- http://www.RoarNetworX.com


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



Re: moving all classes to shared

2005-02-21 Thread QM
On Mon, Feb 21, 2005 at 11:21:01AM -0800, Oleg wrote:
: Well regarding #1 from what I understand the class in webapp web-inf
: will take priority, however, I can see how #2 can be a problem, but,
: does it only work one way? Meaning a class in sared/classes will not
: see webapp/web-inf/classes, so down the hierarchy, however, it will
: work just fine going up, so class in webapp will see classes in
: shared?

Correct -- the per-webapp classloader is the child of the shared/lib
classloader.  (This is an oversimplification but please bear with me.)

Really, there are more than two classloaders involved, forming several
parent/child relationships in a hierarchy...


Try to think of it as the GoF Chain of Responsiblity pattern: when the
per-webapp classloader can't find a class, it delegates (passes the
request) to its parent.  This keeps going until you hit a classloader
that can successfully load the class, or until the innermost classloader
-- which doesn't delegate to anyone else -- gives up and says there's no
such class.


Going the other way thus isn't possible: that innermost (parent)
classloader can't see what its children see, and so on. If a class
under shared/lib needs access to (depends on) a class in a child
classloader, it will never find it, and the system throws a
NoClassDefFoundError.

It's for a similar reason one webapp can't see another webapp's classes:
they only have a relationship with their parent classloader, and not
that of their siblings.

-QM

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



Re: jk vs. jk2

2005-02-21 Thread QM
On Mon, Feb 21, 2005 at 02:57:48PM -0500, Matt wrote:
: If jk2 is abandoned, why would I use it over jk_1.2.8?
: Platform reasons?  Feature reasons? Performance reaosns?  Other?
: Anyone?

Depends on how you define use --

continue using an existing JK2 install -- either because you're in the
process of migrating off JK2 but haven't finished; or because you feel
you have the in-house expertise to tweak and support JK2 yourself
long-term.

use JK2 on a new project -- no real reason, unless (again) you feel
you have the in-house expertise to tweak and support JK2 yourself
long-term.

I recall JK2 had some features over JK(1), but those have already been
backported or developers are in the process of doing so.

-QM

-- 

software  -- http://www.brandxdev.net
tech news -- http://www.RoarNetworX.com


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



Re: Tomcat: who is knocking on my door?

2005-02-21 Thread QM
On Mon, Feb 21, 2005 at 02:55:53PM -0800, Dola Woolfe wrote:
: First, I'm sure this is documented so can anyone point
: me to the documentation on how to determine the client
: application.

Check for the User-Agent header.
(I may have made a typo on the name, but if you iterate through the
headers you'll see it right away)


: Second, does Tomcat itself do anything different
: depending on who's making the request. I sometimes
: notice that IE's requests are fielded faster than
: wget's requests.

It shouldn't -- perhaps there's something different about how wget makes
its requests?


: Finally, is there a blanket way to prevent wget
: requests?

Yes and no:

yes - use a Servlet Filter that refuses requests based on the User-Agent
header.

yes - employ user authentication.  If the offending clients are coming
from off-site, adjust your network topology such that the app in
question is only available from the inside (proactive), or block the
offending IPs using a firewall (reactive).

no - if the user changes the User-Agent header from wget. IIRC wget has
a switch for this; and if not, the source is wide-open.

Note that user auth/firewall/etc are the solid solutions.  There are
myriad non-browser clients out there besides wget, and you'll have a
devil of a time fending the all off.

-QM


-- 

software  -- http://www.brandxdev.net
tech news -- http://www.RoarNetworX.com


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



Re: Tomcat Includes?

2005-02-01 Thread QM
On Tue, Feb 01, 2005 at 09:59:30AM -0600, Curt LeCaptain wrote:
: Currently I'm running Tomcat 5 and I am looking to be able to take the
: virtual hosts section of my server.xml file and move it to it's own
: file, to be included in server.xml.


Sounds like you've gotten tunnel vision from digging at this so long =)

Let's forget about Tomcat-specific solutions and think XML: what about
external entities?  That is, define an entity

... vhostDefs ... some/path/to/vhost_defs.xml

and in server.xml


vhostDefs
...

The trick here would be relative vs absolute paths: what's the server's
current directory when it starts?  Does it stay in $CATALINA_BASE or
$CATALINA_HOME? etc.  You'd have to experiment but it's a start.


Another option would be to use system properties.  At least some such
properties are available in the Tomcat config files using
expression-language syntax (e.g. ${vhost.defs}), though I haven't
researched this.

-QM


-- 

software  -- http://www.brandxdev.net
tech news -- http://www.RoarNetworX.com


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



Re: Performance of different Tomcat Releases

2005-02-01 Thread QM
On Tue, Feb 01, 2005 at 11:52:37AM -0600, sudip shrestha wrote:
: I would like to know if there is significant performance improvement
: from 5.0.x to 5.5.x.  Is there some sort of relative performance study
: done by anybody?

Tomcat 5.5 is supposed to include several performance enhancements, and
you may also see a boost from running JDK 1.5.

That said, there are a lot of app-specific considerations here.  The
only way to be certain is to deploy your app under Tomcat 5.5 and find
out.

-QM

-- 

software  -- http://www.brandxdev.net
tech news -- http://www.RoarNetworX.com


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



Re: Deny access to a JSP page

2005-02-01 Thread QM
On Tue, Feb 01, 2005 at 08:22:45PM +0100, apuerta.foros wrote:
:  I'd like Tomcat to deny access to some JSPs with internal information.
: 
:  I can configure Apache to deny access depending on the user IP,
: transparently.
:  
:  I'd like to do the same in Tomcat, but i don't now how.

Have you searched the archives on this?  Look up AccessValve. (-or was
that RemoteAccessValve?  Either way, it's a Valve implementation.)

That, or look into servlet filters.  They're available with the 2.3 spec
onward.

Finally, it's helpful to the rest of us when you post your setup details
(Tomcat version, OS, etc).  There are several versions of Tomcat.

-QM


-- 

software  -- http://www.brandxdev.net
tech news -- http://www.RoarNetworX.com


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



Re: getAttribute returning null

2005-02-01 Thread QM
On Tue, Feb 01, 2005 at 08:56:14PM +, Didier McGillis wrote:
: Having problem with a context parm.  I have a servlet that queries for 300+ 
: list of names, it then builds a select list.  This list changes 
: infrequently, the jsp page is supposed to display the data from the 
: servlet, so being the absolutly brilliant person that I am I wanted that 
: option list built on startup, and then just have the jsp display the list.
: 
: I retrofitted the servlet to build the list, and then put 
: %=application.getAttribute(listOfDealer)% in the jsp, open the page and 
: wham -o awesome, great .. it doesnt work, all I see is null.

In addition to Tim Funk's advice, I'd suggest you post the code.  A
one-letter typo can cause all sorts of headaches =)

-QM


-- 

software  -- http://www.brandxdev.net
tech news -- http://www.RoarNetworX.com


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



Re: SocketException: Too many open files

2005-02-01 Thread QM
On Tue, Feb 01, 2005 at 05:29:51PM -0600, Stephen Charles Huey wrote:
: java.net.SocketException: Too many open files
:  [snip]
: We're opening lots of these, and it appears we're opening more than a
: maximum number of connections to the internet.  Is there a way to bump
: this up?  Or maybe we're just pounding this harder than it will ever get
: hit in the real world?

I don't recall which OS you run, but look into tuning the TCP stack for
the short, bursty connection style of HTTP.  There's a setting that
determines how long your server hangs onto a socket after the connection
has closed. 

For the life of me, I can't remember this parm right now, but I've seen
it here and there.  

Search the archives for Too many open files and my e-mail address.
You should turn up a post in which I've answered this question before.

-QM


-- 

software  -- http://www.brandxdev.net
tech news -- http://www.RoarNetworX.com


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



  1   2   3   4   5   6   7   8   9   >