You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Rickard Öberg <ri...@dreambean.com> on 2003/05/20 20:03:59 UTC

Accessing Tomcat classes

Hi!

I have code in my webapp that needs to access the internals of Tomcat 
(4.1). I tried moving catalina.jar to /shared/lib and /common/lib, but 
neither worked. It seems it *has* to be in /server/lib. So, how can I 
get Tomcat to work *and* have my servlet classes access these internal 
classes at the same time?

/Rickard

-- 
Rickard Öberg
rickard@dreambean.com
Senselogic

Got blog? I do. http://dreambean.com



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Sending e-mail from a servlet

Posted by "Ivan F. Martinez" <bl...@ivanfm.com>.
On Tue, 20 May 2003 11:57:07 -0700
"John Corrigan" <jo...@johncorrigan.net> wrote:

JC> System:
JC>   Win2K
JC>   Java 1.4.1-rc1
JC>   Tomcat 1.4.18  (NOT LE)
JC> 
JC> Problem:
JC>   Attempting to send e-mail yields the following exception:
JC> 
JC> ENCOUNTERED EXCEPTION: javax.mail.SendFailedException: Sending failed; nested exception is: javax.mail.MessagingException: IOException while sending message; nested exception is: javax.activation.UnsupportedDataTypeException: no object DCH for MIME type text/plain
JC> 
JC> javax.mail.SendFailedException: Sending failed;
JC>   nested exception is: 
JC> 	javax.mail.MessagingException: IOException while sending message;
JC>   nested exception is: 
JC> 	javax.activation.UnsupportedDataTypeException: no object DCH for MIME type text/plain
JC> ...
JC> 
JC> 
JC> 
JC> I've tried extracting the contents of mail.jar to the WEB-INF/classes directory (as was suggested in some usenet postings) and that doesn't seem to help.  Both mail.jar and activation.jar are in .../Tomcat-4.1/common/lib.
JC> 
JC> Any ideas?


Running with security Manager ????
Try this in yout policy... (make the changes for you paths).
I don't know why in one other machine with the same config it's not necessary, but solved this problem for me.

---------------------
// http://java.sun.com/products/javamail/FAQ.html#securityManager
grant {
    permission java.io.FilePermission "/opt/jakarta-tomcat-4.1.24/common/lib/mail.jar", "read";
    permission java.io.FilePermission "/opt/jakarta-tomcat-4.1.24/common/lib/activation.jar", "read";
};
----------------------




-- 


Ivan F. Martinez

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Accessing Tomcat classes

Posted by Rickard Öberg <ri...@dreambean.com>.
Filip Hanik wrote:
>>What I want to do is:
>>*) have a ServletListener access the Host
>>*) get deployed contexts from there, and register for changes
> 
> if you could do this, wouldn't that be a big security problem for Tomcat in
> other environments?

Maybe, but I don't care about that. I care about Tomcat in this 
environment, and for my purposes I want to access the Tomcat core from 
my WAR classes :-) I need to be able to upgrade the Tomcat installation 
easily, so separating what is my app and what is Tomcat is very 
important. I really don't want to put code into the Tomcat server 
installation directory.

> so at this point, I'm out of ideas, if you can't put your files elsewhere
> but in webapps, then I am not sure how you would get a handle on the other
> ones.

Ok, that's too bad. I thought this was something fairly trivial to solve 
but perhaps not. I'll stick with JBoss/Tomcat until I can find a 
solution then.

Thanks for you help.

regards,
   Rickard


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: Accessing Tomcat classes

Posted by Filip Hanik <ma...@filip.net>.
>What I want to do is:
>*) have a ServletListener access the Host
>*) get deployed contexts from there, and register for changes

if you could do this, wouldn't that be a big security problem for Tomcat in
other environments?
so at this point, I'm out of ideas, if you can't put your files elsewhere
but in webapps, then I am not sure how you would get a handle on the other
ones.

Let me know if you come up with something :)

Filip


> -----Original Message-----
> From: Rickard Öberg [mailto:rickard@dreambean.com]
> Sent: Wednesday, May 21, 2003 12:02 AM
> To: Tomcat Users List
> Subject: Re: Accessing Tomcat classes
>
>
> Bill Barker wrote:
>
> > 1)  Assuming that you trust all of your webapps (e.g. you are
> not a hosting
> > service), then probably the easiest is to move the JMX jars to
> common/lib,
> > and access everything from JMX.
>
> If I look something up from JMX, won't I get a ClassCastException when I
> try to cast it to the Tomcat classes? Also, where do I put catalina.jar?
>
> > 2) Otherwise, use the ServerLifecyleListener as a model as to how to
> > propogate your Listener throughout the application, and stick everything
> > that you need into a Context attribute that your servlet can look up.
>
> The problem is that the ONLY code I have is stuff in a WAR file. I.e.
> there's nothing that can "stick" something into anything.
>
> What I want to do is:
> *) have a ServletListener access the Host
> *) get deployed contexts from there, and register for changes
>
> Is this possible? It *should* be *if* I can get both Tomcat and my WAR
> classes to access the same catalina.jar from some classloader. Having
> duplicates is no good, because then I'll get ClassCastException's.
>
> /Rickard
>
> --
> Rickard Öberg
> rickard@dreambean.com
> Senselogic
>
> Got blog? I do. http://dreambean.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Accessing Tomcat classes

Posted by Rickard Öberg <ri...@dreambean.com>.
Bill Barker wrote:

> 1)  Assuming that you trust all of your webapps (e.g. you are not a hosting
> service), then probably the easiest is to move the JMX jars to common/lib,
> and access everything from JMX.

If I look something up from JMX, won't I get a ClassCastException when I 
try to cast it to the Tomcat classes? Also, where do I put catalina.jar?

> 2) Otherwise, use the ServerLifecyleListener as a model as to how to
> propogate your Listener throughout the application, and stick everything
> that you need into a Context attribute that your servlet can look up.

The problem is that the ONLY code I have is stuff in a WAR file. I.e. 
there's nothing that can "stick" something into anything.

What I want to do is:
*) have a ServletListener access the Host
*) get deployed contexts from there, and register for changes

Is this possible? It *should* be *if* I can get both Tomcat and my WAR 
classes to access the same catalina.jar from some classloader. Having 
duplicates is no good, because then I'll get ClassCastException's.

/Rickard

-- 
Rickard Öberg
rickard@dreambean.com
Senselogic

Got blog? I do. http://dreambean.com


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Accessing Tomcat classes

Posted by Bill Barker <wb...@wilshire.com>.
1)  Assuming that you trust all of your webapps (e.g. you are not a hosting
service), then probably the easiest is to move the JMX jars to common/lib,
and access everything from JMX.
2) Otherwise, use the ServerLifecyleListener as a model as to how to
propogate your Listener throughout the application, and stick everything
that you need into a Context attribute that your servlet can look up.

"Filip Hanik" <ma...@filip.net> wrote in message
news:CIEPIAPFGBKPEBHPGDJJKEIFCPAA.mail@filip.net...
> In tomcat 5 you would be able to do this through JMX.
>
> for Tomcat 4, I assume you can specify a Listener class in server.xml (see
> the <Listener>)
> and when a context is installed, removed or reloaded just catch the event,
> grab the context and do whatever you need.
>
> when the context is installed, the event data passed in is the Context
> interface, you can cast this to StandardContext or ContainerBase and do a
> getLoader() on that one, should contain the classloaders
>
> the only problem I see is when the context throughs a reload event,
> lifecycle.fireLifecycleEvent(Context.RELOAD_EVENT, null); it passes in
null,
> so you don't have a handle to it.
>
> maybe I am just swimming out in the air, but this would be an approach I
> would take. Your listener of course would have to be placed in server/lib,
> and then somehow you would need to bridge your portlet container from
there
> to that class, maybe through some events etc.
>
> if this is totally off, just ignore it :)
> Filip
>
> > -----Original Message-----
> > From: Rickard Oberg [mailto:rickard@dreambean.com]
> > Sent: Tuesday, May 20, 2003 12:08 PM
> > To: Tomcat Users List
> > Subject: Re: Accessing Tomcat classes
> >
> >
> > Filip Hanik wrote:
> > > what in particular do you need to access?
> > >
> > > a short description and maybe I can give some good input :)
> >
> > Basically, I'm doing a portlet container so I need access to all
> > deployed contexts. I need the classloaders and URL's to all of them, and
> > preferably notifications when new deployments are available.
> >
> > I'm currently using JBoss/Tomcat, and in there I've managed to retrieve
> > all this information from the EmbeddedCatalina41 MBean, but we're
> > considering dropping JBoss and only use Tomcat instead, so I was trying
> > to figure out how much work it'd be to convert. And immediately hit this
> > blocker. So, any ideas are most welcome.
> >
> > /Rickard
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >
> >




---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Accessing Tomcat classes

Posted by Rickard Öberg <ri...@dreambean.com>.
Filip Hanik wrote:
> I meant the global listeners, maybe I'm wrong, but the code in
> StandardHostDeployer looks like this
> 
>             host.fireContainerEvent(PRE_INSTALL_EVENT, context);
>             host.addChild(context);
>             host.fireContainerEvent(INSTALL_EVENT, context);
> 
> so if you have a listener assigned to your host, then you will receive this,
> and this is global to the host, not a context listener as the spec suggest

Ok, I see. But, then the original question is still unanswered: how do I 
get my classes to access the Tomcat classes so that I can get the above 
"host" object. Where do I put catalina.jar? If it's in the standard 
location my servlet classes can't see it.

/Rickard


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: Accessing Tomcat classes

Posted by Filip Hanik <ma...@filip.net>.
I meant the global listeners, maybe I'm wrong, but the code in
StandardHostDeployer looks like this

            host.fireContainerEvent(PRE_INSTALL_EVENT, context);
            host.addChild(context);
            host.fireContainerEvent(INSTALL_EVENT, context);

so if you have a listener assigned to your host, then you will receive this,
and this is global to the host, not a context listener as the spec suggest

Filip

> -----Original Message-----
> From: Rickard Oberg [mailto:rickard@dreambean.com]
> Sent: Tuesday, May 20, 2003 2:01 PM
> To: Tomcat Users List
> Subject: Re: Accessing Tomcat classes
>
>
> Filip Hanik wrote:
> > for Tomcat 4, I assume you can specify a Listener class in
> server.xml (see
> > the <Listener>)
> > and when a context is installed, removed or reloaded just catch
> the event,
> > grab the context and do whatever you need.
>
> I think the listener only gets events for its own context, not for other
> contexts. Besides, I need access to contexts which have already been
> deployed before the context with the supposed listener, so it's not a
> working solution. I really need to dig into Tomcat to make it work. As I
> said, I already have it working with JBoss/Tomcat, but that integration
> is rather crude (to say the least), so I'd prefer to use plain Tomcat,
> if it's possible.
>
> /Rickard
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Accessing Tomcat classes

Posted by Rickard Öberg <ri...@dreambean.com>.
Filip Hanik wrote:
> for Tomcat 4, I assume you can specify a Listener class in server.xml (see
> the <Listener>)
> and when a context is installed, removed or reloaded just catch the event,
> grab the context and do whatever you need.

I think the listener only gets events for its own context, not for other 
contexts. Besides, I need access to contexts which have already been 
deployed before the context with the supposed listener, so it's not a 
working solution. I really need to dig into Tomcat to make it work. As I 
said, I already have it working with JBoss/Tomcat, but that integration 
is rather crude (to say the least), so I'd prefer to use plain Tomcat, 
if it's possible.

/Rickard


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: Accessing Tomcat classes

Posted by Filip Hanik <ma...@filip.net>.
In tomcat 5 you would be able to do this through JMX.

for Tomcat 4, I assume you can specify a Listener class in server.xml (see
the <Listener>)
and when a context is installed, removed or reloaded just catch the event,
grab the context and do whatever you need.

when the context is installed, the event data passed in is the Context
interface, you can cast this to StandardContext or ContainerBase and do a
getLoader() on that one, should contain the classloaders

the only problem I see is when the context throughs a reload event,
lifecycle.fireLifecycleEvent(Context.RELOAD_EVENT, null); it passes in null,
so you don't have a handle to it.

maybe I am just swimming out in the air, but this would be an approach I
would take. Your listener of course would have to be placed in server/lib,
and then somehow you would need to bridge your portlet container from there
to that class, maybe through some events etc.

if this is totally off, just ignore it :)
Filip

> -----Original Message-----
> From: Rickard Oberg [mailto:rickard@dreambean.com]
> Sent: Tuesday, May 20, 2003 12:08 PM
> To: Tomcat Users List
> Subject: Re: Accessing Tomcat classes
>
>
> Filip Hanik wrote:
> > what in particular do you need to access?
> >
> > a short description and maybe I can give some good input :)
>
> Basically, I'm doing a portlet container so I need access to all
> deployed contexts. I need the classloaders and URL's to all of them, and
> preferably notifications when new deployments are available.
>
> I'm currently using JBoss/Tomcat, and in there I've managed to retrieve
> all this information from the EmbeddedCatalina41 MBean, but we're
> considering dropping JBoss and only use Tomcat instead, so I was trying
> to figure out how much work it'd be to convert. And immediately hit this
> blocker. So, any ideas are most welcome.
>
> /Rickard
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Accessing Tomcat classes

Posted by Rickard Öberg <ri...@dreambean.com>.
Filip Hanik wrote:
> what in particular do you need to access?
> 
> a short description and maybe I can give some good input :)

Basically, I'm doing a portlet container so I need access to all 
deployed contexts. I need the classloaders and URL's to all of them, and 
preferably notifications when new deployments are available.

I'm currently using JBoss/Tomcat, and in there I've managed to retrieve 
all this information from the EmbeddedCatalina41 MBean, but we're 
considering dropping JBoss and only use Tomcat instead, so I was trying 
to figure out how much work it'd be to convert. And immediately hit this 
blocker. So, any ideas are most welcome.

/Rickard


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: Accessing Tomcat classes

Posted by Sriram N <sr...@yahoo.com>.
Hello:

>From the Server Configuration Manual located at 

http://jakarta.apache.org/tomcat/tomcat-4.1-doc/config/context.html

Attribute : privileged
Explanation: "Set to true to allow this context to use container servlets, like
the manager servlet."

What it says is you should edit the server.xml file, configure your web
application here (use the config for the "manager" application as a template),
and mark the Contect as "priveleged".

This way, you web app should have access to the Tomcat classes.

-- Sriram

--- Filip Hanik <ma...@filip.net> wrote:
> what in particular do you need to access?
> 
> a short description and maybe I can give some good input :)
> 
> filip
> 
> > -----Original Message-----
> > From: Rickard Öberg [mailto:rickard@dreambean.com]
> > Sent: Tuesday, May 20, 2003 11:04 AM
> > To: tomcat-user@jakarta.apache.org
> > Subject: Accessing Tomcat classes
> > 
> > 
> > Hi!
> > 
> > I have code in my webapp that needs to access the internals of Tomcat 
> > (4.1). I tried moving catalina.jar to /shared/lib and /common/lib, but 
> > neither worked. It seems it *has* to be in /server/lib. So, how can I 
> > get Tomcat to work *and* have my servlet classes access these internal 
> > classes at the same time?
> > 
> > /Rickard
> > 
> > -- 
> > Rickard Öberg
> > rickard@dreambean.com
> > Senselogic
> > 
> > Got blog? I do. http://dreambean.com
> > 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> > 
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: Accessing Tomcat classes

Posted by Filip Hanik <ma...@filip.net>.
what in particular do you need to access?

a short description and maybe I can give some good input :)

filip

> -----Original Message-----
> From: Rickard Öberg [mailto:rickard@dreambean.com]
> Sent: Tuesday, May 20, 2003 11:04 AM
> To: tomcat-user@jakarta.apache.org
> Subject: Accessing Tomcat classes
> 
> 
> Hi!
> 
> I have code in my webapp that needs to access the internals of Tomcat 
> (4.1). I tried moving catalina.jar to /shared/lib and /common/lib, but 
> neither worked. It seems it *has* to be in /server/lib. So, how can I 
> get Tomcat to work *and* have my servlet classes access these internal 
> classes at the same time?
> 
> /Rickard
> 
> -- 
> Rickard Öberg
> rickard@dreambean.com
> Senselogic
> 
> Got blog? I do. http://dreambean.com
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: Sending e-mail from a servlet

Posted by John Corrigan <jo...@johncorrigan.net>.
I think the problem may have had something to do with more than one JVM
being installed on the machines having trouble.  After removing Tomcat and
all JVMs and then reinstalling just the latest JVM and Tomcat all seems to
be well.


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: Sending e-mail from a servlet

Posted by John Corrigan <jo...@johncorrigan.net>.
Yes.

A different exception is thrown if that hasn't been done :)

-----Original Message-----
From: Sasha Borodin [mailto:sasha@whoissasha.com]
Sent: Tuesday, May 20, 2003 1:44 PM
To: Tomcat Users List
Subject: Re: Sending e-mail from a servlet


Sorry if I haven't followed this thread closely enough, but have you changed
the host to an actual SMPT server in server.xml?

          <Resource name="mail/Session" auth="Container"
                    type="javax.mail.Session"/>
          <ResourceParams name="mail/Session">
            <parameter>
              <name>mail.smtp.host</name>                   <--- HERE
              <value>localhost</value>
            </parameter>
          </ResourceParams>

-Sasha

On 5/20/03 15:20, "Micael" <ca...@harbornet.com> wrote:

> Jah, the code is wrong.  I had to rewrite it.  I cannot remember now what
> was wrong.  But it is pretty easy to find.  Micael
>
> At 12:13 PM 5/20/03 -0700, you wrote:
>> SendMailServlet is not working in my installations :)  The snippet of the
>> stack trace is from /examples/jsp/mail/sendmail.jsp...
>>
>> -----Original Message-----
>> From: Kevin Baynes [mailto:kbaynes@seagullsw.com]
>> Sent: Tuesday, May 20, 2003 12:08 PM
>> To: Tomcat Users List
>> Subject: RE: Sending e-mail from a servlet
>>
>>
>>
>> In the Tomcat examples included with the regular distribution, there is a
>> SendMailServlet at /examples/WEB-INF/classes/SendMailServlet.java that
>> works. Also, look at /examples/jsp/mail/sendmail.jsp.
>>
>> You can also send email using URLConnection, or using a third-party
>> library. I think there are some in Commons, but I may be wrong about
that.
>>
>> ~akb
>>
>> | -----Original Message-----
>> | From: John Corrigan [mailto:john@johncorrigan.net]
>> | Sent: Tuesday, May 20, 2003 2:57 PM
>> | To: Tomcat Users List
>> | Subject: Sending e-mail from a servlet
>> |
>> |
>> | System:
>> |   Win2K
>> |   Java 1.4.1-rc1
>> |   Tomcat 1.4.18  (NOT LE)
>> |
>> | Problem:
>> |   Attempting to send e-mail yields the following exception:
>> |
>> | ENCOUNTERED EXCEPTION: javax.mail.SendFailedException: Sending
>> | failed; nested exception is: javax.mail.MessagingException:
>> | IOException while sending message; nested exception is:
>> | javax.activation.UnsupportedDataTypeException: no object DCH for
>> | MIME type text/plain
>> |
>> | javax.mail.SendFailedException: Sending failed;
>> |   nested exception is:
>> |       javax.mail.MessagingException: IOException while sending message;
>> |   nested exception is:
>> |       javax.activation.UnsupportedDataTypeException: no object
>> | DCH for MIME type text/plain
>> | ...
>> |
>> |
>> |
>> | I've tried extracting the contents of mail.jar to the
>> | WEB-INF/classes directory (as was suggested in some usenet
>> | postings) and that doesn't seem to help.  Both mail.jar and
>> | activation.jar are in .../Tomcat-4.1/common/lib.
>> |
>> | Any ideas?
>> |
>> |
>> | ---------------------------------------------------------------------
>> | To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>> | For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>> |
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>
> LEGAL NOTICE
>
> This electronic mail  transmission and any accompanying documents contain
> information belonging to the sender which may be confidential and legally
> privileged.  This information is intended only for the use of the
> individual or entity to whom this electronic mail transmission was sent as
> indicated above. If you are not the intended recipient, any disclosure,
> copying, distribution, or action taken in reliance on the contents of the
> information contained in this transmission is strictly prohibited.  If you
> have received this transmission in error, please delete the message.
Thank
> you
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Sending e-mail from a servlet

Posted by Sasha Borodin <sa...@whoissasha.com>.
Sorry if I haven't followed this thread closely enough, but have you changed
the host to an actual SMPT server in server.xml?

          <Resource name="mail/Session" auth="Container"
                    type="javax.mail.Session"/>
          <ResourceParams name="mail/Session">
            <parameter>
              <name>mail.smtp.host</name>                   <--- HERE
              <value>localhost</value>
            </parameter>
          </ResourceParams>

-Sasha

On 5/20/03 15:20, "Micael" <ca...@harbornet.com> wrote:

> Jah, the code is wrong.  I had to rewrite it.  I cannot remember now what
> was wrong.  But it is pretty easy to find.  Micael
> 
> At 12:13 PM 5/20/03 -0700, you wrote:
>> SendMailServlet is not working in my installations :)  The snippet of the
>> stack trace is from /examples/jsp/mail/sendmail.jsp...
>> 
>> -----Original Message-----
>> From: Kevin Baynes [mailto:kbaynes@seagullsw.com]
>> Sent: Tuesday, May 20, 2003 12:08 PM
>> To: Tomcat Users List
>> Subject: RE: Sending e-mail from a servlet
>> 
>> 
>> 
>> In the Tomcat examples included with the regular distribution, there is a
>> SendMailServlet at /examples/WEB-INF/classes/SendMailServlet.java that
>> works. Also, look at /examples/jsp/mail/sendmail.jsp.
>> 
>> You can also send email using URLConnection, or using a third-party
>> library. I think there are some in Commons, but I may be wrong about that.
>> 
>> ~akb
>> 
>> | -----Original Message-----
>> | From: John Corrigan [mailto:john@johncorrigan.net]
>> | Sent: Tuesday, May 20, 2003 2:57 PM
>> | To: Tomcat Users List
>> | Subject: Sending e-mail from a servlet
>> |
>> |
>> | System:
>> |   Win2K
>> |   Java 1.4.1-rc1
>> |   Tomcat 1.4.18  (NOT LE)
>> |
>> | Problem:
>> |   Attempting to send e-mail yields the following exception:
>> |
>> | ENCOUNTERED EXCEPTION: javax.mail.SendFailedException: Sending
>> | failed; nested exception is: javax.mail.MessagingException:
>> | IOException while sending message; nested exception is:
>> | javax.activation.UnsupportedDataTypeException: no object DCH for
>> | MIME type text/plain
>> |
>> | javax.mail.SendFailedException: Sending failed;
>> |   nested exception is:
>> |       javax.mail.MessagingException: IOException while sending message;
>> |   nested exception is:
>> |       javax.activation.UnsupportedDataTypeException: no object
>> | DCH for MIME type text/plain
>> | ...
>> |
>> |
>> |
>> | I've tried extracting the contents of mail.jar to the
>> | WEB-INF/classes directory (as was suggested in some usenet
>> | postings) and that doesn't seem to help.  Both mail.jar and
>> | activation.jar are in .../Tomcat-4.1/common/lib.
>> |
>> | Any ideas?
>> |
>> |
>> | ---------------------------------------------------------------------
>> | To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>> | For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>> |
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 
> 
> LEGAL NOTICE
> 
> This electronic mail  transmission and any accompanying documents contain
> information belonging to the sender which may be confidential and legally
> privileged.  This information is intended only for the use of the
> individual or entity to whom this electronic mail transmission was sent as
> indicated above. If you are not the intended recipient, any disclosure,
> copying, distribution, or action taken in reliance on the contents of the
> information contained in this transmission is strictly prohibited.  If you
> have received this transmission in error, please delete the message.  Thank
> you  
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: Sending e-mail from a servlet

Posted by John Corrigan <jo...@johncorrigan.net>.
Nice to know it isn't just me :)

Do you have a snippet you could send that actually works?  I've spent over a
day on this now.

Thanks.

-----Original Message-----
From: Micael [mailto:caraunltd@harbornet.com]
Sent: Tuesday, May 20, 2003 1:20 PM
To: Tomcat Users List
Subject: RE: Sending e-mail from a servlet


Jah, the code is wrong.  I had to rewrite it.  I cannot remember now what
was wrong.  But it is pretty easy to find.  Micael

At 12:13 PM 5/20/03 -0700, you wrote:
>SendMailServlet is not working in my installations :)  The snippet of the
>stack trace is from /examples/jsp/mail/sendmail.jsp...
>
>-----Original Message-----
>From: Kevin Baynes [mailto:kbaynes@seagullsw.com]
>Sent: Tuesday, May 20, 2003 12:08 PM
>To: Tomcat Users List
>Subject: RE: Sending e-mail from a servlet
>
>
>
>In the Tomcat examples included with the regular distribution, there is a
>SendMailServlet at /examples/WEB-INF/classes/SendMailServlet.java that
>works. Also, look at /examples/jsp/mail/sendmail.jsp.
>
>You can also send email using URLConnection, or using a third-party
>library. I think there are some in Commons, but I may be wrong about that.
>
>~akb
>
>| -----Original Message-----
>| From: John Corrigan [mailto:john@johncorrigan.net]
>| Sent: Tuesday, May 20, 2003 2:57 PM
>| To: Tomcat Users List
>| Subject: Sending e-mail from a servlet
>|
>|
>| System:
>|   Win2K
>|   Java 1.4.1-rc1
>|   Tomcat 1.4.18  (NOT LE)
>|
>| Problem:
>|   Attempting to send e-mail yields the following exception:
>|
>| ENCOUNTERED EXCEPTION: javax.mail.SendFailedException: Sending
>| failed; nested exception is: javax.mail.MessagingException:
>| IOException while sending message; nested exception is:
>| javax.activation.UnsupportedDataTypeException: no object DCH for
>| MIME type text/plain
>|
>| javax.mail.SendFailedException: Sending failed;
>|   nested exception is:
>|       javax.mail.MessagingException: IOException while sending message;
>|   nested exception is:
>|       javax.activation.UnsupportedDataTypeException: no object
>| DCH for MIME type text/plain
>| ...
>|
>|
>|
>| I've tried extracting the contents of mail.jar to the
>| WEB-INF/classes directory (as was suggested in some usenet
>| postings) and that doesn't seem to help.  Both mail.jar and
>| activation.jar are in .../Tomcat-4.1/common/lib.
>|
>| Any ideas?
>|
>|
>| ---------------------------------------------------------------------
>| To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>| For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>|
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org



LEGAL NOTICE

This electronic mail  transmission and any accompanying documents contain
information belonging to the sender which may be confidential and legally
privileged.  This information is intended only for the use of the
individual or entity to whom this electronic mail transmission was sent as
indicated above. If you are not the intended recipient, any disclosure,
copying, distribution, or action taken in reliance on the contents of the
information contained in this transmission is strictly prohibited.  If you
have received this transmission in error, please delete the message.  Thank
you



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: Sending e-mail from a servlet

Posted by Micael <ca...@harbornet.com>.
Jah, the code is wrong.  I had to rewrite it.  I cannot remember now what 
was wrong.  But it is pretty easy to find.  Micael

At 12:13 PM 5/20/03 -0700, you wrote:
>SendMailServlet is not working in my installations :)  The snippet of the 
>stack trace is from /examples/jsp/mail/sendmail.jsp...
>
>-----Original Message-----
>From: Kevin Baynes [mailto:kbaynes@seagullsw.com]
>Sent: Tuesday, May 20, 2003 12:08 PM
>To: Tomcat Users List
>Subject: RE: Sending e-mail from a servlet
>
>
>
>In the Tomcat examples included with the regular distribution, there is a 
>SendMailServlet at /examples/WEB-INF/classes/SendMailServlet.java that 
>works. Also, look at /examples/jsp/mail/sendmail.jsp.
>
>You can also send email using URLConnection, or using a third-party 
>library. I think there are some in Commons, but I may be wrong about that.
>
>~akb
>
>| -----Original Message-----
>| From: John Corrigan [mailto:john@johncorrigan.net]
>| Sent: Tuesday, May 20, 2003 2:57 PM
>| To: Tomcat Users List
>| Subject: Sending e-mail from a servlet
>|
>|
>| System:
>|   Win2K
>|   Java 1.4.1-rc1
>|   Tomcat 1.4.18  (NOT LE)
>|
>| Problem:
>|   Attempting to send e-mail yields the following exception:
>|
>| ENCOUNTERED EXCEPTION: javax.mail.SendFailedException: Sending
>| failed; nested exception is: javax.mail.MessagingException:
>| IOException while sending message; nested exception is:
>| javax.activation.UnsupportedDataTypeException: no object DCH for
>| MIME type text/plain
>|
>| javax.mail.SendFailedException: Sending failed;
>|   nested exception is:
>|       javax.mail.MessagingException: IOException while sending message;
>|   nested exception is:
>|       javax.activation.UnsupportedDataTypeException: no object
>| DCH for MIME type text/plain
>| ...
>|
>|
>|
>| I've tried extracting the contents of mail.jar to the
>| WEB-INF/classes directory (as was suggested in some usenet
>| postings) and that doesn't seem to help.  Both mail.jar and
>| activation.jar are in .../Tomcat-4.1/common/lib.
>|
>| Any ideas?
>|
>|
>| ---------------------------------------------------------------------
>| To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>| For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>|
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org



LEGAL NOTICE

This electronic mail  transmission and any accompanying documents contain 
information belonging to the sender which may be confidential and legally 
privileged.  This information is intended only for the use of the 
individual or entity to whom this electronic mail transmission was sent as 
indicated above. If you are not the intended recipient, any disclosure, 
copying, distribution, or action taken in reliance on the contents of the 
information contained in this transmission is strictly prohibited.  If you 
have received this transmission in error, please delete the message.  Thank 
you  



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: Sending e-mail from a servlet

Posted by John Corrigan <jo...@johncorrigan.net>.
I have now tried:

  1.  Extracting mail.jar and activation.jar into the WEB-INF/classes tree.
  2.  Removing mail.jar and activation.jar from the tomcat/common/lib tree.
  3.  Added mail.jar and activation.jar into the classpath (defined in the registry
      for Tomcat) both individually and together trying each first.

Same exception...

And I thought that any jar file in tomcat/common/lib didn't need to be in the classpath since that is the value of java.ext.dirs which is supposed to be searched before the classpath.

Argh!  I really can't affort to lose anymore hair!!! :)



-----Original Message-----
From: Jason Bainbridge [mailto:jason@jblinux.org]
Sent: Tuesday, May 20, 2003 12:24 PM
To: Tomcat Users List
Subject: Re: Sending e-mail from a servlet


On Wed, 21 May 2003 03:13, John Corrigan wrote:
> javax.activation.UnsupportedDataTypeException: no object DCH for

Looking at a few previous similar problems I'd say you need activation.jar to 
be in your classpath: http://java.sun.com/products/javabeans/glasgow/jaf.html

Regards,
-- 
Jason Bainbridge
KDE Web Team - http://kde.org 
webmaster@kde.org 

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Sending e-mail from a servlet

Posted by Jason Bainbridge <ja...@jblinux.org>.
On Wed, 21 May 2003 03:13, John Corrigan wrote:
> javax.activation.UnsupportedDataTypeException: no object DCH for

Looking at a few previous similar problems I'd say you need activation.jar to 
be in your classpath: http://java.sun.com/products/javabeans/glasgow/jaf.html

Regards,
-- 
Jason Bainbridge
KDE Web Team - http://kde.org 
webmaster@kde.org 

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Performance optimization of the coyote connector

Posted by Philippe Marchand <pm...@speechworks.com>.
Hi 

I am running Tomcat 4.1 with the coyote connector and the performance decreases considerably when I have about 100 channels making http requests. This happens even though the server box is not loaded at all at this time: both the memory and the CPU are only partially used. I was wondering what connector configurations would allow me to load more effectively the server. 

Thank you 
Philippe   


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: Sending e-mail from a servlet

Posted by John Corrigan <jo...@johncorrigan.net>.
SendMailServlet is not working in my installations :)  The snippet of the stack trace is from /examples/jsp/mail/sendmail.jsp...

-----Original Message-----
From: Kevin Baynes [mailto:kbaynes@seagullsw.com]
Sent: Tuesday, May 20, 2003 12:08 PM
To: Tomcat Users List
Subject: RE: Sending e-mail from a servlet



In the Tomcat examples included with the regular distribution, there is a SendMailServlet at /examples/WEB-INF/classes/SendMailServlet.java that works. Also, look at /examples/jsp/mail/sendmail.jsp.

You can also send email using URLConnection, or using a third-party library. I think there are some in Commons, but I may be wrong about that.

~akb

| -----Original Message-----
| From: John Corrigan [mailto:john@johncorrigan.net]
| Sent: Tuesday, May 20, 2003 2:57 PM
| To: Tomcat Users List
| Subject: Sending e-mail from a servlet
| 
| 
| System:
|   Win2K
|   Java 1.4.1-rc1
|   Tomcat 1.4.18  (NOT LE)
| 
| Problem:
|   Attempting to send e-mail yields the following exception:
| 
| ENCOUNTERED EXCEPTION: javax.mail.SendFailedException: Sending 
| failed; nested exception is: javax.mail.MessagingException: 
| IOException while sending message; nested exception is: 
| javax.activation.UnsupportedDataTypeException: no object DCH for 
| MIME type text/plain
| 
| javax.mail.SendFailedException: Sending failed;
|   nested exception is: 
| 	javax.mail.MessagingException: IOException while sending message;
|   nested exception is: 
| 	javax.activation.UnsupportedDataTypeException: no object 
| DCH for MIME type text/plain
| ...
| 
| 
| 
| I've tried extracting the contents of mail.jar to the 
| WEB-INF/classes directory (as was suggested in some usenet 
| postings) and that doesn't seem to help.  Both mail.jar and 
| activation.jar are in .../Tomcat-4.1/common/lib.
| 
| Any ideas?
| 
| 
| ---------------------------------------------------------------------
| To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
| For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
| 


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: Sending e-mail from a servlet

Posted by Kevin Baynes <kb...@seagullsw.com>.
In the Tomcat examples included with the regular distribution, there is a SendMailServlet at /examples/WEB-INF/classes/SendMailServlet.java that works. Also, look at /examples/jsp/mail/sendmail.jsp.

You can also send email using URLConnection, or using a third-party library. I think there are some in Commons, but I may be wrong about that.

~akb

| -----Original Message-----
| From: John Corrigan [mailto:john@johncorrigan.net]
| Sent: Tuesday, May 20, 2003 2:57 PM
| To: Tomcat Users List
| Subject: Sending e-mail from a servlet
| 
| 
| System:
|   Win2K
|   Java 1.4.1-rc1
|   Tomcat 1.4.18  (NOT LE)
| 
| Problem:
|   Attempting to send e-mail yields the following exception:
| 
| ENCOUNTERED EXCEPTION: javax.mail.SendFailedException: Sending 
| failed; nested exception is: javax.mail.MessagingException: 
| IOException while sending message; nested exception is: 
| javax.activation.UnsupportedDataTypeException: no object DCH for 
| MIME type text/plain
| 
| javax.mail.SendFailedException: Sending failed;
|   nested exception is: 
| 	javax.mail.MessagingException: IOException while sending message;
|   nested exception is: 
| 	javax.activation.UnsupportedDataTypeException: no object 
| DCH for MIME type text/plain
| ...
| 
| 
| 
| I've tried extracting the contents of mail.jar to the 
| WEB-INF/classes directory (as was suggested in some usenet 
| postings) and that doesn't seem to help.  Both mail.jar and 
| activation.jar are in .../Tomcat-4.1/common/lib.
| 
| Any ideas?
| 
| 
| ---------------------------------------------------------------------
| To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
| For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
| 


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Sending e-mail from a servlet

Posted by John Corrigan <jo...@johncorrigan.net>.
System:
  Win2K
  Java 1.4.1-rc1
  Tomcat 1.4.18  (NOT LE)

Problem:
  Attempting to send e-mail yields the following exception:

ENCOUNTERED EXCEPTION: javax.mail.SendFailedException: Sending failed; nested exception is: javax.mail.MessagingException: IOException while sending message; nested exception is: javax.activation.UnsupportedDataTypeException: no object DCH for MIME type text/plain

javax.mail.SendFailedException: Sending failed;
  nested exception is: 
	javax.mail.MessagingException: IOException while sending message;
  nested exception is: 
	javax.activation.UnsupportedDataTypeException: no object DCH for MIME type text/plain
...



I've tried extracting the contents of mail.jar to the WEB-INF/classes directory (as was suggested in some usenet postings) and that doesn't seem to help.  Both mail.jar and activation.jar are in .../Tomcat-4.1/common/lib.

Any ideas?


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org