Menu

Multifield acs-commons-nested="NODE_STORE" not saving properties into nodes

While working with multifield we use ACS commons multifield property acs-commons-nested="NODE_STORE" to store the values of the fields into nodes instead of JSON or array type property values. Till AEM 6.3  acs-commons-nested property was working fine but with the later versions of AEM  acs-commons-nested has been deprecated. And to achieve the same we can be used granite UI multifield instead of old foundation multifield. 

Problem Statement

When you migrated your project and you came with this problem where your multifield component is not storing the authored content into item nodes then we have to fix it with the below resolution.

Resolution

Since acs-commons-nested has been deprecated now we have to use a different field that supports this approach of storing data. This way we do not have to modify our existing model classes. Make the following changes in your existing multifield component. 

1. Update the multifield from foundation multifield to Granite UI multifield. 

sling:resourceType="granite/ui/components/foundation/form/multifield" to sling:resourceType="granite/ui/components/coral/foundation/form/multifield"

2. Add a property on mutifield composite="{Boolean}true"

After doing the above changes in your component, now author your component and validate the storage of authored content under jcr:content of the page and component model class.


References

https://adobe-consulting-services.github.io/acs-aem-commons/features/ui-widgets/multifield-extension/index.html

https://www.adobe.io/experience-manager/reference-materials/6-5/granite-ui/api/jcr_root/libs/granite/ui/components/coral/foundation/form/multifield/index.html


Port may already be in use

While running any application you may face an issue, that default port or port which our application required to start the process is occupied by some other process or service. In this article we will see how to fix this issue and how we can terminate the active process and service from that port and make it available for our new application. 
below are the steps which we need to follow for windows machine to free the port number.

Error log:

2019-11-22 23:38:18.329 ERROR 27240 --- [  restartedMain] o.apache.catalina.core.StandardService   : Failed to start connector [Connector[HTTP/1.1-8080]]

org.apache.catalina.LifecycleException: Failed to start component [Connector[HTTP/1.1-8080]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167) ~[tomcat-embed-core-8.5.29.jar:8.5.29]
at org.apache.catalina.core.StandardService.addConnector(StandardService.java:225) ~[tomcat-embed-core-8.5.29.jar:8.5.29]
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.addPreviouslyRemovedConnectors(TomcatWebServer.java:256) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.start(TomcatWebServer.java:198) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.startWebServer(ServletWebServerApplicationContext.java:300) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:162) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:553) [spring-context-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:395) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:327) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1255) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1243) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at jobtrees.JobTreesApplication.main(JobTreesApplication.java:25) [classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_221]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_221]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_221]
at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_221]
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-2.0.1.RELEASE.jar:2.0.1.RELEASE]
Caused by: org.apache.catalina.LifecycleException: Protocol handler start failed
at org.apache.catalina.connector.Connector.startInternal(Connector.java:1020) ~[tomcat-embed-core-8.5.29.jar:8.5.29]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ~[tomcat-embed-core-8.5.29.jar:8.5.29]
... 18 common frames omitted
Caused by: java.net.BindException: Address already in use: bind
at sun.nio.ch.Net.bind0(Native Method) ~[na:1.8.0_221]
at sun.nio.ch.Net.bind(Unknown Source) ~[na:1.8.0_221]
at sun.nio.ch.Net.bind(Unknown Source) ~[na:1.8.0_221]
at sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source) ~[na:1.8.0_221]
at sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source) ~[na:1.8.0_221]
at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:210) ~[tomcat-embed-core-8.5.29.jar:8.5.29]
at org.apache.tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.java:1150) ~[tomcat-embed-core-8.5.29.jar:8.5.29]
at org.apache.coyote.AbstractProtocol.start(AbstractProtocol.java:591) ~[tomcat-embed-core-8.5.29.jar:8.5.29]
at org.apache.catalina.connector.Connector.startInternal(Connector.java:1018) ~[tomcat-embed-core-8.5.29.jar:8.5.29]
... 19 common frames omitted

2019-11-22 23:38:18.343  INFO 27240 --- [  restartedMain] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2019-11-22 23:38:18.362  INFO 27240 --- [  restartedMain] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-11-22 23:38:18.364 ERROR 27240 --- [  restartedMain] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

The Tomcat connector configured to listen on port 8080 failed to start. The port may already be in use or the connector may be misconfigured.

Action:

Verify the connector's configuration, identify and stop any process that's listening on port 8080, or configure this application to listen on another port.

How to fix?

To fix this issue and vacant the port you have to kill and stop the current service which is active and running on this port. to do so in your windows machine please follow the following steps.
Step1: Open command prompt(CMD).
Step2: Find the process ID which occupied the port. run the below command to find the PID. to know more on this you may refer our aticle find PID using port number.
netstat -aon | findstr <port number>
let say we want to find the active process ID which is running on port number 4502, hence we will run the below command. 
netstat -aon | findstr 4502
How to find process ID
Find process ID(PID)

Step3: after getting the process ID (PID) you may need to verify which service name or want to know the name of service, then execute the below command.
tasklist /fi "pid eq 8884"
Here, image name is the name of the service. 
How to find the service name using PID
Service name

Step4:
Now we need to stop or kill this active service so we could use another service on same port. To kill a service please run the below command.

taskkill /PID 8884 /F
How to remove an active service from a port.
kill active process/service

We have killed the process and service has been terminated it means now port 4502 is empty and no process or service is currently using that port. We may verify the same by running the command from step2 again.

if you have any query and suggestion, please feel free to pass.


How many hours in a complete day?

Question: Did you know how many hours we have in day? 
or 
Question: How many hours in a complete day? 
or 
Question: How many hours actually in day? 
or 
Question: Are all days exactly 24 hours?
or
Question: How many hours in a day?

Answer: A complete day is twenty three hours, fifty six minutes and four thousand seconds. that is, 23:56:4000 (hh:mm:ss)