[opencms-dev] CmsObject is null

Bryan LaPlante blaplante at netwebapps.com
Fri Sep 26 14:58:01 CEST 2003


How to use CmsMail?A couple of things. 
Is the to field the equivalent of CmsUser[] in your CmsMail constructor? If not that could be a null pointer.

One thing is that the exception generated a line number in CmsMail that suggests you were using a constructor that looks like this.

CmsMail(CmsObject cms, 
                 String from, 
                 String[] to, 
                 String[] cc, 
                 boolean isBcc, 
                 String subject, 
                 String content, 
                 String type)

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.

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.
  ----- Original Message ----- 
  From: Nguyen La Yen Dung 
  To: opencms-dev at opencms.org 
  Sent: Friday, September 26, 2003 6:02 AM
  Subject: [opencms-dev] CmsObject is null




  Hello,

  Could you please specify the problem that I've met?

  The cms is not null but the cmsObj is null (after the command: cms.getCmsObject())

  com.opencms.flex.jsp.CmsJspActionElement cms = new 
                              com.opencms.flex.jsp.CmsJspActionElement(pageContext, request, response); 
  com.opencms.file.CmsObject cmsObj = cms.getCmsObject();


  Therefore, the code: 

            CmsMail cmsMail = new CmsMail(cmsObj, "dny at sdcgrp.com", to, "subject", "content", "text/html");

  will raise an exception:

  java.lang.NullPointerException at com.opencms.defaults.CmsMail.<init>(CmsMail.java:404)


  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. 



  Thanks,

  Yendung

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20030926/d4b2533f/attachment.htm>


More information about the opencms-dev mailing list