YouTube Icon

Interview Questions.

Top 100+ Java Liferay Interview Questions And Answers - May 31, 2020

fluid

Top 100+ Java Liferay Interview Questions And Answers

Question 1. What Is A Liferay Portal?

Answer :

In trendy, a web portal represents an internet utility that provides a unmarried point of get right of entry to to form of records. 

Functionality of a portal can extended very easily by means of developing custom programs which could run internal a portal. These applications are referred to as portlets. 

For jogging portlets you need application server which can run a portlet field spec (JSR168 or JSR286). There are dozens of unfastened and organization portal merchandise available. 

Liferay portal is an open supply portal and underneath are the advantages of the use of Liferay portal: 

Content control gadget(Documents, Articles).
2-degree,three-stage workflows and publishing.
Social networking. 4)Sites and enterprise basis pages.
Integration with 1/3 birthday celebration like LDAP, Solr, SSO(CAS, Siteminder).
Portlets realted to Wiki's, News, Finance, Social, Workflow, Collaboration.
Compatible with extraordinary Operating systems, databases and APP servers.
Compatible with UI technologies and net offerings.
Compatible with specific scripts like PHP, Ruby, Grails, Python.
Suppport of warm deployment feature.
Question 2. What Is A Portlet?

Answer :

Liferay portal comes with exclusive portlets through default. These portlets are nothing however unique small applications strolling in the example(portal). Portlets are pluggable software program additives which are controlled in a web portal. 

In trendy words you can call them as unique catalogues as portlets produce fragments of markup code which can be aggregated right into a portal. So a portal web page is displayed as a group of portlet, thease a couple of small programs together making a page of the website online and those all pages collectively makes one network or employer portal. Hence a portlet (or series of portlets) resembles an internet-based utility this is hosted in a portal. 

Portlet is a small software to meet the requirement of positive area. Inter portlet verbal exchange is supported beneath Liferay portal. Portlet help warm deployment characteristic of Liferay Portal.

Adv Java Interview Questions
Question three. What Is The Difference Between Hook, Ext And Portlet?

Answer :

Liferay affords 3 approaches to increase the capability of a Liferay portal. Each of the manner fits is right for exclusive desires.

Hook:

Liferay portal comes with a package deal wherein all the default built in portlets exist. Typically if any customization required in phrases of JSP (UI) and portal houses. We need to head through Hook implementation. Hook is supported by warm deployment. Liferay documentation suggests that - Whenever feasible, hooks should be used in area of Ext plugins, as they're warm-deployable and more forward well suited.

Some commonplace situations that require the use of a hook are: 

When you need to perform a custom motion on portal startup
When you need to carry out a custom movement on user login
When you need to overwrite or amplify portal JSPs
When you need to regulate portal properties
When you want to replace a portal carrier along with your very own implementation.
EXT:

Liferay EXT Plugins are the maximum effective manner to increase the portal capability. If any customization required within the middle stage training then it could be carried out thru EXT as an example LDAP customers and consumer corporations import amendment. But here in EXT, restart could be required.

EXT Plugins have to be used best in case the portal capability cannot be extended the use of Portlet of Hooks. The EXT plugins are complicated to broaden and can reason renovation problems in case you are trying to upgrade.

From liferay documents, The major use cases wherein an Ext plugin may be used are:

Customizations to portal.Homes (that is not supported via Hook Plugins)
Customizing and making adjustments to the Struts Actions for portal
Customizations of the Liferay beans declared in Liferay's Spring documents
Adding JSPs which can be referenced from portal homes that may handiest be changed from an ext plugin (be sure to test if the assets may be changed from a hook plugin earlier than doing this)
Direct overwriting of a category (no longer recommended until it is strictly important)
Portlet:

Portlets are the most not unusual and easiest way to extend and offer a custom capability for a liferay portal. This is a small utility to fulfill the requirement of certain area. It is largely a bunch of code(Java Files, JSP, CSS, Java Scripts and so on.). Portlet is supported through hot deployment.

Liferay additionally has a marketplace where lots of beneficial portlets are available for download and those portlets can contributed by means of absolutely everyone in the world. We these days contributed a Speed reading portlet and a My IP Address portlet in this marketplace without spending a dime use by liferay network. 

Question 4. What Jsr Version Liferay Implements? Why Jsr Compatibility Is Important While Choosing A Portal?

Answer :

JSR is a "Java Specification Request". Liferay Portal is developed to adhere to JSR 168 and JSR 286 specifications. 

This specification is created by way of committee of JEE portal companies. This specification is designed to obtain interoperability between special portals and portlets.

Liferay supports specially below JSRs: 

JSR-168(Portlet 1.Zero) 
JSR-286(Portlet 2.Zero) 
JSR-127(JSF 1.0) 
JSR-170 
JSR-314(JSF 2.0) 
JSR-329

Why these requirements are described?

These requirements are defined for the gain of portal customers (give up clients). Before those requirements had been born, portal purchaser have been required to use one portal and there has been no smooth way to switch between extraordinary portal carriers. Earlier portal were very vendor specific and all capability were developed the use of proprietary API, era and programming strategies. The JSR 168 and JSR 286 standards have defined the manner portlets can be evolved with a view to assist users in long run. 

Benefits of Following JSR Standards:

Following these standards will make sure that there is no dealer lock in. However this will be assured simplest when the portlets are developed sticking to the requirements.

Adv Java Tutorial
Question 5. What Is A Portlet Lifecycle?

Answer :

Following is the portlet lifecycle: 

init(): It specially initializes the portlet.

Render(): It takes the HTML output to User Interface. It specifically render the view in time period of JSP/HTML code and show into the respective portlet.

Destroy: This method takes care of releasing the portlet resources.

J2EE Interview Questions
Question 6. What Is The Difference Between View Mode And Edit Mode Of Portlets?

Answer :

The modes of a portlet are normally associated with the types of operations a user can carry out at the portlet. A view mode is where users are allowed to do read handiest operations, whereas in edit mode consumer can add/replace the facts within the portlet. 

Each portlet mode has a method which handles it:

doView()
doEdit()
doHelp()

These techniques will contain especially our "visitors directing" good judgment, which can be accountable to determine what view the user wants to see.

Once the view has been decided, we are able to forward directly to strategies which clearly implement that view.

For standard portlet view modes have two perspectives:

The default view which shows the listing of items.
The shape, wherein customers will specially do the add and edit motion.
In this in which cease person can edit the specific object, is called edit mode of portlet.
Question 7. What Is A Liferay Theme? What Are The Advantages Of Using Them?

Answer :

Liferay themes are the manner to customize appearance and experience of a liferay portal web page. The subject matters are extendable components that may be deployed one by one on a portal and each page on the portal can choose a exceptional subject matter (if required).

Themes are certainly powerful way to run more than one web sites from a single portal. You can host more than one websites on a single liferay portal with definitely exceptional appearance and experience. This permits you to be precise on the same time keep lots resources on hosting. 

A lot of agencies use liferay for creating multiple specific web sites with the assist of super themes that can be without difficulty developed. 

Themes also are available from market.

For developing on our own, we have choice of the usage of VM pages(Velocity templates). Liferay presents the function to install the exclusive topics into the portal identical like portlets struggle files. So quantity of themes we may be deployed into Liferay portal and we can in addition choose the ones topics for person interface as according to the requirement of end person for one of a kind website online or enterprise pages.

J2EE Tutorial Core Java Interview Questions
Question eight. How To Use Ldap Authentication With Liferay?

Answer :

LDAP is light-weight directory get entry to protocol this is most typically used for authentication and authorization of users. LDAP specially is composed users and usergroups of any business enterprise with certain serach filter out like DN entries. In the control panel of liferay we've got choice to offer the LDAP settings so that portal can touch the 1/3 celebration like LDAP and fetch the required users and organizations as in step with given mappings.

For example Active directory is a LDAP implementation that may save customers. Liferay support integration of any LDAP implementation via its admin control panel. 

We want to provide the settings on top of things panel - > portal settings -> LDAP

This will require LDAP URL, username, password, users search filters mappings, agencies search filters mapping and so forth.

Question nine. What Is Portal-ext.Houses File? How This Can Be Configured And Used In Liferay?

Answer :

Liferay Portal comes with default configurations which are saved in portal.Belongings record. You can use portal-ext.Residences record to override the values in portal.Houses file. 

This allows you a smooth way to maintain your very own copy of configurations that can be used outdoor the portal at the same time you can effortlessly upgrade the portal.

JSP Interview Questions
Question 10. What Is Inter-portlet Communication? Why Is It Required To Use Jsr Style Inter-portlet Communication?

Answer :

Sometimes we've the requirement where we want to set up communique in between  portlets as an example any movement performed in a single portlet redirecting the cease user to different portlet wherein some form of result is showing as according to movement accomplished on first portlet. 

So in this use case we should use liferay inter-portlet verbal exchange mechanism which serve the motion completed with the aid of quit user in a single portlet and offer the end result to the second one portlet wherein the motion end result needs to be displayed. We can say that it really works on striker-catcher mechanism. 

JSR fashion inter portlet conversation guarantees that your portlets are going to work on some other JSR compliant portal server. If you use a liferay unique manner to communicate between portlets than you could not be able to install and run the same portlet conflict on any other JSR compliant portal (e.G. Apache Pluto)

Core Java Tutorial
Question eleven. What Is A Liferay Portal Instance?

Answer :

Liferay portal ships with the only liferay portal tomcat package deal that's up and running in any server with positive database settings. We will have a couple of liferay instances walking from one database.

Liferay Portal permits you to run a couple of portal instance on a unmarried server. The Portal Instances page of the control panel lets you manage those times. Data for each portal instance are stored separate. All portal records, however, is stored in the equal database.

Each portal instance requires its very own area call. Liferay will direct users to the proper portal instance primarily based on this area call. So earlier than you configure an instance, we want to configure its domain call in our community first. When we are geared up to add an example, click the Instances tab - > Add button.

It will be triggered for 4 fields and a check container:

Web ID: A wellknown conference is to apply the domain call for this. It’s a person-generated ID for the example.

Virtual Host: Put the area call you configured to your community right here. When users are directed to your Liferay server through this domain name, Liferay will then be able to send them to the proper portal instance.

Mail Domain: Enter the domain name for the mail host for this instance. Liferay will use this to send e mail notifications from the portal.

Max Users: Enter the most numbers of person accounts you would really like your portal example to help.

Active: Use this test field to choose whether or not to create an active or an inactive portal instance.

Now we need to click on Save. Now navigate to the portal using new area name. We will see that looks as if a easy installation of Liferay. This is our new portal instance that can now be up and jogging.

Java-Springs Interview Questions
Question 12. How Can I Configure Two Different Domain Names (e.G. First.Example.Com And Second.Instance.Com) On Liferay?

Answer :

At the time of creation of any web site we want to provide domain names which further take it as web site domain call. We need to provide the certain area name as required through the manage panel of liferay portal. Single instance of Liferay Portal helps web hosting of  or more domain names through communities(websites). 

When we will visit manipulate panel -> Site settings -> we will provide the website URL, details like site(community) description, membership type, energetic repute and digital host.

Adv Java Interview Questions
Question thirteen. How Can I Configure Liferay To Use Email Address As User Name Instead Of Screen Name?

Answer :

We can set this from manipulate panel -> portal settings -> Authentication -> LDAP -> How do users authenticate?. Here we can pick something we require from electronic mail cope with,display screen call or person ID. At the time of LDAP authentication, we need to offer the specified LDAP mappings which basically reads all the information related to customers and usergroups from LDAP listing and import into Liferay portal. At the time of this connection with third birthday party we need to present the desired subject like authentication have to be by way of email address or display name or user ID.

JSP Tutorial
Question 14. How To Customize The Behavior Of Liferay Default Out Of The Box Portlets (e.G. Document View, Calendar, Blog, Wiki Etc) ?

Answer :

If we want any customization, associated with JSP and UI then we can put in force this using Hooks. Liferay portal comes with a package deal where all of the default built in portlets exist.

If any customixation required within the core level instructions then it may be finished via EXT as an instance LDAP users and person corporations import amendment. But here in EXT, restart could be required.

Question 15. What Is Liferay Service Builder? Is There Any Alternative To Use Service Builder? What Are The Advantages And Disadvantages Of Using It?

Answer :

Liferay provider builder is basically used to create the provider layers for any enterprise logic implementation. From developer factor of view it's miles very helpfull as it used to create all the service layers computerized. Suppose we want to broaden a portlet, for this we need to write down all of the required implementation lessons, utility cleasses and other required training. Service builder is used to create a lot of these lessons for developer, where they are able to add their enterprise logic in addition and process the records and render the output to view as in keeping with the requirement. 

As in line with the benefit, this service builder will create complete structure of the carrier layers for developer specially. It really facilitates them to write down the code and their good judgment in carrier builder created model implementations and carrier implementation training. These instructions comes with ordinary CRUD (create, update and delete)operations. For developer, no want to feature whatever extra as whole carrier and utility layers are already were given created with the aid of service builder. It absolutely accelerate the developement process.

Service builder calls for carrier.Xml which is having some of the required entries. Each of the entry is basically known as entity, that is having it is primary key fields with some different required fields. If we want to put into effect order and finder technique, we will put in force it through the use of this carrier.Xml. 

Each entity creates desk into liferay configured database with the given column names and their types. We can create carrier.Xml related local-carrier and far off-provider by using setting them cost as "actual". When we would run this build-carrier like beneath, this would create all of the carrier layers(implementation, application etc.) wherein developer can write their required commercial enterprise good judgment in addition. Creation of all the provider-lessons could be performed by way of the construct.Xml, we need to build-services the use of this xml report into Ant view of IDE.

JMS(Java Message Service) Interview Questions
Question 16. How To Set The Display Category Of A Custom Built Liferay Portlet ?

Answer :

We can set the display class like below stated liferay-show.Xml. Suppose we have advanced one portlet where portlet ID we've got furnished. We want to enter the custom constructed liferay portlet into sure category like name "category.Cms", "category.Collaboration" and so on.

By doing this practice constructed liferay portlet could are available required category by clicking the upload utility function of liferay as there could be a lot of portlets beneath unique classes. So below tag we want to enter for the entry of a portlet into sure class.

<display>
<category name="category.Cms">
<portlet id="20" />
</category>
</display> 

Java-Springs Tutorial
Question 17. How To Support Internationalization (i18n) On Liferay Portlets? How Do You Support Multiple Languages Without Writing Java Code In Liferay?

Answer :

We can assist internationalization (i18n) on Liferay portlets and through out this complete Liferay portal. We want to provide some thing language we want to help into LIferay portal. This is mainly reads the regions range and provide the to be had language like en_US(english), SG(singapore), zh_CN(easy chinease), zh_TW(conventional chinease), ja_JP(Japanease). 

In the identical manner to provide support of multiple languages without writing java code online in Liferay, we are able to use Locales this throu out the portal, portlet, hooks and subject matters. This access we are able to offer into same portal-ext.Homes which Liferay portal would examine and offer all of the translation as a consequence.

portlet, hooks and subject matters. This access we are able to offer into same portal-ext.Homes which Liferay portal would examine and offer all of the translation as a consequence.

Locales=en_US,zh_CN,zh_TW,ja_JP,ko_KR

If we are writing some custom messages in out code then we want to provide the underneath belongings documents also as according to the known as language and the usage of of Locales might convert it hence. We can use LocaleUtil in our code if you want to convert the positive message given in language documents. 

For instance we need the assetCategory identify in multi languages then we want to apply this assetCategory.GetTitle(locale). So right here anything locale we have referred to in advance would be in motion and select the given name name from sure locale associated language.Assets file.

Language_en_US.Residences
Language_zh_CN.Properties
Language_zh_TW.Properties

Java applet Interview Questions
Question 18. What Are The Advantages Of Using Tomcat Bundle Of Liferay Against Other App Servers (e.G. Jboss, Glassfish Or Others)?

Answer :

It is feasible to use Liferay with Liferay IDE with different then tomcat server bundles but there are a few features or advantages so as to now not be available:

Native eclipse server adapter that helps launching and debugging.

Deployment via upload/take away modules wizard might not be to be had.

Auto redeployment based on changes to task assets.

J2EE Interview Questions
Question 19. Which One Is Best To Start In A Clean Setup?

Answer :

Liferay package with tomcat app server is the quality one to begin in a clean setup.

Java Tutorial
Question 20. How Do You Perform Junit Tests On Your Portlet?

Answer :

Junit checks are there to test the code particularly via presenting the price of any approach enter parameter, how the approach could paintings and gives the values.

Public class MyEmployeeTest 
 ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
   "ApplicationContext-provider.Xml");
 public void testMyMethod() 
  UserService employeeService = (UserService) context.GetBean("userService");
  //Provide the user Id as 101581
  User person = storeService.FindUserByUserId(1234);
  //get the employee
  Set employee = person.GetEmployeesForUserId();
  System.Out.Println("Employee Name : "+employee.GetName());
 


Java Interview Questions
Question 21. How Will You Configure A Portlet That Can Be Added Multiple Times On A Portal Page?

Answer :

One belongings is there in portlet.Xml which is as follows:

<instanceable>actual</instanceable>

through the use of the price true and false we will configure a portler that can be brought more than one times on a portal page.

 

Question 22. How Can You Customize Liferay Search Feature? What Are The Apis To Do It?

Answer :

We can personalize Liferay Search characteristic, relies upon upon our requirement by underneath  methods.

Hook : If modifications are required as per the view aspect like we need to exchange the quest result shape view then we are able to write the Hook to customise it.

EXT : If adjustments are required as in line with the center functionality like we need to exchange the quest query term, we will enforce EXT.

Java eight Tutorial
Question 23. How Can You Integrate Liferay With An External Content Management System (e.G. Alfresco)?

Answer :

Liferay passes user credentials through CMIS to the alfresco if you want to connect. To enable this in liferay, we need to go into following underneath property in portal-ext.Houses that allows you to permit liferay to shop password in session. 

Consultation.Keep.Password=genuine

Also one greater element we need to take into consideration is that Liferay passes logged in consumer's credentials to CMIS Repository (whihc is alfresco

here) as described above. What this indicates is that userid/password in liferay must fit userid/password in Alfresco. Alfresco by way of default uses a loginid (that's just like display screen-call in liferay) to authenticate user. So we want to make liferay additionally authenticate the use of display screen name by way of making following access into portal-ext.Residences.

Corporation.Protection.Auth.Type=screenName

So we need to begin Liferay. Login as administrator and visit manipulate panel. We need to visit Document and Media on the way to deliver up a screen where we want to click on on Add -> New Repository. This will bring one display where we essentially offer connection information to hook up with Alfresco like underneath.

Name: Give any call you want to give on your repository view in liferay. For example, I will deliver Alfresco repository name.

Description: A short description about it. 

Repository Type: We can join both using AtomPub or the usage of web offerings. 

AtomPub URL: This may be the CMIS repository URL where our alfresco is jogging. In our case, it is would be http://localhost:8080/alfresco/service/api/cmis (Note: In case of Alfresco four.Zero, it will be http://host:port/alfresco/cmisatom).

Repository ID: It is basically used to connect to a selected repository incase we've got multiple repositories available. If we do now not enter a repositoryId, then it will just search for the first repository the usage of the given parameters and set it to that.

Java eight Interview Questions
Question 24. How To Setup A Liferay Cluster From Scratch?

Answer :

We need to setup underneath residences in our portal-ext.Residences(that is for one instance represented with the aid of 1p, equal properties we need to feature for 2nd instance additionally represented by 2p) and some required IP addresses.

#cluster configurations - those settings are for cluster
internet.Sf.Ehcache.ConfigurationResourceName=/myehcache/hibernate-clustered.Xml
dl.Store.Record.System.Root.Dir=/webapps/document_library_cluster
#other settings for cluster
liferay.Home=/webapps/liferay-1p/liferay-portal-6.1.10-ee-ga1/
lucene.Dir=/webapps/liferay-1p/liferay-portal-6.1.10-ee-ga1/records/lucene
cluster.Hyperlink.Enabled=actual
lucene.Replicate.Write=actual
multicast.Group.Address["cluster-link-control"]=239.255.Four.1

Core Java Interview Questions
Question 25. How To Use Aui In Liferay? What Are The Advantages Of Using It In Liferay Instead Of Jquery Or Some Other Js Library?

Answer :

AlloyUI (AUI) is Liferay's open-supply javascript library. It is built on Yahoo User Interface (YUI) and has assist for a spread of superior javascript features mainly designed for portlets. As it is Liferay furnished JS library here no want to merge this code. It is designed to take gain of and include patterns from the great libraries to make constructing strong and flexible internet applications.

It is a JavaScript library, a CSS framework, a set of HTML recipes and a taglib library, all blended to empower builders across multi-skilled groups supply wealthy and dynamic packages. Only we want to feature sure tag library like underneath on the way to use Liferay Alloy UI libraries. 

<taglib>
        <taglib-uri>http://liferay.Com/tld/aui</taglib-uri>
        <taglib-location>/WEB-INF/tld/liferay-aui.Tld</taglib-location>
</taglib>
So further we will use these all form and fields like below in our JSP code.
<aui:form>
    <aui:input name="Name" size="45" />
</aui:form>

Question 26. How To Use Jquery In Liferay?

Answer :

We need to offer the access like below in our JSP files. So that it may study the provided java script route very easily and we are able to use jQuery therefore.

<script type="textual content/javascript" src="<%=themeDisplay.GetPathThemeCss()%>/../js/jquery-1.7.2.Min.Js"></script>

Java Programmer Interview Questions
Question 27. How To Configure Liferay To Use A Jndi Jdbc Datasource Instead Of Internal C3p0 Connection Pool?

Answer :

We want to do the access of perticular aid with a few certain parameter like name, manufacturing facility, driverclassname, url of database, uaername and password.

Below is the access of useful resource in which JDBC datasource is configured.

            Name="jdbc/LiferayPool"
            factory="org.Apache.Tomcat.Jdbc.Pool.DataSourceFactory"
            driverClassName="com.Mysql.Jdbc.Driver"            
   url="jdbc:mysql:///?AutoReconnect=real&useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false&noAccessToProcedureBodies=true"
            username="liferay"
            password="0bknSWE2zzl"
            initialSize="10"
            maxActive="two hundred"
            minIdle="0"
            />

Below is the entry of resource where c3p0.ComboPooledDataSource is configured.

<Resource
    name="jdbc/LiferayPool"
    auth="Container"
    type="com.Mchange.V2.C3p0.ComboPooledDataSource"
    factory="org.Apache.Naming.Factory.BeanFactory"
    driverClass="com.Mysql.Jdbc.Driver"    jdbcUrl="jdbc:mysql:///?UseUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false&noAccessToProcedureBodies=true"
    user="liferay"
    password="0bknSWE2zzl"
    minPoolSize="10"
    maxPoolSize="100"
    />

JSP Interview Questions




CFG