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

Unable to load bean.xml in AEM java

Avatar

Avatar
Validate 1
Level 2
rasikawanjari
Level 2

Likes

6 likes

Total Posts

22 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
View profile

Avatar
Validate 1
Level 2
rasikawanjari
Level 2

Likes

6 likes

Total Posts

22 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
View profile
rasikawanjari
Level 2

22-04-2019

Am trying to load bean.xml file but am getting following error

IOException parsing XML document from class path resource [bean.xml]; nested exception is java.io.FileNotFoundException: class path resource [bean.xml] cannot be opened because it does not exist

This is line of code am using to load bean file is

ApplicationContext context = new ClassPathXmlApplicationContext("bean.xml");

bean.xml file present in src/main/resources folder

provide any solution ASAP..

Replies

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

22-04-2019

THIS API (org.springframework.context.ApplicationContxt) is not an AEM API.

Looks like you are attempting to use Spring MVC API in AEM.

To develop in AEM - you should use Sling APIs, OSGi, etc, See this article as a guideline on how to develop against AEM:

Getting Started with AEM Sites - WKND Tutorial

Avatar

Avatar
Validate 1
Level 2
rasikawanjari
Level 2

Likes

6 likes

Total Posts

22 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
View profile

Avatar
Validate 1
Level 2
rasikawanjari
Level 2

Likes

6 likes

Total Posts

22 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
View profile
rasikawanjari
Level 2

24-04-2019

I have dependency on external customized jar so i have to use ApplicationContext to load bean.xml
is there any solution ?
because which is working  in eclipse  but not in AEM server .

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

24-04-2019

The reason it's not working is that you are attempting to use AEM as if its a Spring-based platform.

ApplicationContext is a Spring API: Understanding application-context

As discussed in the WEEKEND tutorial - an AEM site is implemented using:

  • HTL
  • Sling Models
  • Touch UI
  • Core Components v2
  • Editable Templates
  • Style System
  • Maven AEM Project Archetype 15

Not Spring APIs.

I also know SPRING MVC and how it works with Controllers, Views, and Models and annotations like @autowired. AEM uses none of these.

AEM uses OSGi based R6, R7 annotations (like @Reference) : Using OSGi R6 annotations (>= AEM6.2) - Experience Delivers