YouTube Icon

Interview Questions.

Top 50 J2ee Interview Questions - Jul 26, 2022

fluid

Top 50 J2ee Interview Questions

Q1. How Do I Enable Server Side Includes (ssi)?

Two matters must be finished for tomcat to renowned SSI scripts: 

@Rename $CATALINA_BASE/server/lib/servlets-ssi.Renametojar to $CATALINA_BASE/server/lib/servlets-ssi.Jar. 

@Uncomment the segment of net.Xml observed in $CATALINA_BASE/conf/net.Xml that offers with SSI. It looks like this when it's far uncommented: 

    <servlet>

        <servlet-name>ssi</servlet-name>

        <servlet-class>

          org.Apache.Catalina.Ssi.SSIServlet

        </servlet-class>

        <init-param>

          <param-name>buffered</param-name>

          <param-value>1</param-value>

        </init-param>

        <init-param>

          <param-name>debug</param-name>

          <param-value>0</param-value>

        </init-param>

        <init-param>

          <param-name>expires</param-name>

          <param-value>666</param-value>

        </init-param>

        <init-param>

          <param-name>isVirtualWebappRelative</param-name>

          <param-value>0</param-value>

        </init-param>

        <load-on-startup>four</load-on-startup>

    </servlet>

Q2. What Is The Use Of Message Object?

Message is a mild weight message having handiest header and houses and no payload. Thus if the receivers are to be notified approximately an event, and no facts desires to be exchanged then the usage of Message can be very efficient.

Q3. What Is An Action Class Used For?

An Action is an adapter between the contents of an incoming HTTP request and the corresponding commercial enterprise logic that need to be carried out to manner this request. The controller (ActionServlet) will select the ideal Action for each request, create an example (if vital), and get in touch with the perform method. Actions should be programmed in a thread-secure way, due to the fact the controller will percentage the equal example for more than one simultaneous requests. In this me you should design with the subsequent gadgets in thoughts:

Instance and static variables MUST NOT be used to shop records associated with the nation of a specific request. They MAY be used to proportion international resources across requests for the identical action.

 Access to different sources (JavaBe, session variables, and so on.) MUST be synchronized if the ones sources require safety. (Generally, but, aid lessons ought to be designed to provide their own safety wherein vital. When an Action instance is first created, the controller servlet will call setServlet() with a non-null argument to identify the controller servlet example to which this Action is attached. When the controller servlet is to be shut down (or restarted), the setServlet() method will be referred to as with a null argument, which can be used to easy up any allocated resources in use through this Action.

Q4. What Is Jsp Tag Library?

A series of custom tags described via a tag library descriptor and Java training.

Q5. What Is Jsp Container?

A container that provides the equal offerings as a servlet field and an engine that translates and approaches JSP pages into a servlet.

Q6. What Is Connector Architecture?

An architecture for integration of J2EE merchandise with business enterprise facts structures. There are  components to this structure: a useful resource adapter supplied by using an organization statistics device vendor and the J2EE product that allows this useful resource adapter to plug in. This architecture defines a fixed of contracts that a useful resource adapter must help to plug in to a J2EE product-for instance, tractions, security, and aid control.

Q7. What Is J2ee Product Provider?

A vendor that materials a J2EE product.

Q8. What Are Types Of J2ee Clients?

J2EE clients are the software that get entry to the services components established on the J2EE box. Following are the J2EE clients:

a) Applets

b) Java-Web Start customers

c) Wireless customers

d) Web applications.

Q9. What Is Content?

In an XML report, the component that happens after the prolog, along with the foundation detail and the entirety it incorporates.

Q10. How Do You Create Multiple Virtual Hosts?

If you want tomcat to just accept requests for distinct hosts e.G., www.Myhostname.Com then you definately must 

@create $catalina.Home/www/appBase , $catalina.Home/www/install, and $catalina.Domestic /conf /Catalina /www.Myhostname.Com 

@upload a bunch entry inside the server.Xml document 

  <Host appBase="www/appBase" name="www.Myhostname.Com"/>

@Create the the following file underneath conf/Catalina/www.Myhostname.Com/ROOT.Xml 

<?Xml version="1.0" encoding="UTF-8"?>

<Context

    path="/"

    docBase="www/deploy/mywebapp.War"

    reloadable="true" antiJARLocking="true">

</Context>

Add any parameters unique to this hosts webapp to this context record 

@placed your struggle record in $catalina.Domestic/www/install 

When tomcat starts, it reveals the host access, then appears for any context files and could start any apps with a context 

To add more websites just repeat and rinse, all webapps can percentage the identical battle report area and appbase.

Q11. What Is The Default Value Of Boolean?

False.

Q12. How Do You Optimize Entity Be?

• Tune the entity be pool size to avoid overhead of introduction and destruction of be.

• Tune the entity be cache size to keep away from overhead of activation, passivation and database calls.

• Use setEntityContext() technique to cache bean precise sources.

• Release received sources in unSetEntityContext() approach.

• Use Lazy loading to avoid needless pre-loading of toddler records.

• Choose ideal traction isolation degree to keep away from blockading of other tractional clients.

• Use right locking strategy.

• Make study-only entity be for study handiest operations.

Q13. What Is External Subset?

That a part of a DTD that is defined by using references to outside DTD documents.

Q14. What Are The Special Design Care That Must Be Taken When You Work With Local Interfaces?

It is critical to remember the fact that the calling semantics of neighborhood interfaces are specific from the ones of faraway interfaces. For example, faraway interfaces bypass parameters the use of call-by using-price semantics, at the same time as nearby interfaces use call-through-reference. This me that which will use local interfaces competently, utility builders need to cautiously don't forget capability deployment eventualities up the front, then decide which interfaces may be neighborhood and which far flung, and in the end, expand the utility code with these picks in mind. While EJB 2.Zero local interfaces are extremely beneficial in some conditions, the long-time period prices of these selections, specifically while changing requirements and component reuse are taken under consideration, want to be factored into the design decision.

Q15. What Is Basic Authentication?

An authentication mechanism in which a Web server authenticates an entity through a consumer name and password obtained the use of the Web application's built-in authentication mechanism.

Q16. How Do I Configure Tomcat To Work With Iis And Ntlm?

Follow the usual commands for when the isapi_redirector.Dll 

Configure IIS to apply "incorporated windows safety" 

In server.Xml, make sure you disable tomcat authentication: 

<Connector port="8009" enableLookups="false" redirectPort="8443"

protocol="AJP/1.3"tomcatAuthentication="false" />

Q17. What Is Javaserver Faces Technology?

A framework for building server-side consumer interfaces for Web applications written inside the Java programming language.

Q18. What Is Ddp?

Document-pushed programming. The use of XML to outline programs.

Q19. What Is Ejb Object?

An item whose class implements the company bean's far flung interface. A consumer never references an enterprise bean example directly; a consumer continually references an EJB item. The elegance of an EJB item is generated by a field's deployment equipment.

Q20. How Do You Optimize Io?

• Use Buffered IO lessons.

• File information which include document length requires a device name and can be slow. Don't use it regularly. Similarly, System.CurrentTimeMillis() makes use of a local call to get present day time. Make sure your manufacturing code does not have this statement.

• Many java.Io.File methods are gadget calls which can be gradual.

• Use BufferedIO streams to get admission to URLConnection sInput/Output streams.

• Use the trient key-word to outline fields to avoid having those fields serialized. Examine serialized gadgets to decide which fields do now not need to be serialized for the utility to work.

• Increase server concentrate queues for high load or high latency servers.

Q21. What Is Jms Administered Object?

A preconfigured JMS object (a useful resource supervisor connection factory or a destination) created by means of an administrator for the usage of JMS customers and positioned in a JNDI namespace.

Q22. When Are Automatic Variable Initialized?

Automatic variable have to be initialized explicitly.

Q23. What Is Enterprise Bean Provider?

An application developer who produces agency bean instructions, faraway and home interfaces, and deployment descriptor documents, and programs them in an EJB JAR document.

Q24. What Is Cdata?

A predefined XML tag for character information that me "do not interpret these characters," in preference to parsed man or woman data (PCDATA), wherein the regular guidelines of XML syntax practice. CDATA sections are normally used to reveal examples of XML syntax.

Q25. How Is An Argument Passed In Java, By Copy Or By Reference?

If the variable is primitive datatype then it's miles exceeded by using reproduction.

If the variable is an object then it's far surpassed through reference.

Q26. What Is J2ee Server?

The runtime part of a J2EE product. A J2EE server affords EJB or Web boxes or each.

Q27. Does The Corba Specification Define Any Specific Capabilities For A Factory Object?

The CORBA Lifecycle specification defines a GenericFactory interface from which all factories must inherit, however this isn't always required. The CORBA specification additionally defines a manufacturing unit for factories, known as a manufacturing facility finder. The manufacturing facility finder is a only a CORBA factory which act as a manufacturing facility for different manufacturing facility interfaces.

Q28. What Is The Servlet?

Servlet is a script, which is living and executes on server facet, to create dynamic HTML. In servlet programming we will use java language. A servlet can deal with a couple of requests simultaneously.

Q29. What Is Deployment?

The procedure whereby software program is hooked up into an operational environment.

Q30. What Is Destination?

A JMS administered item that encapsulates the identification of a JMS queue or subject matter. See point-to-point messaging device, put up/subscribe messaging gadget.

Q31. What Is Ejb Server?

Software that provides offerings to an EJB container. For example, an EJB field generally is predicated on a traction manager that is part of the EJB server to carry out the 2-phase commit across all the taking part resource managers. The J2EE architecture assumes that an EJB container is hosted by using an EJB server from the identical dealer, so it does not specify the agreement between these  entities. An EJB server can host one or more EJB containers.

Q32. When Should I Use The -nostage Option?

Set the staging mode to -nostage (the usage of weblogic.Deployer or the Administration Console) in case you don't want to replicate deployment files but want to installation an software from its gift vicinity. All target servers should be capable of get right of entry to the equal set of deployment documents.

Q33. How Do You Optimize A Jsp Page?

• Use jspInit() method to cache static statistics

• Use StringBuffer as opposed to using + operator while you concatenate multiple strings

• Use print() technique rather than println() approach

• Use ServletOutputStream in place of JSPWriter to send binary information

• Initialize the 'out' object (implicit object) with right length inside the page directive.

• Flush the data partially.

• Minimize code within the synchronized block.

• Set the content material period.

• Release resources in jspDestroy() technique.

• Give 'fake' fee to the session in the page directive to avoid session object advent.

• Use encompass directive in place of encompass motion whilst you need to consist of the child web page content in the trlation phase.

• Avoid giving needless scope within the 'useBean' motion.

• Do now not use custom tags if you do not have reusability.

• Use software server caching facility.

• Use Mixed consultation mechanisms together with 'consultation' with hidden fields.

• Use 'consultation' and 'software' as cache.

• Use caching tags furnished by one-of-a-kind businesses like openSymphony.Com.

• Remove 'consultation' objects explicitly on your program every time you end the venture.

• Reduce session time out price as a whole lot as viable.

• Use 'trient' variables to lessen serialization overhead if your consultation tracking mechanism makes use of serialization technique.

• Disable JSP auto reloading function.

Q34. What Is Deployment Descriptor?

An XML file furnished with every module and J2EE software that describes how they should be deployed. The deployment descriptor directs a deployment device to install a module or application with precise field alternatives and describes specific configuration necessities that a deployer have to solve.

Q35. What Is Corba?

Common Object Request Broker Architecture. A language-independent dispensed object version distinctive via the OMG.

Q36. What Is Local Subset?

That part of the DTD this is defined inside the current XML file.

Q37. What Is B2b?

B2B stands for Business-to-business.

Q38. How Do You Optimize Stateless Session Be?

• Tune the Stateless consultation be pool size to avoid overhead of creation and destruction of be.

• Use setSessionContext() or ejbCreate() method to cache bean precise assets.

• Release acquired assets in ejbRemove() approach.

Q39. Why Do I Get En Exception When I Use Location="d:codeinclude" As Attribute Of Includepath?

See here.

You want to get away the string to "D:Codeinclude" or use "D:/Code/consist of" alternatively!

Believe me or not? Forward shrink works on windows in all ant or java code. It also works in home windows environment variables. It does not work in cmd (dos) window before XP. It also works in XP dos window now!

Q40. What Is General Entity?

An entity this is referenced as part of an XML report's content material, as wonderful from a parameter entity, that's referenced in the DTD. A trendy entity may be a parsed entity or an unparsed entity.

Q41. What Types Of Performance Should I Be Concerned With?

There are many different performance traits which might be important. Performance must also scale linearly as connections or objects growth. While uncooked throughput between one purchaser and one server is critical, it is not the best or the most important characteristic. Many characteristics of the CORBA implementation should be considered. As continually, actual utility necessities to the relative significance of those distinctive characteristics. With the high pace nature of most CORBA implementations, uncooked purchaser/server throughput is regularly no longer a bottleneck. It is likewise vital that elements consisting of the variety of operations does no longer sluggish down character far off invocations. Here is a list of a few vital overall performance characteristics.

• Scalability across linked purchaser programs.

• Scalability throughout objects within a CORBA server.

• Raw throughout among one purchaser and one server.

• Activation time of server techniques.

• Activation time of CORBA objects.

• Streaming time for one-of-a-kind IDL types.

• Connection time associated with the first far flung operation, _narrow name, _is_a name and many others.

• Minimum memory ate up by using a CORBA item.

• Number of file descriptors consumed by a complex community of dispensed gadgets.

Q42. What Is Jaap?

The Java Authentication and Authorization Service (JAAS) offers a way for a J2EE utility to authenticate and authorize a selected person or institution of customers to run it. It is a widespread Pluggable Authentication Module (PAM) framework that extends the Java 2 platform security architecture to guide person-primarily based authorization.

Q43. Can Corba Applications Have Callbacks?

Yes. The words customer and server are simply simplest relevant inside the context of a far off call. In different words, the "purchaser procedure" also can get hold of calls on CORBA objects that it implements and arms out the references to.

Q44. When I Obtain An Object Reference, What Determines If It Is An Ior Or Just An Or?

If you create the item reference from a string through a CORBA 2.Zero compliant library then the object reference is an IOR. If you create the item reference thru resolve_initial_references() the ORB libraries would possibly create an OR or an IOR. Some ORBs from agencies which includes Expersoft and Visigenic ORBs assist simplest local IIOP and as a consequence all references are IORs. On the opposite hand, some commericial providers who shipped ORBS that supported IDL before IIOP existed bypass round references that are not IORs and therefore those referencesmight now not usually be IORs. Many instances an ORB vendor would possibly help a proprietary protocol similarly to IIOP. Note: even though resolve_initial_references() returns and IOR, the IOR almost continually refers to an item implemented with the equal ORB surroundings as the software calling resolve_initial_references(). If the item reference is obtained from a server, a NameContext, or from a manufacturing unit, the process and ORB libraries that originially created the object reference, determine if the reference is an OR or an IOR.

Q45. What Is Java 2 Platform, Enterprise Edition (j2ee)?

An environment for growing and deploying corporation packages. The J2EE platform consists of a hard and fast of offerings, utility programming interfaces (APIs), and protocols that provide the capability for growing multitiered, Web-based applications.

Q46. What Is The Static Invocation Interface?

The CORBA specification defines  mechanisms for invoking operations on a CORBA Object. Functionaly, the two mechanisms provide the identical talents. They allow essentially the IDL defined operations on the CORBA item to be invoked, permit application variables to be exceeded to the operation as inbound parameters, and allow return values or out parameters to be exceeded from the server to the client. The first mechanism is referred to as the Static Invocation Interface (SII), the other is known as Dynamic Invocation Interface . Developers of client packages which use SII ought to understand the name of the operation, and all parameters/return kinds previous to software compilation. The actual operation names and parameters/go back values are in effect tough coded into the utility source code.

Q47. What Other Surprises Are There With Is_equivalent()?

Remember that is_equivalent() is invoked on one of the two items, and there are instances where this may cause impasse. The following example illustrates how this will happen on one specific unmarried-threaded ORB that won't allow a server to invoke a method at the consumer (contributed by way of Jeff Stewart, jstewart+@andrew.Cmu.Edu; used with permission): Suppose a server gets updates from cached customers and then has to replace all clients except for the only that pronounced (updating the reporting patron could motive a impasse on this ORB). So, as the server iterates thru its purchaser list it have to make sure that it does not invoke the reporting patron. But it can not use is_equivalent() because this may in the end reason an invocation at the reporting consumer simply to do the is_equivalent() test, inadvertently growing a deadlock.

Q48. What Is Corba? What Does It Do?

CORBA is the acronym for Common Object Request Broker Architecture, OMG's open, seller-independent structure and infrastructure that pc programs use to paintings collectively over networks. Using the usual protocol IIOP, a CORBA-primarily based program from any seller, on nearly any computer, working gadget, programming language, and community, can interoperate with a CORBA-primarily based software from the identical or another seller, on nearly every other computer, running system, programming language, and network.

Q49. What's The Difference Between Jndi Lookup(), List(), Listbindings(), And Search()?

Lookup() :attempts to find the specified object inside the given context. I.E., it looks for a single, precise item and both unearths it in the modern-day context or it fails.

List(): tries to go back an enumeration of all of the NameClassPair’s of all the objects inside the modern-day context. I.E., it’s a listing of all the gadgets within the contemporary context but only returns the object’s call and the call of the class to which the object belongs.

ListBindings(): tries to return an enumeration of the Binding’s of all the gadgets inside the modern context. I.E., it’s a listing of all of the items in the current context with the object’s call, its magnificence name, and a reference to the item itself.

Seek(): tries to return an enumeration of all the gadgets matching a given set of search criteria. It can seek across more than one contexts (or no longer). It can go back whatever attributes of the objects that you preference. It’s by means of far the most complex and powerful of those alternatives but is likewise the most expensive.

Q50. What Are The Different Types Of Messages Available In The Jms Api?

Message, TextMessage, BytesMessage, StreamMessage, ObjectMessage, MapMessage are the unique messages available inside the JMS API.




CFG