Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Does same code package is allowed in different bundles?

Avatar

Level 3

Having the same package in two different bundles, but the classes are different. 

Ex : two bundles has same package x.y.z but classes are different.

 Bundle 1 : 

       x.y.z.ClassA

Bundle 2 : 

      x.y.z.ClassB

Now I am trying to use this classes in JSP files , it is throwing me the error 

Caused by: org.apache.sling.api.SlingException: javax.servlet.ServletException: java.lang.Error: Unresolved compilation problems: 
    Only a type can be imported. x.y.z.ClassA resolves to a package
    ClassA cannot be resolved to a type

1 Accepted Solution

Avatar

Correct answer by
Level 10

I would strongly recommend that you use different Java packages in different bundles. FRom personal experience - I have found that different Java Packages in different bundles work much better. 

View solution in original post

1 Reply

Avatar

Correct answer by
Level 10

I would strongly recommend that you use different Java packages in different bundles. FRom personal experience - I have found that different Java Packages in different bundles work much better.