Friday, April 29, 2016

Only a type can be imported. xxxxxx resolves to a package - AEM/Adobe CQ5

Only a type can be imported. xxxxxx resolves to a package - AEM/Adobe CQ5

We were receiving the following error in run time due to this the pages got broken. The same scenario was working fine earlier and broken without any code or config change to the server.

We have tried multiple options as follows without any luck
  • Re-deploying the code to affected server
  • Restarting the server
  • Removing run time class files - /var/classes/org/apache
  • Recompile/Clear the JSP classes - http://www.albinsblog.com/2016/04/how-to-clearrecompile-jsp-classes-in-AEM-6.1.html
We could not able to identify the root cause but as a work around manually added a space to the component and saved through CRXDE and that helped to fix the issue.


11 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Hi Albin,

    This will happen as while Uploading/Installing the project Bundle/Jar in to AEM, you will have to refresh all the bundles too along with refreshing only one Jar the has to be Uploaded( Wait for 5-10 sec after clicking on refresh of all bundles).

    This should resolve the issue.

    ReplyDelete
    Replies
    1. Thanks Sumanth.

      This happened all of sudden, we did not uploaded/installed any bundle/jar to the server.

      Looks to be a strange issue.

      Thanks
      Albin I

      Delete
    2. This comment has been removed by the author.

      Delete
  3. Thanks Albin,

    I always face this issue when I upload/Install a bundle and access a Page(In turn jsp/component) while its still restarting.

    While this happens the package is still not available for jsp and the compiled jsp class gets stored under ~crx-quickstart\launchpad\felix\bundleNo\data\apps folder. I either just modify something in the jsp to make the jsp compile again or delete the compiled classes from bundle folder I mentioned earlier and it will resolve the issue for me.

    Thanks,
    Sumanth

    ReplyDelete
  4. Thank you for taking the time to provide us with your valuable information. We strive to provide our candidates with excellent care and we take your comments to heart.As always, we appreciate your confidence and trust in us.

    SAP training in Chennai

    ReplyDelete
  5. Hi Albin,

    If this is not resolved yet. Please try the below approach of increasing service ranking to max value.

    for example:
    @Property(name = "service.ranking", intValue = Integer.MAX_VALUE, propertyPrivate = true)

    Hope this helpss!!!

    Sumanth

    ReplyDelete
  6. Hi Albin,

    Use below code to import your service in jsp or fiddle in AEM.

    SlingBindings bindings = (SlingBindings) req.getAttribute(SlingBindings.class.getName());
    SlingScriptHelper scriptHelper = bindings.getSling();
    MyService service = scriptHelper.getService(MyService.class);

    This is totally working code.

    Hope this helpss-
    Amogh

    ReplyDelete
  7.  http://:<AEM PORT/system/console/slingjsp

    forces all you jsp to recompile when installing bundles, fixes most of the dumb publish app issues when replicating / installing bundles.

    ReplyDelete
  8. this worked for me too, Thanks

    ReplyDelete