Tomcat Security and Struts

2009-04-22 Thread Mighty Tornado
Tomcat 6Struts 1.3
OS: MacOS X - Leopard

Hi,

I am trying to make sure my app requires a login. So I configured the
following in my deployment descriptor:

 security-constraint

   web-resource-collection

   web-resource-nameadmin/web-resource-name

   url-pattern*.do/url-pattern

   http-methodPOST/http-method

   /web-resource-collection



   auth-constraint

   role-namemember/role-name

   /auth-constraint



   user-data-constraint

   transport-guaranteeCONFIDENTIAL/transport-guarantee

   /user-data-constraint

  /security-constraint



  login-config

   auth-methodFORM/auth-method

   form-login-config

   form-login-page/WEB-INF/JSP/login.jsp/form-login-page

   form-error-page/WEB-INF/JSP/loginError.jsp/form-error-page

   /form-login-config

  /login-config


However, when I follow the links in my app the login page doesn't come in.


Any ideas as to what I am doing wrong?


Thanks.


Re: Tomcat Security and Struts

2009-04-22 Thread Mighty Tornado
You are right:
I just fixed this mistake - added

security-role

  role-namemember/role-name

  /security-role


into my web.xml


However, when I try to access my URL the browser gives me the following
message:


Data Transfer Interrupted

On Wed, Apr 22, 2009 at 10:26 AM, Caldarale, Charles R 
chuck.caldar...@unisys.com wrote:

  From: Mighty Tornado [mailto:mighty.torn...@gmail.com]
  Subject: Tomcat Security and Struts
 
  I am trying to make sure my app requires a login. So I configured the
  following in my deployment descriptor:
 
   security-constraint
 web-resource-collection
 web-resource-nameadmin/web-resource-name
 url-pattern*.do/url-pattern
 http-methodPOST/http-method
 /web-resource-collection
 auth-constraint
 role-namemember/role-name
 /auth-constraint
 user-data-constraint
 transport-guaranteeCONFIDENTIAL/transport-guarantee
 /user-data-constraint
/security-constraint
login-config
 auth-methodFORM/auth-method
 form-login-config
 form-login-page/WEB-INF/JSP/login.jsp/form-login-page
 form-error-page/WEB-INF/JSP/loginError.jsp/form-error-page
 /form-login-config
/login-config

 Where is your security-role section?

  - Chuck


 THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
 MATERIAL and is thus for use only by the intended recipient. If you received
 this in error, please contact the sender and delete the e-mail and its
 attachments from all computers.


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




Re: Tomcat Security and Struts

2009-04-22 Thread Mighty Tornado
I think the following might be a problem. When I access the application I
get this error in the browser:Firefox can't establish a connection to the
server at localhost:8443

But Tomcat is supposed to listen on port 8080 - and it has been for my app,
until I put in the security feature.

any way around this?

On Wed, Apr 22, 2009 at 1:05 PM, Caldarale, Charles R 
chuck.caldar...@unisys.com wrote:

  From: André Warnier [mailto:a...@ice-sa.com]
  Subject: Re: Tomcat Security and Struts
 
  Maybe this : if the login page itself contains a link to a gif located
  in the same area, trying to load that gif will also hit the
  authentication bit, and trigger another login page, before the first
  even finishes displaying ?

 Of course; I was thinking basic authentication, not form.

  - Chuck


 THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
 MATERIAL and is thus for use only by the intended recipient. If you received
 this in error, please contact the sender and delete the e-mail and its
 attachments from all computers.


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




Re: Tomcat Security and Struts

2009-04-22 Thread Mighty Tornado
How can I make the request to port 8443 actually succeed?

On Wed, Apr 22, 2009 at 2:40 PM, Hassan Schroeder 
hassan.schroe...@gmail.com wrote:

 On Wed, Apr 22, 2009 at 11:16 AM, Mighty Tornado
 mighty.torn...@gmail.com wrote:
  I think the following might be a problem. When I access the application I
  get this error in the browser:Firefox can't establish a connection to the
  server at localhost:8443
 
  But Tomcat is supposed to listen on port 8080 - and it has been for my
 app,
  until I put in the security feature.
 
  any way around this?

 Er, way around? You're *telling* it to use an SSL connection:

  user-data-constraint
  transport-guaranteeCONFIDENTIAL/transport-guarantee
  /user-data-constraint

 If you don't want it to, don't do that. Pretty simple, really.  :-)

 --
 Hassan Schroeder  hassan.schroe...@gmail.com

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




javax.naming.NamingException: Cannot create resource instance

2009-04-06 Thread Mighty Tornado
JVM: 1.5.0_16Tomcat: 6.0.16 2
OS: Mac OS X Leopard

Hi,

I defined the following context.xml under META-INF:

?xml version=1.0 encoding=UTF-8?

Context path=/Household docBase=Household debug=5 reloadable=true
crossContext=true

Resource

auth=Container

description=DB Connection

name=jdbc/vhousehold

type=javax.sql.DataSource

password=vhousehold

driverClassName=com.mysql.jdbc.Driver

maxIdle=2

maxWait=5000

validationQuery=/* PING */ SELECT 1;

username=vhousehold

url=jdbc:mysql://localhost:3306/vhousehold

maxActive=4/

/Context


In web.xml I have the following:


  resource-ref

descriptionConnection Pool/description

res-ref-namejdbc/vhousehold/res-ref-name

res-typejavax.sql.Datasource/res-type

res-authContainer/res-auth

  /resource-ref


I try to get this data source in my application using the following code:


DataSource ds = (DataSource)initContext.lookup(
java:/comp/env/jdbc/vhousehold);


and it fails. This is the exception I get:

javax.naming.NamingException: Cannot create resource instance

at
org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:143)

at
javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)

at org.apache.naming.NamingContext.lookup(NamingContext.java:793)

at org.apache.naming.NamingContext.lookup(NamingContext.java:140)

at org.apache.naming.NamingContext.lookup(NamingContext.java:781)

at org.apache.naming.NamingContext.lookup(NamingContext.java:140)

at org.apache.naming.NamingContext.lookup(NamingContext.java:781)

at org.apache.naming.NamingContext.lookup(NamingContext.java:153)

at
org.apache.naming.SelectorContext.lookup(SelectorContext.java:137)

at javax.naming.InitialContext.lookup(InitialContext.java:351)

at
com.vhousehold.dao.RandomPhraseDAO.getPhrases(RandomPhraseDAO.java:60)

at
com.vhousehold.model.RandomPhraseModel.getRandomPhrase(RandomPhraseModel.java:19)

at com.vhousehold.servlet.VHController.doPost(VHController.java:52)

at com.vhousehold.servlet.VHController.doGet(VHController.java:35)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)

at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)

at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)

at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)

at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)

at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)

at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)

at java.lang.Thread.run(Thread.java:613)


Any suggestions as to what I am doing wrong?


Thanks.


Re: javax.naming.NamingException: Cannot create resource instance

2009-04-06 Thread Mighty Tornado
I added the same entry to context.xml under $CATALINA/conf and it did work.
Could there be something else wrong?

On Mon, Apr 6, 2009 at 12:30 PM, Pid p...@pidster.com wrote:

 Mighty Tornado wrote:
  JVM: 1.5.0_16Tomcat: 6.0.16 2
  OS: Mac OS X Leopard
 
  Hi,
 
  I defined the following context.xml under META-INF:
 
  ?xml version=1.0 encoding=UTF-8?
 
  Context path=/Household docBase=Household debug=5
 reloadable=true
  crossContext=true
 
  Resource
 
  auth=Container
 
  description=DB Connection
 
  name=jdbc/vhousehold
 
  type=javax.sql.DataSource
 
  password=vhousehold
 
  driverClassName=com.mysql.jdbc.Driver
 
  maxIdle=2
 
  maxWait=5000
 
  validationQuery=/* PING */ SELECT 1;
 
  username=vhousehold
 
  url=jdbc:mysql://localhost:3306/vhousehold
 
  maxActive=4/
 
  /Context
 
 
  In web.xml I have the following:
 
 
resource-ref
 
  descriptionConnection Pool/description
 
  res-ref-namejdbc/vhousehold/res-ref-name
 
  res-typejavax.sql.Datasource/res-type
 
  res-authContainer/res-auth
 
/resource-ref
 
 
  I try to get this data source in my application using the following code:
 
 
  DataSource ds = (DataSource)initContext.lookup(
  java:/comp/env/jdbc/vhousehold);
 
 
  and it fails. This is the exception I get:
 
  javax.naming.NamingException: Cannot create resource instance
 
  at
 
 org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:143)
 
  at
  javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
 
  at org.apache.naming.NamingContext.lookup(NamingContext.java:793)
 
  at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
 
  at org.apache.naming.NamingContext.lookup(NamingContext.java:781)
 
  at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
 
  at org.apache.naming.NamingContext.lookup(NamingContext.java:781)
 
  at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
 
  at
  org.apache.naming.SelectorContext.lookup(SelectorContext.java:137)
 
  at javax.naming.InitialContext.lookup(InitialContext.java:351)
 
  at
  com.vhousehold.dao.RandomPhraseDAO.getPhrases(RandomPhraseDAO.java:60)
 
  at
 
 com.vhousehold.model.RandomPhraseModel.getRandomPhrase(RandomPhraseModel.java:19)
 
  at
 com.vhousehold.servlet.VHController.doPost(VHController.java:52)
 
  at
 com.vhousehold.servlet.VHController.doGet(VHController.java:35)
 
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
 
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
 
  at
 
 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
 
  at
 
 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 
  at
 
 org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
 
  at
 
 org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
 
  at
 
 org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
 
  at
 
 org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
 
  at
 
 org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
 
  at
 
 org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
 
  at
 
 org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
 
  at
 
 org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
 
  at
  org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
 
  at java.lang.Thread.run(Thread.java:613)
 
 
  Any suggestions as to what I am doing wrong?

 You've added the path and docBase attributes to your
 META-INF/context.xml.  Don't do that.

 Are the credentials you're using for the database correct?

 p


  Thanks.
 


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




a href to another JSP

2009-04-05 Thread Mighty Tornado
Hi,
I have an index.jsp page with 3 links to other JSP's.
These links don't seem to work. I get the 404 error.

Do I have to register the JSP's somewhere similarly to how I create servlet
mappings?

in the href attribute I tried passing along both relative path - sine all my
JSP's are in one directory called JSP under the app root so I wrote
something like ./mission.jsp
And I also tried giving the absolute path - /JSP/mission.jsp - no luck.

Thanks.


Re: Restarting Tomcat from Ant

2009-04-03 Thread Mighty Tornado
This worked:

target name=start-tomcat

exec os=Mac OS X executable=/bin/sh

arg line=${TOMCAT}/bin/startup.sh /

/exec

/target

On Fri, Apr 3, 2009 at 7:19 AM, Gregor Schneider rc4...@googlemail.comwrote:

 How about

 exec dir=${TOMCAT}/bin/ executable=./shutdown.sh /

 Rgds

 Gregor
 --
 just because your paranoid, doesn't mean they're not after you...
 gpgp-fp: 79A84FA526807026795E4209D3B3FE028B3170B2
 gpgp-key available
 @ http://pgpkeys.pca.dfn.de:11371
 @ http://pgp.mit.edu:11371/
 skype:rc46fi

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




Restarting Tomcat from Ant

2009-04-02 Thread Mighty Tornado
Hi,
I currently copy the Application files to CATALINA_HOME/webapps from Ant,
and then run shutdown and startup. Is there a way to also restart the server
from Ant?

Thanks,


Re: Restarting Tomcat from Ant

2009-04-02 Thread Mighty Tornado
I tried the following Chuck,

target name=stop-tomcat

 exec dir=${TOMCAT}/bin/ executable=shutdown.sh /

/target
 but it tells me that the script cannot be found



On Thu, Apr 2, 2009 at 2:21 PM, Caldarale, Charles R 
chuck.caldar...@unisys.com wrote:

  From: Mighty Tornado [mailto:mighty.torn...@gmail.com]
  Subject: Restarting Tomcat from Ant
 
  Is there a way to also restart the server
  from Ant?

 Why don't you just use the startup and shutdown scripts that come with
 Tomcat?  If you want to call them from within an ant script, use the exec
 task.

  - Chuck


 THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
 MATERIAL and is thus for use only by the intended recipient. If you received
 this in error, please contact the sender and delete the e-mail and its
 attachments from all computers.


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




Re: DataSource from Context files - doesn't work

2009-04-01 Thread Mighty Tornado
Additional info:

I get the following exception in the log when I start the server up:

== localhost.2009-03-03.log ==
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:613)



I use the following code to get the connection:

InitialContext ic = new InitialContext();

if(ic == null)
{
System.out.println(context not found);
}

DataSource ds =
(DataSource)ic.lookup(java:comp/env/jdbc/vhousehold);

if(ds == null)
{
System.out.println(DataSource not found);
}

conn = ds.getConnection();

stat = conn.createStatement();

rs = stat.executeQuery(SELECT * FROM family_member );

On Tue, Mar 31, 2009 at 9:36 PM, Mighty Tornado mighty.torn...@gmail.comwrote:

 Hi I placed the following in context.xml in META-INF.
 But the result set is null, what's wrong with my set up?Can anybody please
 advise?

 ?xml version=1.0 encoding=UTF-8?
 Context
 Resource
 auth=Container
 description=DB Connection
 name=jdbc/vhousehold
 type=javax.sql.DataSource
 password=vhousehold
 driverClassName=com.mysql.jdbc.Driver
 maxIdle=2
 maxWait=5000
 validationQuery=select * from family_member;
 username=vhousehold
 url=jdbc:mysql://localhost:3306/vhousehold
 maxActive=4/
 /Context

 Thanks,

 Ramy.



Re: DataSource from Context files - doesn't work

2009-04-01 Thread Mighty Tornado
Where can I obtain it?
The exception that I posted is the only exception that showed up following
tail -f *

On Wed, Apr 1, 2009 at 6:04 AM, Gregor rc4...@googlemail.com wrote:

 your log is useless.
 please post the complete stacktrace incl. the type of the exception

 rds

 gregor

 Am 01.04.2009 um 11:57 schrieb Mighty Tornado mighty.torn...@gmail.com:


  Additional info:

 I get the following exception in the log when I start the server up:

 == localhost.2009-03-03.log ==
   at

 org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
   at

 org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
   at

 org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
   at

 org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
   at

 org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   at

 org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
   at
 org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
   at

 org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
   at
 org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
   at java.lang.Thread.run(Thread.java:613)



 I use the following code to get the connection:

 InitialContext ic = new InitialContext();

   if(ic == null)
   {
   System.out.println(context not found);
   }

   DataSource ds =
 (DataSource)ic.lookup(java:comp/env/jdbc/vhousehold);

   if(ds == null)
   {
   System.out.println(DataSource not found);
   }

   conn = ds.getConnection();

   stat = conn.createStatement();

   rs = stat.executeQuery(SELECT * FROM family_member );

 On Tue, Mar 31, 2009 at 9:36 PM, Mighty Tornado mighty.torn...@gmail.com
 wrote:

  Hi I placed the following in context.xml in META-INF.
 But the result set is null, what's wrong with my set up?Can anybody
 please
 advise?

 ?xml version=1.0 encoding=UTF-8?
 Context
 Resource
   auth=Container
   description=DB Connection
   name=jdbc/vhousehold
   type=javax.sql.DataSource
   password=vhousehold
   driverClassName=com.mysql.jdbc.Driver
   maxIdle=2
   maxWait=5000
   validationQuery=select * from family_member;
   username=vhousehold
   url=jdbc:mysql://localhost:3306/vhousehold
   maxActive=4/
 /Context

 Thanks,

 Ramy.


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




Re: DataSource from Context files - doesn't work

2009-04-01 Thread Mighty Tornado
No Exception there. Even after I restart the server and call the Servlet
that is supposed to retrieve the DB data.

On Wed, Apr 1, 2009 at 6:24 AM, Yassine elas...@users.sourceforge.netwrote:

 catalina.out


 On Wed, Apr 1, 2009 at 12:17 PM, Mighty Tornado
 mighty.torn...@gmail.com wrote:
  I have the following files in the logs directory:
 
  admin.2009-04-01.log
  catalina.out
  localhost.2009-04-01.log
  catalina.2009-04-01.log
  host-manager.2009-04-01.log
  manager.2009-04-01.log
 
  Which one of them should I VI or LESS to find the complete stack trace
 for
  the exception?
 
  Also, is there something obviously wrong with my context definition or
  reference? I followed the Tomcat online tutorial to define them.
  Also, previously a regular JDBC code with the same parameters was able to
  access the DB and retrieve the data correctly.
 
  Thank you all.
 
  On Wed, Apr 1, 2009 at 6:09 AM, Yassine elas...@users.sourceforge.net
 wrote:
 
  don't tail -f
  use less and copy the part containing the exception from its beginning
  to the end.
 
 
 
  On Wed, Apr 1, 2009 at 12:07 PM, Mighty Tornado
  mighty.torn...@gmail.com wrote:
   Where can I obtain it?
   The exception that I posted is the only exception that showed up
  following
   tail -f *
  
   On Wed, Apr 1, 2009 at 6:04 AM, Gregor rc4...@googlemail.com wrote:
  
   your log is useless.
   please post the complete stacktrace incl. the type of the exception
  
   rds
  
   gregor
  
   Am 01.04.2009 um 11:57 schrieb Mighty Tornado 
 mighty.torn...@gmail.com
  :
  
  
Additional info:
  
   I get the following exception in the log when I start the server up:
  
   == localhost.2009-03-03.log ==
 at
  
  
 
 org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
 at
  
  
 
 org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
 at
  
  
 
 org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
 at
  
  
 
 org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
 at
  
  
 
 org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
 at
  
  
 
 org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
 at
  
 
 org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
 at
  
  
 
 org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
 at
  
 org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
 at java.lang.Thread.run(Thread.java:613)
  
  
  
   I use the following code to get the connection:
  
   InitialContext ic = new InitialContext();
  
 if(ic == null)
 {
 System.out.println(context not found);
 }
  
 DataSource ds =
   (DataSource)ic.lookup(java:comp/env/jdbc/vhousehold);
  
 if(ds == null)
 {
 System.out.println(DataSource not found);
 }
  
 conn = ds.getConnection();
  
 stat = conn.createStatement();
  
 rs = stat.executeQuery(SELECT * FROM family_member );
  
   On Tue, Mar 31, 2009 at 9:36 PM, Mighty Tornado 
  mighty.torn...@gmail.com
   wrote:
  
Hi I placed the following in context.xml in META-INF.
   But the result set is null, what's wrong with my set up?Can anybody
   please
   advise?
  
   ?xml version=1.0 encoding=UTF-8?
   Context
   Resource
 auth=Container
 description=DB Connection
 name=jdbc/vhousehold
 type=javax.sql.DataSource
 password=vhousehold
 driverClassName=com.mysql.jdbc.Driver
 maxIdle=2
 maxWait=5000
 validationQuery=select * from family_member;
 username=vhousehold
 url=jdbc:mysql://localhost:3306/vhousehold
 maxActive=4/
   /Context
  
   Thanks,
  
   Ramy.
  
  
   -
   To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
   For additional commands, e-mail: users-h...@tomcat.apache.org
  
  
  
 
 
 
  --
  --
  Yassine Elassad
  Bonn, Germany.
  Fon : +49 228 97629355
  Mobile : +49 157 74519666
 
  PEACE :
  ( P ) Positive ( E ) Energy ( A ) Always ( C ) Correct ( E ) Errors.
 
  -
  To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
  For additional commands, e-mail: users-h...@tomcat.apache.org
 
 
 



 --
 --
 Yassine Elassad
 Bonn, Germany.
 Fon : +49 228 97629355
 Mobile : +49 157 74519666

 PEACE :
 ( P ) Positive ( E ) Energy ( A ) Always ( C ) Correct ( E ) Errors.

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




Re: DataSource from Context files - doesn't work

2009-04-01 Thread Mighty Tornado
guess it was an old exception. no new ones in the logs. But I am doing
something wrong with the way I define the data source and hand it to Tomcat
for handling. Any suggestions as to how I can find out where the mistake is?

On Wed, Apr 1, 2009 at 6:36 AM, Gregor Schneider rc4...@googlemail.comwrote:

 On Wed, Apr 1, 2009 at 12:07 PM, Mighty Tornado
 mighty.torn...@gmail.com wrote:
  Where can I obtain it?

 You wrote before:

  I get the following exception in the log when I start the server up:
 
  == localhost.2009-03-03.log ==
 at
 
 org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
 at

 so in that log there should be the complete stacktrace of the
 exception including it's type.

 Unfortunately my apps are working like charm, so I ain't got an
 example to cpy and post here... *cough*

 Rgds

 Gregor

 @ Yassine: Availabe for a chat via Google? I got your shirts, remeber... ;)
 --
 just because your paranoid, doesn't mean they're not after you...
 gpgp-fp: 79A84FA526807026795E4209D3B3FE028B3170B2
 gpgp-key available
 @ http://pgpkeys.pca.dfn.de:11371
 @ http://pgp.mit.edu:11371/

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




Re: DataSource from Context files - doesn't work

2009-04-01 Thread Mighty Tornado
I have the following files in the logs directory:

admin.2009-04-01.log
catalina.out
localhost.2009-04-01.log
catalina.2009-04-01.log
host-manager.2009-04-01.log
manager.2009-04-01.log

Which one of them should I VI or LESS to find the complete stack trace for
the exception?

Also, is there something obviously wrong with my context definition or
reference? I followed the Tomcat online tutorial to define them.
Also, previously a regular JDBC code with the same parameters was able to
access the DB and retrieve the data correctly.

Thank you all.

On Wed, Apr 1, 2009 at 6:09 AM, Yassine elas...@users.sourceforge.netwrote:

 don't tail -f
 use less and copy the part containing the exception from its beginning
 to the end.



 On Wed, Apr 1, 2009 at 12:07 PM, Mighty Tornado
 mighty.torn...@gmail.com wrote:
  Where can I obtain it?
  The exception that I posted is the only exception that showed up
 following
  tail -f *
 
  On Wed, Apr 1, 2009 at 6:04 AM, Gregor rc4...@googlemail.com wrote:
 
  your log is useless.
  please post the complete stacktrace incl. the type of the exception
 
  rds
 
  gregor
 
  Am 01.04.2009 um 11:57 schrieb Mighty Tornado mighty.torn...@gmail.com
 :
 
 
   Additional info:
 
  I get the following exception in the log when I start the server up:
 
  == localhost.2009-03-03.log ==
at
 
 
 org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at
 
 
 org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at
 
 
 org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at
 
 
 org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at
 
 
 org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
 
 
 org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at
 
 org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at
 
 
 org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at
  org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:613)
 
 
 
  I use the following code to get the connection:
 
  InitialContext ic = new InitialContext();
 
if(ic == null)
{
System.out.println(context not found);
}
 
DataSource ds =
  (DataSource)ic.lookup(java:comp/env/jdbc/vhousehold);
 
if(ds == null)
{
System.out.println(DataSource not found);
}
 
conn = ds.getConnection();
 
stat = conn.createStatement();
 
rs = stat.executeQuery(SELECT * FROM family_member );
 
  On Tue, Mar 31, 2009 at 9:36 PM, Mighty Tornado 
 mighty.torn...@gmail.com
  wrote:
 
   Hi I placed the following in context.xml in META-INF.
  But the result set is null, what's wrong with my set up?Can anybody
  please
  advise?
 
  ?xml version=1.0 encoding=UTF-8?
  Context
  Resource
auth=Container
description=DB Connection
name=jdbc/vhousehold
type=javax.sql.DataSource
password=vhousehold
driverClassName=com.mysql.jdbc.Driver
maxIdle=2
maxWait=5000
validationQuery=select * from family_member;
username=vhousehold
url=jdbc:mysql://localhost:3306/vhousehold
maxActive=4/
  /Context
 
  Thanks,
 
  Ramy.
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
  For additional commands, e-mail: users-h...@tomcat.apache.org
 
 
 



 --
 --
 Yassine Elassad
 Bonn, Germany.
 Fon : +49 228 97629355
 Mobile : +49 157 74519666

 PEACE :
 ( P ) Positive ( E ) Energy ( A ) Always ( C ) Correct ( E ) Errors.

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




Re: DataSource from Context files - doesn't work

2009-04-01 Thread Mighty Tornado
Trying to put in some logging statements.
Can anyone suggest where System.out prints to?

I don't see it in any of the logs.

On Wed, Apr 1, 2009 at 8:47 AM, Christopher Schultz 
ch...@christopherschultz.net wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Ramy,

 (Hey! I found my original message. Here's a bit more detail on the
 validationQuery)

 On 3/31/2009 9:36 PM, Mighty Tornado wrote:
  Hi I placed the following in context.xml in META-INF.
  But the result set is null, what's wrong with my set up? Can anybody
 please
  advise?

 As others have suggested, your exception does not include the important
 part: what actually happened. We only got a piece of what happened. You
 say that it's an old exception so maybe it's unrelated.

 Let's take a look at your configuration:

  validationQuery=select * from family_member;

 Yikes! A complete table-scan for each validation query? I would
 recommend something like /* PING */ SELECT 1 where the database
 doesn't have to do any work to fulfill the query. Remember, the
 validation query just checks to see if communication with the database
 is still working. It's not intended to return any actual data.

 Other than that, your configuration looks good. It appears to be
 working, so you're probably fine.

 (See my other message with comments on your code)

 - -chris
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.9 (MingW32)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

 iEYEARECAAYFAknTYkYACgkQ9CaO5/Lv0PArVwCeNrLv9Z57uFqpM6i9c4OU4AmD
 sJYAoK6l6VD93NAjvDEhxkBPWDtJDk0T
 =mdTH
 -END PGP SIGNATURE-

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




DataSource from Context files - doesn't work

2009-03-31 Thread Mighty Tornado
Hi I placed the following in context.xml in META-INF.
But the result set is null, what's wrong with my set up?Can anybody please
advise?

?xml version=1.0 encoding=UTF-8?
Context
Resource
auth=Container
description=DB Connection
name=jdbc/vhousehold
type=javax.sql.DataSource
password=vhousehold
driverClassName=com.mysql.jdbc.Driver
maxIdle=2
maxWait=5000
validationQuery=select * from family_member;
username=vhousehold
url=jdbc:mysql://localhost:3306/vhousehold
maxActive=4/
/Context

Thanks,

Ramy.


Tomcat Data sources and connection pools

2009-03-22 Thread Mighty Tornado
Hi,
A couple of questions regarding Tomcat 6 Data Sources.

1. I used WebLogic previously and there you had to configure connection
pools and then create data sources and link them to connection pools.

Is the process the same in Tomcat?

2. From what I understand I need to create the data source definition in the
Context element of an xml file. Which xml file is it?

Thanks.


Re: Tomcat Data sources and connection pools

2009-03-22 Thread Mighty Tornado
So do I understand this correctly?
Tomcat will read the context.xml file in the META-INF directory and get the
data source from there?

I also added a resource ref in my web.xml because that's what various
tutorials suggest. After that is done, how do I obtain a connection?

and one more question, is it correct to make a DAO a singleton?

Thanks,


On Sun, Mar 22, 2009 at 7:57 PM, Caldarale, Charles R 
chuck.caldar...@unisys.com wrote:

  From: Mighty Tornado [mailto:mighty.torn...@gmail.com]
  Subject: Tomcat Data sources and connection pools
 
  1. I used WebLogic previously and there you had to configure
  connection pools and then create data sources and link them
  to connection pools.

 You can manage the pool yourself, but it's certainly easier if you let
 Tomcat do it.  The doc is here:
 http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html

  2. From what I understand I need to create the data source
  definition in the Context element of an xml file. Which xml
  file is it?

 You can define the data source in a Context file if you want it available
 only to one webapp, or as a GlobalResource if you want it available to all
 webapps.  A Context element describes the Tomcat-specific configuration
 for a webapp; it is normally located within the webapp at
 META-INF/context.xml, or you can also put it at
 conf/Catalina/[host]/[appName].xml if you want to keep it outside of the
 webapp's .war file or directory.  (For compatibility with older Tomcat
 versions, you can also put it in conf/server.xml, but that's strongly
 discouraged these days.)  Doc is here:
 http://tomcat.apache.org/tomcat-6.0-doc/config/context.html

 Do not use the path of docBase attributes when using one of the standard
 location for your Context element and webapp.

  - Chuck


 THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
 MATERIAL and is thus for use only by the intended recipient. If you received
 this in error, please contact the sender and delete the e-mail and its
 attachments from all computers.

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




Testing DB before creating Connection Pools

2009-03-21 Thread Mighty Tornado
Hi,
I am encountering a problem when trying to test JDBC connection to my
database before I hand it over to the container.

I get the No suitable driver exception wen trying to run the test main class
in Eclipse, even though I added the mysql connector jar to the build path in
the project.

Thanks,


Newline doesn't work

2009-03-18 Thread Mighty Tornado
Silly question.
I wrote a servlet that gets init params from the web.xml and stuffs them
into the request which is the displayed by JSP.

But when I try to make it a string with newline characters it still prints
everything in one line - like newline characters turn into regular space
characters.

This is the code:

String newline = System.getProperty(line.separator);

String rName = getServletConfig().getInitParameter(rName);

String kName = getServletConfig().getInitParameter(kName);

result += Family Members + newline;

result += rName + newline;

result += kName + newline;


I tried \n, and '\n' as well.


Thanks.


Re: Newline doesn't work

2009-03-18 Thread Mighty Tornado
Thank you all. The answers were very valuable and I got the thing to work.

On Wed, Mar 18, 2009 at 1:41 PM, Ilya Kazakevich
kazakev...@devexperts.comwrote:

 Mighty,

 Here is good and small HTML tutorial, which I advice you to read:
 http://www.w3schools.com/html/default.asp

 -Original Message-
 From: Caldarale, Charles R [mailto:chuck.caldar...@unisys.com]
 Sent: Wednesday, March 18, 2009 7:41 PM
 To: Tomcat Users List
 Subject: RE: Newline doesn't work

  From: Mighty Tornado [mailto:mighty.torn...@gmail.com]
  Subject: Newline doesn't work
 
  But when I try to make it a string with newline characters it still
  prints everything in one line - like newline characters turn into
  regular space characters.

 That's the way HTML works.  You need to separate lines by p or br;
 experiment with both to see which is more to your liking.

  - Chuck


 THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
 MATERIAL and is thus for use only by the intended recipient. If you
 received
 this in error, please contact the sender and delete the e-mail and its
 attachments from all computers.

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


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




Console Output

2009-03-17 Thread Mighty Tornado
Hi,
I am running Tomcat on Mac OS X.
How can I see output on the console of the command line?

For example, if I would like to put System.out statements in the code and
would like to see them on the console.

Thanks,


Can't use J2EE libraries in Eclipse

2009-03-01 Thread Mighty Tornado
Hi,
I am working on Mac OS X.
I have the latest version of Tomcat, and Eclipse Europa.

Mac OS X did not come with J2EE.

I downloaded J2EE with GlassFish from Sun. Set it up by running the setup
shell script. Unfortunately the directory structure is very different now, I
am guessing the J2EE is inside GlassFish somewhere. I need to set it up in
Eclipse to be able to compile Servlets and the like. and I cannot find the
right Jars.

1. Could somebody point me to where the jars are now within GlassFish so I
can add them to Eclipse?
2. Is there a way to install J2EE without this GlassFish stuff, just
alongside the J2SE?

Thank you.


Re: Can't use J2EE libraries in Eclipse

2009-03-01 Thread Mighty Tornado
Thanks,
I resolved this issue by having Eclipse use the Tomcat SDK.

Unfortunately I now have a different problem with my initial app.

I have an HTML page - index.html which asks the user to select one of two
values from a dropdown and then click a Submit button.

It's a regular HTML form using POST request. I have a context in my
server.xml, I have a servlet mapped in web.xml. I have the servlet class
compiled and in the deployment dir under webapps in tomcat directory.
However, when I hit the submit button on the HTML, nothing happens.

not sure where I went wrong.

On Sun, Mar 1, 2009 at 8:56 AM, supareno reno.rkc...@free.fr wrote:

 Mighty,

 you need to add to your classpath project the servlet.api to compile
 servlet
 tomcat6.0.x/lib/servlet-api.api
 (right click on the projet - build path/configure build path choose
 librairy/ add external jar)

 in glassfish v2, it is in glassfish/lib/javaee.jar

 now with javaee5, i'm not sure that is possible to download the ee sdk
 separeted from glassfish
 it was possible with j2ee 1.4

 hope this help

 supareno

  Hi,
 I am working on Mac OS X.
 I have the latest version of Tomcat, and Eclipse Europa.

 Mac OS X did not come with J2EE.

 I downloaded J2EE with GlassFish from Sun. Set it up by running the setup
 shell script. Unfortunately the directory structure is very different now,
 I
 am guessing the J2EE is inside GlassFish somewhere. I need to set it up in
 Eclipse to be able to compile Servlets and the like. and I cannot find the
 right Jars.

 1. Could somebody point me to where the jars are now within GlassFish so I
 can add them to Eclipse?
 2. Is there a way to install J2EE without this GlassFish stuff, just
 alongside the J2SE?

 Thank you.





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




Re: Can't use J2EE libraries in Eclipse

2009-03-01 Thread Mighty Tornado
Here is what I have:
HTML


form action=GetInfo.do method=post

p

Please Choose Info:

/p

 select name=InfoSelect

option value=MembersFamily Members/option

option value=TimeTime/option

/select

 /form

 input type=submit


web.xml
===

welcome-file-list

welcome-file/HTML/index.html/welcome-file

  /welcome-file-list



  servlet

  servlet-nameGetInfo/servlet-name

  servlet-classcom.Household.servlet.GetInfo/servlet-class

  /servlet



  servlet-mapping

  servlet-nameGetInfo/servlet-name

  url-pattern/GetInfo.do/url-pattern

  /servlet-mapping
On Sun, Mar 1, 2009 at 7:31 PM, Martin Gainty mgai...@hotmail.com wrote:


 you need to identify a program that submit will post to as in this example

 form method=POST action='chat' name=loginForm
 input type=hidden name=action value=login/
 Nickname: input type=text name=nickname/
 /form

 where the contents of web.xml map chat to submit its contents to
 ChatServlet
servlet-mapping
servlet-nameChatServlet/servlet-name
url-pattern/jsp/chat/chat/url-pattern
/servlet-mapping

 where ChatServlet maps to the ChatServlet class located in
 /WEB-INF/classes/chat/ChatServlet
servlet
servlet-nameChatServlet/servlet-name
servlet-classchat.ChatServlet/servlet-class
/servlet

 Martin
 __
 Disclaimer and confidentiality note
 Everything in this e-mail and any attachments relates to the official
 business of Sender. This transmission is of a confidential nature and Sender
 does not endorse distribution to any party other than intended recipient.
 Sender does not necessarily endorse content contained within this
 transmission.




  Date: Sun, 1 Mar 2009 19:02:03 -0500
  Subject: Re: Can't use J2EE libraries in Eclipse
  From: mighty.torn...@gmail.com
  To: users@tomcat.apache.org
 
  Thanks,
  I resolved this issue by having Eclipse use the Tomcat SDK.
 
  Unfortunately I now have a different problem with my initial app.
 
  I have an HTML page - index.html which asks the user to select one of two
  values from a dropdown and then click a Submit button.
 
  It's a regular HTML form using POST request. I have a context in my
  server.xml, I have a servlet mapped in web.xml. I have the servlet class
  compiled and in the deployment dir under webapps in tomcat directory.
  However, when I hit the submit button on the HTML, nothing happens.
 
  not sure where I went wrong.
 
  On Sun, Mar 1, 2009 at 8:56 AM, supareno reno.rkc...@free.fr wrote:
 
   Mighty,
  
   you need to add to your classpath project the servlet.api to compile
   servlet
   tomcat6.0.x/lib/servlet-api.api
   (right click on the projet - build path/configure build path choose
   librairy/ add external jar)
  
   in glassfish v2, it is in glassfish/lib/javaee.jar
  
   now with javaee5, i'm not sure that is possible to download the ee sdk
   separeted from glassfish
   it was possible with j2ee 1.4
  
   hope this help
  
   supareno
  
Hi,
   I am working on Mac OS X.
   I have the latest version of Tomcat, and Eclipse Europa.
  
   Mac OS X did not come with J2EE.
  
   I downloaded J2EE with GlassFish from Sun. Set it up by running the
 setup
   shell script. Unfortunately the directory structure is very different
 now,
   I
   am guessing the J2EE is inside GlassFish somewhere. I need to set it
 up in
   Eclipse to be able to compile Servlets and the like. and I cannot find
 the
   right Jars.
  
   1. Could somebody point me to where the jars are now within GlassFish
 so I
   can add them to Eclipse?
   2. Is there a way to install J2EE without this GlassFish stuff, just
   alongside the J2SE?
  
   Thank you.
  
  
  
  
  
   -
   To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
   For additional commands, e-mail: users-h...@tomcat.apache.org
  
  

 _
 Express your personality in color! Preview and select themes for Hotmail®.

 http://www.windowslive-hotmail.com/LearnMore/personalize.aspx?ocid=TXT_MSGTX_WL_HM_express_032009#colortheme



Fwd: J2EE on Mac

2009-02-22 Thread Mighty Tornado
Hi,

I installed Tomcat on my mac OS X and it's running. I also have Eclipse
Europa. Now I don't think I have J2EE installed - How do I do it?
I went to Sun's website and it gave me an archive with GlassFish which I
don't need.
Can somebody please tell me where I can download the latest J2EE for Mac?
What I need to do to compile servlets with it in Eclipse?

Thank you.


Re: sending smtp mail failure

2007-04-19 Thread Mighty Tornado

I have ZoneAlarm running, but normally Zone Alarm notifies me if a program
from within is trying to access the internet and let's me block it or let it
go. Is it possible that ZA is blocking not my request to connect to the smtp
server but the server's reply?

On 4/19/07, Christopher Schultz [EMAIL PROTECTED] wrote:


-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

MT,

Mighty Tornado wrote:
 It was churning for a long time and still didn't manage to send the
email.
 But it left me this exception:

[snip]

 Caused by: javax.mail.MessagingException: Could not connect to SMTP
host:
 smtp.gmail.com, port: 465, response: -1

- From the command-line on your server, can you telnet to
smtp.gmail.com:465? I'm wondering if you have a firewall that won't
allow you to make that connection.

 I heeded your advice and tried setting up Outlook Express for gmail
 server.
 This is the message that I got:
 The connection to the server has failed. Account: 'smtp.google.com',
 Server:
 'smtp.google.com', Protocol: SMTP, Port: 25, Secure(SSL): No, Socket
 Error:
 10060, Error Number: 0x800CCC0E

So, it looks like this isn't a problem specific to Java. I'm guessing
that you are being blocked somewhere. Microsoft Windows versions since
2000 (at least) have had software firewalls built into them that you can
easily configure. You may also have another firewall on your network
between you and google's SMTP server. If that's the case, you'll have to
change the configuration of the firewall(s) to allow communication.

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGJ2z19CaO5/Lv0PARAhw7AJ0eEUTkWPr0SJkAOysnoUHAWqb7FACeItA9
Z2wwl1/F8zG5/ahCnAdNIMY=
=1Ll0
-END PGP SIGNATURE-

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: sending smtp mail failure

2007-04-18 Thread Mighty Tornado

It was churning for a long time and still didn't manage to send the email.
But it left me this exception:

org.apache.commons.mail.EmailException: Sending the email to the following
serve
r failed : smtp.gmail.com:465
   at org.apache.commons.mail.Email.sendMimeMessage(Email.java:873)
   at org.apache.commons.mail.Email.send(Email.java:898)
   at TimeTravelMailer.sendMessage(TimeTravelMailer.java:29)
   at CreateAccountServlet.doPost(CreateAccountServlet.java:12)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
(Appl
icationFilterChain.java:269)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter
(ApplicationF
ilterChain.java:188)
   at org.apache.catalina.core.StandardWrapperValve.invoke
(StandardWrapperV
alve.java:210)
   at org.apache.catalina.core.StandardContextValve.invoke
(StandardContextV
alve.java:174)
   at org.apache.catalina.core.StandardHostValve.invoke(
StandardHostValve.j
ava:127)
   at org.apache.catalina.valves.ErrorReportValve.invoke(
ErrorReportValve.j
ava:117)
   at org.apache.catalina.core.StandardEngineValve.invoke
(StandardEngineVal
ve.java:108)
   at org.apache.catalina.connector.CoyoteAdapter.service(
CoyoteAdapter.jav
a:151)
   at org.apache.coyote.http11.Http11Processor.process(
Http11Processor.java
:870)
   at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.p
rocessConnection(Http11BaseProtocol.java:665)
   at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket
(PoolTcpEndpo
int.java:528)
   at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt
(LeaderFol
lowerWorkerThread.java:81)
   at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run
(ThreadP
ool.java:685)
   at java.lang.Thread.run(Thread.java:619)
Caused by: javax.mail.MessagingException: Could not connect to SMTP host:
smtp.g
mail.com, port: 465, response: -1
   at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java
:1270)
   at com.sun.mail.smtp.SMTPTransport.protocolConnect(
SMTPTransport.java:37
0)
   at javax.mail.Service.connect(Service.java:297)
   at javax.mail.Service.connect(Service.java:156)
   at javax.mail.Service.connect(Service.java:105)
   at javax.mail.Transport.send0(Transport.java:168)
   at javax.mail.Transport.send(Transport.java:98)
   at org.apache.commons.mail.Email.sendMimeMessage(Email.java:863)
   ... 19 more

On 4/17/07, Johnny Kewl [EMAIL PROTECTED] wrote:


Ha ha now you need to read up on threads and background processing
Very good description in the java tutorial from sun.

The browser will wait so u need to start the email as a background
process.
The browser will come back instantly, and depending on what u doing, you
will have to log the error messages, and possibly allow the user to see a
report via the browser.

enjoy


- Original Message -
From: Mighty Tornado [EMAIL PROTECTED]
To: Tomcat Users List users@tomcat.apache.org
Sent: Tuesday, April 17, 2007 2:35 AM
Subject: Re: sending smtp mail failure


 Thanks for the input,

 I was able to actually send email from Outlook Express after changing
port
 numbers and changing the host name to smtp.gmail.com instead of
 smtp.google.com.

 Now I encountered a different problem - when I attempt to send an email
 from
 a servlet running on my local XP machine it looks like it is doing
 something
 but the green bar in the browser doesn't progress, it is there but stays
 white. And no exceptions thrown. Just sitting there not proceeding to
the
 next page. Like it is trying to send an email but it is taking a year.

 On 4/16/07, Len Popp [EMAIL PROTECTED] wrote:

 That's a timeout error. I was able to send an email thru
 smtp.google.com using Outlook Express, with no timeout error, so it
 looks like there's something wrong with either your email settings or
 your connection to gmail.com (firewall or something).

 Google has a troubleshooter program to diagnose POP  SMTP setup
 problems:
 http://mail.google.com/support/bin/answer.py?answer=44769
 --
 Len

 On 4/16/07, Mighty Tornado [EMAIL PROTECTED] wrote:
  I heeded your advice and tried setting up Outlook Express for gmail
 server.
  This is the message that I got:
  The connection to the server has failed. Account: 'smtp.google.com',
 Server:
  'smtp.google.com', Protocol: SMTP, Port: 25, Secure(SSL): No, Socket
 Error:
  10060, Error Number: 0x800CCC0E
 
  On 4/15/07, Johnny Kewl [EMAIL PROTECTED] wrote:
  
  
   Here is a little framework that u can play with
  
   MimeMessage msg = new MimeMessage(session);
   msg.setFrom(new InternetAddress(from));
   msg.addRecipient(Message.RecipientType.TO, new
   InternetAddress(to));
   msg.setSubject(subject);
   msg.setSentDate(new Date());
  
// ADD TEXT

Re: sending smtp mail failure

2007-04-14 Thread Mighty Tornado

Thanks for responding,

there something wrong with my code?
This is my code:

import java.util.*;
import java.io.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;




public class TimeTravelMailer
{
   public void sendMessage()
   {
   String to = [EMAIL PROTECTED];
   String from = [EMAIL PROTECTED];
   String host = smtp.google.com;
   String message = This is a test;

   Properties props = new Properties();

   props.put(mail.smtp.host, host);

   Session session = Session.getInstance(props);

   try
   {
   Transport bus = session.getTransport(smtp);

   bus.connect(host, [EMAIL PROTECTED], [EMAIL PROTECTED]);

   Message msg = new MimeMessage(session);

   msg.setFrom(new InternetAddress(from));

   InternetAddress[] address = {new InternetAddress(to)};

   msg.setRecipients(Message.RecipientType.TO, address);

   msg.setRecipients(Message.RecipientType.CC,
InternetAddress.parse(to, true));

   msg.setRecipients(Message.RecipientType.BCC,
InternetAddress.parse(to, false));

   msg.setSubject(Test E-Mail through Java);

   msg.setSentDate(new Date());

   msg.setText(message);

   msg.saveChanges();

 bus.sendMessage(msg, address);

 bus.close();
   }
   catch(Exception ex)
   {
   ex.printStackTrace();
   }
   }
}

On 4/7/07, Johnny Kewl [EMAIL PROTECTED] wrote:



Easiest way is to setup a normal email program and see what the error
messages are.
If the machine doesnt have core mailing engines installed, it will
probably
tell you.
If you on windows, try Outlook express, detailed messages will probably
point you in right direction.

Code should look something like this


public boolean prepareConnection(String smtpHost){
this.smtpHost = smtpHost;
fSessionInited = true;

try{
java.util.Properties properties = System.getProperties();
properties.put(mail.smtp.host, smtpHost);
session = Session.getInstance(properties,null);
} catch(Exception e) {
   fSessionInited = false;
}

return fSessionInited;
}




- Original Message -
From: Mighty Tornado [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, April 06, 2007 7:30 AM
Subject: sending smtp mail failure


 Hi,

 I set up a small web app and the servlet is supposed to send an email
 using
 JavaMail. But I am getting exceptions - Connection Timed out every time.
I
 am using Gmail as an smtp server to bounce emails off. How can I avoid
the
 Connection Timed out exception? Could it be because of my firewall? If
so,
 which process should I permission?

 Thank you,

 MT



-
To start a new topic, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




sending smtp mail failure

2007-04-05 Thread Mighty Tornado

Hi,

I set up a small web app and the servlet is supposed to send an email using
JavaMail. But I am getting exceptions - Connection Timed out every time. I
am using Gmail as an smtp server to bounce emails off. How can I avoid the
Connection Timed out exception? Could it be because of my firewall? If so,
which process should I permission?

Thank you,

MT