Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

NoClassDefFoundError in AEM

Avatar

Avatar
Validate 1
Level 3
trc41594544
Level 3

Likes

16 likes

Total Posts

43 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 5
Ignite 3
Ignite 1
Give Back 5
View profile

Avatar
Validate 1
Level 3
trc41594544
Level 3

Likes

16 likes

Total Posts

43 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 5
Ignite 3
Ignite 1
Give Back 5
View profile
trc41594544
Level 3

09-07-2018

Hi,

I am working on custom Sling Filter in AEM 6.2 SP1. I am running in to issue where i am getting runtime whenever i upload my project JAR for one service.

The error is :

Error during instantiation of the implementation object (java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest)

java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest

  at java.lang.Class.getDeclaredConstructors0(Native Method)

  at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)

  at java.lang.Class.getConstructor0(Class.java:3075)

  at java.lang.Class.newInstance(Class.java:412)

.

.

.

Caused by: java.lang.ClassNotFoundException: javax.servlet.http.HttpServletRequest not found by com.*.*.core [1423]

  at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1574)

  at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:79)

  at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2018)

I do not have any issues while compiling the project. It complies with out a problem. I am having javax.servlet as a dependency in POM. I tried with different versions of that also. I am running in to this issue every time i install jar in publish or author instance.

Any ideas or help would be appreciated.

Thanks

Replies

Avatar

Avatar
Give Back 5
Level 4
aneeta45259594
Level 4

Likes

46 likes

Total Posts

67 posts

Correct Reply

27 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back 10
Give Back
Boost 5
View profile

Avatar
Give Back 5
Level 4
aneeta45259594
Level 4

Likes

46 likes

Total Posts

67 posts

Correct Reply

27 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back 10
Give Back
Boost 5
View profile
aneeta45259594
Level 4

09-07-2018

trc41594544

You have to ensure that the dependency javax.servlet.http.httpservletrequest is available in AEM. For this, go to /system/console/depfinder and search for javax.servlet.http.httpservletrequest and see which bundle exports it. You can then update you dependency accordingly and try re-uploading your jar.

Regards,

Aneet Arora

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,408 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,408 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

09-07-2018

AEM does not expose that Java package --

M444.png

Avatar

Avatar
Validate 1
Level 3
trc41594544
Level 3

Likes

16 likes

Total Posts

43 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 5
Ignite 3
Ignite 1
Give Back 5
View profile

Avatar
Validate 1
Level 3
trc41594544
Level 3

Likes

16 likes

Total Posts

43 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 5
Ignite 3
Ignite 1
Give Back 5
View profile
trc41594544
Level 3

09-07-2018

Hi,

Can you let me know what can be done then? I am not sure how to proceed with this.

Thanks

Avatar

Avatar
Validate 1
Level 3
trc41594544
Level 3

Likes

16 likes

Total Posts

43 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 5
Ignite 3
Ignite 1
Give Back 5
View profile

Avatar
Validate 1
Level 3
trc41594544
Level 3

Likes

16 likes

Total Posts

43 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 5
Ignite 3
Ignite 1
Give Back 5
View profile
trc41594544
Level 3

10-07-2018

Hi,

I think you tried wrong Jar file in depfinder. It should be javax.servlet.http.HttpServletRequest and you are looking for javax.servlet.http.httpservletrequest.

I have tried to add the dependency also but it did not worked.

Thanks

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,408 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,408 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

10-07-2018

You need to get a physical JAR file that contains this Java package, wrap that JAR into an OSGi bundle and then deploy that OSGi bundle to AEM. It has nothing to do with adding a dependency to the POM when you build the bundle. THe issue is this Java package is not in the AEM OSGi service container. That is, no OSGi bundle exposes that Java package.

Avatar

Avatar
Give Back 5
Employee
Andrew_Khoury
Employee

Likes

75 likes

Total Posts

93 posts

Correct Reply

33 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back 10
Give Back
Boost 50
View profile

Avatar
Give Back 5
Employee
Andrew_Khoury
Employee

Likes

75 likes

Total Posts

93 posts

Correct Reply

33 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back 10
Give Back
Boost 50
View profile
Andrew_Khoury
Employee

11-07-2018

Is your jar file an OSGi bundle?

If so what do you have defined as the Bundle-SymbolicName?  You can get the Bundle-SymbolicName from the META-INF/MANIFEST.MF file in the jar file.

The reason I ask is because com.*.*.core is weird in this error message:

Caused by: java.lang.ClassNotFoundException: javax.servlet.http.HttpServletRequest not found by com.*.*.core [1423]