<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>How to use CmsMail?</TITLE>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2600.0" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>A couple of things. </FONT></DIV>
<DIV><FONT face=Arial size=2>Is the to field the equivalent of CmsUser[] in your
CmsMail constructor? If not that could be a null pointer.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>One thing is that the exception generated a line
number in CmsMail that suggests you were using a constructor that looks like
this.</FONT></DIV>
<DIV><FONT face=Arial size=2><BR>CmsMail(CmsObject cms,
<BR>
String from, <BR>
String[]
to, <BR> String[]
cc, <BR> boolean
isBcc, <BR>
String subject, <BR>
String content,
<BR>
String type)</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I am assuming that if you are using sessions and it
has not timed out waiting for some other request you can do this test for debug
purposes.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Internally to the CmsJspActionElement is a private
boolean Flag to indicate that this bean was properly initialized. So just as a
test before you cms.getCmsObject(); try
cms.getRequestContext().isInstance(CmsRequestContext) if that is returning false
than the best guess here is that the CmsJspActionElement never got initialized
and you will have to back trace your steps and find out why.</FONT></DIV>
<BLOCKQUOTE dir=ltr
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=dny@sdcgrp.com href="mailto:dny@sdcgrp.com">Nguyen La Yen Dung</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=opencms-dev@opencms.org
href="mailto:opencms-dev@opencms.org">opencms-dev@opencms.org</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Friday, September 26, 2003 6:02
AM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> [opencms-dev] CmsObject is
null</DIV>
<DIV><BR></DIV>
<DIV>
<P><FONT size=2><SPAN class=175382910-26092003></SPAN></FONT> </P>
<P><FONT size=2><SPAN class=175382910-26092003>Hello,</SPAN></FONT></P>
<P><FONT size=2><SPAN class=175382910-26092003>Could you please specify the
problem that I've met?</SPAN></FONT></P>
<P><FONT size=2><SPAN class=175382910-26092003>The cms is not null but the
cmsObj is null (after the command: cms.getCmsObject())</SPAN></FONT></P>
<P><FONT color=#0000ff><FONT size=2>com.opencms.flex.jsp.CmsJspActionElement
cms = new </FONT><BR><FONT
size=2>
com.opencms.flex.jsp.CmsJspActionElement(pageContext, request,
response);</FONT> <BR></FONT><FONT color=#0000ff
size=2>com.opencms.file.CmsObject cmsObj = cms.getCmsObject();<BR></FONT><FONT
size=2><SPAN class=175382910-26092003><FONT face=Arial
color=#0000ff></FONT></SPAN></FONT></P>
<P><FONT size=2><SPAN class=175382910-26092003><FONT face=Arial>Therefore, the
code: </FONT></SPAN></FONT></P>
<P><FONT size=2><FONT color=#0000ff><SPAN
class=175382910-26092003>
</SPAN><SPAN class=175382910-26092003>CmsMail cmsMail = new CmsMail(cmsObj,
"dny@sdcgrp.com", to, "subject", "content",
"text/html");</SPAN></FONT></FONT></P>
<P><FONT size=2><SPAN class=175382910-26092003>will raise an
exception:</SPAN></FONT></P>
<P><FONT color=#ff0000 size=2><SPAN
class=175382910-26092003>java.lang.NullPointerException</SPAN></FONT><FONT
color=#ff0000 size=2><SPAN class=175382910-26092003> at
com.opencms.defaults.CmsMail.<init>(CmsMail.java:404)<BR></SPAN></FONT></P>
<P><FONT size=2><SPAN class=175382910-26092003><FONT face=Arial
color=#0000ff><FONT color=#000000>Before, I used to suceed in creating an
email. Now I get the code back, and it failed. I think the failure maybe
comes from my system, but checked it, I see everything
is alright. Please help me, it's really
urgent.</FONT> </FONT></SPAN></FONT></P>
<P><FONT face=Arial size=2><SPAN
class=175382910-26092003></SPAN></FONT> </P>
<P><FONT face=Arial size=2><SPAN
class=175382910-26092003>Thanks,</SPAN></FONT></P>
<P><FONT face=Arial size=2><SPAN
class=175382910-26092003>Yendung</SPAN></FONT></P></DIV></BLOCKQUOTE></BODY></HTML>