1

I developed a class DateFormatter in core bundle following blog . and get my date value in header page :

<sly data-sly-use.date="${'com.xxx.DateFormatter' @ date=pageProperties.jcr:created,
     format='dd/MM/yyyy'}"></sly>
<meta name="my_date" content="${date.value}">

This works fine on my local server. However, after I run package install onto remote server. On the author page,it got errors:

Error Message: org.apache.sling.scripting.sightly.SightlyException: Compilation errors in org/apache/sling/scripting/sightly/apps/xxx/components/structure/page/header_html.java: Line 28, column 1285 : Only a type can be imported. com.xxx.DateFormatter resolves to a package Line 106, column 4988 : DateFormatter cannot be resolved to a type

I tried mvn clean and installed bundles onto the remote server but no luck.

Xie Kevin
  • 31
  • 1
  • 7
  • It appears that your remote server is missing a dependency or that it uses a different version of a library than your local one. Is the `DateFormatter` class deployed with the rest of your project or does it come from a separate bundle? What do you see when you try to find the class in `/system/console/depfinder`? – toniedzwiedz Feb 16 '19 at 09:18
  • @toniedzwiedz, thanks for your reply. Yes, the class is in core bundle `com.xxx.core`. and I can find package info of core bundle and `com.xxx.core.models` in `/system/console/depfinder` . but cannot find `com.xxx.core.utils` and `DateFormatter` on it. The class is in the `utils` package. – Xie Kevin Feb 19 '19 at 05:12
  • Check in `/system/console/bundles` if your bundles are deployed and installed properly. Maybe your bundle is missing a dependency and it's not active. – Evaristo Carmona Feb 22 '19 at 07:13
  • 1
    @Evaristo Carmona, verified the bundle is active and this issue is resolved now. Maybe it was not active during that time. Thanks! – Xie Kevin Feb 22 '19 at 13:16

1 Answers1

2

Verified the bundle is active and this issue is resolved now. Maybe it was not active during that time. BTW, I run bundle installation (not installPackage) specially also resolved the issue.

Xie Kevin
  • 31
  • 1
  • 7