Expand my Community achievements bar.

SOLVED

Issues in JSP compilation.

Avatar

Level 3

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.

1 Accepted Solution

Avatar

Correct answer by
Level 3

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.

View solution in original post

7 Replies

Avatar

Level 9

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

---jitendra

Avatar

Level 10

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/

Avatar

Former Community Member

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

Avatar

Level 3

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..

Avatar

Level 10

Have you exported you package?

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

Avatar

Level 9

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.

Avatar

Correct answer by
Level 3

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.