Skip to main content
Level 3
Mar 9, 2016 11:55 AM UTC
Solved

Issues in JSP compilation.

Hi,

I am a facing issues with JSP compiling. The classes imported in JSP not getting resolved. Getting errors like  "Only a type can be imported.and class cannot resolves to a package."

 Sometimes it works fine in Author but in publish getting the errors above. Tried the deleting files under "/var/classes/org/apache/jsp" but didnt help.

Any solution to counter this issue with be very helpful. I am using AEM 5.6 version.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
sagarkmr0915Accepted solution
Level 3
Mar 29, 2016 11:12 AM UTC

Bundle in felix has export package value ie all package services are exported. The package name has been added in pom file as well. Today again rebuilt the whole project again and uploaded the bundle via felix console. It started working. Thanks to everyone. This happens frequently. Any suggestions/things or steps to keep in mind while creating a service or calling service from JSP to avoid this issue in future as am not able to find out the root cause yet.

7 replies

Jitendra_S_Toma
Level 10
Mar 9, 2016 12:24 PM UTC

Are you getting service object using sling.getService(...), but importing a class than an interface of a service?.

---jitendra

Translate
edubey
Level 10
Mar 9, 2016 1:06 PM UTC

I am assuming your code is working fine and bundle is in active state.

If its your local publish, try recompiling jsp again using the approach suggested here..

http://adobeaemclub.com/unable-to-recompile-cq5-jsp/

Translate
Mar 11, 2016 8:49 AM UTC

edubey wrote...

I am assuming your code is working fine and bundle is in active state.

If its your local publish, try recompiling jsp again using the approach suggested here..

http://adobeaemclub.com/unable-to-recompile-cq5-jsp/

 

Thanks, this help me

Translate
Level 3
Mar 28, 2016 11:07 AM UTC

edubey wrote...

I am assuming your code is working fine and bundle is in active state.

If its your local publish, try recompiling jsp again using the approach suggested here..

http://adobeaemclub.com/unable-to-recompile-cq5-jsp/

 

Tried the approach, but still the facing the same issue..

Translate
edubey
Level 10
Mar 29, 2016 3:15 AM UTC

Have you exported you package?

Go to bundle description in felix console and can you see your package in export list?

Translate
Hemant_arora
Level 8
Mar 29, 2016 10:55 AM UTC

As edubey mentioned, check the bundle in felix console and click on the bundle and see the exported packages value.

If it is empty, click on the refresh packages button on top right.

If its still empty, then check the pom.xml of the project and add the package to exported packages tag

or move the specific class that you are calling in your jsp to a package which is exported, There are several ways you can fix it.

Translate
sagarkmr0915AuthorAccepted solution
Level 3
Mar 29, 2016 11:12 AM UTC

Bundle in felix has export package value ie all package services are exported. The package name has been added in pom file as well. Today again rebuilt the whole project again and uploaded the bundle via felix console. It started working. Thanks to everyone. This happens frequently. Any suggestions/things or steps to keep in mind while creating a service or calling service from JSP to avoid this issue in future as am not able to find out the root cause yet.

Translate