Received: (qmail 79638 invoked by uid 501); 3 Apr 2001 11:42:14 -0000 Message-Id: <20010403114214.79637.qmail@apache.org> Date: 3 Apr 2001 11:42:14 -0000 From: Gilson Wilson Reply-To: gilson@ionideainteractive.com To: submit@bugz.apache.org Subject: 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 X-Send-Pr-Version: 3.110 >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: closed >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: apache >Arrival-Date: Tue Apr 03 04:50:00 PDT 2001 >Closed-Date: Tue Apr 03 10:49:32 PDT 2001 >Last-Modified: Tue Apr 03 10:49:32 PDT 2001 >Originator: gilson@ionideainteractive.com >Release: 1.3.17 >Organization: >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: State-Changed-From-To: open-closed State-Changed-By: jon@clearink.com State-Changed-When: Tue Apr 3 10:49:31 PDT 2001 State-Changed-Why: Not a JServ problem, it is a configuration problem. You are either missing the mail.jar in your classpath or some other problem. >Unformatted: [In order for any reply to be added to the PR database, you need] [to include 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.