Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

Core Project has dependency on javax.inject [0,1) Bundles and imports not getting deployed

Avatar

Level 4

Capture.PNG

I Have many dependencies on java and director service but none gets deployed. there are no packages imported as well.

<Import-Package>javax.inject;version=0.0.0,*</Import-Package>

<Sling-Model-Packages>

${project}.core

</Sling-Model-Packages>

Is this expected ?

26 Replies

Avatar

Level 10

This means you are not using the correct POM dependencies. If you are using AEM 6.3 - use UBER 6.3. See this article - Scott's Digital Community: Creating an Adobe Experience Manager 6.3 Project using Adobe Maven Archet...

Avatar

Level 4

If you are missing any particular Dependency you can try add those in apps/pom.xml file

Under <dependencies><dependency>what ever you are missing</dependency></dependencies>

we faced the same problem, it fixed for us it may help.

Avatar

Community Advisor

Can you add

<!-- Import any version of javax.inject, to allow running on multiple versions of AEM -->

<Import-Package>javax.inject;version=0.0.0,*</Import-Package>

to your bundles pom.xml. This should solve your issue. This says take any version from the felix console for this bundle.  Add it under maven-scr-plugin

1318722_pastedImage_1.png

Avatar

Level 4

I think i have the same code Veena. Is something wrong with this code.    

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

                <executions>

                    <execution>

                        <id>bundle-manifest</id>

                        <phase>process-classes</phase>

                        <goals>

                            <goal>manifest</goal>

                        </goals>

                    </execution>

                </executions>

                <configuration>

                    <instructions>

                        <!-- Import any version of javax.inject, to allow running on multiple

                            versions of AEM -->

                        <Import-Package>javax.inject;version=0.0.0,*</Import-Package>

                        <Sling-Model-Packages>

                            com.project.core

                        </Sling-Model-Packages>

                    </instructions>

                </configuration>

Avatar

Employee Advisor

What is the problem? I don't see anything in your original post. javax.inject is imported properly.

Jörg

Avatar

Level 4

I have couple of services not getting deployed. This code is from AEM 5.6. Dependencies we updates there were no errors. But code was not getting deployed.

Avatar

Level 4

Only java code rest of components were getting deployed. I am unable to see java code and import packages in console

Avatar

Employee Advisor

what do you mean with "not deployed". Can you share relevant log entries from the error.log?

Jörg

Avatar

Level 10

Show screemshot of the OSGi bunlde in Felix console - i suspect you are not building your bundle correctly. Did you refer to the Sling Model article that i shared?

Avatar

Level 4

Capture.PNG

This service is from 5.6. Like these there are three other services which are not there in 6.3 with same code. I have updated java dependencies. I am unable to see any of the imported packages as well as above

Avatar

Level 10

When you built this for AEM 6.3 - did you use UBER 6.3 JAR  and Maven 11 Archetype and dependencies listed in this article --

Creating an Adobe Experience Manager 6.3 Project using Adobe Maven Archetype 11

Avatar

Level 10

If you built this example and put your Java code into the sample project - you will be able to successfully built it and get it deployed.

Avatar

Level 4

     Hi Donald,

<dependency>

                <groupId>com.adobe.aem</groupId>

                <artifactId>uber-jar</artifactId>

                <version>6.3.0</version>

                <classifier>apis</classifier>

                 <scope>provided</scope>

          </dependency>

I have used Maven Archetype 11 to built 6.3 system.

Avatar

Level 10

Build the sample project in the Maven 11 artilce I listed. Get the project built. Then once you confirm that is up and running - you can build off of that project. So 1st - built that and post back when its working.

Avatar

Community Advisor

There could be many reasons your bundles may not be reflecting .  If the project is in 5.6 ; there could be syntax mismatches for the services because of which this is not loading. Go to your services in felix console and check if your services are in active state ?

But first step; just take your logs and check if anything is specifically logged regarding your bundles.

I don't see any error in your bundle which says anything is unresolved in the screenshot you provided .

Avatar

Employee

Can you try this?

  <!-- needed for javax.Inject -->

  <dependency>

  <groupId>javax.inject</groupId>

  <artifactId>javax.inject</artifactId>

  <version>1</version>

  <scope>provided</scope>

  </dependency>

Avatar

Level 10

DId you build the sample Maven 11 project i pointed you to?

Avatar

Level 4

Hi Donald,

I have created sample maven project with archetype 11. It has no issues.