Hey everyone,
I have an AEM project where a utility class is found in the core module and is referenced in the apps module in an asset.jsp overlay. However, whenever I attempt to bring up the page in AEM which uses the overlay I am getting an exception that the overlay could not be compiled because this the module reference class could not be found.
Any help would be appreciated.
Error Log
==> error.log <==
09.04.2020 00:18:38.206 *ERROR* [0:0:0:0:0:0:0:1 [1586416718199] GET /mnt/overlay/dam/gui/content/assets/jcr:content/views/list.0.40.html/content/dam/site/aem/jobnumber/assetfolder HTTP/1.1] org.apache.sling.engine.impl.SlingRequestProcessorImpl service: Uncaught SlingException
org.apache.sling.scripting.jsp.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 7 in the generated java file
Only a type can be imported. com.site.assets.core.utils.statusutil resolves to a package
at org.apache.sling.scripting.jsp.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:93)
at org.apache.sling.scripting.jsp.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
at org.apache.sling.scripting.jsp.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:136)
at org.apache.sling.scripting.jsp.jasper.compiler.Compiler.compile(Compiler.java:304)
at org.apache.sling.scripting.jsp.jasper.compiler.Compiler.compile(Compiler.java:282)
at org.apache.sling.scripting.jsp.jasper.compiler.Compiler.compile(Compiler.java:269)
at org.apache.sling.scripting.jsp.jasper.JspCompilationContext.compile(JspCompilationContext.java:501)
at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.prepareServlet(JspServletWrapper.java:427)
at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:486)
at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:449)
at org.apache.sling.scripting.jsp.JspScriptEngineFactory.callJsp(JspScriptEngineFactory.java:346)
at org.apache.sling.scripting.jsp.JspScriptEngineFactory.access$100(JspScriptEngineFactory.java:101)
site.core POM
<plugins>
<plugin>
<groupId>org.apache.sling</groupId>
<artifactId>maven-sling-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Import-Package>!com.csvreader.*,javax.inject;version=0.0.0,*</Import-Package>
<Sling-Model-Packages>
com.site.assets.core
</Sling-Model-Packages>
</instructions>
</configuration>
</plugin>
</plugins>
asset.jsp Imports
<%@page import="org.apache.sling.api.resource.Resource"%>
<%@page import="com.site.assets.core.utils.statusutil"%>
<%@taglib prefix="cq" uri="http://www.day.com/taglibs/cq/1.0"%>
<%@include file="/libs/dam/gui/coral/components/admin/contentrenderer/base/init/assetBase.jsp"%>
<%@include file="/libs/dam/gui/coral/components/admin/contentrenderer/base/insightBase.jsp"%>
<%@include file="/libs/dam/gui/coral/components/admin/contentrenderer/row/common/common.jsp"%>
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
Hi,
The error seems quite informative to me:
Only a type can be imported. com.site.assets.core.utils.statusutil resolves to a package
So what are you trying to import exactly?
Also, make sure thal all your packages include a package-info.java file.
Hi,
The error seems quite informative to me:
Only a type can be imported. com.site.assets.core.utils.statusutil resolves to a package
So what are you trying to import exactly?
Also, make sure thal all your packages include a package-info.java file.
Hi,
statusutil is a class where the package is com.site.assets.core.utils.
I am attempting to import the statusutil class so that I can use a static method inside the class to retrieve a status. However, on the import of the class I am getting the exception which I am confused about since I am able to link to it and build the project. At runtime it just seems that it cannot find the class to import.
Views
Replies
Total Likes
Views
Replies
Total Likes
Overall, the naming is specifically for posting the question on the forum. In the project it is named with the casing you specified in your comment.
I have tried the solutions you specified but by the time I attempt to use the class it says the same message of not being able to resolve the dependency and resolving to the package instead of the type.
I'm thinking it has to do with the fact that I am attempting to import a package from the core module into my apps module in the same AEM project.
Views
Replies
Total Likes