adobe / aem-component-generator

AEM Component Generator is a java project that enables developers to generate the base structure of an AEM component using a JSON configuration file specifying component and dialog properties and other configuration options.
Apache License 2.0
113 stars 46 forks source link

Error while including component on page #19

Closed 1412jenne closed 5 years ago

1412jenne commented 5 years ago

While including the generated component in my page im getting the below issue: org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: No use provider could resolve identifier com.cognizant.core.models.DemoComp

The bundle is however in active state.

HitmanInWis commented 5 years ago

What version of AEM? Do you have other sling models in the same package (com.congnizant.core.models) that are working correctly?

1412jenne commented 5 years ago

AEM version used is 6.5 and the sling model version is 1.3.6. Yes it is working fine with our other models in the same package. The issue is only with the generated DemoComp model.

HitmanInWis commented 5 years ago

I'll try to reproduce this today. Can you please share what exact version of AEM (6.5.0, 6.5.1?) and any other related dependency versions that you might think of?

HitmanInWis commented 5 years ago

Tested on 6.5.0, compiling the generator from master branch and using data-config.json basically verbatim (other than setting my package names). It is working as expected for me.

Are your other sling models using the pattern of Interface + Impl class, where the HTL references the Interface class and behind the scenes sling assigns the Impl?

Are you perhaps running AEM in some sort of backward-compatibility mode after a recent upgrade to AEM 6.5?

Here's a bunch of the AEM/Sling/OSGi dependencies we are using, in case that helps debug.

            <!-- OSGi Dependencies -->
            <dependency>
                <groupId>org.osgi</groupId>
                <artifactId>osgi.core</artifactId>
                <version>6.0.0</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.osgi</groupId>
                <artifactId>osgi.cmpn</artifactId>
                <version>6.0.0</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.osgi</groupId>
                <artifactId>osgi.annotation</artifactId>
                <version>6.0.1</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.osgi</groupId>
                <artifactId>osgi.cmpn</artifactId>
                <version>6.0.0</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.osgi</groupId>
                <artifactId>org.osgi.core</artifactId>
                <version>6.0.0</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.osgi</groupId>
                <artifactId>org.osgi.compendium</artifactId>
                <version>6.0.0</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>javax.inject</groupId>
                <artifactId>javax.inject</artifactId>
                <version>1</version>
            </dependency>
            <dependency>
                <groupId>javax.annotation</groupId>
                <artifactId>javax.annotation-api</artifactId>
                <version>1.3.2</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.apache.felix</groupId>
                <artifactId>org.apache.felix.scr.annotations</artifactId>
                <version>1.12.0</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>biz.aQute</groupId>
                <artifactId>bndlib</artifactId>
                <version>1.50.0</version>
                <scope>provided</scope>
            </dependency>

            <!-- Logging Dependencies -->
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>1.7.21</version>
                <scope>provided</scope>
            </dependency>

            <!-- Adobe AEM Dependencies -->
            <dependency>
                <groupId>com.adobe.aem</groupId>
                <artifactId>uber-jar</artifactId>
                <classifier>apis</classifier>
                <version>6.5.0</version>
                <scope>provided</scope>
            </dependency>

            <!-- Apache Sling Dependencies -->
            <dependency>
                <groupId>org.apache.sling</groupId>
                <artifactId>org.apache.sling.api</artifactId>
                <version>2.18.4</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.apache.sling</groupId>
                <artifactId>org.apache.sling.models.api</artifactId>
                <version>1.3.8</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.apache.sling</groupId>
                <artifactId>org.apache.sling.scripting.sightly.compiler</artifactId>
                <version>1.1.2-1.4.0</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.apache.sling</groupId>
                <artifactId>org.apache.sling.scripting.sightly.compiler.java</artifactId>
                <version>1.1.2-1.4.0</version>
                <scope>provided</scope>
            </dependency>

            <!-- Jackson -->
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-annotations</artifactId>
                <version>2.8.4</version>
                <scope>provided</scope>
            </dependency>

            <!-- Servlet API -->
            <dependency>
                <groupId>javax.servlet</groupId>
                <artifactId>javax.servlet-api</artifactId>
                <version>3.1.0</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>javax.servlet.jsp</groupId>
                <artifactId>jsp-api</artifactId>
                <version>2.1</version>
                <scope>provided</scope>
            </dependency>

            <!-- JCR -->
            <dependency>
                <groupId>javax.jcr</groupId>
                <artifactId>jcr</artifactId>
                <version>2.0</version>
                <scope>provided</scope>
            </dependency>

            <!-- javax.inject 1 -->
            <dependency>
                <groupId>org.apache.geronimo.specs</groupId>
                <artifactId>geronimo-atinject_1.0_spec</artifactId>
                <version>1.0</version>
                <scope>provided</scope>
            </dependency>

            <!-- Taglibs -->
            <dependency>
                <groupId>com.day.cq.wcm</groupId>
                <artifactId>cq-wcm-taglib</artifactId>
                <version>5.13.6</version>
                <scope>provided</scope>
            </dependency>
HitmanInWis commented 5 years ago

@1412jenne were you ever able to figure out your issue?

1412jenne commented 5 years ago

No the issue is still persisting.We tried the implementation even in WKND package even there we are having the same issue i.e. the component when placed in page throws an error. Would be great if we could get this fixed.

HitmanInWis commented 5 years ago

is there a way you can package up just the generated pieces of code (all of them) and share via a google drive link or something? I'm at a loss on what your issue might be, since I cannot reproduce it.

HitmanInWis commented 5 years ago

Closing this issue until more information is provided.

smmx commented 4 years ago

I have the same issue, basic 6.5.0 out of the box, just changing the json file and get the "Cannot get DefaultSlingScript" error

HitmanInWis commented 4 years ago

Can you provide a shell of a project, where you strip out any private code, but at least leave the pom build file intact? We run this with AEM 6.5 w/o issues so I need some help in reproducing.

The other option I'd be open to is doing a zoom meeting and trying to debug the issue in pair mode so that we can post the resolution here if it's related to project setup or make a code update to the generator if it's truly a bug with the generator.

smmx commented 4 years ago

Zoom meeting is good if you would be open to that On Nov 26, 2019, 9:43 AM -0500, Brett Birschbach notifications@github.com, wrote:

Can you provide a shell of a project, where you strip out any private code, but at least leave the pom build file intact? We run this with AEM 6.5 w/o issues so I need some help in reproducing. The other option I'd be open to is doing a zoom meeting and trying to debug the issue in pair mode so that we can post the resolution here if it's related to project setup or make a code update to the generator if it's truly a bug with the generator. — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

HitmanInWis commented 4 years ago

Worked with @smmx on this issue, and in this case it was a matter of the new model code not being deployed to AEM. There was an old JAR bundle file sitting under his /apps//install folder and thus the ui.apps build was not pulling the new jar in. Once we removed the old JAR bundle, allowing the new JAR bundle with the generated sling models to be pulled in, everything worked as expected.

So for anyone getting an error like Cannot get DefaultSlingScript: No use provider could resolve identifier com.cognizant.core.models.DemoComp my first recommendation would be to download the bundle jar from AEM and make sure it contains the new classes that have been generated.

nilavobanerjee commented 1 year ago

Hey @HitmanInWis I am facing the same error . Please, can you help me ? I have deleted the jar from apps/install in CRXDE lite What's the name of jar bundle ? that I need to download.

HitmanInWis commented 1 year ago

@nilavobanerjee the bundle name you would be looking for would be custom to your codebase. You can find the name of your deployed bundle in the pom.xml file of folder that contains your java code (probably named core).

Search your pom files for: <packaging>bundle</packaging> and then the bundle name is specified by the artifactId node: <artifactId>THISISTHEBUNDLENAME</artifactId>

HitmanInWis commented 1 year ago

Note that if you are deploying with a version number that is not either a -SNAPSHOT version or a newer version that what is already installed on the AEM instance, that would be at least one possible reason why the new bundle is not deploying.

The other thing you can look for is errors in your log files that indicate a reason why your bundle is not installing.

harshai07 commented 2 months ago

I am getting the same error : org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: No use provider could resolve identifier com.aem.geeks.core.models.Test

I have searched in the OSGI bundle , the project and inside the project the class is present but, i am getting error how to resolve?

HitmanInWis commented 2 months ago

@harshai07 if you downloaded the bundle from AEM, and you can see the class present within it, a couple things I can think to check.

Go to /system/console/bundles and check... 1) Is the bundle in Active state? 2) If you open the details for the bundle, in the Exported Packages section do you see the java package (com.aem.geeks.core.models)

And if you go to /system/console/status-slingmodels do you see anything from com.aem.geeks.core.models?