Does same code package is allowed in different bundles? | Community
Skip to main content
Level 3
February 18, 2016
Solved

Does same code package is allowed in different bundles?

  • February 18, 2016
  • 1 reply
  • 629 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by smacdonald2008

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. 

1 reply

smacdonald2008
smacdonald2008Accepted solution
Level 10
February 18, 2016

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.