Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

How To Integrate AEM with Existing Java web application

Avatar

Level 2

How To Integrate AEM with Existing Java web application

1 Accepted Solution

Avatar

Correct answer by
Level 10

AEM front end logic (JSP or HTL) communicate with Java backend OSGi services using: 

So in both cases - a front end AEM component is interacting with Java located in an OSGi bundle located in the AEM OSGi service container. 

Having said that - the only way i can think of to successfully let an AEM front end interat with Java located on a J2EE servlet outside of AEM is to build an AEM component and use AJAX to invoke a servlet outside of AEM: 

//Use JQuery AJAX request to post data to a Sling Servlet
 $.ajax({
         type: 'POST',    
         url:<URL OUT OF AEM>/mySearchServlet',
         data:'id='+ claimId+'&firstName='+ myFirst+'&lastName='+ myLast+'&address='+ address+'&cat='+ cat+'&state='+ state+'&details='+ details+'&date='+ date+'&city='+ city,
         success: function(msg){
           alert(msg); //display the data returned by the servlet
         }
     });

View solution in original post

9 Replies

Avatar

Level 10

Please provide more details. You ca n interact with AEM from Java in different ways. Ie - a External Java app can use JCR API to perform read/update operations on the JCR.

Avatar

Level 2

We have existing java web application which uses struts, EJB and some other technologies. We want migrate one by one module to AEM.

Is it possible to have some modules on AEM and Some Modules on Existing Jboss server? and also Can we use the Existing back end code with AEM?

Avatar

Level 10

Is it possible to have some modules on AEM

I am assuming that you want to transfer Java logic from EJB to AEM when you state we want migrate one by one module to AEM. 

AEM does not support EJB. What you need to port your Java that is in EJB to OSGi. AEM is based on Apache SLing/OSGi frameworks. If you have servlets on your other Java app - you need to port them to Sling Servlets. 

I would recommend porting as much Java code to OSGi as possible. 

Hope this helps. 

Avatar

Level 2

Can we Only UI from AEM and Back end Logic in Jboss Server. Can  AME Pages communicate The business logic reside on jboss server(Existing Application).

I mean to say I want only migrate the front to AEM and Back end as it is.

Avatar

Correct answer by
Level 10

AEM front end logic (JSP or HTL) communicate with Java backend OSGi services using: 

So in both cases - a front end AEM component is interacting with Java located in an OSGi bundle located in the AEM OSGi service container. 

Having said that - the only way i can think of to successfully let an AEM front end interat with Java located on a J2EE servlet outside of AEM is to build an AEM component and use AJAX to invoke a servlet outside of AEM: 

//Use JQuery AJAX request to post data to a Sling Servlet
 $.ajax({
         type: 'POST',    
         url:<URL OUT OF AEM>/mySearchServlet',
         data:'id='+ claimId+'&firstName='+ myFirst+'&lastName='+ myLast+'&address='+ address+'&cat='+ cat+'&state='+ state+'&details='+ details+'&date='+ date+'&city='+ city,
         success: function(msg){
           alert(msg); //display the data returned by the servlet
         }
     });

Avatar

Level 2

Thank You for the info if i need any thing can i contact you ?

Avatar

Administrator

srinivasarao Bora wrote...

Thank You for the info if i need any thing can i contact you ?

 

 

You can always reach-out to Adobe AEM Forums to get answer/response from the experts.

~kautuk



Kautuk Sahni

Avatar

Level 2

Hi I want to know some more info

Can i have any expert contact no.

 

Thanks,

Srini

Avatar

Level 10

"Can we Only UI from AEM and Back end Logic in Jboss Server. Can  AME Pages communicate The business logic reside on jboss server(Existing Application)."

That is not best practice - actually a very bad practice. Keep you Java logic in OSGi bundles deployed in the service container.