Menu

ssh_dispatch_run_fatal: Connection to server x.x.x.x port 22: message authentication code incorrect

When we are doing the ssh to a server using ssh command, then sometimes on windows we got this error that doesn't allow us to connect with the servers. 

command: ssh userjorvee@10.10.10.10

 ssh_dispatch_run_fatal: Connection to server xx.xx.xx.xx port 22: message authentication code incorrect


To fix the above issue you can run the ssh with these parameters.

ssh -m hmac-sha2-256 userjorvee@10.10.10.10


Workaround:

1. https://www.nrel.gov/hpc/announcements/posts/windows-ssh-workaround.html

How to run unit test for a specific file using mvn command?

For a single class

 mvn clean test -Dtest=ClassNameTest

For a specific method within a class

 mvn clean test -Dtest=ClassNameTest#MethodName


Exception swallowed while including error page

com.adobe.acs.commons.errorpagehandler.impl.ErrorPageHandlerImpl Exception swallowed while including error page java.lang.NullPointerException: null


com.adobe.acs.commons.errorpagehandler.impl.ErrorPageHandlerImpl Exception swallowed while including error page java.lang.NullPointerException: null at java.io.PrintWriter.write(Unknown Source) at com.adobe.acs.commons.errorpagehandler.impl.ErrorPageHandlerImpl.includeUsingGET(ErrorPageHandlerImpl.java:1017) [com.adobe.acs.acs-aem-commons-bundle:5.0.6] at org.apache.jsp.apps.sling.servlet.errorhandler._404_jsp._jspService(_404_jsp.java:324) at org.apache.sling.scripting.jsp.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) [org.apache.sling.scripting.jsp:2.3.6] at javax.servlet.http.HttpServlet.service(HttpServlet.java:725) [org.apache.felix.http.servlet-api:1.1.2] at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:502) [org.apache.sling.scripting.jsp:2.3.6] at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:449) [org.apache.sling.scripting.jsp:2.3.6] at org.apache.sling.scripting.jsp.JspScriptEngineFactory.callJsp(JspScriptEngineFactory.java:339) [org.apache.sling.scripting.jsp:2.3.6] at org.apache.sling.scripting.jsp.JspScriptEngineFactory.access$100(JspScriptEngineFactory.java:97) [org.apache.sling.scripting.jsp:2.3.6] at org.apache.sling.scripting.jsp.JspScriptEngineFactory$JspScriptEngine.eval(JspScriptEngineFactory.java:600) [org.apache.sling.scripting.jsp:2.3.6] at org.apache.sling.scripting.core.impl.DefaultSlingScript.call(DefaultSlingScript.java:388) [org.apache.sling.scripting.core:2.3.2] at org.apache.sling.scripting.core.impl.DefaultSlingScript.eval(DefaultSlingScript.java:184) [org.apache.sling.scripting.core:2.3.2] at org.apache.sling.scripting.core.impl.DefaultSlingScript.service(DefaultSlingScript.java:491) [org.apache.sling.scripting.core:2.3.2] at org.apache.sling.servlets.resolver.internal.SlingServletResolver.handleError(SlingServletResolver.java:646) [org.apache.sling.servlets.resolver:2.7.10] at org.apache.sling.servlets.resolver.internal.SlingServletResolver.handleError(SlingServletResolver.java:328) [org.apache.sling.servlets.resolver:2.7.10] at org.apache.sling.engine.impl.DefaultErrorHandler.handleError(DefaultErrorHandler.java:97) [org.apache.sling.engine:2.7.8] at org.apache.sling.engine.impl.SlingRequestProcessorImpl$1.render(SlingRequestProcessorImpl.java:346) [org.apache.sling.engine:2.7.8] at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:88) [org.apache.sling.engine:2.7.8] at org.apache.sling.rewriter.impl.RewriterFilter.doFilter(RewriterFilter.java:87) [org.apache.sling.rewriter:1.2.2] at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:78) [org.apache.sling.engine:2.7.8] at org.apache.sling.i18n.impl.I18NFilter.doFilter(I18NFilter.java:131) [org.apache.sling.i18n:2.5.14] at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:78) [org.apache.sling.engine:2.7.8] at org.apache.sling.engine.impl.SlingRequestProcessorImpl.handleError(SlingRequestProcessorImpl.java:353) [org.apache.sling.engine:2.7.8] at org.apache.sling.engine.impl.SlingRequestProcessorImpl.doProcessRequest(SlingRequestProcessorImpl.java:167) [org.apache.sling.engine:2.7.8] at org.apache.sling.engine.impl.SlingMainServlet.service(SlingMainServlet.java:250) [org.apache.sling.engine:2.7.8] at org.apache.felix.http.base.internal.handler.ServletHandler.handle(ServletHandler.java:123) [org.apache.felix.http.jetty:4.1.10] at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:86) [org.apache.felix.http.jetty:4.1.10] at com.adobe.granite.license.impl.LicenseCheckFilter.doFilter(LicenseCheckFilter.java:308) [com.adobe.granite.license:1.2.10] at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:142) [org.apache.felix.http.jetty:4.1.10] at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:81) [org.apache.felix.http.jetty:4.1.10] at org.apache.sling.i18n.impl.I18NFilter.doFilter(I18NFilter.java:131) [org.apache.sling.i18n:2.5.14] at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:142) [org.apache.felix.http.jetty:4.1.10] at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:81) [org.apache.felix.http.jetty:4.1.10] at org.apache.sling.featureflags.impl.FeatureManager.doFilter(FeatureManager.java:116) [org.apache.sling.featureflags:1.2.2] at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:142) [org.apache.felix.http.jetty:4.1.10] at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:81) [org.apache.felix.http.jetty:4.1.10] at org.apache.sling.engine.impl.log.RequestLoggerFilter.doFilter(RequestLoggerFilter.java:75) [org.apache.sling.engine:2.7.8] at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:142) [org.apache.felix.http.jetty:4.1.10] at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:81) [org.apache.felix.http.jetty:4.1.10] at org.apache.sling.engine.impl.parameters.RequestParameterSupportConfigurer.doFilter(RequestParameterSupportConfigurer.java:67) [org.apache.sling.engine:2.7.8] at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:142) [org.apache.felix.http.jetty:4.1.10] at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:81) [org.apache.felix.http.jetty:4.1.10] at org.apache.felix.http.base.internal.dispatch.Dispatcher$1.doFilter(Dispatcher.java:146) [org.apache.felix.http.jetty:4.1.10] at org.apache.felix.http.base.internal.whiteboard.WhiteboardManager$2.doFilter(WhiteboardManager.java:1002) [org.apache.felix.http.jetty:4.1.10] at com.adobe.granite.auth.oauth.impl.OAuthCallbackFilter.doFilter(OAuthCallbackFilter.java:69) [com.adobe.granite.auth.oauth:1.7.2] at org.apache.felix.http.base.internal.handler.PreprocessorHandler.handle(PreprocessorHandler.java:137) [org.apache.felix.http.jetty:4.1.10] at org.apache.felix.http.base.internal.whiteboard.WhiteboardManager$2.doFilter(WhiteboardManager.java:1008) [org.apache.felix.http.jetty:4.1.10] at com.adobe.granite.auth.ims.impl.IMSClusterExchangeTokenPreprocessor.doFilter(IMSClusterExchangeTokenPreprocessor.java:281) [com.adobe.granite.auth.ims:1.3.12.CQ650-B0014] at org.apache.felix.http.base.internal.handler.PreprocessorHandler.handle(PreprocessorHandler.java:137) [org.apache.felix.http.jetty:4.1.10] at org.apache.felix.http.base.internal.whiteboard.WhiteboardManager$2.doFilter(WhiteboardManager.java:1008) [org.apache.felix.http.jetty:4.1.10] at org.apache.sling.security.impl.ReferrerFilter.doFilter(ReferrerFilter.java:326) [org.apache.sling.security:1.1.16] at org.apache.felix.http.base.internal.handler.PreprocessorHandler.handle(PreprocessorHandler.java:137) [org.apache.felix.http.jetty:4.1.10] at org.apache.felix.http.base.internal.whiteboard.WhiteboardManager$2.doFilter(WhiteboardManager.java:1008) [org.apache.felix.http.jetty:4.1.10] at org.apache.felix.http.sslfilter.internal.SslFilter.doFilter(SslFilter.java:97) [org.apache.felix.http.sslfilter:1.2.6] at org.apache.felix.http.base.internal.handler.PreprocessorHandler.handle(PreprocessorHandler.java:137) [org.apache.felix.http.jetty:4.1.10] at org.apache.felix.http.base.internal.whiteboard.WhiteboardManager$2.doFilter(WhiteboardManager.java:1008) [org.apache.felix.http.jetty:4.1.10] at org.apache.felix.http.base.internal.whiteboard.WhiteboardManager.invokePreprocessors(WhiteboardManager.java:1012) [org.apache.felix.http.jetty:4.1.10] at org.apache.felix.http.base.internal.dispatch.Dispatcher.dispatch(Dispatcher.java:91) [org.apache.felix.http.jetty:4.1.10] at org.apache.felix.http.base.internal.dispatch.DispatcherServlet.service(DispatcherServlet.java:49) [org.apache.felix.http.jetty:4.1.10] at javax.servlet.http.HttpServlet.service(HttpServlet.java:725) [org.apache.felix.http.servlet-api:1.1.2] at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799) [org.apache.felix.http.jetty:4.1.10] at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:550) [org.apache.felix.http.jetty:4.1.10] at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233) [org.apache.felix.http.jetty:4.1.10] at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624) [org.apache.felix.http.jetty:4.1.10] at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233) [org.apache.felix.http.jetty:4.1.10] at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1435) [org.apache.felix.http.jetty:4.1.10] at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188) [org.apache.felix.http.jetty:4.1.10] at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:501) [org.apache.felix.http.jetty:4.1.10] at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594) [org.apache.felix.http.jetty:4.1.10] at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186) [org.apache.felix.http.jetty:4.1.10] at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1350) [org.apache.felix.http.jetty:4.1.10] at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) [org.apache.felix.http.jetty:4.1.10] at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:191) [org.apache.felix.http.jetty:4.1.10] at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) [org.apache.felix.http.jetty:4.1.10] at org.eclipse.jetty.server.Server.handle(Server.java:516) [org.apache.felix.http.jetty:4.1.10] at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:388) [org.apache.felix.http.jetty:4.1.10] at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:633) [org.apache.felix.http.jetty:4.1.10] at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:380) [org.apache.felix.http.jetty:4.1.10] at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277) [org.apache.felix.http.jetty:4.1.10] at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311) [org.apache.felix.http.jetty:4.1.10] at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105) [org.apache.felix.http.jetty:4.1.10] at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104) [org.apache.felix.http.jetty:4.1.10] at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338) [org.apache.felix.http.jetty:4.1.10] at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315) [org.apache.felix.http.jetty:4.1.10] at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173) [org.apache.felix.http.jetty:4.1.10] at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131) [org.apache.felix.http.jetty:4.1.10] at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:383) [org.apache.felix.http.jetty:4.1.10] at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:882) [org.apache.felix.http.jetty:4.1.10] at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1036) [org.apache.felix.http.jetty:4.1.10] at java.lang.Thread.run(Unknown Source)


Resolution

Increae the JSON max result size in OSGi configuration "Apache Sling GET Servlet". Direct link: http://localhost:4502/system/console/configMgr/org.apache.sling.servlets.get.DefaultGetServlet

Apache Sling GET Servlet | AEM Servlet Exception
Apache Sling GET Servlet

 

 

Verbose option not active, closing stdin and redirecting stdout and stderr

We experience this issue at the time of running the AEM jar file. Everything is fine or even using a valid command we are unable to start the AEM service then look and follow.

Error:

java -jar aem-sdk-quickstart-author-p4502.jar -debug 30303
Loading quickstart properties: default
Loading quickstart properties: instance
Low-memory action set to fork
Using 64bit VM settings, min.heap=1024MB, min permgen=256MB, default fork arguments=[-Xmx1024m, -XX:MaxPermSize=256m]
The JVM reports a heap size of 4014 MB, meets our expectation of 1024 MB +/- 20
Debugging requested on port 30303, forcing fork
Preparing to fork JVM, OS name=Windows 10, isWindows=true
Forking JVM: [C:\Program Files\Java\jdk-11.0.15\bin\java.exe, -agentlib:jdwp=transport=dt_socket,address=30303,server=y,suspend=n, -Xmx1024m, -XX:MaxPermSize=256m, -jar, C:/Users/mohammad_r/Downloads/aem-sdk/aem-sdk-quickstart-author-p4502.jar, -nofork, -pt, CHILD]
Java HotSpot(TM) 64-Bit Server VM warning: Ignoring option MaxPermSize; support was removed in 8.0
Listening for transport dt_socket at address: 30303
Loading quickstart properties: default
Loading quickstart properties: instance
Low-memory action set to fork
Using 64bit VM settings, min.heap=1024MB, min permgen=256MB, default fork arguments=[-Xmx1024m, -XX:MaxPermSize=256m]
The JVM reports a heap size of 1024 MB, meets our expectation of 1024 MB +/- 20
Setting properties from filename 'C:/Users/jorvee/Downloads/aem-sdk/aem-sdk-quickstart-author-p4502.jar'
Option '-quickstart.server.port' set to '4502' from filename aem-sdk-quickstart-author-p4502.jar
Verbose option not active, closing stdin and redirecting stdout and stderr
Redirecting stdout to C:\Users\jorvee\Downloads\aem-sdk\crx-quickstart\logs\stdout.log
Redirecting stderr to C:\Users\jorvee\Downloads\aem-sdk\crx-quickstart\logs\stderr.log
Forked JVM process exited with exit code 1
Main JVM process exiting
MAIN process: shutdown hook
MAIN process: exiting

Log file stderr

Low-memory action set to fork
Using 64bit VM settings, min.heap=1024MB, min permgen=256MB, default fork arguments=[-Xmx1024m, -XX:MaxPermSize=256m]
The JVM reports a heap size of 1024 MB, meets our expectation of 1024 MB +/- 20
Setting properties from filename 'C:/Users/mohammad_r/Downloads/aem-sdk/aem-sdk-quickstart-author-p4502.jar'
Option '-quickstart.server.port' set to '4502' from filename aem-sdk-quickstart-author-p4502.jar
Verbose option not active, closing stdin and redirecting stdout and stderr
Redirecting stdout to C:\Users\jorvee\Downloads\aem-sdk\crx-quickstart\logs\stdout.log
Redirecting stderr to C:\Users\jorvee\Downloads\aem-sdk\crx-quickstart\logs\stderr.log
ResourceProvider paths=[/gui, /gui/default]
java.io.IOException: Did not find an available server port, tried 4502
at com.adobe.granite.quickstart.base.impl.exec.PortSelector.selectPort(PortSelector.java:74)
at com.adobe.granite.quickstart.base.impl.Quickstart.<init>(Quickstart.java:147)
at com.adobe.granite.quickstart.base.impl.Main.<init>(Main.java:911)
at com.adobe.granite.quickstart.base.impl.Main.main(Main.java:980)
Quickstart: aborting
CHILD process: shutdown hook
CHILD process: exiting

Resolution

Port 4502 is not available and is being consumed by any other service.

java.lang.NoClassDefFoundError

When we import a Java class in a Java project we sometimes face NoClassDefFoundError and that import is not getting resolved. If you are using IntelliJ IDE then you could resolve this issue by going to the following setting option.

Run >> Edit Configurations >> Click on Modify options >> select Include dependencies with "Provided scope" OR "Add dependencies with "Provided" scope to classpath"

How to check the node property type is single value or multi value in aem?

We can check the type of property(whether single or multiple) using the method isMultiple() of Property interface. Below is an example to check the node property "items" is a single value or multiple values and based on that get the value or values for that property in AEM.

 

Property property = node.getProperty("items");
Value[] values = null;
if(property.isMultiple()){
   values = property.getValues();
} else { 
   values[0] = property.getValue();

} 


Hope this helps. Thank you! 

Select only one checkbox from a group of checkboxes

Create a group of checkboxes and allow only one selection. Here is the sample code for of creating checkbox using simple HTML and JavaScript.


HTML code

<!DOCTYPE html>
<html>
<head>
  <title>Page Title</title>
  <script>
  var checkboxChecked;
  document.addEventListener('input',(e)=> {
    if(e.target.getAttribute('name')=="termsCondition") {
      if(checkboxChecked)
        checkboxChecked.checked=false;
      }
      e.target.checked=true;
      checkboxChecked=e.target;
  })
  </script>
</head>
<body>
  <p>Select only one checkbox from a group of checkboxes.</p>
  <input type="checkbox" name="termsCondition" value="1" /> 1
  <input type="checkbox" name="termsCondition" value="2" /> 2
  <input type="checkbox" name="termsCondition" value="3" /> 3
  <input type="checkbox" name="termsCondition" value="4" /> 4
</body>
</html>

Output



Learn JavaScript and HTML