Running application keeps redirecting back to the Root application

2015-08-06 Thread Eric Wood
I'm running an application under tomcat6.  Also, if I go to the root of the 
tomcat server http://myserver:8080, I can see the tomcat home page displayed.  
I assume this is the ROOT in webapps.  Regardless, then I attempt to hit the 
application by putting the name of the war on the end, 
http://myserver:8080/myapplication it redirects me back to the "root" server.

I run several application in tomcat 7 and I do not see this behavior.  Any idea 
what might be causing this?  I do not see anything in the logs.




Re: Configuring E-Mail Session via JNDI

2015-08-06 Thread Mark H. Wood
On Wed, Aug 05, 2015 at 09:12:14PM -0700, Tim Gustafson wrote:
> I'm trying to configure an e-mail session in my Tomcat configuration like 
> this:
> 
>auth="Container"
>   type="javax.mail.Session"
>   mail.transport.protocol="smtp"
>   mail.smtp.host="192.168.0.2"
>   mail.debug="true" />

That means Tomcat will have to have access to mail.jar, typically by
placing a copy in Tomcat's /lib.  Otherwise it can't load javax.mail.*.

> From my web application, I'm instantiating a Session object like this:
> 
> Context initialContext = new InitialContext();
> session = (Session) initialContext.lookup("java:comp/env/mail/session");
> 
> When I go to send e-mail from my web applet, I'm getting:
> 
> java.lang.ClassNotFoundException: javax.mail.Authenticator

Probably because the Resource could not be created.  See above.

> I find that error a little odd, as I'm not doing SMTP AUTH anywhere,
> but I'll let that go for now.  Based on documentation I found while
> Googling that error message, I copied the mail.jar file from my
> Netbeans library into Tomcat's lib folder, and now I get:
> 
> java.lang.ClassCastException: javax.mail.Session cannot be cast to
> javax.mail.Session

As another noted, this happens when you have two copies of mail.jar
available to the classloader tree, even when they are exact copies of
each other.  Don't include a copy in your application if it is to be
provided by the container (which is required, if you want to use it
this way).

> Removing Java Mail from my Netbeans project does not appear to be an
> option as it will refuse to compile the project without it.

I use NetBeans with Maven, and in that context I would declare the
mail dependency to be provided.  I don't know how to do
that in a native NetBeans project, but what you'd need to do is to
tell NetBeans that javax.mail is required to compile but must not be
included in the output WAR.

Or you can just manually remove mail.jar from the built application
before deployment.  I have to do that with a community project that I
haven't yet had time to fully adapt to  injection.  Doing it
this way might be a good quick proof-of-concept for a nicer solution.

In summary:  place mail.jar in Tomcat's /lib and NOT in your deployed
application.

-- 
Mark H. Wood
Lead Technology Analyst

University Library
Indiana University - Purdue University Indianapolis
755 W. Michigan Street
Indianapolis, IN 46202
317-274-0749
www.ulib.iupui.edu


signature.asc
Description: Digital signature


Tomcat 7.0.41 shows v6 manager GUI

2015-08-06 Thread Dan OConnor
I have tomcat 7.0.41 running on multiple machines all running with jre1.7.0_80. 
I know they are identical installations because they are all extracted from the 
same tarball.

On machines running Centos5, 5.4, 6.2 and 7, the manager GUI is the v7 look and 
feel.

On one machine running Centos6.6, the manager GUI is the v6 look and feel.

It doesn’t affect the functionality, but it is a difference that I can’t 
explain and that has me concerned.

I’ve looked through the open bugs and the changeling on the Wiki and cannot 
find anything close.

Has anyone else seen this? And, if so, what is the cause and is there a fix?

Thanks,
Dan


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



RequestDispatcher.forward between 2 virtual hosts defined in the same Tomcat container

2015-08-06 Thread Neha Munjal
Hi,

I would like to know if we can do servlet forwarding between 2 different
webapps deployed on 2 different virtual hosts configured in the same Tomcat
container.

So, I have configured 2 different virtual hosts in my Tomcat server.xml as
follows:

 

and put the root.xml file for default webapps to:

$CATALINA_HOME/conf/Catalina/ directory.

servlet2 is deployed as a different war in the 2nd virtual host.

I notice that when I try to fetch the context of servlet2 from
Servlet1 to do a forward from Servlet1 to Servlet2, the loaded context
is null and so there is forwars. Please note that crossContext
attribute is set to true in the context.xml for the 1st war.

Also, noticed that in case I do not define any explicit virtual hosts
and deploy both the wars in the default host i.e localhost, the
forwarding works fine.

Can somebody please let me know if servlet.forward works with virtual hosts.

Any suggestions would be highly appreciated.


Thanks

Neha


Re: Configuring E-Mail Session via JNDI

2015-08-06 Thread Felix Schumacher


Am 6. August 2015 06:12:14 MESZ, schrieb Tim Gustafson :
>I'm trying to configure an e-mail session in my Tomcat configuration
>like this:
>
>  auth="Container"
>  type="javax.mail.Session"
>  mail.transport.protocol="smtp"
>  mail.smtp.host="192.168.0.2"
>  mail.debug="true" />
>
>From my web application, I'm instantiating a Session object like this:
>
>Context initialContext = new InitialContext();
>session = (Session)
>initialContext.lookup("java:comp/env/mail/session");
>
>When I go to send e-mail from my web applet, I'm getting:
>
>java.lang.ClassNotFoundException: javax.mail.Authenticator
>
>I find that error a little odd, as I'm not doing SMTP AUTH anywhere,
>but I'll let that go for now.  Based on documentation I found while
>Googling that error message, I copied the mail.jar file from my
>Netbeans library into Tomcat's lib folder, and now I get:
>
>java.lang.ClassCastException: javax.mail.Session cannot be cast to
>javax.mail.Session

This error indicates that you have mail.jar in two different classloaders. 
Probably common loader and webapp loader. The one in tomcats lib folder  - 
common loader - is the right one. 

>
>Removing Java Mail from my Netbeans project does not appear to be an
>option as it will refuse to compile the project without it.

I don't use netbeans, so I can't help you there. You could look for tutorials 
about database drivers, they will probably be handled the same way. 

Sorry,
Felix

>
>I'm at a loss.  What am I doing wrong?  Thanks in advance for any help
>with this - it has been driving me nuts for a while now!


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org