You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apache-bugdb@apache.org by Gilson Wilson <gi...@ionideainteractive.com> on 2001/04/03 13:42:14 UTC

mod_jserv/7504: Having a problem with "Session session=Session.getDefaultInstance(props,null)" in a Servlet using Apache JServ. We are using it as it is a requirement for email, but as a independent Java app works well - does not work when used as a Ser

>Number:         7504
>Category:       mod_jserv
>Synopsis:       Having a problem with "Session session=Session.getDefaultInstance(props,null)" in a Servlet using Apache JServ. We are using it as it is a requirement for email, but as a independent Java app works well - does not work when used as a Ser
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    jserv
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   apache
>Arrival-Date:   Tue Apr 03 04:50:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     gilson@ionideainteractive.com
>Release:        1.3.17
>Organization:
apache
>Environment:
Red Hat Linux 7.0 Kernel 2.2.16 with Apache 1.3.17 and Apache JServ and JDK1.3
>Description:
We are using a statement like "Session session=Session.getDefaultInstance(props,null)" in a Servlet in order to initialise a mail session. When this is included as an independent Java application, it works - but gives an "Internal Server Error" when used as a Servlet or JSP.

/* Session session=Session.getDefaultInstance(props,null);

                session.setDebug(sessionDebug);

                try{
                        Message msg=new MimeMessage(session);
                        msg.setFrom(new InternetAddress(from));
                        InternetAddress[] address={new InternetAddress(to)};
                        msg.setRecipients(Message.RecipientType.TO,address);
                        msg.setSubject(subject);
                msg.setSentDate(new Date());
                        msg.setContent(messagetext,"text/html");
                msg.setText(messagetext);

                        Transport.send(msg);



                }catch(MessagingException mex){
                        mex.printStackTrace();
                } */

If I uncomment this code, it gives me a "URL not found" - but if I comment this block - the servlet atleast works a bit!
>How-To-Repeat:
I guess you should try that code snippet as a servlet.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
 [In order for any reply to be added to the PR database, you need]
 [to include <ap...@Apache.Org> in the Cc line and make sure the]
 [subject line starts with the report component and number, with ]
 [or without any 'Re:' prefixes (such as "general/1098:" or      ]
 ["Re: general/1098:").  If the subject doesn't match this       ]
 [pattern, your message will be misfiled and ignored.  The       ]
 ["apbugs" address is not added to the Cc line of messages from  ]
 [the database automatically because of the potential for mail   ]
 [loops.  If you do not include this Cc, your reply may be ig-   ]
 [nored unless you are responding to an explicit request from a  ]
 [developer.  Reply only with text; DO NOT SEND ATTACHMENTS!     ]
 
 
 vlet or JSP.