Not able to import a class in aem component jsp | Community
Skip to main content
ajinkayk6258253
Level 3
April 7, 2020
Solved

Not able to import a class in aem component jsp

  • April 7, 2020
  • 2 replies
  • 4378 views

Hi All,

 

I'm want to use an api for encoding in my component's jsp and in my servlet which consist some backend logic. i have added dependency in my core,ui,parent's pom file. i'm able to import the class in the servlet and other java classes. but importing same class in component jsp is giving error only a type can be imported. i have tried giving package name in exported-packages and made other possible changes. any help? 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Surabhi_Katiyar

This error is usually because that package is not exported (or the bundle exporting it is not active), so not available to the JSP compiler.

Can you please check below points:

  1. Make sure that all bundles are active
  2. Make sure that a bundle actually exports this class
  3. Can you try:
  • rebuild clientlibs http://host:port/libs/granite/ui/content/dumplibs.rebuild.html
  • recompile JSP via http://host:port/system/console/slingjsp

2 replies

ArpitVarshney
Community Advisor
Community Advisor
April 7, 2020

@ajinkayk6258253 Please verify first whether your bundle is in resolved state in OSGi console.If no then please make sure that it should be resolved in OSGi and then try to use.

 

If you are not able to figure out then provide detailed information of your issue.

ajinkayk6258253
Level 3
April 7, 2020
@arpitvarshney Sorry i forgot to mention that bundle is in active state
Surabhi_Katiyar
Adobe Employee
Surabhi_KatiyarAdobe EmployeeAccepted solution
Adobe Employee
April 7, 2020

This error is usually because that package is not exported (or the bundle exporting it is not active), so not available to the JSP compiler.

Can you please check below points:

  1. Make sure that all bundles are active
  2. Make sure that a bundle actually exports this class
  3. Can you try:
  • rebuild clientlibs http://host:port/libs/granite/ui/content/dumplibs.rebuild.html
  • recompile JSP via http://host:port/system/console/slingjsp