Java use-class getting called twice

Avatar

Avatar

bilala23933647

Avatar

bilala23933647

bilala23933647

05-05-2020

Dear members,

 

I'm using AEM 6.4.4 and using wcm-use along with it. The issue is that my use-class activate() method is getting called twice. Anyone has faced this issue before? I tried debugging it but no luck how it's happening. Any help would be really appreciated.

 

Thanks,

Bilal.

View Entire Topic

Avatar

Avatar

Veena_Vikram

MVP

Avatar

Veena_Vikram

MVP

Veena_Vikram
MVP

05-05-2020

Can you give a sample of the code how you are invoking the class and just a skeleton of your class (remove any main business logic ) ?

Thank you so much Veena. for responding to my issue, also apologies for the delayed response.

Thank you so much Veena. for responding to my issue, also apologies for the delayed response. I'll attach the files here:

 

 

<sly data-sly-use.commonutilobj="${'com.mysite.aem.core.use.CommonUtilUse'}"/>
<div id="${commonutilobj.componentId}" data-tracking-event-label="${commonutilobj.componentLabel}" class="jumbotron ${!properties.backgroundColor ? '': '{0}{1}' @format=[properties.backgroundColor,'-bg']} ${properties.paddingTop} ${properties.paddingBottom} ${properties.alwaysShowImg ? 'alwaysImg' : ''} ${!properties.fileReferencebckgroundimage ? '' : '{0}{1}{2}' @ format=['backgroundImg-',properties.horizontalAlign, properties.verticalAlign]} ${properties.alignment}" style="background-image: url('${properties.fileReferencebckgroundimage @ context='uri'}')"> 
    <div class="wrapper">
		<div class="row" data-sly-test="${properties.H3Title || properties.H5Eyebrow || properties.leadPara}">
			<div class="col-md-8 ${properties.alignment=='text-center'? 'mx-auto':''}">
				<h5 data-sly-test="${properties.H5Eyebrow}" class="alt ${properties.H5EyebrowColor}">${properties.H5Eyebrow ='unsafe'}</h5>
				<h3 data-sly-test="${properties.H3Title}" class="${properties.H3TitleColor}"
					data-sly-use.supuse="${'com.mysite.aem.core.components.use.SuperScriptUse' @ param=properties.H3Title}">${supuse.highlight ='unsafe'}</h3>
				<p data-sly-test="${properties.leadPara}" class="lead2 ${properties.leadParaColor}">${properties.leadPara ='unsafe'}</p>
			</div>
		</div>
	</div>
</div>

 

wcm-use-error.PNG

I don't see an issue in your code. How did you figure out it is getting called twice ?

Thanks for the response, Veena_07
Here's how I found out - I have created a page with only one component(this one) on it.  I start my AEM instance in debug mode and placed a breakpoint at activate() method. when I refresh the page, the control comes to the activate method, it executes, then it gets called again and gets processed. Many Thanks, Bilal.