troubleshooting Question

You have attempted to dereference a scalar variable of type class java.lang.String as a structure with members. in Coldfusion

Avatar of erikTsomik
erikTsomikFlag for United States of America asked on
Programming Languages-OtherWeb DevelopmentWeb Servers
25 Comments1 Solution1400 ViewsLast Modified:
I am getting the following error
You have attempted to dereference a scalar variable of type class java.lang.String as a structure with members.  And it points me to the following line of my code :  <cfset StructAppend(SESSION, data)>
The below is my script

<cfcomponent displayname="login2" extends="tool">
<cffunction name="init" access="public" returntype="any" output="false">
            <cfargument name="CompanyID" required="true" type="numeric">            
            <cfargument name="webid" required="false" default="0">
            <cfargument name="datatype" required="false" default="0">
            
            <cfset super.init(CompanyID, arguments.webID, arguments.datatype)>
             <!--- create objects --->
            <cfset this.navigation = createObject("component", "hb50.navigation").init(CompanyID)>
            <cfset this.workflow = createObject("component", "hb50.workflow").init(CompanyID)>
            <cfset this.display = createObject("component", "hb50.display").init(CompanyID)>
            <cfset this.media = createObject("component", "hb50.media").init(this.CompanyID)>
            <cfset this.blnContent = true>
            
            <cfscript>
                  this.homeData = newFormData();
                  this.homeData.tablename = "tblExtranetOptions";
                  this.homeData.title = "Extranet Login Options";
                  columns = ArrayNew(1);
                  
                  xmlNav = this.navigation.getPublicNavXML();
                  x = StructNew();
                  x.varname = "optDefaultPage";
                  x.title = "Extranet Logged In Default Page";
                  x.type = TYPES.SELECT;
                  x.xml = xmlNav;
                  x.required = true;
                  x.multiple = FALSE;
                  ArrayAppend(columns, x);
                  
                  x = StructNew();
                  x.varname = "optLoggedOutDefaultPage";
                  x.title = "Extranet Logged Out Default Page";
                  x.type = TYPES.SELECT;
                  x.xml = xmlNav;
                  x.required = false;
                  x.multiple = FALSE;
                  ArrayAppend(columns, x);
                  
                  x = StructNew();
                  x.varname = "blnLDAP";
                  x.title = "Use LDAP for Authentication";
                  x.type = TYPES.BOOLEAN;
                  x.required = false;
                  ArrayAppend(columns, x);
                  
                  x = StructNew();
                  x.varname = "txtForgotPass";
                  x.title = "Forgot Password";
                  x.type = TYPES.HTML;
                  x.required = true;
                  ArrayAppend(columns, x);
                  
                  x = StructNew();
                  x.varname = "txtSuccessEmail";
                  x.title = "Password Emailed";
                  x.type = TYPES.HTML;
                  x.required = true;
                  ArrayAppend(columns, x);
                  
                  x = StructNew();
                  x.varname = "txtUnSuccessEmail";
                  x.title = "Password Not Emailed";
                  x.type = TYPES.HTML;
                  x.required = true;
                  ArrayAppend(columns, x);

                  x = StructNew();
                  x.varname = "txtLoginMessage";
                  x.title = "Login";
                  x.type = TYPES.HTML;
                  x.required = true;
                  ArrayAppend(columns, x);
                  
                  x = StructNew();
                  x.varname = "intRoleID";
                  x.title = "RoleId";
                  x.type = TYPES.NUMBER;
                  x.required = false;
                  ArrayAppend(columns, x);
                  
                  
                  this.homeData.columns = columns;
                  this.homeData.webid = this.webid;
                  this.homeData.blnWorkflow = false;
                  this.homeData.blnApproval = false;
                  this.homeData.blnLock = false;
                  this.homeData.blnVersion = false;
                  this.homeData.blnDelete = false;
                  this.homeData.blnPreview = false;
                  this.homeData.blnCategory = false;                  
                  this.homeData.blnScheduling = false;                  
                  this.homeData.blnMeta = true;                  
                  this.homeData.blnResources = false;
                  this.homeData.link = this.link;
                  this.homeData.varID = "intID";
                  return this;
            </cfscript>
      </cffunction>
      
      <cffunction name="getTabs" access="public" returntype="any">
            <cfxml variable="xmlNav">
                  <cfoutput>
                        <item>
                              <item caption="Login Options" id="1"/>
                        </item>
                  </cfoutput>
            </cfxml>
            <cfreturn xmlNav />
      </cffunction>
      
      <cffunction name="getBackEnd" access="public" returntype="string">
            <cfset this.workflow.verifyColumns(this.homeData)>
            <!--- process the form in the back end and inserted --->
            <cfset this.display.setActionMsg(this.workflow.processForm(this.homeData))>
            <!--- this actually get the record (only 1) and you continually edit the record after the first time --->
            <cfquery name="qryExtranetOptions" datasource="#this.datasource#">
                  SELECT *
                  FROM tblExtranetOptions
                  WHERE intCompanyID = #this.companyID#
            </cfquery>
            <cfif qryExtranetOptions.recordcount>
                  <cfset url.id = qryExtranetOptions.intID>
            </cfif>
            <cfset this.homeData.tabs[1] = StructNew()>
            <cfset this.homeData.tabs[1].caption = 'Default Pages'>
            <cfset this.homeData.tabs[1].columnlist = 'optDefaultPage,optLoggedOutDefaultPage,blnLDAP'>
            <cfset this.homeData.tabs[2] = StructNew()>
            <cfset this.homeData.tabs[2].caption = 'Login'>
            <cfset this.homeData.tabs[2].columnlist = 'txtLoginMessage'>
            <cfset this.homeData.tabs[3] = StructNew()>
            <cfset this.homeData.tabs[3].caption = 'Emailed'>
            <cfset this.homeData.tabs[3].columnlist = 'txtSuccessEmail'>
            <cfset this.homeData.tabs[4] = StructNew()>      `
            <cfset this.homeData.tabs[4].caption = 'Not Emailed'>
            <cfset this.homeData.tabs[4].columnlist = 'txtUnSuccessEmail'>
            <cfset this.homeData.tabs[5] = StructNew()>
            <cfset this.homeData.tabs[5].caption = 'Forgot'>
            <cfset this.homeData.tabs[5].columnlist = 'txtForgotPass'>
            
            <!--- when user clicks save, update all the blnldap settings for this company --->
            <cfif isDefined("form.button") AND FORM.button eq #translate('Save')#>
                  <cfset ldap = 0>
                  <cfif isDefined("form.BLNLDAP") AND FORM.BLNLDAP eq 'on'>
                        <cfset ldap = 1>
                  </cfif>

                  <cfquery name="qryUpdateLdap" datasource="#this.datasource#">
                        UPDATE tblExtranetOptions
                        SET blnLDAP = #ldap#                  
                        WHERE intCompanyID = #this.companyID#
                  </cfquery>
            </cfif>
            <cfreturn this.display.getAddEdit(this.homeData)>
      </cffunction>

      <cffunction name="DisplayLoginForm" access="public" returntype="string" output="false">
      
            <cfsavecontent variable="txtOutput">
                  <cfoutput>
                  <div id="test">
                        <form   method="post"  name="form">
                              <b><i>User Name: </i></b><input type="text" name="txtUserName" size="20"><br />
                               <b><i>Password: </i></b><input type="password" name="txtPassword" size="20"><br />
                               <input type="submit" value="Login >>>" name="Login" >
                        </form>
                        </div>
                  </cfoutput>
            </cfsavecontent>
            
            <cfreturn txtOutput />      
      </cffunction>
      
      
      <cffunction name="getFrontEnd" access="public" returntype="struct" hint="Returns front end display.">
            <cfset var strFrontEnd = StructNew()>
            <cfset strFrontEnd.title = "">
            <cfset strFrontEnd.body = "">
            
            <cfquery name="qryOptions" datasource="#this.datasource#">
                  SELECT       optDefaultPage, txtLoginMessage, txtForgotPass, txtSuccessEmail, txtUnSuccessEmail,      optLoggedOutDefaultPage
                  FROM       tblExtranetOptions
                  WHERE       intCompanyID = #this.companyId#
            </cfquery>
            
            
            <cfset strFrontEnd.body = DisplayLoginForm()>
            
            
            <!---check if the user is authenticated--->
            <cfif isDefined ("form.txtUserName") and isDefined ("form.txtPassword")>
                  <cfset admin = createObject('component', 'hb50.ldap').init(this.companyId)>
            <cftry>
                  <cfset data = admin.login(#FORM.txtUsername#, #FORM.txtPassword#)>
                  <cfset StructAppend(SESSION, data)>
                  <cfcatch type="user">
                  
                        <cfset loginError = true>
                        <cfset loginErrorText = CFCATCH.message>
                        
                  </cfcatch>
            </cftry>
                  </cfif>
                  <cfoutput> <cfdump var="SESSION"></cfoutput>
                  <cfif isDefined("URL.navid")>
                  
            <cfset URL.navid = Val(URL.navid)>
      </cfif>
                  
                  <!---<cfif not (isDefined("SESSION.loggedIn") and SESSION.loggedIn)>
            <!---<cfinclude template="test.cfm">--->
            <cfabort />
      </cfif>
      <cfif isDefined("URL.navid")>
            <cfset URL.navid = Val(URL.navid)>
      </cfif>
            <cfif not (isDefined("SESSION.loggedIn") and SESSION.loggedIn)>
                  <cfparam name="defPage" default="#qryOptions.optDefaultPage#">
                  <cfparam name="loginMsg" default="#qryOptions.txtLoginMessage#">
                  <cfif isDefined("qryOptions") AND qryOptions.recordCount>
                        <cfset defPage = qryOptions.optDefaultPage>
                        <cfset loginMsg = qryOptions.txtLoginMessage>
                  </cfif>
            
                  <cfset xmlNav = this.navigation.getPublicNavXML()>
                  <cfset xmlResult = searchXMLByID(xmlNav, defPage)>
                        <cfset xmlResult = searchXMLByID(xmlNav, qryOptions.optLoggedOutDefaultPage)>
                        <cfif not isSimpleValue(xmlResult)>
                              <cfset xmlParent = xmlResult[1]>
                              <cfset txtRedirectLink = qryOptions.optDefaultPage>
                              <cfif xmlParent.xmlattributes.id NEQ this.webid>                        
                                          
                                    <cflocation url="#txtRedirectLink#" addtoken="no">                              
                              </cfif>
            </cfif>
            </cfif>--->
            
            <cfreturn strFrontEnd />
      </cffunction>
      
</cfcomponent>



ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 25 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 25 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros