J2EE Interview Questions & Answers

4 avg. rating (80% score) - 1 votes

J2EE Interview Questions & Answers

J2EE is a platform independent and Java centric environment for developing, building and deploying Web-based enterprise applications online. In order to develop web based applications, J2EE platform consists of set of services, protocols and APIs. Every programming language has their design patterns for various solutions they come across. One can check the availability of the job across cities including Mumbai, Delhi, Bangalore, Pune and Hyderabad. J2EE role consists of high knowledge and proficient in creating solutions to issues that are repeatable using Java Servlets and JSP. Wisdomjobs has interview questions which are exclusively designed for job seekers to assist them in clearing job interviews. J2EE interview questions and answers are useful for developers to attend job interviews and get selected for Design Patterns job position.

J2EE Interview Questions

J2EE Interview Questions
    1. Question 1. What Is J2ee?

      Answer :

      J2EE is an environment for developing and deploying enterprise applications. The J2EE platform consists of a set of services, application programming interfaces (APIs), and protocols that provide the functionality for developing multitiered, web-based applications.

    2. Question 2. What Is The J2ee Module?

      Answer :

      A J2EE module consists of one or more J2EE components for the same container type and one component deployment descriptor of that type.

    3. Question 3. What Are The Components Of J2ee Application?

      Answer :

      A J2EE component is a self-contained functional software unit that is assembled into a J2EE application with its related classes and files and communicates with other components. The J2EE specification defines the following J2EE components:

      Application clients and applets are client components.

      Java Servlet and JavaServer PagesTM (JSPTM) technology components are web components.

      Enterprise JavaBeansTM (EJBTM) components (enterprise beans) are business components.

      Resource adapter components provided by EIS and tool vendors.

    4. Question 4. What Are The Four Types Of J2ee Modules?

      Answer :

      1. Application client module
      2. Web module
      3. Enterprise JavaBeans module
      4. Resource adapter module.

    5. Question 5. What Does Application Client Module Contain?

      Answer :

      The application client module contains:
      --class files,
      --an application client deployment descriptoor.
      Application client modules are packaged as JAR files with a .jar extension.

    6. Question 6. What Does Web Module Contain?

      Answer :

      The web module contains:
      --JSP files,
      --class files for servlets,
      --GIF and HTML files, and
      --a Web deployment descriptor.
      Web modules are packaged as JAR files with a .war (Web ARchive) extension.

    7. Question 7. What Are The Differences Between Ear, Jar And War Files? Under What Circumstances Should We Use Each One?

      Answer :

      There are no structural differences between the files; they are all archived using zip-jar compression.
      However, they are intended for different purposes.
      --Jar files (files with a .jar extension) are intended to hold generic libraries of Java classes, resources, auxiliary files, etc.
      --War files (files with a .war extension) arre intended to contain complete Web applications. In this context, a Web application is defined as a single group of files, classes, resources, .jar files that can be packaged and accessed as one servlet context.
      --Ear files (files with a .ear extension) arre intended to contain complete enterprise applications. In this context, an enterprise application is defined as a collection of .jar files, resources, classes, and multiple Web applications.
      Each type of file (.jar, .war, .ear) is processed uniquely by application servers, servlet containers, EJB containers, etc.

    8. Question 8. What Is The Difference Between Session Bean And Entity Bean?one?

      Answer :

      The Session bean and Entity bean are two main parts of EJB container.
      Session Bean
      --represents a workflow on behalf of a client.
      --one-to-one logical mapping to a client.
      --created and destroyed by a client.
      --not permanent objects.
      --lives its EJB container(generally) does noot survive system shut down.
      --two types: stateless and stateful beans Entity Bean.
      --represents persistent data and behavior off this data.
      --can be shared among multiple clients.
      --persists across multiple invocations.
      --findable permanent objects.
      --outlives its EJB container, survives systeem shutdown.
      --two types: container managed persistence(CCMP) and bean managed persistence(BMP).

    9. Question 9. What Is "applet"?

      Answer :

      A J2EE component that typically executes in a Web browser but can execute in a variety of other applications or devices that support the applet programming model.

    10. Question 10. What Is "applet Container"?

      Answer :

      A container that includes support for the applet programming model.

    11. Question 11. What Is Authorization?

      Answer :

      The process by which access to a method or resource is determined. Authorization depends on the determination of whether the principal associated with a request through authentication is in a given security role. A security role is a logical grouping of users defined by the person who assembles the application. A deployer maps security roles to security identities. Security identities may be principals or groups in the operational environment.

    12. Question 12. What Is Authorization Constraint?

      Answer :

      An authorization rule that determines who is permitted to access a Web resource collection.

    13. Question 13. What Is B2b?

      Answer :

      B2B stands for Business-to-business.

    14. Question 14. What Is Backing Bean?

      Answer :

      A JavaBeans component that corresponds to a JSP page that includes JavaServer Faces components. The backing bean defines properties for the components on the page and methods that perform processing for the component. This processing includes event handling, validation, and processing associated with navigation.

    15. Question 15. What Is Basic Authentication?

      Answer :

      An authentication mechanism in which a Web server authenticates an entity via a user name and password obtained using the Web application's built-in authentication mechanism.

    16. Question 16. What Is Bean-managed Persistence?

      Answer :

      The mechanism whereby data transfer between an entity bean's variables and a resource manager is managed by the entity bean.

    17. Question 17. What Is Bean-managed Transaction?

      Answer :

      A transaction whose boundaries are defined by an enterprise bean.

    18. Question 18. What Is Binding (xml)?

      Answer :

      Generating the code needed to process a well-defined portion of XML data.

    19. Question 19. What Is Binding (javaserver Faces Technology)

      Answer :

      Wiring UI components to back-end data sources such as backing bean properties.

    20. Question 20. What Is Build File?

      Answer :

      The XML file that contains one or more asant targets. A target is a set of tasks you want to be executed. When starting asant, you can select which targets you want to have executed. When no target is given, the project's default target is executed.

    21. Question 21. What Is Business Logic?

      Answer :

      The code that implements the functionality of an application. In the Enterprise JavaBeans architecture, this logic is implemented by the methods of an enterprise bean.

    22. Question 22. What Is Business Method?

      Answer :

      A method of an enterprise bean that implements the business logic or rules of an application.

    23. Question 23. What Is Callback Methods?

      Answer :

      Component methods called by the container to notify the component of important events in its life cycle.

    24. Question 24. What Is Caller Principal?

      Answer :

      The principal that identifies the invoker of the enterprise bean method.

    25. Question 25. What Is Cascade Delete?

      Answer :

      A deletion that triggers another deletion. A cascade delete can be specified for an entity bean that has container-managed persistence.

    26. Question 26. What Is Cdata?

      Answer :

      A predefined XML tag for character data that means "don't interpret these characters," as opposed to parsed character data (PCDATA), in which the normal rules of XML syntax apply. CDATA sections are typically used to show examples of XML syntax.

    27. Question 27. What Is Certificate Authority?

      Answer :

      A trusted organization that issues public key certificates and provides identification to the bearer.

    28. Question 28. What Is Client-certificate Authentication?

      Answer :

      An authentication mechanism that uses HTTP over SSL, in which the server and, optionally, the client authenticate each other with a public key certificate that conforms to a standard that is defined by X.509 Public Key Infrastructure.

    29. Question 29. What Is Comment?

      Answer :

      In an XML document, text that is ignored unless the parser is specifically told to recognize it.

    30. Question 30. What Is Commit?

      Answer :

      The point in a transaction when all updates to any resources involved in the transaction are made permanent.

    31. Question 31. What Is Component Contract?

      Answer :

      The contract between a J2EE component and its container. The contract includes life-cycle management of the component, a context interface that the instance uses to obtain various information and services from its container, and a list of services that every container must provide for its components.

    32. Question 32. What Is Component-managed Sign-on?

      Answer :

      A mechanism whereby security information needed for signing on to a resource is provided by an application component.

    33. Question 33. What Is Connector?

      Answer :

      A standard extension mechanism for containers that provides connectivity to enterprise information systems. A connector is specific to an enterprise information system and consists of a resource adapter and application development tools for enterprise information system connectivity. The resource adapter is plugged in to a container through its support for system-level contracts defined in the Connector architecture.

    34. Question 34. What Is Connector Architecture?

      Answer :

      An architecture for integration of J2EE products with enterprise information systems. There are two parts to this architecture: a resource adapter provided by an enterprise information system vendor and the J2EE product that allows this resource adapter to plug in. This architecture defines a set of contracts that a resource adapter must support to plug in to a J2EE product-for example, transactions, security, and resource management.

    35. Question 35. What Is Container?

      Answer :

      An entity that provides life-cycle management, security, deployment, and runtime services to J2EE components. Each type of container (EJB, Web, JSP, servlet, applet, and application client) also provides component-specific services.

    36. Question 36. What Is Container-managed Persistence?

      Answer :

      The mechanism whereby data transfer between an entity bean's variables and a resource manager is managed by the entity bean's container.

    37. Question 37. What Is Container-managed Sign-on?

      Answer :

      The mechanism whereby security information needed for signing on to a resource is supplied by the container.

    38. Question 38. What Is Container-managed Transaction?

      Answer :

      A transaction whose boundaries are defined by an EJB container. An entity bean must use container-managed transactions.

    39. Question 39. What Is Content?

      Answer :

      In an XML document, the part that occurs after the prolog, including the root element and everything it contains.

    40. Question 40. What Is Context Attribute?

      Answer :

      An object bound into the context associated with a servlet.

    41. Question 41. What Is Context Root?

      Answer :

      A name that gets mapped to the document root of a Web application.

    42. Question 42. What Is Conversational State?

      Answer :

      The field values of a session bean plus the transitive closure of the objects reachable from the bean's fields. The transitive closure of a bean is defined in terms of the serialization protocol for the Java programming language, that is, the fields that would be stored by serializing the bean instance.

    43. Question 43. What Is Corba?

      Answer :

      Common Object Request Broker Architecture. A language-independent distributed object model specified by the OMG.

    44. Question 44. What Is Create Method?

      Answer :

      A method defined in the home interface and invoked by a client to create an enterprise bean.

    45. Question 45. What Is Credentials?

      Answer :

      The information describing the security attributes of a principal.

    46. Question 46. What Is Css?

      Answer :

      Cascading style sheet. A stylesheet used with HTML and XML documents to add a style to all elements marked with a particular tag, for the direction of browsers or other presentation mechanisms.

    47. Question 47. What Is Cts?

      Answer :

      Compatibility test suite. A suite of compatibility tests for verifying that a J2EE product complies with the J2EE platform specification.

    48. Question 48. What Is Data?

      Answer :

      The contents of an element in an XML stream, generally used when the element does not contain any subelements. When it does, the term content is generally used. When the only text in an XML structure is contained in simple elements and when elements that have subelements have little or no data mixed in, then that structure is often thought of as XML data, as opposed to an XML document.

    49. Question 49. What Is Ddp?

      Answer :

      Document-driven programming. The use of XML to define applications.

    50. Question 50. What Is Declaration?

      Answer :

      The very first thing in an XML document, which declares it as XML. The minimal declaration is . The declaration is part of the document prolog.

    51. Question 51. What Is Declarative Security?

      Answer :

      Mechanisms used in an application that are expressed in a declarative syntax in a deployment descriptor.

    52. Question 52. What Is Delegation?

      Answer :

      An act whereby one principal authorizes another principal to use its identity or privileges with some restrictions.

    53. Question 53. What Is Deployer?

      Answer :

      A person who installs J2EE modules and applications into an operational environment.

    54. Question 54. What Is Deployment?

      Answer :

      The process whereby software is installed into an operational environment.

    55. Question 55. What Is Deployment Descriptor?

      Answer :

      An XML file provided with each module and J2EE application that describes how they should be deployed. The deployment descriptor directs a deployment tool to deploy a module or application with specific container options and describes specific configuration requirements that a deployer must resolve.

    56. Question 56. What Is Destination?

      Answer :

      A JMS administered object that encapsulates the identity of a JMS queue or topic. See point-to-point messaging system, publish/subscribe messaging system.

    57. Question 57. What Is Digest Authentication?

      Answer :

      An authentication mechanism in which a Web application authenticates itself to a Web server by sending the server a message digest along with its HTTP request message. The digest is computed by employing a one-way hash algorithm to a concatenation of the HTTP request message and the client's password. The digest is typically much smaller than the HTTP request and doesn't contain the password.

    58. Question 58. What Is Distributed Application?

      Answer :

      An application made up of distinct components running in separate runtime environments, usually on different platforms connected via a network. Typical distributed applications are two-tier (client-server), three-tier (client-middleware-server), and multitier (client-multiple middleware-multiple servers).

    59. Question 59. What Is Document?

      Answer :

      In general, an XML structure in which one or more elements contains text intermixed with subelements.

    60. Question 60. What Is Document Object Model?

      Answer :

      An API for accessing and manipulating XML documents as tree structures. DOM provides platform-neutral, language-neutral interfaces that enables programs and scripts to dynamically access and modify content and structure in XML documents.

    61. Question 61. What Is Document Root?

      Answer :

      The top-level directory of a WAR. The document root is where JSP pages, client-side classes and archives, and static Web resources are stored.

    62. Question 62. What Is Dtd?

      Answer :

      Document type definition. An optional part of the XML document prolog, as specified by the XML standard. The DTD specifies constraints on the valid tags and tag sequences that can be in the document. The DTD has a number of shortcomings, however, and this has led to various schema proposals. For example, the DTD entry says that the XML element called username contains parsed character data-that is, text alone, with no other structural elements under it. The DTD includes both the local subset, defined in the current file, and the external subset, which consists of the definitions contained in external DTD files that are referenced in the local subset using a parameter entity.

    63. Question 63. What Is Ejb Object?

      Answer :

      An object whose class implements the enterprise bean's remote interface. A client never references an enterprise bean instance directly; a client always references an EJB object. The class of an EJB object is generated by a container's deployment tools.

    64. Question 64. What Is Ejb Server?

      Answer :

      Software that provides services to an EJB container. For example, an EJB container typically relies on a transaction manager that is part of the EJB server to perform the two-phase commit across all the participating resource managers. The J2EE architecture assumes that an EJB container is hosted by an EJB server from the same vendor, so it does not specify the contract between these two entities. An EJB server can host one or more EJB containers.

    65. Question 65. What Is Ejb Server Provider?

      Answer :

      A vendor that supplies an EJB server.

    66. Question 66. What Is Element?

      Answer :

      A unit of XML data, delimited by tags. An XML element can enclose other elements.

    67. Question 67. What Is Empty Tag?

      Answer :

      A tag that does not enclose any content.

    68. Question 68. What Is Enterprise Bean?

      Answer :

      A J2EE component that implements a business task or business entity and is hosted by an EJB container; either an entity bean, a session bean, or a message-driven bean.

    69. Question 69. What Is Enterprise Bean Provider?

      Answer :

      An application developer who produces enterprise bean classes, remote and home interfaces, and deployment descriptor files, and packages them in an EJB JAR file.

    70. Question 70. What Is Enterprise Information System?

      Answer :

      The applications that constitute an enterprise's existing system for handling companywide information. These applications provide an information infrastructure for an enterprise. An enterprise information system offers a well-defined set of services to its clients. These services are exposed to clients as local or remote interfaces or both. Examples of enterprise information systems include enterprise resource planning systems, mainframe transaction processing systems, and legacy database systems.

    71. Question 71. What Is Enterprise Information System Resource?

      Answer :

      An entity that provides enterprise information system-specific functionality to its clients. Examples are a record or set of records in a database system, a business object in an enterprise resource planning system, and a transaction program in a transaction processing system.

    72. Question 72. What Is Enterprise Javabeans (ejb)?

      Answer :

      A component architecture for the development and deployment of object-oriented, distributed, enterprise-level applications. Applications written using the Enterprise JavaBeans architecture are scalable, transactional, and secure.

    73. Question 73. What Is Enterprise Javabeans Query Language (ejb Ql)?

      Answer :

      Defines the queries for the finder and select methods of an entity bean having container-managed persistence. A subset of SQL92, EJB QL has extensions that allow navigation over the relationships defined in an entity bean's abstract schema.

    74. Question 74. What Is An Entity?

      Answer :

      A distinct, individual item that can be included in an XML document by referencing it. Such an entity reference can name an entity as small as a character (for example, <, which references the less-than symbol or left angle bracket, <). An entity reference can also reference an entire document, an external entity, or a collection of DTD definitions.

    75. Question 75. What Is Entity Bean?

      Answer :

      An enterprise bean that represents persistent data maintained in a database. An entity bean can manage its own persistence or can delegate this function to its container. An entity bean is identified by a primary key. If the container in which an entity bean is hosted crashes, the entity bean, its primary key, and any remote references survive the crash.

    76. Question 76. What Is Entity Reference?

      Answer :

      A reference to an entity that is substituted for the reference when the XML document is parsed. It can reference a predefined entity such as < or reference one that is defined in the DTD. In the XML data, the reference could be to an entity that is defined in the local subset of the DTD or to an external XML file (an external entity). The DTD can also carve out a segment of DTD specifications and give it a name so that it can be reused (included) at multiple points in the DTD by defining a parameter entity.

    77. Question 77. What Is Error?

      Answer :

      A SAX parsing error is generally a validation error; in other words, it occurs when an XML document is not valid, although it can also occur if the declaration specifies an XML version that the parser cannot handle. See also fatal error, warning.

    78. Question 78. What Is Extensible Markup Language?

      Answer :

      XML.

    79. Question 79. What Is External Entity?

      Answer :

      An entity that exists as an external XML file, which is included in the XML document using an entity reference.

    80. Question 80. What Is External Subset?

      Answer :

      That part of a DTD that is defined by references to external DTD files.

    81. Question 81. What Is Fatal Error?

      Answer :

      A fatal error occurs in the SAX parser when a document is not well formed or otherwise cannot be processed. See also error, warning.

    82. Question 82. What Is Filter?

      Answer :

      An object that can transform the header or content (or both) of a request or response. Filters differ from Web components in that they usually do not themselves create responses but rather modify or adapt the requests for a resource, and modify or adapt responses from a resource. A filter should not have any dependencies on a Web resource for which it is acting as a filter so that it can be composable with more than one type of Web resource.

    83. Question 83. What Is Filter Chain?

      Answer :

      A concatenation of XSLT transformations in which the output of one transformation becomes the input of the next.

    84. Question 84. What Is Finder Method?

      Answer :

      A method defined in the home interface and invoked by a client to locate an entity bean.

    85. Question 85. What Is Form-based Authentication?

      Answer :

      provides an application-specific form for logging in. This form of authentication uses Base64 encoding and can expose user names and passwords unless all connections are over SSL.

    86. Question 86. What Is General Entity?

      Answer :

      An entity that is referenced as part of an XML document's content, as distinct from a parameter entity, which is referenced in the DTD. A general entity can be a parsed entity or an unparsed entity.

    87. Question 87. What Is Group?

      Answer :

      An authenticated set of users classified by common traits such as job title or customer profile. Groups are also associated with a set of roles, and every user that is a member of a group inherits all the roles assigned to that group.

    88. Question 88. What Is Handle?

      Answer :

      An object that identifies an enterprise bean. A client can serialize the handle and then later deserialize it to obtain a reference to the enterprise bean.

    89. Question 89. What Is Home Handle?

      Answer :

      An object that can be used to obtain a reference to the home interface. A home handle can be serialized and written to stable storage and deserialized to obtain the reference.

    90. Question 90. What Is Home Interface?

      Answer :

      One of two interfaces for an enterprise bean. The home interface defines zero or more methods for managing an enterprise bean. The home interface of a session bean defines create and remove methods, whereas the home interface of an entity bean defines create, finder, and remove methods.

    91. Question 91. What Is Html?

      Answer :

      Hypertext Markup Language. A markup language for hypertext documents on the Internet. HTML enables the embedding of images, sounds, video streams, form fields, references to other objects with URLs, and basic text formatting.

    92. Question 92. What Is Http?

      Answer :

      Hypertext Transfer Protocol. The Internet protocol used to retrieve hypertext objects from remote hosts. HTTP messages consist of requests from client to server and responses from server to client.

    93. Question 93. What Is Https?

      Answer :

      HTTP layered over the SSL protocol.

    94. Question 94. What Is Idl?

      Answer :

      Interface Definition Language. A language used to define interfaces to remote CORBA objects. The interfaces are independent of operating systems and programming languages.

    95. Question 95. What Is Iiop?

      Answer :

      Internet Inter-ORB Protocol. A protocol used for communication between CORBA object request brokers.

    96. Question 96. What Is Impersonation?

      Answer :

      An act whereby one entity assumes the identity and privileges of another entity without restrictions and without any indication visible to the recipients of the impersonator's calls that delegation has taken place. Impersonation is a case of simple delegation.

    97. Question 97. What Is Initialization Parameter?

      Answer :

      A parameter that initializes the context associated with a servlet.

    98. Question 98. What Is Iso 3166?

      Answer :

      The international standard for country codes maintained by the International Organization for Standardization (ISO).

    99. Question 99. What Is Isv?

      Answer :

      Independent software vendor.

    100. Question 100. What Is J2ee Application?

      Answer :

      Any deployable unit of J2EE functionality. This can be a single J2EE module or a group of modules packaged into an EAR file along with a J2EE application deployment descriptor. J2EE applications are typically engineered to be distributed across multiple computing tiers.

    101. Question 101. What Is J2ee Component?

      Answer :

      A self-contained functional software unit supported by a container and configurable at deployment time. The J2EE specification defines the following J2EE components: Application clients and applets are components that run on the client. Java servlet and JavaServer Pages (JSP) technology components are Web components that run on the server. Enterprise JavaBeans (EJB) components (enterprise beans) are business components that run on the server. J2EE components are written in the Java programming language and are compiled in the same way as any program in the language. The difference between J2EE components and "standard" Java classes is that J2EE components are assembled into a J2EE application, verified to be well formed and in compliance with the J2EE specification, and deployed to production, where they are run and managed by the J2EE server or client container.

    102. Question 102. What Is J2ee Module?

      Answer :

      A software unit that consists of one or more J2EE components of the same container type and one deployment descriptor of that type. There are four types of modules: EJB, Web, application client, and resource adapter. Modules can be deployed as stand-alone units or can be assembled into a J2EE application.

    103. Question 103. What Is J2ee Product?

      Answer :

      An implementation that conforms to the J2EE platform specification.

    104. Question 104. What Is J2ee Product Provider?

      Answer :

      A vendor that supplies a J2EE product.

    105. Question 105. What Is J2ee Server?

      Answer :

      The runtime portion of a J2EE product. A J2EE server provides EJB or Web containers or both.

    106. Question 106. What Is J2me?

      Answer :

      Abbreviate of Java 2 Platform, Micro Edition.

    107. Question 107. What Is J2se?

      Answer :

      Abbreviate of Java 2 Platform, Standard Edition.

    108. Question 108. What Is Jar?

      Answer :

      Java archive. A platform-independent file format that permits many files to be aggregated into one file.

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

      Answer :

      An environment for developing and deploying enterprise applications. The J2EE platform consists of a set of services, application programming interfaces (APIs), and protocols that provide the functionality for developing multitiered, Web-based applications.

    110. Question 110. What Is Java 2 Platform, Micro Edition (j2me)?

      Answer :

      A highly optimized Java runtime environment targeting a wide range of consumer products, including pagers, cellular phones, screen phones, digital set-top boxes, and car navigation systems.

    111. Question 111. What Is Java 2 Platform, Standard Edition (j2se)?

      Answer :

      The core Java technology platform.

    112. Question 112. What Is Java Api For Xml Processing (jaxp)?

      Answer :

      An API for processing XML documents. JAXP leverages the parser standards SAX and DOM so that you can choose to parse your data as a stream of events or to build a tree-structured representation of it. JAXP supports the XSLT standard, giving you control over the presentation of the data and enabling you to convert the data to other XML documents or to other formats, such as HTML. JAXP provides namespace support, allowing you to work with schema that might otherwise have naming conflicts.

    113. Question 113. What Is Java Api For Xml Registries (jaxr)?

      Answer :

      An API for accessing various kinds of XML registries.

    114. Question 114. What Is Java Api For Xml-based Rpc (jax-rpc)?

      Answer :

      An API for building Web services and clients that use remote procedure calls and XML.

    115. Question 115. What Is Java Idl?

      Answer :

      A technology that provides CORBA interoperability and connectivity capabilities for the J2EE platform. These capabilities enable J2EE applications to invoke operations on remote network services using the Object Management Group IDL and IIOP.

    116. Question 116. What Is Java Message Service (jms)?

      Answer :

      An API for invoking operations on enterprise messaging systems.

    117. Question 117. What Is Java Naming And Directory Interface (jndi)?

      Answer :

      An API that provides naming and directory functionality.

    118. Question 118. What Is Java Secure Socket Extension (jsse)?

      Answer :

      A set of packages that enable secure Internet communications.

    119. Question 119. What Is Java Transaction Api (jta)?

      Answer :

      An API that allows applications and J2EE servers to access transactions.

    120. Question 120. What Is Java Transaction Service (jts)?

      Answer :

      Specifies the implementation of a transaction manager that supports JTA and implements the Java mapping of the Object Management Group Object Transaction Service 1.1 specification at the level below the API.

    121. Question 121. What Is Javabeans Component?

      Answer :

      A Java class that can be manipulated by tools and composed into applications. A JavaBeans component must adhere to certain property and event interface conventions.

    122. Question 122. What Is Javamail?

      Answer :

      An API for sending and receiving email.

    123. Question 123. What Is Javaserver Faces Technology?

      Answer :

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

    124. Question 124. What Is Javaserver Faces Conversion Model?

      Answer :

      A mechanism for converting between string-based markup generated by JavaServer Faces UI components and server-side Java objects.

    125. Question 125. What Is Javaserver Faces Event And Listener Model?

      Answer :

      A mechanism for determining how events emitted by JavaServer Faces UI components are handled. This model is based on the JavaBeans component event and listener model.

    126. Question 126. What Is Javaserver Faces _expression Language?

      Answer :

      A simple _expression language used by a JavaServer Faces UI component tag attributes to bind the associated component to a bean property or to bind the associated component's value to a method or an external data source, such as a bean property. Unlike JSP EL expressions, JavaServer Faces EL expressions are evaluated by the JavaServer Faces implementation rather than by the Web container.

    127. Question 127. What Is Javaserver Faces Navigation Model?

      Answer :

      A mechanism for defining the sequence in which pages in a JavaServer Faces application are displayed.

    128. Question 128. What Is Javaserver Faces Ui Component?

      Answer :

      A user interface control that outputs data to a client or allows a user to input data to a JavaServer Faces application.

    129. Question 129. What Is Javaserver Faces Ui Component Class?

      Answer :

      A JavaServer Faces class that defines the behavior and properties of a JavaServer Faces UI component.

    130. Question 130. What Is Javaserver Faces Validation Model?

      Answer :

      A mechanism for validating the data a user inputs to a JavaServer Faces UI component.

    131. Question 131. What Is Javaserver Pages (jsp)?

      Answer :

      An extensible Web technology that uses static data, JSP elements, and server-side Java objects to generate dynamic content for a client. Typically the static data is HTML or XML elements, and in many cases the client is a Web browser.

    132. Question 132. What Is Javaserver Pages Standard Tag Library (jstl)?

      Answer :

      A tag library that encapsulates core functionality common to many JSP applications. JSTL has support for common, structural tasks such as iteration and conditionals, tags for manipulating XML documents, internationalization and locale-specific formatting tags, SQL tags, and functions.

    133. Question 133. What Is Jaxr Client?

      Answer :

      A client program that uses the JAXR API to access a business registry via a JAXR provider.

    134. Question 134. What Is Jaxr Provider?

      Answer :

      An implementation of the JAXR API that provides access to a specific registry provider or to a class of registry providers that are based on a common specification.

    135. Question 135. What Is Jdbc?

      Answer :

      An JDBC for database-independent connectivity between the J2EE platform and a wide range of data sources.

    136. Question 136. What Is Jms?

      Answer :

      Java Message Service.

    137. Question 137. What Is Jms Administered Object?

      Answer :

      A preconfigured JMS object (a resource manager connection factory or a destination) created by an administrator for the use of JMS clients and placed in a JNDI namespace.

    138. Question 138. What Is Jms Application?

      Answer :

      One or more JMS clients that exchange messages.

    139. Question 139. What Is Jms Client?

      Answer :

      A Java language program that sends or receives messages.

    140. Question 140. What Is Jms Provider?

      Answer :

      A messaging system that implements the Java Message Service as well as other administrative and control functionality needed in a full-featured messaging product.

    141. Question 141. What Is Jms Session?

      Answer :

      A single-threaded context for sending and receiving JMS messages. A JMS session can be nontransacted, locally transacted, or participating in a distributed transaction.

    142. Question 142. What Is Jndi?

      Answer :

      Abbreviate of Java Naming and Directory Interface.

    143. Question 143. What Is Jsp?

      Answer :

      Abbreviate of JavaServer Pages.

    144. Question 144. What Is Jsp Action?

      Answer :

      A JSP element that can act on implicit objects and other server-side objects or can define new scripting variables. Actions follow the XML syntax for elements, with a start tag, a body, and an end tag; if the body is empty it can also use the empty tag syntax. The tag must use a prefix. There are standard and custom actions.

    145. Question 145. What Is Jsp Container?

      Answer :

      A container that provides the same services as a servlet container and an engine that interprets and processes JSP pages into a servlet.

    146. Question 146. What Is Jsp Container, Distributed?

      Answer :

      A JSP container that can run a Web application that is tagged as distributable and is spread across multiple Java virtual machines that might be running on different hosts.

    147. Question 147. What Is Jsp Custom Action?

      Answer :

      A user-defined action described in a portable manner by a tag library descriptor and imported into a JSP page by a taglib directive. Custom actions are used to encapsulate recurring tasks in writing JSP pages.

    148. Question 148. What Is Jsp Custom Tag?

      Answer :

      A tag that references a JSP custom action.

    149. Question 149. What Is Jsp Declaration?

      Answer :

      A JSP scripting element that declares methods, variables, or both in a JSP page.

    150. Question 150. What Is Jsp Directive?

      Answer :

      A JSP element that gives an instruction to the JSP container and is interpreted at translation time.

    151. Question 151. What Is Jsp Tag Library?

      Answer :

      A collection of custom tags described via a tag library descriptor and Java classes.

    152. Question 152. What Is Jstl?

      Answer :

      Abbreviate of JavaServer Pages Standard Tag Library.

    153. Question 153. What Is Jta?

      Answer :

      Abbreviate of Java Transaction API.

    154. Question 154. What Is Jts?

      Answer :

      Abbreviate of Java Transaction Service.

    155. Question 155. What Is Keystore?

      Answer :

      A file containing the keys and certificates used for authentication.

    156. Question 156. What Is Life Cycle (j2ee Component)?

      Answer :

      The framework events of a J2EE component's existence. Each type of component has defining events that mark its transition into states in which it has varying availability for use. For example, a servlet is created and has its init method called by its container before invocation of its service method by clients or other servlets that require its functionality. After the call of its init method, it has the data and readiness for its intended use. The servlet's destroy method is called by its container before the ending of its existence so that processing associated with winding up can be done and resources can be released. The init and destroy methods in this example are callback methods. Similar considerations apply to the life cycle of all J2EE component types: enterprise beans, Web components (servlets or JSP pages), applets, and application clients.

    157. Question 157. What Is Life Cycle (javaserver Faces)?

      Answer :

      A set of phases during which a request for a page is received, a UI component tree representing the page is processed, and a response is produced. During the phases of the life cycle: The local data of the components is updated with the values contained in the request parameters. Events generated by the components are processed. Validators and converters registered on the components are processed. The components' local data is updated to back-end objects. The response is rendered to the client while the component state of the response is saved on the server for future requests.

    158. Question 158. What Is Local Subset?

      Answer :

      That part of the DTD that is defined within the current XML file.

    159. Question 159. What Is Managed Bean Creation Facility?

      Answer :

      A mechanism for defining the characteristics of JavaBeans components used in a JavaServer Faces application.

    160. Question 160. What Is Message?

      Answer :

      In the Java Message Service, an asynchronous request, report, or event that is created, sent, and consumed by an enterprise application and not by a human. It contains vital information needed to coordinate enterprise applications, in the form of precisely formatted data that describes specific business actions.

    161. Question 161. What Makes J2ee Suitable For Distributed Multitiered Applications?

      Answer :

      The J2EE platform uses a multitiered distributed application model. Application logic is divided into components according to function, and the various application components that make up a J2EE application are installed on different machines depending on the tier in the multitiered J2EE environment to which the application component belongs.

      The J2EE application parts are:

      • Client-tier components run on the client machine.
      • Web-tier components run on the J2EE server.
      • Business-tier components run on the J2EE server.
      • Enterprise information system (EIS)-tier software runs on the EIS server.

       

    162. Question 162. How Is The Mvc Design Pattern Used In Struts Framework?

      Answer :

      In the MVC design pattern, application flow is mediated by a central Controller. The Controller delegates requests to an appropriate handler. The handlers are tied to a Model, and each handler acts as an adapter between the request and the Model. The Model represents, or encapsulates, an application’s business logic or state. Control is usually then forwarded back through the Controller to the appropriate View. The forwarding can be determined by consulting a set of mappings, usually loaded from a database or configuration file. This provides a loose coupling between the View and Model, which can make an application significantly easier to create and maintain. Controller: Servlet controller which supplied by Struts itself; View: what you can see on the screen, a JSP page and presentation components; Model: System state and a business logic JavaBeans.

    163. Question 163. What Is Struts?

      Answer :

      A Web page development framework. Struts combines Java Servlets, Java Server Pages, custom tags, and message resources into a unified framework. It is a cooperative, synergistic platform, suitable for development teams, independent developers, and everyone between.

    164. Question 164. What Is Java Naming And Directory Service?

      Answer :

      The JNDI provides naming and directory functionality. It provides applications with methods for performing standard directory operations, such as associating attributes with objects and searching for objects using their attributes. Using JNDI, a J2EE application can store and retrieve any type of named Java object. Because JNDI is independent of any specific implementations, applications can use JNDI to access multiple naming and directory services, including existing naming and directory services such as LDAP, NDS, DNS, and NIS.

    165. Question 165. What Is Jaap?

      Answer :

      The Java Authentication and Authorization Service (JAAS) provides a way for a J2EE application to authenticate and authorize a specific user or group of users to run it. It is a standard Pluggable Authentication Module (PAM) framework that extends the Java 2 platform security architecture to support user-based authorization.

    166. Question 166. What Is J2ee Connector?

      Answer :

      The J2EE Connector API is used by J2EE tools vendors and system integrators to create resource adapters that support access to enterprise information systems that can be plugged into any J2EE product. Each type of database or EIS has a different resource adapter. Note: A resource adapter is a software component that allows J2EE application components to access and interact with the underlying resource manager. Because a resource adapter is specific to its resource manager, there is typically a different resource adapter for each type of database or enterprise information system.

    167. Question 167. What Is Jaxp?

      Answer :

      JAXP stands for Java API for XML. XML is a language for representing and describing text-based data which can be read and handled by any program or tool that uses XML APIs. It provides standard services to determine the type of an arbitrary piece of data, encapsulate access to it, discover the operations available on it, and create the appropriate JavaBeans component to perform those operations.

    168. Question 168. What Is Jta And Jts?

      Answer :

      JTA is the abbreviation for the Java Transaction API. JTS is the abbreviation for the Jave Transaction Service. JTA provides a standard interface and allows you to demarcate transactions in a manner that is independent of the transaction manager implementation. The J2EE SDK implements the transaction manager with JTS. But your code doesn’t call the JTS methods directly. Instead, it invokes the JTA methods, which then call the lower-level JTS routines. Therefore, JTA is a high level transaction interface that your application uses to control transaction. and JTS is a low level transaction interface and ejb uses behind the scenes (client code doesn’t directly interact with JTS. It is based on object transaction service(OTS) which is part of CORBA.

    169. Question 169. What Is The Ear File?

      Answer :

      An EAR file is a standard JAR file with an .ear extension, named from Enterprise ARchive file. A J2EE application with all of its modules is delivered in EAR file.

    170. Question 170. What Is The Web Container?

      Answer :

      Servlet and JSP containers are collectively referred to as Web containers. It manages the execution of JSP page and servlet components for J2EE applications. Web components and their container run on the J2EE server.

    171. Question 171. What Is Applet Container?

      Answer :

      IManages the execution of applets. Consists of a Web browser and Java Plugin running on the client together.

    172. Question 172. What Are Container Services?

      Answer :

      A container is a runtime support of a system-level entity. Containers provide components with services such as lifecycle management, security, deployment, and threading.

    173. Question 173. What Can Be Considered As A Web Component?

      Answer :

      J2EE Web components can be either servlets or JSP pages. Servlets are Java programming language classes that dynamically process requests and construct responses. JSP pages are text-based documents that execute as servlets but allow a more natural approach to creating static content.

    174. Question 174. What Is The Container?

      Answer :

      Containers are the interface between a component and the low-level platform specific functionality that supports the component. Before a Web, enterprise bean, or application client component can be executed, it must be assembled into a J2EE application and deployed into its container.

    175. Question 175. Is Html Page A Web Component?

      Answer :

      No. Static HTML pages and applets are bundled with web components during application assembly, but are not considered web components by the J2EE specification. Even the server-side utility classes are not considered web components, either.

    176. Question 176. Are Javabeans J2ee Components?

      Answer :

      No. JavaBeans components are not considered J2EE components by the J2EE specification. They are written to manage the data flow between an application client or applet and components running on the J2EE server or between server components and a database. JavaBeans components written for the J2EE platform have instance variables and get and set methods for accessing the data in the instance variables. JavaBeans components used in this way are typically simple in design and implementation, but should conform to the naming and design conventions outlined in the JavaBeans component architecture.

    177. Question 177. Is J2ee Application Only A Web-based?

      Answer :

      No, It depends on type of application that client wants. A J2EE application can be web-based or non-web-based. if an application client executes on the client machine, it is a non-web-based J2EE application. The J2EE application can provide a way for users to handle tasks such as J2EE system or application administration. It typically has a graphical user interface created from Swing or AWT APIs, or a command-line interface. When user request, it can open an HTTP connection to establish communication with a servlet running in the web tier.

    178. Question 178. What Do Enterprise Javabeans Components Contain?

      Answer :

      Enterprise JavaBeans components contains Business code, which is logic that solves or meets the needs of a particular business domain such as banking, retail, or finance, is handled by enterprise beans running in the business tier. All the business code is contained inside an Enterprise Bean which receives data from client programs, processes it (if necessary), and sends it to the enterprise information system tier for storage. An enterprise bean also retrieves data from storage, processes it (if necessary), and sends it back to the client program.

    179. Question 179. What Is Corba? What Does It Do?

      Answer :

      CORBA is the acronym for Common Object Request Broker Architecture, OMG's open, vendor-independent architecture and infrastructure that computer applications use to work together over networks. Using the standard protocol IIOP, a CORBA-based program from any vendor, on almost any computer, operating system, programming language, and network, can interoperate with a CORBA-based program from the same or another vendor, on almost any other computer, operating system, programming language, and network.

    180. Question 180. What Is Corba Good For?

      Answer :

      CORBA is useful in many situations. Because of the easy way that CORBA integrates machines from so many vendors, with sizes ranging from mainframes through minis and desktops to hand-helds and embedded systems, it is the middleware of choice for large (and even not-so-large) enterprises. One of its most important, as well most frequent, uses is in servers that must handle large number of clients, at high hit rates, with high reliability. CORBA works behind the scenes in the computer rooms of many of the world's largest websites; ones that you probably use every day. Specializations for scalability and fault-tolerance support these systems. But it's not used just for large applications; specialized versions of CORBA run real-time systems, and small embedded systems.

    181. Question 181. How Do Remote Invocations Work?

      Answer :

      In order to invoke the remote object instance, the client first obtains its object reference. (There are many ways to do this, but we won't detail any of them here. Easy ways include the Naming Service and the Trader Service.) To make the remote invocation, the client uses the same code that it used in the local invocation we just described, substituting the object reference for the remote instance. When the ORB examines the object reference and discovers that the target object is remote, it routes the invocation out over the network to the remote object's ORB. (Again we point out: for load balanced servers, this is an oversimplification.)

      How does this work? OMG has standardized this process at two key levels: First, the client knows the type of object it's invoking (that it's a shopping cart object, for instance), and the client stub and object skeleton are generated from the same IDL. This means that the client knows exactly which operations it may invoke, what the input parameters are, and where they have to go in the invocation; when the invocation reaches the target, everything is there and in the right place. We've already seen how OMG IDL accomplishes this. Second, the client's ORB and object's ORB must agree on a common protocol - that is, a representation to specify the target object, operation, all parameters (input and output) of every type that they may use, and how all of this is represented over the wire. OMG has defined this also - it's the standard protocol IIOP. (ORBs may use other protocols besides IIOP, and many do for various reasons. But virtually all speak the standard protocol IIOP for reasons of interoperability, and because it's required by OMG for compliance.)

      Although the ORB can tell from the object reference that the target object is remote, the client can not. (The user may know that this also, because of other knowledge - for instance, that all accounting objects run on the mainframe at the main office in Tulsa.) There is nothing in the object reference token that the client holds and uses at invocation time that identifies the location of the target object. This ensures location transparency - the CORBA principle that simplifies the design of distributed object computing applications.

    182. Question 182. Can Corba Allow Servers To Cause Client Side Events Or Notifications?

      Answer :

      CORBA communication is inherently asymmetric. Request messages originate from clients and responses originate from servers. The important thing to realize is that a CORBA server is a CORBA object and a CORBA client is a CORBA stub. A client application might use object references to request remote service, but the client application might also implement CORBA objects and be capable of servicing incoming requests. Along the same lines, a server process that implements CORBA objects might have several object references that it uses to make requests to other CORBA objects. Those CORBA objects might reside in client applications. By implementing a CORBA object within an client application, any process that obtains its object reference can "notify" it by performing an operation on the client-located object.

    183. Question 183. Why Would Applications Require Asynchronous Communications?

      Answer :

      Performance is the most common reason. Applications that perform a series of tasks that must be done sequentially cannot benefit from asynchronous communication. Applications that make only short duration remote operations have little need for asynchronous communication. Asynchronous communication can allow an application to perform additional tasks instead of waiting for tasks to complete. Applications that have a number of tasks that can be performed in any order can often benefit from distributed asynchronous communication. This becomes more important for applications that call lengthy remote operations. In order to benefit from asynchronous communication, an application must be able to perform some task after the request is issued but before the response is available. Tasks might include prompting for additional user input, displaying information, or making additional remote operation requests. Typical asynchronous communication candidates include applications that need to perform several lengthy database queries or complex calculations.

    184. Question 184. Does Corba Support Asynchronous Communication?

      Answer :

      Kind of. At the lowest level CORBA supports two modes of communication: A synchronous request/response which allows an application to make a request to some CORBA object and then wait for a response. A deferred synchronous request/response which allows an application to make a request to some CORBA object. An empty result will be returned immediately to the application. It can then perform other operations and later poll the ORB to see if the result has been made available. At the lowest level, the CORBA deferred synchronous communication does allow a certain degree of asynchronous communication. Polling for responses represents only one form of asynchronous communication. Other more sophisticated asynchronous communication can only be achieved by developing an architecture on top of the lowest levels of CORBA.

    185. Question 185. Are Application Threading And Asynchronous Communication Related?

      Answer :

      Theoretically, no. They come from different families but hang out together a lot. Each has its own identity, but sometimes they can work together to make things go much more smoothly. Applications that wish to perform multiple concurrent tasks can use multiple threads instead of multiple asynchronous or deferred requests. Just as the distribution of operations across processes can allow for concurrent processing, performing tasks in different threads can allow for concurrent processing. Distribution supports concurrent processing across a network and threading supports concurrent processing within a particular machine. An application that needs to perform concurrent distributed requests can issue requests in different threads or issue asynchronous requests. The use of threading adds complex synchronization issues to the development process.

    186. Question 186. Are There Important Forms Of Asynchronous Communication That Aren't Supported Directly By Corba?

      Answer :

      Yeah, but you can fake it pretty easily. While CORBA does support a deferred synchronous request/response, it does not directly support distributed requests with a callback driven response. A callback driven response allows an application to perform an operation on a distributed object, associate a callback with the response, continue with other processing. When the server responds, the associated callback is automatically executed within the original caller's application.

    187. Question 187. Can Corba Applications Be Multi-threaded?

      Answer :

      The CORBA specification does not currently address multi-threaded architectures. Provided that the CORBA product is thread safe, threaded CORBA applications can be developed. CORBA clients and servers can both be multi-threaded. Daemon processes provided with CORBA products may be implemented as multi-threaded servers by the CORBA vendor. Different multi-threaded models or multi-threaded architectures may be supported by a particular CORBA product. A particular ORB may provide frameworks to simplify the development of multi-threaded CORBA applications.

    188. Question 188. Why Would I Decide To Implement A Corba Client Application With Multi-threading?

      Answer :

      Client-side CORBA applications might require multi-threading to allow it to perform other tasks while it is waiting for a synchronous remote invocation to return. It might desire this functionality for several different reasons. A client application might wish to leverage the static request/response style of invocation but achieve some degree of asynchronous communication. Perhaps the client wishes to perform several synchronous invocations within their own application threads. This would allow a client to obtain results from several remote servers more quickly. There are several reasons the use of multi-threading might be preferred over the use of DII. DII might be complicate application source code. Application polling associated with the deferred synchronous invocation might result in a performance bottleneck. A client-side CORBA application might need to respond to events such as incoming invocations, connect requests, or GUI events (mouse clicks, etc.) CORBA products that support only blocking style remote invocations will be unable to process any of these events. This would mean that a client-side application would be unable to respond to GUI events for the duration of any remote CORBA invocations. This is not an issue for short duration invocations but becomes a problem for longer invocations or in failure or time-out situations. Performing remote invocations within dedicated threads can avoid this issue.

    189. Question 189. Why Would I Decide To Implement A Corba Server Application With Multi-threading?

      Answer :

      CORBA server applications may be multi-threaded for serveral reasons.
      A particular CORBA object may support an operation whose implementation performs some blocking routine. This may be a disk read or database query. Let us assume that the server application processes all CORBA events within a single main thread. This means that the server will be unable to respond to incoming connection requests or invocation requests while the blocking operation is in progress. Multi-threading can be used to avoid these sorts of situations. The server can be more accessible if multiple threads are allowed to process (an block during) incoming CORBA events. A single multi-threaded server process supporting many (>25) clients is much more efficient that many (>25) single-threaded server processes each supporting its own client. Running a single application with multiple threads requires less machine resources than running multiple applications. This advantage can be seen even if the operation invocations are of short duration and non-blocking.

    190. Question 190. Are There Reasons To Avoid The Development Of Multi-threaded Corba Applications ?

      Answer :

      Building multi-threaded applications requires an additional efforts in the area of design, development and testing. Issues like concurrency and synchronization become more critical. Difficult to find software bugs are unfortunately easy to introduce. A specific set of application requirements can often be met without resorting to the use of threaded clients or servers. This is not true with all applications. Some do require multi-threading to achieve their desired level of concurrency, performance or scalability.

    191. Question 191. Does Corba Define High Level Application Architectures?

      Answer :

      No, it's infrastructure. Which is good because the history of high-level "one size fits all" architectures hasn't been very good, has it? CORBA provides low level request/response communication. It also provides general services that are implemented on top of request/response communication. The actual architecture used within a given application is not defined by CORBA. CORBA leaves these decisions up the application architect.

    192. Question 192. Can Corba Applications Have Callbacks?

      Answer :

      Yes. The words client and server are really only applicable in the context of a remote call. In other words, the "client process" can also receive calls on CORBA objects that it implements and hands out the references to.

    193. Question 193. What Is An Object Reference?

      Answer :

      A transient, opaque handle that identifies an object instance in your ORB. An object reference is the identifier needed to invoke methods on objects. Object references are not global identifiers that are valid across all machines in a distributed network. Their scope is limited to your local ORB.

    194. Question 194. Why A Handle Rather Than A "hard" Address?

      Answer :

      CORBA is a dynamic environment and objects move around in an unpredictable manner. You need a soft locator rather than something static and brittle.

    195. Question 195. For How Long Is An Object Reference Valid?

      Answer :

      Only during the session while your client is connected to the ORB. If a target object moves during a session, the ORB will provide the equivalent of a transparent forwarding mechanism.

    196. Question 196. What If I Want A Persistent Reference?

      Answer :

      Stringify the object reference and save it in a persistent medium. But, we have to warn you, you're about to get into deep water. Maybe you should just skip to the section on Naming Service, unless you want to be an "expert".

    197. Question 197. How Do I Stringify An Object Reference?

      Answer :

      Use object_to_string(), and reverse the process using string_to_object(). There is some magic in string_ to_ object(); it not only does the necessary string-to-pointer conversion, it ensures that you get a currently valid object reference that is equivalent to the original reference that was stringified (i.e., both refer to the same object instance).

    198. Question 198. What Is The Format Of An Object Reference?

      Answer :

      We can't tell you because there is no standard for this. OMG wanted to give ORB implementers as much freedom as possible to develop efficient, possibly platform-dependent schemes. Thus, the references are opaque and should be thought of as an interface without regard for their implementation.

    199. Question 199. Who Creates Object References?

      Answer :

      Some ORB calls such as resolve_initial_references() and string_to_object() generate an object reference. The object it refers to might or might not exist (the act of using the object reference can result in the creation of the actual object). Also, a factory might create an object reference by creating an object implementation within the same process. The factory could generate the object reference and cause an object to be created (as above), or the factory could obtain the object reference from some other source (NameService, TraderService).

    200. Question 200. How Do I Compare References?

      Answer :

      Use is_equivalent(), but don't take it too seriously. This method never lies to you, if it says two references are equivalent, then they are. But they might be equivalent but not identical and is_equivalent() can potentially return false. See the October 1996 column by Steve Vinoski and Doug Schmidt in C++ Report.

    201. Question 201. What Other Surprises Are There With Is_equivalent()?

      Answer :

      Remember that is_equivalent() is invoked on one of the two objects, and there are cases where this can cause deadlock. The following example illustrates how this can happen on one particular single-threaded ORB that won't allow a server to invoke a method on the client (contributed by Jeff Stewart, [email protected]; used with permission): Suppose a server receives updates from cached clients and then has to update all clients except for the one that reported (updating the reporting client would cause a deadlock on this ORB). So, as the server iterates through its client list it must ensure that it does not invoke the reporting client. But it can't use is_equivalent() because this will eventually cause an invocation on the reporting client just to do the is_equivalent() check, inadvertently creating a deadlock.

    202. Question 202. Is That All Of The Bad News About Is_equivalent()?

      Answer :

      Not really. You also have to remember that it typically requires network traffic. It's easy to fall into the wishful thinking that the ORB can handle is_equivalent() for you, but, in general, it doesn't.

    203. Question 203. So Why Don't We Just Compare Stringified References?

      Answer :

      First, the object may have moved in between the times that its references were stringified, so the strings may not be identical. Also, there are potential problems if you have multiple vendors because stringified object references can be quite ORB-specific.

    204. Question 204. This Sounds Too Complicated. Should I Just Learn Dcom Instead?

      Answer :

      No, not at all. We've taken you into the depths of a topic that has deep philosophical roots, which has been the focus of arguments for many years. Most people never need this kind of knowledge. We warned you earlier, didn't we? And you just had to know, didn't you?

    205. Question 205. Why Do You Say, "most People Never Need This Kind Of Knowledge"?

      Answer :

      From a practical standpoint, these considerations don't come up all that often, even for people who have to work at this level. Fortunately, most users can merely use the Naming Service and work with (essentially) character strings for names, and avoid all the complexity above.

    206. Question 206. Then Why Did You Just Drag Us Through The Mud?

      Answer :

      You're the one who wanted to be an expert. We just wanted to raise your awareness so that you'll think twice when comparing object references. Besides, this is a good way to illustrate how CORBA requires a little learning on your part.

    207. Question 207. When Do I Use _var Instead Of _ptr?

      Answer :

      Use _var when you can, because they are simpler. Use _ptr when you have to, usually for performance reasons. Sometimes there are critical windows you can't afford to let the system take over memory management. As a very rough guide, think about _ptr when you have many fine-grained objects and known timing or performance problems.

    208. Question 208. What If I Want To Invoke Methods On An Object In Another Orb?

      Answer :

      Then you need to know about interoperable object references (IOR).

    209. Question 209. Does An Ior Have A Defined Format And, If So, Why?

      Answer :

      Yes, because this is something that inherently requires cooperation between different vendors and ORBs. Ordinary object references exist within an ORB so there was no compelling reason to standardize formats.

    210. Question 210. What Is The Format Of An Ior?

      Answer :

      The specific details can be found at the OMG web site, and probably shouldn't matter to you. But it doesn't hurt to know that an IOR consists of a type ID and one or more tagged profiles.

    211. Question 211. What Is A Tag?

      Answer :

      A tag indicates the protocol ID from the most recent protocol change as the IOR flowed from its home ORB to your local ORB (we'll discuss what this is all about when we get into more detail on bridges and interoperability), and is something that is registered with OMG; for instance, IIOP has an ID of zero.

    212. Question 212. What Is A Profile?

      Answer :

      A high-performance way for an ORB to tell another ORB what it needs to know to use the IOR properly. There are two types, single- and multiple-component. Both typically contain information about the presence of ORB services such as Transaction Service.

    213. Question 213. What Is The Difference Between The Two Types Of Profiles?

      Answer :

      It depends. Profiles are defined by the people who developed the protocol and registered its tag with OMG. IIOP uses a single-component profile, while DCE CIOP uses a multiple-component profile.

    214. Question 214. Why Did You Say That The Specific Details Probably Shouldn't Matter?

      Answer :

      You'll probably never need them because you'll probably never see an example of an IOR. These only exist in the nether world between ORBs.

    215. Question 215. But How Does My Program Use An Ior?

      Answer :

      It doesn't. Your local ORB creates a local proxy for the remote object represented by the IOR. All your program ever sees directly is the object reference for the proxy. The ORB takes care of everything else.

    216. Question 216. What About Stringifying An Ior?

      Answer :

      You never learn, do you? Let's discuss this at another time. When you are in a position where you need this knowledge, you won't be getting your information from this document. In the meantime, learn all about Naming Service.

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

      Answer :

      If you create the object reference from a string via a CORBA 2.0 compliant library then the object reference is an IOR. If you create the object reference via resolve_initial_references() the ORB libraries might create an OR or an IOR. Some ORBs from companies such as Expersoft and Visigenic ORBs support only native IIOP and thus all references are IORs. On the other hand, some commericial vendors who shipped ORBS that supported IDL before IIOP existed pass around references that are not IORs and thus these referencesmight not always be IORs. Many cases an ORB vendor might support a proprietary protocol in addition to IIOP. Note: even if resolve_initial_references() returns and IOR, the IOR almost always refers to an object implemented with the same ORB environment as the application calling resolve_initial_references(). If the object reference is obtained from a server, a NameContext, or from a factory, the process and ORB libraries that originially created the object reference, determine if the reference is an OR or an IOR.

    218. Question 218. What Is A Factory?

      Answer :

      A factory is a CORBA Object that returns another CORBA object via one of its CORBA operations. There are many different types of factories with many different purposes. In fact, the OMG has defined several services that are actually factories.

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

      Answer :

      The CORBA Lifecycle specification defines a GenericFactory interface from which all factories should inherit, but this is not required. The CORBA specification also defines a factory for factories, known as a factory finder. The factory finder is a just a CORBA factory which act as a factory for other factory interfaces.

    220. Question 220. What Is A Distributed Reference Counting Architecture?

      Answer :

      Distributed reference counting is something typically performed either by a remote object, the factory for the remote object or possibly by the ORB itself. The key concept is that something is tracking the number of connections to a particular remote object. The counter is incremented when a new reference to the remote object is created. The counter is decremented when a reference to the remote object is destroyed. The idea is that by looking at the counter, one can determine if the remote object is still in use.

    221. Question 221. Why Would An Application Implement A Distributed Reference Counting Architecture?

      Answer :

      There are several reasons why reference counting might be important.

      Clean-up: An application might like to know that a remote object no longer has active references. The typical reason is that object that are no longer in use can be removed from memory. This allows resources associated with a remote object to be reclaimed. This is especially important if a distinct remote object exists for each client application.

      Reporting: In many cases it might be helpful to know the usage patterns for a particular remote object. Without reference counting, an object could only report the total number of method invocations performed. Information regarding the number of connected clients or average usage per client would only be available if a reference counting architecture was in place.

      Load Balancing: In some cases, a client might gain access to a remote object via an out-of-process factory. The goal of the factory might be to support clients via a pool of remote objects hosted on different machines. The factory can choose which remote object to return based on actual usage. Reference counting might be one mechanism for determining a remote object's "load".

    222. Question 222. Does Corba Support Distributed Reference Counting Architectures?

      Answer :

      CORBA does not directly support distributed reference counting. This was a conscious decision on the part of its designers. While CORBA does not directly support reference counting, it is possible to build reference counting into a particular distributed object architecture. This can be done through an explicit session management facility which can be exposed through factories or other remote interfaces. While it is possible to design reference counting into an application, it is the burden of the application designer/developer to ensure that such an approach is implemented correctly.

    223. Question 223. Is There An Alternative To Distributed Reference Counting Architectures?

      Answer :

      Yes: connection-less architectures. With a connection-less architecture, an object does not "know" any thing about the object references which refer to it, including the number of references. This is the style found most often on the World Wide Web.

    224. Question 224. Do Different Corba Implementations Perform At Significantly Different Levels?

      Answer :

      They can. Different CORBA implementations can vary significantly in performance. Good implementations should be fairly similar since network performance defines the maximum achievable performance characteristics. Network latency does represent the significant portion of distributed invocation latency.

    225. Question 225. What Types Of Performance Should I Be Concerned With?

      Answer :

      There are many different performance characteristics that are important. Performance should also scale linearly as connections or objects increase. While raw throughput between one client and one server is important, it is not the only or the most critical characteristic. Many characteristics of the CORBA implementation should be considered. As always, actual application requirements to the relative importance of these different characteristics. With the high speed nature of most CORBA implementations, raw client/server throughput is often not a bottleneck. It is also important that factors such as the number of operations does not slow down individual remote invocations. Here is a list of some important performance characteristics.

      • Scalability across connected client applications.
      • Scalability across objects within a CORBA server.
      • Raw throughout between one client and one server.
      • Activation time of server processes.
      • Activation time of CORBA objects.
      • Streaming time for different IDL types.
      • Connection time associated with the first remote operation, _narrow call, _is_a call etc.
      • Minimum memory consumed by a CORBA object.
      • Number of file descriptors consumed by a complex network of distributed objects.

    226. Question 226. What Is Interoperability?

      Answer :

      Interoperability describes whether or not two components of a system that were developed with different tools or different vendor products can work together. CORBA addresses interoperability at various levels.

    227. Question 227. How Does Corba Support Interoperability?

      Answer :

      CORBA's goal is to address interoperability at various levels. There is a history to this. In the early versions of CORBA, interoperability between platforms and programming languages was addressed. This included the standardization of IDL and the mapping of IDL to a programming language. While a client and server developed with the same vendor's ORB could talk to one another, a client and server developed with different vendors' ORBs were not likely to interoperate. CORBA 2.0 introduced interoperability between different ORB vendors. This resulted from the introduction of a standard wire protocol called General Inter-ORB Protocol (GIOP), and the incarnation for GIOP for the internet, known as Internet Inter-ORB Protocol (IIOP). So CORBA 2.0 compliant ORBs will interoperate. This means a client using ORB vendor A can talk to a server using ORB vendor B. Interoperability is actually a broader issue than just have ORB vendor A talking to ORB vendor B. Fuller interoperability means that various services interoperate. For example, while a CORBA object can talk to a DCOM object via a protocol bridge, can the CORBA Transaction Service talk to the Microsoft Transaction Service to have a seamless transaction between systems? This broader interoperability at the service level is being addressed now.

    228. Question 228. Should I Use Underscores ("_") In The Names Of Interfaces And/or Methods?

      Answer :

      In other words, when representing the concept of a "foreign exchange rate" in IDL, should the IDL interface be called ForeignExchangeRate or Foreign_Exchange_Rate? Similarly should a method to "execute the trade" be called executeTheTrade() or execute_the_trade()? There are many stylistic issues that boil down to "I think it looks better this way or that way." But from a development/maintenance cost perspective, these have little if any value. However there are some nits that can bite you if you choose one over the other. If you expect to interoperate with Smalltalk, the underscore can create an ambiguity, particularly if you mix the two styles. For example, the IDL names execute_the_trade() and executeTheTrade() both are mapped into the Smalltalk name executeTheTrade(), which could create an ambiguity if the styles are mixed. In this case, it is best to avoid the underscores. Similarly if you expect to interoperate with the C language, the IDL :: token is mapped to an _ in C, which can create ambiguities. In this case it is best to avoid the underscores. It's a small point, to be sure, but it can catch up to you in the long run.

    229. Question 229. What Is The Basic Corba Architecture?

      Answer :

      The CORBA architecture is designed to support the distribution of objects implemented in a variety of programming languages. This is achieved by defining an interface definition language that can be mapped to a number of existing languages. IDL is used to define the services offered by a particular distributed object. CORBA defines a wire protocol for making requests to an object and for the object to respond to the application making the request. The IIOP protocol ensures interoperability between client applications and server based objects. CORBA then extends on this basic set of functionality by defining a set of low level services. These services are required by applications regardless of the exact nature of the applications. These services are defined in CORBA IDL. CORBA vendors preprocess the service IDL and then implement the service with varying degrees of robustness.

    230. Question 230. How Are Corba Objects Defined?

      Answer :

      CORBA objects are defined as Interfaces in IDL.

    231. Question 231. What Capabilities Do Corba Objects Possess?

      Answer :

      CORBA objects support operations that take and return simple and complex IDL types.

    232. Question 232. What Are Corba Pseudo Objects?

      Answer :

      CORBA Pseudo Objects are not real CORBA objects. A CORBA Object has an Object Reference, and can be accessed remotely. Pseudo objects do not have Object References and cannot be accessed remotely.

    233. Question 233. Why Are Pseudo Objects Needed?

      Answer :

      Keep in mind the CORBA is primarily a specification for accessing remote objects. There is support for location transparency and the case where CORBA objects can be accessed locally, but there is a bias in the specification for remote objects. There is a need, however, to describe local objects, such as the ORB itself in the local process. In keeping with CORBA, the description of this local object is done in IDL, so that the description is programming language independent. To distinguish the use of IDL to describe a potentially remote object (the normal use of IDL), and the use of IDL to describe an exclusively local object, the concept of a Pseudo Object was introduced. Pseudo objects use Pseudo IDL (also called PIDL) to describe their interfaces. PIDL is indentical to IDL, except the intention is that the object of a PIDL interface is not associated with an Object Reference for the purposes of remote access.

    234. Question 234. What Is The Purpose Of Idl?

      Answer :

      IDL stands for Interface Definition Language. Its purpose is to define the capabilities of a distributed service along with a common set of data types for interacting with those distributed services. IDL meets a number of objectives:

      • Language Independence:
      • Distributed service specification:
      • Definition of complex data types:
      • Hardware Independence.

    235. Question 235. How Do I Express Aggregation In Idl?

      Answer :

      The aggregation of two objects is a very common OO design concept. Aggregation is also known as has-a and contains. Since IDL doesn't support "public data," a programmer that is using an IDL interface cannot tell whether an aggregation is actually implemented using aggregation or by some other technique. In other words, IDL is a specification language that separates interface from implementation. In particular, IDL does not support implementation constructs such as aggregation. However logical aggregation is supported by IDL: IDL lets you specify an operation that returns another interface, and this second interface could represent an object that is logically contained within the first object. Whether it's actually implemented using aggregation or not is an implementation issue, not a specification issue, and the implementer can do it either way without requiring any changes to the IDL interface. Note that DCOM directly supports aggregation since DCOM combines implementation issues with specification issues. The COM<->CORBA interworking specification actually maps aggregation to and from inheritance (CORBA IDL supports inheritance directly, and DCOM supports aggregation directly).

    236. Question 236. How Are Object References Obtained By Applications?

      Answer :

      Object references allow applications to issue distributed requests. How does an application acquire an object reference? CORBA provides a number of ways for this to occur. They basically fall into two categories, mechanisms to obtain initial object references and mechanisms to obtain subsequent object references.

      CORBA provides two standard ways to obtain an initial object reference:

      ORB::resolve_initial_references(string): CORBA defines a vendor specific mechanism for obtaining an initial set of object references. While CORBA defines the interface for the mechanism, internals required to drive the functionality are not standardized. CORBA specifies that an application can obtain an object reference by calling resolve_initial_references(), but vendor specific configurations files, command line arguments, of environmental variable might be required for the call to succeed. Object references obtained in this way can most likely be implemented only within the same vendors ORB. ORB::string_to_object(string):

      CORBA provides a vendor independent mechanism for obtaining an object reference. The string_to_object() operation returns an object reference directly from a particular string. The object reference is actually an interoperable object reference and thus can be implemented within an ORB supporting IIOP. Strings are basically encoded identifiers and are not human readable. The string can be hard coded into an application, stored and retrieved from a file, or obtained through some other IPC mechanism. Strings are initially created by calling object_to_string() on an actual object reference. Once an application obtains an object reference, it can obtain subsequent objects by calling any remote operations on the original object reference that happen to return a CORBA object. CORBA refers to an object capable of returning an object reference as a factory. CORBA defines two services that are basically mechanisms by which subsequent object references can be obtained. These are listed below: CORBA NameService CORBA TraderService .

    237. Question 237. What Is A Language Mapping?

      Answer :

      CORBA IDL is used to describe application and system interfaces in a manner that is independent of programming language and computer platform. A language mapping is a standard to convert the IDL to a particular programming language, like C, C++ or Java.

    238. Question 238. What Is The Static Invocation Interface?

      Answer :

      The CORBA specification defines two mechanisms for invoking operations on a CORBA Object. Functionaly, the two mechanisms provide the same capabilities. They allow basically the IDL defined operations on the CORBA object to be invoked, allow program variables to be passed to the operation as inbound parameters, and allow return values or out parameters to be passed from the server to the client. The first mechanism is known as the Static Invocation Interface (SII), the other is known as Dynamic Invocation Interface . Developers of client applications which use SII must know the name of the operation, and all parameters/return types prior to program compilation. The actual operation names and parameters/return values are in effect hard coded into the application source code.

    239. Question 239. Which Is The Best Mechanism To Invoke Operations On An Object?

      Answer :

      Generally speaking, SII is the easiest mechanism which can be used to invoke operations on a CORBA object. All applications which use SII could be implemented with DII. Not all applications which use DII can be implemented with SII. If an application can be developed with SII then it probably should be. This is because developing code with SII requires less code and is much more straight forward. The language compiler can be used to validate types and optimize code. There are certain conditions which make DII a better alternative.

    240. Question 240. How Does A Orb Support Static Invocation Interface?

      Answer :

      Implementations of the CORBA specification (i.e. a CORBA ORB) support SII in the following way. The ORB will provide an IDL compiler which is specific to that particular ORB product. When a developer compiles their IDL with the ORB vendor's IDL compiler, stubs and skeletons are created. These stubs and skeletons are static. This is because they do not change. If changes are made to the IDL, the stubs and skeletons must be regenerated by running the IDL compiler again. The IDL compiler generates a stub and skeleton based on the structure of the appropriate IDL interfaces. The stubs and skeletons are statically generated at IDL compilation time. These stubs are then either imported or included into the application which needs access to the CORBA Objects. The stubs and skeletons will have been generated to either directly or indirectly utilize IIOP to communicate. In many cases, the IDL compiler, will generate stubs to utilize Dynamic Invocation Interface to interact with the skeletons. The IDL compiler may also generate skeletons which utilize Dynamic Skeleton Interface to interact with the stubs.

    241. Question 241. What Is The Deferred Synchronous Invocation?

      Answer :

      DII also provides a deferred synchronous invocation. This feature is not part of CORBA 2.0's SII. Deferred synchronous invocations are submitted without having to wait for a response. This is similiar to a one-way operation except a return values and out parameters are possible, but must be polled for. CORBA 3.0 will support this type of invocation for both static and dynamic modes via the Asynchronous Messaging Service.

    242. Question 242. What Is The Dynamic Skeleton Interface?

      Answer :

      The CORBA specification defines two mechanisms for implementations of a CORBA Object to service its operation invocations. One is the static mechanism and the other is dynamic. The static mechanism requires that the implementation support the specific methods as required by statically known IDL interfaces. Implementations can do this through either a delegated or derived approach (i.e. inheritance or delegation/TIE). If the dynamic approach is taken, the implementation of the Object deals with the request generically and in a sense, has one "do-it" method for dealing with all requests. The implementatin must inforce type safety as apposed to relying on an IDL compiler or Language compiler to do it. DSI is much more complicated for a developer then relying on the IDL compiler to generate static request dispatching code.

    243. Question 243. How Many Number Of Non-public Class Definitions Can A Source File Have?

      Answer :

      A source file can contain unlimited number of non-public class definitions.

    244. Question 244. What Types Of Values Does Boolean Variables Take?

      Answer :

      It only takes values true and false.

    245. Question 245. Which Primitive Datatypes Are Signed?

      Answer :

      All except char and Boolean.

    246. Question 246. Is Char Type Signed Or Unsigned?

      Answer :

      char type is integral but unsigned. It range is 0 to 2^7-1.

    247. Question 247. What Forms An Integral Literal Can Be?

      Answer :

      decimal, octal and hexadecimal, hence example it can be 28, 034 and 0x1c respectively.

    248. Question 248. What Is The Default Value Of Boolean?

      Answer :

      False.

    249. Question 249. Why Is The Main Method Static?

      Answer :

      So that it can be invoked without creating an instance of that class.

    250. Question 250. What Is The Difference Between Class Variable, Member Variable And Automatic(local) Variable?

      Answer :

      class variable is a static variable and does not belong to instance of class but rather shared across all the instances member variable belongs to a particular instance of class and can be called from any method of the class automatic or local variable is created on entry to a method and has only method scope.

    251. Question 251. When Are Static And Non Static Variables Of The Class Initialized?

      Answer :

      The static variables are initialized when the class is loadedNon static variables are initialized just before the constructor is called.

    252. Question 252. When Are Automatic Variable Initialized?

      Answer :

      Automatic variable have to be initialized explicitly.

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

      Answer :

      If the variable is primitive datatype then it is passed by copy.
      If the variable is an object then it is passed by reference.

    254. Question 254. What Is Garbage Collection?

      Answer :

      The runtime system keeps track of the memory that is allocated and is able to determine whether that memory is still useable. This work is usually done in background by a low-priority thread that is referred to as garbage collector. When the gc finds memory that is no longer accessible from any live thread it takes steps to release it back to the heap for reuse.

    255. Question 255. Does System.gc And Runtime.gc() Guarantee Garbage Collection?

      Answer :

      No.

    256. Question 256. What Are The Contents Of Web Module?

      Answer :

      A web module may contain:
      a) JSP files
      b) Java classes
      c) gif and html files and
      d) web component deployment descriptors.

    257. Question 257. Differentiate Between .ear, .jar And .war Files?

      Answer :

      These files are simply zipped file using java jar tool. These files are created for different purposes. Here is the description of these files:

      .jar files: These files are with the .jar extenstion. The .jar files contains the libraries, resources and accessories files like property files.

      .war files: These files are with the .war extension. The war file contains the web application that can be deployed on the any servlet/jsp container. The .war file contains jsp, html, javascript and other files for necessary for the development of web applications.

      .ear files: The .ear file contains the EJB modules of the application.

    258. Question 258. What Is The Difference Between Session Bean And Entity Bean?

      Answer :

      Session Bean: Session is one of the EJBs and it represents a single client inside the Application Server. Stateless session is easy to develop and its efficient. As compare to entity beans session beans require few server resources.

      A session bean is similar to an interactive session and is not shared; it can have only one client, in the same way that an interactive session can have only one user. A session bean is not persistent and it is destroyed once the session terminates.

      Entity Bean: An entity bean represents persistent global data from the database. Entity beans data are stored into database.

    259. Question 259. Why J2ee Is Suitable For The Development Distributed Multi-tiered Enterprise Applications?

      Answer :

      The J2EE platform consists of multi-tiered distributed application model. J2EE applications allows the developers to design and implement the business logic into components according to business requirement. J2EE architecture allows the development of multi-tired applications and the developed applications can be installed on different machines depending on the tier in the multi-tiered J2EE environment . The J2EE application parts are:

      a) Client-tier components run on the client machine.
      b) Web-tier components run on the J2EE server.
      c) Business-tier components run on the J2EE server and the
      d) Enterprise information system (EIS)-tier software runs on the EIS servers.

    260. Question 260. What Are Types Of J2ee Clients?

      Answer :

      J2EE clients are the software that access the services components installed on the J2EE container. Following are the J2EE clients:
      a) Applets
      b) Java-Web Start clients
      c) Wireless clients
      d) Web applications.

    261. Question 261. What Do You Understand By Jta And Jts?

      Answer :

      JTA stands for Java Transaction API and JTS stands for Java Transaction Service. JTA provides a standard interface which allows the developers to demarcate transactions in a manner that is independent of the transaction manager implementation. The J2EE SDK uses the JTA transaction manager to implement the transaction. The code developed by developers does not calls the JTS methods directly, but only invokes the JTA methods. Then JTA internally invokes the JTS routines. JTA is a high level transaction interface used by the application code to control the transaction.

    262. Question 262. What Is Difference Between Java Bean And Enterprise Java Bean?

      Answer :

      Java Bean as is a plain java class with member variables and getter setter methods. Java Beans are defined under JavaBeans specification as Java-Based software component model which includes the features like introspection, customization, events, properties and persistence.

      Enterprise JavaBeans or EJBs for short are Java-based software components that comply with Java's EJB specification. EJBs are delpoyed on the EJB container and executes in the EJB container. EJB is not that simple, it is used for building distributed applications. Examples of EJB are Session Bean, Entity Bean and Message Driven Bean. EJB is used for server side programming whereas java bean is a client side. Bean is only development but the EJB is developed and then deploy on EJB Container.

    263. Question 263. Can Entity Beans Have No Create() Methods?

      Answer :

      Entity Beans can have no create() methods. Entity Beans have no create() method, when entity bean is not used to store the data in the database. In this case entity bean is used to retrieve the data from database.

    264. Question 264. What Are The Call Back Methods In Session Bean?

      Answer :

      Callback methods are called by the container to notify the important events to the beans in its life cycle. The callback methods are defined in the javax.ejb.EntityBean interface.The callback methods example are ejbCreate(), ejbPassivate(), and ejbActivate().

    265. Question 265. What Is Bean Managed Transaction?

      Answer :

      In EJB transactions can be maintained by the container or developer can write own code to maintain the transaction. If a developer doesn’t want a Container to manage transactions, developer can write own code to maintain the database transaction.

    266. Question 266. A Win-win Ant Learning Method?

      Answer :

      There is a shortcut.

      If you download a small jakarta project, such as Log4J, which is built by ant. It is a good and simple example for you to learn ant. Actually, you hit two birds with one stone.

      Ant is easy!

      The hard part is how to make a very complicated diversified system work very simple and elegant. Knowledge about ant is not enough, you need an elegant and simple design, you need great naming convention, you need to optimize the code reusability and flexibility, you need a least maintenance system...

      Then it is not easy now .

    267. Question 267. How Do I Get Started To Use Ant? Can You Give Me A "hello World" Ant Script?

      Answer :

      Simple.
      * Download the most recent version of ant from Apache; unzip it some where on your machine.
      * Install j2sdk 1.4 or above.
      * Set JAVA_HOME and ANT_HOME to the directory your installed them respectively.
      * Put %JAVA_HOME%/bin;%ANT_HOME%/bin on your Path. Use ${JAVA_HOME}/bin:${ANT_HOME}/bin on UNIX. Yes, you can use forward slash on windows.
      * Write a "Hello world" build.xml

                        <project name="hello" default="say.hello" basedir="." >
                          <property name="hello.msg" value="Hello, World!" />
                          <target name="say.hello" >
                            <echo>${hello.msg}</echo>
                          </target>
                        </project>
                      
          * Type ant in the directory your build.xml located.
          * You are ready to go!!!! 

    268. Question 268. How Do I Set Classpath In Ant?

      Answer :

      Here is some snippet of code

        <path id="build.classpath">
          <fileset dir="${build.lib}" includes="**/*.jar"/> 
          <fileset dir="${build.classes}" /> 
        </path>
       
        <target....>
          <javac ....>
            <classpath refid="build.classpath" />
          </java>
        </target>
       
        <target....>
          <java ....>
            <classpath refid="build.classpath" />
          </java>
        </target>
        

    269. Question 269. How Does Ant Read Properties? How To Set My Property System?

      Answer :

      Ant sets properties by order, when something is set, the later same properties cannot overwrite the previous ones. This is opposite to your Java setters.

      This give us a good leverage of preset all properties in one place, and overwrite only the needed. Give you an example here. You need password for a task, but don't want to share it with your team members, or not the developers outside your team.

      Store your password in your ${user.home}/prj.properties
      pswd=yourrealpassword
      In your include directory master prj.properties
      pswd=password
      In your build-common.xml read properties files in this order

         1. The commandline will prevail, if you use it: ant -Dpswd=newpassword
         2. ${user.home}/prj.properties (personal)
         3. yourprojectdir/prj.properties (project team wise)
         4. your_master_include_directory/prj.properties (universal) 

      <cvsnttask password="${pswd} ... />

      Problem solved!

    270. Question 270. How To Loop On A List Or Fileset?

      Answer :

      Use ant-contrib <for> <foreach> tasks
      General to say, use <for> is better than use <foreach> since for each is actually open another ant property space, use more memory too.

    271. Question 271. Why Do I Get En Exception When I Use Location="d:\\code\\include" As Attribute Of Includepath?

      Answer :

      See here.
      You need to escape the string to "D:\\\\Code\\\\include" or use "D:/Code/include" instead!

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

    272. Question 272. Can I Put The Contents Of A Classpath Or Fileset Into A Property?

      Answer :

      Yes, you can.
      This is very similar to the call of Java class toString() method and actually it is calling the toString() method inside ant. For example

      <fileset id="fs1" dir="t1" includes="**/*.java"/>
      <property name="f1.contents" refid="fs1"/>
      <echo>f1.contents=${f1.contents}</echo>

    273. Question 273. Where Can I Find The Javadoc For Ant Api?

      Answer :

      Download apache ant src version. Use ant javadocs command to see generated javadoc for ant in build/docs directory.

    274. Question 274. How Can I Use Ant To Run A Java Application?

      Answer :

      Here is a real world example.

        <target name="run" depends="some.target,some.other.target">

          <java classname="${run.class}" fork="yes">
            <classpath>
              <path refid="classpath" />
            </classpath>

            <jvmarg line="${debug.jvmargs}" />
            <jvmarg line="${my.jvmargs}" />
            <jvmarg value="-Dname=${name}" />
            <jvmarg line="${run.jvmargs}" />
            <arg line="${run.args}" />
          </java>
        </target>

    275. Question 275. How To Use Ant To Run Commandline Command? How To Get Perl Script Running Result?

      Answer :

      Use exec ant task.
      Don't forget ant is pure Java. That is why ant is so useful, powerful and versatile. If you want ant receive unix command and result, you must think Unix. So does in MS-Windows. Ant just helps you to automate the process.

    276. Question 276. How Do I Debug My Ant Script?

      Answer :

      Many ways
      * Do an echo on where you have doubt. You will find out what is the problem easily. Just like the old c printf() or Java System.println()
      * Use project.log("msg") in your javascript or custom ant task
      * Run Ant with -verbose, or even -debug, to get more information on what it is doing, and where. However, you might be tired with that pretty soon, since it give you too much information.

    277. Question 277. How To Exclude Multi Directories In Copy Or Delete Task?

      Answer :

      Here is an example.
            
        <copy todir="${to.dir}" >
          <fileset dir="${from.dir}" >
            <exclude name="dirname1" />
            <exclude name="dirname2" />
            <exclude name="abc/whatever/dirname3" />
            <exclude name="**/dirname4" />
          </fileset>
        </copy>

    278. Question 278. How To Use Runtime In Ant?

      Answer :

      You don't need to use Runtime etc. Ant have exec task. The class name is org.apache .tools.ant. taskdefs. ExecTask. You can create the task by using the code in your customized ant Task.
      ExecTask compile = (ExecTask)project.createTask("exec");

    279. Question 279. How To Rearrange My Directory Structure In My Jar/war/ear/zip File? Do I Need To Unarchive Them First?

      Answer :

      No, you don't need to unarchive them first.

          * You don't need to unzip the files from archive to put into your destination jar/ear/war files.
          * You can use zipfileset in your jar/war/ear task to extract files from old archive to different directory in your new archive.
          * You also can use zipfileset in your jar/war/ear task to send files from local directory to different directory in your new archive. 

      See the follow example:

        <jar destfile="${dest}/my.jar">
          <zipfileset src="old_archive.zip" includes="**/*.properties" prefix="dir_in_new_archive/prop"/>
          <zipfileset dir="curr_dir/abc" prefix="new_dir_in_archive/xyz"/>
        </jar>
          

    280. Question 280. How Can I Write My Own Ant Task?

      Answer :

      Easy!
      Writing Your Own Task How-To from ant.
      In your own $ANT_HOME/docs/manual directory, there also is tutorial-writing-tasks-src.zip
      Use them! Use taskdef to define it in your script, define it before using it.

    281. Question 281. How To Copy Files Without Extention?

      Answer :

      If files are in the directory:

      <include name="a,b,c"/>

      If files are in the directory or subdirectories:

      <include name="**/a,**/b,**/c"/>

      If you want all files without extension are in the directory or subdirectories:

      <exclude name="**/*.*"/> 

    282. Question 282. How Do I Use Two Different Versions Of Jdk In Ant Script?

      Answer :

      The followings are what I'm doing.

      1. Don't define java.home by yourself. Ant uses an internal one derived from your environment var JAVA_HOME. It is immutable.
      2. I do the followings:
      * In my build.properties (read first)
      jdk13.bin=${tools.home}/jdk1.3.1_13/bin
      jdk14.bin=${tools.home}/j2sdk1.4.2_08/bin/
      * In my master properties file (read last), set default javac.location=${jdk13.bin}
      * In my prj.properties, if I need to use 1.4
      javac.location=${jdk14.bin}
      * in my javac task
      executable="${javac.location}/javac.exe"

    283. Question 283. How To Pass -xlint Or -xlint:unchecked To 1.5 Javac Task?

      Answer :

      pass it as compilerarg nested <compilerarg> to specify.

        <compilerarg value="-Xlint"/>
        <!-- or -->
        <compilerarg value="-Xlint:unchecked"/>

    284. Question 284. Can You Give Me A Simple Ant Xslt Task Example?

      Answer :

      Here is a working one!

          <xslt style="${xslfile}" in="${infile}" out="${outfile}" >
            <classpath>
              <fileset dir="${xml.home}/bin" 
                includes="*.jar" />
            </classpath>
          </xslt>

    285. Question 285. How To Hide Password Input?

      Answer :

      Override ant Input task.
      Response every user input with a backspace. Not the best, but it works.

    286. Question 286. How Do I Add Elements To An Existing Path Dynamically?

      Answer :

      Yes, it is possible. However, you need to write a custom ant task, get the path, and add/modify it, and put it in use. What I am doing is that I define a path reference lib.classpath, then add/modify the lib.classpath use my own task.

    287. Question 287. How To Do Conditional Statement In Ant?

      Answer :

      There are many ways to solve the problem.

      • Since target if/unless all depend on some property is defined or not, you can use condition to define different NEW properties, which in turn depends on your ant property values. This makes your ant script very flexible, but a little hard to read.
      • Ant-contrib has <if> <switch> tasks for you to use.
      • Ant-contrib also has <propertyregex> which can make very complicate decisions. 

       

    288. Question 288. Can I Change/override Ant Properties When I Use Ant-contrib Foreach Task?

      Answer :

      <foreach> is actually using a different property space, you can pass any property name/value pair to it. Just use <param> nested tag inside foreach

    289. Question 289. How To Let Auto-detect Platform And Use Platform Specific Properties?

      Answer :

      Tell you a great trick, it works excellent.
      In your major build-include.xml, put in this line

        <property file="${antutil.includes}/${os.name}-${os.arch}.properties" />

      This will auto-detect your platform, and you write one file for each environment specific variables. For example: HP-UX-PA_RISC2.0.properties SunOS-sparc.properties Windows XP-x86.properties ... They work great!!! 

    290. Question 290. What Is A Good Directory Structure For Main Code And Junit Test Code?

      Answer :

      Dev
          |_src
          |  |_com
          |     |_mycom
          |        |_mypkg
          |           |_A.java
          |_test
             |_src
               |_com
                  |_mycom
                     |_mypkg
                        |_ATest.java

    291. Question 291. What Are The Core Jms-related Objects Required For Each Jms-enabled Application?

      Answer :

      Each JMS-enabled client must establish the following:
      . A connection object provided by the JMS server (the message broker)
      . Within a connection, one or more sessions, which provide a context for message sending and receiving .
      . Within a session, either a queue or ic object representing the destination (the message staging area) within the message broker .
      . Within a session, the appropriate sender or publisher or receiver or subscriber object (depending on whether the client is a message producer or consumer and uses a point-to-point or publish/subscribe strategy, respectively) Within a session, a message object (to send or to receive) .

    292. Question 292. What Are The Types Of Messaging?

      Answer :

      There are two kinds of Messaging.

      Synchronous Messaging: Synchronous messaging involves a client that waits for the server to respond to a message.

      Asynchronous Messaging: Asynchronous messaging involves a client that does not wait for a message from the server. An event is used to trigger a message from a server.

    293. Question 293. What Is Mdb And What Is The Special Feature Of That?

      Answer :

      MDB is Message driven bean, which very much resembles the Stateless session bean. The incoming and out going messages can be handled by the Message driven bean. The ability to communicate asynchronously is the special feature about the Message driven bean.

    294. Question 294. How Is A Java Object Message Delivered To A Non-java Client?

      Answer :

      It is according to the specification that the message sent should be received in the same format. A non-java client cannot receive a message in the form of java object. The provider in between handles the conversion of the data type and the message is transferred to the other end.

    295. Question 295. What Are The Various Message Types Supported By Jms?

      Answer :

      Stream Messages -- Group of Java Primitives
      Map Messages -- Name Value Pairs. Name being a string& Value being a java primitive
      Text Messages -- String messages (since being widely used a separate messaging Type has been supported)
      Object Messages -- Group of serialize able java object
      Bytes Message -- Stream of uninterrupted bytes.

    296. Question 296. Why Doesn't The Jms Api Provide End-to-end Synchronous Message Delivery And Notification Of Delivery?

      Answer :

      Some messaging systems provide synchronous delivery to destinations as a mechanism for implementing reliable applications. Some systems provide clients with various forms of delivery notification so that the clients can detect dropped or ignored messages. This is not the model defined by the JMS API.

      JMS API messaging provides guaranteed delivery via the once-and-only-once delivery semantics of PERSISTENT messages. In addition, message consumers can ensure reliable processing of messages by using either CLIENT_ACKNOWLEDGE mode or transacted sessions. This achieves reliable delivery with minimum synchronization and is the enterprise messaging model most vendors and developers prefer.

      The JMS API does not define a schema of systems messages (such as delivery notifications). If an application requires acknowledgment of message receipt, it can define an application-level acknowledgment message.

    297. Question 297. Give An Example Of Using The Publish/subscribe Model.

      Answer :

      JMS can be used to broadcast shutdown messages to clients connected to the Weblogic server on a module wise basis. If an application has six modules, each module behaves like a subscriber to a named ic on the server.

    298. Question 298. What Is The Advantage Of Persistent Message Delivery Compared To Nonpersistent Delivery?

      Answer :

      If the JMS server experiences a failure, for example, a power outage, any message that it is holding in primary storage potentially could be lost. With persistent storage, the JMS server logs every message to secondary storage. (The logging occurs on the front end, that is, as part of handling the send operation from the message producing client.) The logged message is removed from secondary storage only after it has been successfully delivered to all consuming clients .

    299. Question 299. What Is Point-to-point Messaging?

      Answer :

      With point-to-point message passing the sending application/client establishes a named message queue in the JMS broker/server and sends messages to this queue. The receiving client registers with the broker to receive messages posted to this queue. There is a one-to-one relationship between the sending and receiving clients.

    300. Question 300. What Is The Difference Between Bytesmessage And Streammessage?

      Answer :

      BytesMessage stores the primitive data types by converting them to their byte representation. Thus the message is one contiguous stream of bytes. While the StreamMessage maintains a boundary between the different data types stored because it also stores the type information along with the value of the primitive being stored. BytesMessage allows data to be read using any type. Thus even if your payload contains a long value, you can invoke a method to read a short and it will return you something. It will not give you a semantically correct data but the call will succeed in reading the first two bytes of data. This is strictly prohibited in the StreamMessage. It maintains the type information of the data being stored and enforces strict conversion rules on the data being read.

    301. Question 301. What Is The Use Of Mapmessage?

      Answer :

      A MapMessage carries name-value pair as it's payload. Thus it's payload is similar to the java.util.Properties object of Java. The values can be Java primitives or their wrappers.

    302. Question 302. What Is The Use Of Objectmessage?

      Answer :

      ObjectMessage contains a Serializable java object as it's payload. Thus it allows exchange of Java objects between applications. This in itself mandates that both the applications be Java applications. The consumer of the message must typecast the object received to it's appropriate type. Thus the consumer should before hand know the actual type of the object sent by the sender. Wrong type casting would result in ClassCastException. Moreover the class definition of the object set in the payload should be available on both the machine, the sender as well as the consumer. If the class definition is not available in the consumer machine, an attempt to type cast would result in ClassNotFoundException. Some of the MOMs might support dynamic loading of the desired class over the network, but the JMS specification does not mandate this behavior and would be a value added service if provided by your vendor. And relying on any such vendor specific functionality would hamper the portability of your application. Most of the time the class need to be put in the classpath of both, the sender and the consumer, manually by the developer.

    303. Question 303. What Is The Use Of Textmessage?

      Answer :

      TextMessage contains instance of java.lang.String as it's payload. Thus it is very useful for exchanging textual data. It can also be used for exchanging complex character data such as an XML document.

    304. Question 304. What Is The Use Of Streammessage?

      Answer :

      StreamMessage carries a stream of Java primitive types as it's payload. It contains some conveient methods for reading the data stored in the payload. However StreamMessage prevents reading a long value as short, something that is allwed in case of BytesMessage. This is so because the StreamMessage also writes the type information alonwgith the value of the primitive type and enforces a set of strict conversion rules which actually prevents reading of one primitive type as another.

    305. Question 305. What Is The Use Of Bytesmessage?

      Answer :

      BytesMessage contains an array of primitive bytes in it's payload. Thus it can be used for transfer of data between two applications in their native format which may not be compatible with other Message types. It is also useful where JMS is used purely as a transport between two systems and the message payload is opaque to the JMS client. Whenever you store any primitive type, it is converted into it's byte representation and then stored in the payload. There is no boundary line between the different data types stored. Thus you can even read a long as short. This would result in erroneous data and hence it is advisable that the payload be read in the same order and using the same type in which it was created by the sender.

    306. Question 306. What Is The Basic Difference Between Publish Subscribe Model And P2p Model?

      Answer :

      Publish Subscribe model is typically used in one-to-many situation. It is unreliable but very fast. P2P model is used in one-to-one situation. It is highly reliable.

    307. Question 307. What Kind Of Information Found In The Header Of A Message ?

      Answer :

      The header of a message contains message identification and routing information. This includes , but is not limited to :

      JMSDestination
      JMSDeliveryMode
      JMSMessageID
      JMSTimeStamp
      JMSExpiration
      JMSReplyTO
      JMSCorrelationID
      JMSType
      JMSRedelivered 

    308. Question 308. What Are The Three Components Of A Message ?

      Answer :

      A JMS message consists of three parts:

      Message header 
      For message identification. For example, the header is used to determine if a given message is appropriate for a "subscriber" 

      Properties 
      For application-specific, provider-specific, and optional header fields 

      Body 
      Holds the content of the message. Several formats are supported, including TextMessage, which wrap a simple String, that wrap arbitrary Java objects (which must be serializable). Other formats are supported as well. 

    309. Question 309. What Is The Use Of Message Object?

      Answer :

      Message is a light weight message having only header and properties and no payload. Thus if the receivers are to be notified about an event, and no data needs to be exchanged then using Message can be very efficient.

    310. Question 310. What Is The Role Of Jms In Enterprise Solution Development?

      Answer :

      JMS is typically used in the following scenarios
      1. Enterprise Application Integration: - Where a legacy application is integrated with a new application via messaging.
      2. B2B or Business to Business: - Businesses can interact with each other via messaging because JMS allows organizations to cooperate without tightly coupling their business systems.
      3. Geographically dispersed units: - JMS can ensure safe exchange of data amongst the geographically dispersed units of an organization.
      4. One to many applications: - The applications that need to push data in packet to huge number of clients in a one-to-many fashion are good candidates for the use JMS. Typical such applications are Auction Sites, Stock Quote Services etc.

    311. Question 311. What Is The Difference Between Ic And Queue?

      Answer :

      A ic is typically used for one to many messaging i.e. it supports publish subscribe model of messaging. While queue is used for one-to-one messaging i.e. it supports Point to Point Messaging.

    312. Question 312. What Is The Diffrence Between Java Mail And Jms Queue?

      Answer :

      Java Mail - API siting on top of e-mail protocols like SMTP, POP, IMAP - essentially same stuff e-mail clients like MS outlook use .. hence make sense if at least on one side of conversation we have human. 

      JMS Queue - is asynchronous point-to-point communication between systems 

    313. Question 313. What Is The Difference Between Point To Point And Publish/subscribe Messaging Domains?

      Answer :

      A point-to-point (PTP) product or application is built around the concept of message queues, senders, and receivers. Each message is addressed to a specific queue, and receiving clients extract messages from the queue(s) established to hold their messages. Queues retain all messages sent to them until the messages are consumed or until the messages expire.

      In a publish/subscribe (pub/sub) product or application, clients address messages to a topic. Publishers and subscribers are generally anonymous and may dynamically publish or subscribe to the content hierarchy. The system takes care of distributing the messages arriving from a topic's multiple publishers to its multiple subscribers. Topics retain messages only as long as it takes to distribute them to current subscribers.

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

      Answer :

      Message, TextMessage, BytesMessage, StreamMessage, ObjectMessage, MapMessage are the different messages available in the JMS API.

    315. Question 315. What Is Javaserver Faces?

      Answer :

      JavaServer Faces (JSF) is a user interface (UI) framework for Java web applications. It is designed to significantly ease the burden of writing and maintaining applications that run on a Java application server and render their UIs back to a target client. JSF provides ease-of-use in the following ways: Makes it easy to construct a UI from a set of reusable UI components Simplifies migration of application data to and from the UI Helps manage UI state across server requests Provides a simple model for wiring client-generated events to server-side application code Allows custom UI components to be easily built and re-used .

      Most importantly, JSF establishes standards which are designed to be leveraged by tools to provide a developer experience which is accessible to a wide variety of developer types, ranging from corporate developers to systems programmers. A "corporate developer" is characterized as an individual who is proficient in writing procedural code and business logic, but is not necessarily skilled in object-oriented programming. A "systems programmer" understands object-oriented fundamentals, including abstraction and designing for re-use. A corporate developer typically relies on tools for development, while a system programmer may define his or her tool as a text editor for writing code. Therefore, JSF is designed to be tooled, but also exposes the framework and programming model as APIs so that it can be used outside of tools, as is sometimes required by systems programmers.

    316. Question 316. How To Add Context Path To Url For Outputlink?

      Answer :

      Current JSF implementation does not add the context path for outputLink if the defined path starts with '/'. To correct this problem use #{facesContext.externalContext.requestContextPath} prefix at the beginning of the outputLink value attribute. For example: 
      <h:outputLink value="#{facesContext.externalContext.requestContextPath}/myPage.faces">

    317. Question 317. How To Get Current Page Url From Backing Bean?

      Answer :

      You can get a reference to the HTTP request object via FacesContext like this:

      FacesContext fc = FacesContext.getCurrentInstance(); HttpServletRequest request = (HttpServletRequest) fc.getExternalContext().getRequest();

      And then use the normal request methods to obtain path information. Alternatively,
      context.getViewRoot().getViewId();
      will return you the name of the current JSP (JSF view IDs are basically just JSP path names).

    318. Question 318. How To Access Web.xml Init Parameters From Java Code?

      Answer :

      You can get it using externalContext getInitParameter method. For example, if you have:
      connectionString jdbc:oracle:thin:scott/[email protected]:1521:O901DB
      You can access this connection string with:
      FacesContext fc = FacesContext.getCurrentInstance();
      String connection = fc.getExternalContext().getInitParameter("connectionString");

    319. Question 319. How To Reload The Page After Valuechangelistener Is Invoked?

      Answer :

      At the end of the ValueChangeListener, call FacesContext.getCurrentInstance().renderResponse()

    320. Question 320. How To Show Confirmation Dialog When User Click The Command Link?

      Answer :

      h:commandLink assign the onclick attribute for internal use. So, you cannot use it to write your own code. This problem will fixed in the JSF 1.2. For the current JSF version you can use onmousedown event that occurs before onclick. <script language="javascript"> function ConfirmDelete(link) { var delete = confirm('Do you want to Delete?'); if (delete == true) { link.onclick(); } } </script> . . . . <h:commandLink action="delete" onmousedown="return ConfirmDelete(this);"> <h:outputText value="delete it"/> </h:commandLink>

    321. Question 321. What Is The Different Between Getrequestparametermap() And Getrequestparametervaluesmap()

      Answer :

      getRequestParameterValuesMap() similar to getRequestParameterMap(), but contains multiple values for for the parameters with the same name. It is important if you one of the components such as <h:selectMany>.

    322. Question 322. Is It Possible To Have More Than One Faces Configuration File?

      Answer :

      Yes. You can define the list of the configuration files in the web.xml.
      This is an example:

      <context- param> <param- name> javax .faces.CONFIG_ FILES </param- name> <param-value> /WEB-INF /faces- config- navigation .xml, /WEB- INF /faces- beans .xml </param- value></context-param>

    323. Question 323. H:inputsecret Field Becomes Empty When Page Is Reloaded. How To Fix This?

      Answer :

      Set redisplay=true, it is false by default.

    324. Question 324. How Do You Optimize Methods In A Class?

      Answer :

      • Avoid creating temporary objects within frequently called methods.
      • Define methods that accept reusable objects to be filled in with data, rather than methods that return objects holding that data.
      • Use methods that alter objects without making copies.
      • Eliminate repeatedly called methods where alternatives are possible [For example, if you are processing a vector in a loop, get the size of the vector in the beginning in a length local variable rather than calling size() method on the vector in the condition part of the for loop]
      • Use private and static methods and final classes to encourage inlining by the compiler.
      • Inline methods manually where it is appropriate • Keep methods short and simple to make them automatic inlining candidates.
      • Access to private member by the inner classes to the enclosing class goes by a method call even if it is not intended to.
      • Keep synchronized methods out of loops if you possibly can.

    325. Question 325. How Do You Optimize Loops And Conditional Statements?

      Answer :

      • Reduce the number of temporary objects being used,especially in loops.
      • Use short-circuit Boolean operators instead of normal Boolean operators.
      • Eliminate unnecessary repeated method calls from loops.
      • Move loop invariants outside the loop.
      • Perform the loop backwards (this actually performs slightly faster than forward loops do). [Actually it is converting the test to compare against 0 that makes the difference].
      • It can help to copy slower-access vars to fast local vars if you are going to operate on them repeatedly, as in a loop.
      • Use exception terminated infinite loops for long loops.
      • Whatever can be calculated outside of a loop should be calculated outside of the loop.
      • For multidimensional arrays store a reference for the currently accessed row in a variable.
      • Cache the size of the collection in a local variable to use in a loop instead of repeatedly calling collection.size().

    326. Question 326. How Do You Optimize Strings?

      Answer :

      • Use StringBuffer instead of String concat '+' operator
      • Formatting numbers using java.text.DecimalFormat is always slower than Double.toString(double) method, because internally java.text.DecimalFormat() calls Double.toString(double) then parses and converts the results.
      • Convert String to char[] arrays to process characters rather than accessing one at a time using String.charAt() method
      • Creating Double from string is slow
      • Intern() Strings to enable (==) comparisions
      • Use char arrays for all character processing in loops, rather than using String or StringBuffer classes
      • Set the initial string buffer size to maximum if it known.
      • StringTokenizer is very inefficient, and can be optimized by storing the string and delimiter in a character array instead of in String.
      • DON'T create static strings via new().
      • Where the compiler cannot resolve concatenated strings at compile time, the code should be converted to StringBuffer appends, and the StringBuffer should be appropriately sized rather than using the default size.
      • The compiler concatenates strings where they are fully resolvable, so don t move these concatenations to runtime with StringBuffer.

    327. Question 327. How Do You Optimize Arrays, Vectors And Collections?

      Answer :

      • Create copies of simple array by initializing them through loops or by using System.arraycopy(), create copies of complex arrays by cloning them.
      • Iterator.hasNext() and Enumerator.hasMoreElements() need not be repeatedly called when the size of the collection is known. Use collection.size() and a loop counter instead.
      • ArrayList is faster than Vector
      • Go for a non-synchronized version of collection unless used in a threaded application
      • LinkedList is faster than ArrayList for inserting elements to the front of the array, but slower at indexed lookup.
      • Accessing arrays is much faster than accessing vectors, String, and StringBuffer
      • Vector is convenient to use, but inefficient. Ensure that elementAt() is not used inside a loop.
      • Re-use Hashtables by using Hashtable.clear().
      • Removing elements from a Vector will necessitate copying within the Vector if the element is removed from anywhere other than the end of the collection.
      • Presizing collections to the expected size is more efficient than using the default size and letting the collection grow.
      • For multidimensional arrays store a reference for the currently accessed row in a variable.
      • When adding multiple items to a collection, add them all in one call if possible.

    328. Question 328. How Do You Optimize Threads?

      Answer :

      • Avoid synchronization where possible
      • Code a multi-thread for multi-processor machine.
      • Synchronizing on method rather than code blocks is slightly faster.
      • Polling is only acceptable when waiting for outside events and should be performed in a "side" thread. Use wait/notify instead.
      • Prioritize threads. Use notify instead of notifyAll. Use synchronization sparingly.
      • Keep synchronized methods out of loops if you possibly can.
      • Maximize thread lifetimes and minimize thread creation/destruction cycles.
      • Use Thread pools where these improve performance.
      • Use Thread.sleep() instead of a for loop for measured delays.
      • Use a separate timer thread to timeout socket operations.
      • Use more server threads if multiple connections have high latency.

    329. Question 329. How Do You Optimize Io?

      Answer :

      • Use Buffered IO classes.
      • File information such as file length requires a system call and can be slow. Don't use it often. Similarly, System.currentTimeMillis() uses a native call to get current time. Make sure your production code does not have this statement.
      • Many java.io.File methods are system calls which can be slow.
      • Use BufferedIO streams to access URLConnection sInput/Output streams.
      • Use the transient keyword to define fields to avoid having those fields serialized. Examine serialized objects to determine which fields do not need to be serialized for the application to work.
      • Increase server listen queues for high load or high latency servers.

    330. Question 330. How Do You Optimize Exceptions?

      Answer :

      • Be specific while handling the exception in your catch block.
      • Be specific while throwing exception in your throws clause.
      • Do not use Exception Handling to control programming flow.
      • Very little overhead is imposed by using exception handling mechanism unless an exception occurs or thrown a new exception object explicitly.
      • Always use the finally block to release the resources to prevent resource leaks.
      • Handle exceptions locally wherever possible.
      • Do not use Exception handling in loops.

    331. Question 331. How Will You Optimize Performance In Jdbc?

      Answer :

      • Use batch transactions.
      • Choose right isolation level as per your requirement.
      TRANSACTION_READ_UNCOMMITED gives best performance for concurrent transaction based applications. TRANSACTION_NONE gives best performance for non-concurrent transaction based applications.
      • Use PreparedStatement when you execute the same statement more than once.
      • Use CallableStatement when you want result from multiple and complex statements for a single request.
      • Use batch update facility available in Statements.
      • Use batch retrieval facility available in Statements or ResultSet.
      • Set up proper direction for processing rows.
      • Use proper getXXX() methods.
      • Close ResultSet, Statement and Connection whenever you finish your work with them.
      • Write precise SQL queries.
      • Cache read-only and read-mostly tables data.
      • Fetch small amount of data iteratively rather than whole data at once when retrieving large amount of data like searching database etc.

    332. Question 332. How Do You Optimize Servlets?

      Answer :

      • Use init() method to cache static data.
      • Use StringBuffer rather than using + operator when you concatenate multiple strings.
      • Use print() method rather than println() method.
      • Use ServletOutputStream rather than PrintWriter to send binary data.
      • Initialize the PrintWriter with proper size.
      • Flush the data partly.
      • Minimize code in the synchronized block.
      • Set the content length
      • Release resources in destroy() method.
      • Implement getLastModified() method to use browser cache and server cache
      • Use application server caching facility
      • Use Mixed session mechanisms such as HttpSession with hidden fields
      • Remove HttpSession objects explicitly in your program whenever you finish the task.
      • Reduce session time out value as much as possible.
      • Use 'transient' variables to reduce serialization overhead if your HttpSession tracking mechanism uses serialization process.
      • Disable servlet auto reloading feature.
      • Use thread pool for your servlet engine and define the size as per application requirement.

    333. Question 333. How Do You Optimize A Jsp Page?

      Answer :

      • Use jspInit() method to cache static data
      • Use StringBuffer rather than using + operator when you concatenate multiple strings
      • Use print() method rather than println() method
      • Use ServletOutputStream instead of JSPWriter to send binary data
      • Initialize the 'out' object (implicit object) with proper size in the page directive.
      • Flush the data partly.
      • Minimize code in the synchronized block.
      • Set the content length.
      • Release resources in jspDestroy() method.
      • Give 'false' value to the session in the page directive to avoid session object creation.
      • Use include directive instead of include action when you want to include the child page content in the translation phase.
      • Avoid giving unnecessary scope in the 'useBean' action.
      • Do not use custom tags if you do not have reusability.
      • Use application server caching facility.
      • Use Mixed session mechanisms such as 'session' with hidden fields.
      • Use 'session' and 'application' as cache.
      • Use caching tags provided by different organizations like openSymphony.com.
      • Remove 'session' objects explicitly in your program whenever you finish the task.
      • Reduce session time out value as much as possible.
      • Use 'transient' variables to reduce serialization overhead if your session tracking mechanism uses serialization process.
      • Disable JSP auto reloading feature.

    334. Question 334. What Are Common Optimizing Practices For Ejb?

      Answer :

      • Use Local interfaces that are available in EJB2.0 if you deploy both EJB Client and EJB in the same EJB Server.
      • Use Vendor specific pass-by-reference implementation to make EJB1.1 remote EJBs as Local EJBs if you deploy both EJB Client and EJB in the same EJB Server.
      • Wrap entity beans with session beans to reduce network calls and to promote declarative transactions. Optionally, make entity beans as local beans where appropriate.
      • Make coarse grained session and entity beans to reduce network calls.
      • Control serialization by modifying unnecessary data variables with 'transient' key word to avoid unnecessary data transfer over network.
      • Cache EJBHome references to avoid JNDI lookup overhead.
      • Avoid transaction overhead for non-transactional methods of session beans by declaring 'NotSupported' or 'Never' transaction attributes that avoid further propagation of transactions.
      • Set proper transaction age(time-out) to avoid large transaction.
      • Use clustering for scalability.
      • Tune thread count for EJB Server to increase EJB Server capacity.
      • Choose servlet's HttpSession object rather than Stateful session bean to maintain client state if you don't require component architecture and services of Stateful session bean.
      • Choose best EJB Server by testing with ECperf tool kit.
      • Choose normal java object over EJB if you don't want built-in services such as RMI/IIOP, transactions, security, persistence, resource pooling, thread safe, client state etc..

    335. Question 335. How Do You Optimize Stateless Session Beans?

      Answer :

      • Tune the Stateless session beans pool size to avoid overhead of creation and destruction of beans.
      • Use setSessionContext() or ejbCreate() method to cache bean specific resources.
      • Release acquired resources in ejbRemove() method.

    336. Question 336. How Do You Optimize Stateful Session Beans?

      Answer :

      • Tune Stateful session beans cache size to avoid overhead of activation and passivation process.
      • Set optimal Stateful session bean age(time-out) to avoid resource congestion.
      • Use 'transient' key word for unnecessary variables of Stateful session bean to avoid serialization overhead.
      • Remove Stateful session beans explicitly from client using remove() method.

    337. Question 337. How Do You Optimize Entity Beans?

      Answer :

      • Tune the entity beans pool size to avoid overhead of creation and destruction of beans.
      • Tune the entity beans cache size to avoid overhead of activation, passivation and database calls.
      • Use setEntityContext() method to cache bean specific resources.
      • Release acquired resources in unSetEntityContext() method.
      • Use Lazy loading to avoid unnecessary pre-loading of child data.
      • Choose optimal transaction isolation level to avoid blocking of other transactional clients.
      • Use proper locking strategy.
      • Make read-only entity beans for read only operations.

    338. Question 338. How Do You Optimize Message Driven Beans?

      Answer :

      • Tune the Message driven beans pool size to promote concurrent processing of messages.
      • Use setMesssageDrivenContext() or ejbCreate() method to cache bean specific resources.
      • Release acquired resources in ejbRemove() method.
      • Use JMS tuning techniques in Message driven beans.

    339. Question 339. How Do You Optimize Java Message Service (jms)?

      Answer :

      • Start producer connection after you start consumer.
      • Use concurrent processing of messages.
      • Close the Connection when finished.
      • Choose either DUPS_OK_ACKNOWLEDGE or AUTO_ACKNOWLEDGE rather than CLIENT_ACKNOWLEDGE.
      • Control transactions by using separate transactional session for transactional messages and non-transactional session for non-transactional messages.
      • Close session object when finished.

    340. Question 340. Explain Rmi Architecture?

      Answer :

      RMI uses a layered architecture, each of the layers could be enhanced or replaced without affecting the rest of the system. The details of layers can be summarised as follows: Application Layer: The client and server program Stub & Skeleton Layer: Intercepts method calls made by the client/redirects these calls to a remote RMI service. Remote Reference Layer: Understands how to interpret and manage references made from clients to the remote service objects. Transport layer: Based on TCP/IP connections between machines in a network. It provides basic connectivity, as well as some firewall penetration strategies.

    341. Question 341. Explain About Rmi And It's Usage?

      Answer :

      RMI is one of the distributed computing technology alternative powered by Java . RMI stands for Remote Method Invocation ,to keep it simple it means accessing a service from different node ( i.e., accessing a service provided by an object on server machine , here an object in client JVM talks with object in the server JVM ). Java provides an API and base some classes ( in package java.rmi ) to perform these kind of operations . We basically use this methodology when we need to publish an object at server side which exposes set of services ( as methods in Object oriented programming terminology ) and where in one or more clients access these services from remote machines. By this we are distibuting a common code in two different JVM's and we are able to access the code on different JVM.

    342. Question 342. How Do Rmi Clients Contact Remote Rmi Servers?

      Answer :

      For an RMI client to contact a remote RMI server, the client must first hold a reference to the server. The Naming.lookup method call is the most common mechanism by which clients initially obtain references to remote servers. Remote references may be obtained by other means, for example: all remote method calls can return remote references. This is what Naming.lookup does; it uses a well-known stub to make a remote method call to the rmiregistry, which sends back the remote reference to the object requested by the lookup method. Every remote reference contains a server hostname and port number that allow clients to locate the VM that is serving a particular remote object. Once an RMI client has a remote reference, the client will use the hostname and port provided in the reference to open a socket connection to the remote server. Please note that with RMI the terms client and server can refer to the same program. A Java program that acts as an RMI server contains an exported remote object. An RMI client is a program that invokes one or more methods on a remote object in another virtual machine. If a VM performs both of these functions, it may be referred to as an RMI client and an RMI server.

    343. Question 343. Why Do I Get The Exception "java.net.socketexception: Address Already In Use" When I Try To Run The Registry?

      Answer :

      This exception means that the port that the RegistryImpl uses (by default 1099) is already in use. You may have another registry running on your machine and will need to stop it.

    344. Question 344. Does Rmi Handle "out" And "inout" Parameters (like Corba)?

      Answer :

      RMI does not support "out" or "inout" parameters, just like the rest of the core Java programming language. All remote calls are methods of a remote object. Local objects are passed by copy and remote objects are passed by reference to a stub.

    345. Question 345. Normally In The Java Programming Language, It Is Possible To Cast An Interface Instance To An Instance Of The Class From Which It Was Created And Use The Result. Why Doesn't This Work In Rmi?

      Answer :

      In RMI the client sees only a stub for the original object. The stub implements only the remote interfaces and their remote methods and cannot be cast back to the original implementation class because it's just a stub. So, you cannot pass a remote object reference from a server to a client, and then send it back to the server and be able to cast it back to the original implementation class. You can, though, use the remote object reference on the server to make a remote call to the object. If you need to find the implementation class again, you'll need to keep a table that maps the remote reference to the implementation class.

    346. Question 346. What Is The Difference Between Rmi & Corba ?

      Answer :

      The most significant difference between RMI and CORBA is that CORBA was made specifically for interoperability across programming languages. That is CORBA fosters the notion that programs can be built to interact in multiple languages. The server could be written in C++, the business logic in Python, and the front-end written in COBOL in theory. RMI, on the other hand is a total Java solution, the interfaces, the implementations and the clients--all are written in Java.

      RMI allows dynamic loading of classes at runtime. In a multi-language CORBA environment, dynamic class loading is not possible. The important advantage to dynamic class loading is that it allows arguments to be passed in remote invocations that are subtypes of the declared types. In CORBA, all types have to be known in advance. RMI (as well as RMI/IIOP) provides support for polymorphic parameter passing, whereas strict CORBA does not. CORBA does have support for multiple languages which is good for some applications, but RMI has the advantage of being dynamic, which is good for other applications.

    347. Question 347. What Are The Services In Rmi ?

      Answer :

      An RMI "service" could well be any Java method that can be invoked remotely. The other service is the JRMP RMI naming service which is a lookup service.

    348. Question 348. Does Rmi-iiop Support Code Downloading For Java Objects Sent By Value Across An Iiop Connection In The Same Way As Rmi Does Across A Jrmp Connection?

      Answer :

      Yes. The JDK 1.2 and above support the dynamic class loading.

    349. Question 349. How Many Types Of Protocol Implementations Does Rmi Have?

      Answer :

      RMI has at least three protocol implementations: Java Remote Method Protocol(JRMP), Internet Inter ORB Protocol(IIOP), and Jini Extensible Remote Invocation(JERI). These are alternatives, not part of the same thing, All three are indeed layer 6 protocols for those who are still speaking OSI reference model.

    350. Question 350. Does Rmi-iiop Support Dynamic Downloading Of Classes?

      Answer :

      No, RMI-IIOP doesn't support dynamic downloading of the classes as it is done with CORBA in DII (Dynamic Interface Invocation).Actually RMI-IIOP combines the usability of Java Remote Method Invocation (RMI) with the interoperability of the Internet Inter-ORB Protocol (IIOP).So in order to attain this interoperability between RMI and CORBA,some of the features that are supported by RMI but not CORBA and vice versa are eliminated from the RMI-IIOP specification.

    351. Question 351. Can Rmi And Corba Based Applications Interact ?

      Answer :

      Yes they can. RMI is available with IIOP as the transport protocol instead of JRMP.

    352. Question 352. Explain Lazy Activation?

      Answer :

      Lazy activation: This means that the activable remote object will be activated by rmid (default). This activation is performed only when the first remote method call is intercepted.

    353. Question 353. What Is The Main Functionality Of The Remote Reference Layer ?

      Answer :

      RRL exists in both the RMI client and server. It is used by the stub or skeleton protocol layer and uses the transport layer. RRL is reponsible for transport-independent functioning of RMI, such as connection management or unicast/multicast object invocation.

    354. Question 354. Describe Jakarta Struts Framework?

      Answer :

      It implements Model-View-Controller pattern in the framework and it is an open source code. It saves time in design and implementation of a web based application due to this framework and pattern as I is highly robust, scalable and reliable.

    355. Question 355. What Are The Components Of Struts?

      Answer :

      Struts is based on the MVC design pattern. Struts components can be categories into Model, View and Controller.

      Model: Components like business logic / business processes and data are the part of Model.

      View: JSP, HTML etc. are part of View

      Controller: Action Servlet of Struts is part of Controller components which works as front controller to handle all the requests.

    356. Question 356. Describe Is Actionservlet?

      Answer :

      ActionServlet provides the "controller" in the Model-View-Controller (MVC) design pattern for web applications that is commonly known as "Model 2". This nomenclature originated with a description in the JavaServerPages Specification, version 0.92, and has persisted ever since (in the absence of a better name).Controller is responsible for handling all the requests.

    357. Question 357. What Is An Action Class Used For?

      Answer :

      An Action is an adapter between the contents of an incoming HTTP request and the corresponding business logic that should be executed to process this request. The controller (ActionServlet) will select an appropriate Action for each request, create an instance (if necessary), and call the perform method. Actions must be programmed in a thread-safe manner, because the controller will share the same instance for multiple simultaneous requests. In this means you should design with the following items in mind:

      • Instance and static variables MUST NOT be used to store information related to the state of a particular request. They MAY be used to share global resources across requests for the same action.
      •  Access to other resources (JavaBeans, session variables, etc.) MUST be synchronized if those resources require protection. (Generally, however, resource classes should be designed to provide their own protection where necessary. When an Action instance is first created, the controller servlet will call setServlet() with a non-null argument to identify the controller servlet instance to which this Action is attached. When the controller servlet is to be shut down (or restarted), the setServlet() method will be called with a null argument, which can be used to clean up any allocated resources in use by this Action.

    358. Question 358. What Is Actionform?

      Answer :

      An ActionForm is a JavaBean optionally associated with one or more ActionMappings. Such a bean will have had its properties initialized from the corresponding request parameters before the corresonding action's perform() method is called. When the properties of this bean have been populated, but before the perform() method of the action is called, this bean's validate() method will be called, which gives the bean a chance to verify that the properties submitted by the user are correct and valid. If this method finds problems, it returns an error messages object that encapsulates those problems, and the controller servlet will return control to the corresponding input form. Otherwise, the validate() method returns null(), indicating that everything is acceptable and the corresponding Action's perform() method should be called. This class must be subclassed in order to be instantiated. Subclasses should provide property getter and setter methods for all of the bean properties they wish to expose, plus override any of the public or protected methods for which they wish to provide modified functionality.

    359. Question 359. What Is Struts Validator Framework?

      Answer :

      Struts Framework provides the functionality to validate the form data. It can be use to validate the data on the users browser as well as on the server side. Struts Framework emits the java scripts and it can be used validate the form data on the client browser. Server side validation of form can be accomplished by sub classing your From Bean with DynaValidatorForm class.

    360. Question 360. What Are The Core Classes Of The Struts Framework?

      Answer :

      Core classes of Struts Framework are ActionForm, Action, ActionMapping, ActionForward, ActionServlet etc.

    361. Question 361. What Are Tag Libraries Provided With Struts?

      Answer :

      Struts provides a number of tag libraries that helps to create view components easily. These tag libraries are:
      a) Bean Tags: Bean Tags are used to access the beans and their properties.
      b) HTML Tags: HTML Tags provides tags for creating the view components like forms, buttons, etc..
      c) Logic Tags: Logic Tags provides presentation logics that eliminate the need for scriptlets.
      d) Nested Tags: Nested Tags helps to work with the nested context.

    362. Question 362. What Are Difference Between Actionerrors And Actionmessage?

      Answer :

      ActionMessage: A class that encapsulates messages. Messages can be either global or they are specific to a particular bean property.

      Each individual message is described by an ActionMessage object, which contains a message key (to be looked up in an appropriate message resources database), and up to four placeholder arguments used for parametric substitution in the resulting message.

      ActionErrors: A class that encapsulates the error messages being reported by the validate() method of an ActionForm. Validation errors are either global to the entire ActionForm bean they are associated with, or they are specific to a particular bean property (and, therefore, a particular input field on the corresponding form).

    363. Question 363. How You Will Handle Exceptions In Struts?

      Answer :

      In Struts you can handle the exceptions in two ways:
      a) Declarative Exception Handling: You can either define global exception handling tags in your struts-config.xml or define the exception handling tags within .. tag. 
      Example:

            key="database.error.duplicate" 
            path="/UserExists.jsp" 
            type="mybank.account.DuplicateUserException"/>
      b) Programmatic Exception Handling: Here you can use try{}catch{} block to handle the exception. 

    364. Question 364. How You Will Make Available Any Message Resources Definitions File To The Struts Framework Environment?

      Answer :

      Message Resources Definitions file are simple .properties files and these files contains the messages that can be used in the struts project. Message Resources Definitions files can be added to the struts-config.xml file through tag.

    365. Question 365. What Is Struts Flow?

      Answer :

      Struts Flow is a port of Cocoon's Control Flow to Struts to allow complex workflow, like multi-form wizards, to be easily implemented using continuations-capable JavaScript. It provides the ability to describe the order of Web pages that have to be sent to the client, at any given point in time in an application. The code is based on a proof-of-concept Dave Johnson put together to show how the Control Flow could be extracted from Cocoon.

    366. Question 366. What Is Lookupdispatchaction?

      Answer :

      An abstract Action that dispatches to the subclass mapped execute method. This is useful in cases where an HTML form has multiple submit buttons with the same name. The button name is specified by the parameter property of the corresponding ActionMapping.

    367. Question 367. Is Struts Threadsafe?give An Example?

      Answer :

      Struts is not only thread-safe but thread-dependant. The response to a request is handled by a light-weight Action object, rather than an individual servlet. Struts instantiates each Action class once, and allows other requests to be threaded through the original object. This core strategy conserves resources and provides the best possible throughput. A properly-designed application will exploit this further by routing related operations through a single Action.

    368. Question 368. What Are The Uses Of Tiles-def.xml File, Resourcebundle.properties File, Validation.xml File?

      Answer :

      tiles-def.xml : tiles-def.xml is used as a configuration file for an appliction during tiles development You can define the layout /header /footer /body content for your View.

      validation.xml : The validation.xml file is used to declare sets of validations that should be applied to Form Beans.

      Each Form Bean you want to validate has its own definition in this file Inside that definition, you specify the validations you want to apply to the Form Bean's fields.

      Resourcebundle.properties : Instead of having hard-coded error messages in the framework, Struts Validator allows you to specify a key to a message in the Application Resources. properties (or resourcebundle. properties) file that should be returned if a validation fails.

    369. Question 369. What Is The Difference Between Perform() And Execute() Methods?

      Answer :

      Perform method is the method which was deprecated in the Struts Version 1.1. In Struts 1.x, Action.perform() is the method called by the ActionServlet. This is typically where your business logic resides, or at least the flow control to your JavaBeans and EJBs that handle your business logic. As we already mentioned, to support declarative exception handling, the method signature changed in perform. Now execute just throws Exception. Action.perform() is now deprecated; however, the Struts v1.1 ActionServlet is smart enough to know whether or not it should call perform or execute in the Action, depending on which one is available.

    370. Question 370. What Is Struts Actions And Action Mappings?

      Answer :

      A Struts action is an instance of a subclass of an Action class, which implements a portion of a Web application and whose perform or execute method returns a forward.

      An action can perform tasks such as validating a user name and password.

      An action mapping is a configuration file entry that, in general, associates an action name with an action. An action mapping can contain a reference to a form bean that the action can use, and can additionally define a list of local forwards that is visible only to this action.

      An action servlet is a servlet that is started by the servlet container of a Web server to process a request that invokes an action. The servlet receives a forward from the action and asks the servlet container to pass the request to the forward's URL. An action servlet must be an instance of an

      org.apache.struts.action.ActionServlet class or of a subclass of that class. An action servlet is the primary component of the controller.

    371. Question 371. How Struts Relates To J2ee?

      Answer :

      Struts framework is built on J2EE technologies (JSP, Servlet, Taglibs), but it is itself not part of the J2EE standard.

    372. Question 372. How Do You Create Multiple Virtual Hosts?

      Answer :

      If you want tomcat to accept requests for different hosts e.g., www.myhostname.com then you must 

      0. create ${catalina.home}/www/appBase , ${catalina.home}/www/deploy, and ${catalina.home} /conf /Catalina /www.myhostname.com 

      1. add a host entry in the server.xml file 
        <Host appBase="www/appBase" name="www.myhostname.com"/>

      2. Create the the following file under 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 specific to this hosts webapp to this context file 

      3. put your war file in ${catalina.home}/www/deploy 

      When tomcat starts, it finds the host entry, then looks for any context files and will start any apps with a context 

      To add more sites just repeat and rinse, all webapps can share the same war file location and appbase.

    373. Question 373. How Will You Load Properties File?

      Answer :

      • Use a ResourceBundle. See the Java docs for the specifics of how the ResourceBundle class works. Using this method, the properties file must go into the WEB-INF/classes directory or in a jar file contained in the WEB-INF/lib directory.
      • Another way is to use the method getResourceAsStream() from the ServletContext class. This allows you update the file without having to reload the webapp as required by the first method. Here is an example code snippet, without any error trapping:

      // Assuming you are in a Servlet extending HttpServlet
      // This will look for a file called "/more/cowbell.properties" relative
      // to your servlet Root Context
      InputStream is = getServletContext().getResourceAsStream("/more/cowbell.properties");
      Properties p = new Properties();
      p.load(is);
      is.close();

    374. Question 374. Can I Set Java System Properties Differently For Each Webapp?

      Answer :

      No. If you can edit Tomcat's startup scripts, you can add "-D" options to Java. But there is no way to add such properties in web.xml or the webapp's context.

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

      Answer :

      Follow the standard instructions for when the isapi_redirector.dll 

      Configure IIS to use "integrated windows security" 

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

      <Connector port="8009" enableLookups="false" redirectPort="8443"
      protocol="AJP/1.3"tomcatAuthentication="false" />

    376. Question 376. How Do I Override The Default Home Page Loaded By Tomcat?

      Answer :

      After successfully installing Tomcat, you usually test it by loading  http://localhost:8080 . The contents of that page are compiled into the index_jsp servlet. The page even warns against modifying the index.jsp files for this reason. Luckily, it is quite easy to override that page. Inside $TOMCAT_HOME/conf/web.xml there is a section called <welcome-file-list> and it looks like this: 

          <welcome-file-list>
              <welcome-file>index.html</welcome-file>
              <welcome-file>index.htm</welcome-file>
              <welcome-file>index.jsp</welcome-file>
          </welcome-file-list>
      The default servlet attempts to load the index.* files in the order listed. You may easily override the index.jsp file by creating an index.html file at $TOMCAT_HOME/webapps/ROOT. It's somewhat common for that file to contain a new static home page or a redirect to a servlet's main page. A redirect would look like: 

      <html>
      <head>
      <meta http-equiv="refresh" content="0;URL=http://mydomain.com/some/path/to/servlet/homepage/">
      </head>
      <body>
      </body>
      </html>
      This change takes effect immediately and does not require a restart of Tomcat.

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

      Answer :

      Two things have to be done for tomcat to acknowledge SSI scripts: 

      1. Rename $CATALINA_BASE/server/lib/servlets-ssi.renametojar to $CATALINA_BASE/server/lib/servlets-ssi.jar. 

      2. Uncomment the section of web.xml found in $CATALINA_BASE/conf/web.xml that deals with SSI. it looks like this when it is 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>4</load-on-startup>
          </servlet>

    378. Question 378. How Do I Provide User Credentials For Starting A Server?

      Answer :

      When you create a domain, the Configuration Wizard prompts you to provide the username and password for an initial administrative user. If you create the domain in development mode, the wizard saves the username and encrypted password in a boot identity file. A WebLogic Server instance can refer to a boot identity file during its startup process. If a server instance does not find such a file, it prompts you to enter credentials.

      If you create a domain in production mode, or if you want to change user credentials in an existing boot identity file, you can create a new boot identity file.

    379. Question 379. Can I Start A Managed Server If The Administration Server Is Unavailable?

      Answer :

      By default, if a Managed Server is unable to connect to the specified Administration Server during startup, it can retrieve its configuration by reading a configuration file and other files directly. You cannot change the server's configuration until the Administration Server is available. A Managed Server that starts in this way is running in Managed Server Independence mode.

    380. Question 380. What Is The Function Of T3 In Weblogic Server?

      Answer :

      T3 provides a framework for WebLogic Server messages that support for enhancements. These enhancements include abbreviations and features, such as object replacement, that work in the context of WebLogic Server clusters and HTTP and other product tunneling. T3 predates Java Object Serialization and RMI, while closely tracking and leveraging these specifications. T3 is a superset of Java Object. Serialization or RMI; anything you can do in Java Object Serialization and RMI can be done over T3. T3 is mandated between WebLogic Servers and between programmatic clients and a WebLogic Server cluster. HTTP and IIOP are optional protocols that can be used to communicate between other processes and WebLogic Server. It depends on what you want to do. For example, when you want to communicate between a browser and WebLogic Server-use HTTP, or an ORB and WebLogic Server-IIOP.

    381. Question 381. How Do Stubs Work In A Weblogic Server Cluster?

      Answer :

      Clients that connect to a WebLogic Server cluster and look up a clustered object obtain a replica-aware stub for the object. This stub contains the list of available server instances that host implementations of the object. The stub also contains the load balancing logic for distributing the load among its host servers.

    382. Question 382. What Happens When A Failure Occurs And The Stub Cannot Connect To A Weblogic Server Instance?

      Answer :

      When the failure occurs, the stub removes the failed server instance from its list. If there are no servers left in its list, the stubb uses DNS again to find a running server and obtain a current list of running instances. Also, the stub periodically refreshes its list of available server instances in the cluster; this allows the stub to take advantage of new servers as they are added to the cluster.

    383. Question 383. How Does A Server Know When Another Server Is Unavailable?

      Answer :

      WebLogic Server uses two mechanisms to determine if a given server instance is unavailable.
      Each WebLogic Server instance in a cluster uses multicast to broadcast regular "heartbeat" messages that advertise its availability. By monitoring heartbeat messages, server instances in a cluster determine when a server instance has failed. The other server instances will drop a server instance from the cluster, if they do not receive three consecutive heartbeats from that server instance.

      WebLogic Server also monitors socket errors to determine the availability of a server instance. For example, if server instance A has an open socket to server instance B, and the socket unexpectedly closes, server A assumes that server B is offline.

    384. Question 384. How Are Notifications Made When A Server Is Added To A Cluster?

      Answer :

      The WebLogic Server cluster broadcasts the availability of a new server instance each time a new instance joins the cluster. Cluster-aware stubs also periodically update their list of available server instances.

    385. Question 385. How Do Clients Handle Dns Requests To Failed Servers?

      Answer :

      If a server fails and DNS continues to send requests to the unavailable machine, this can waste bandwidth. For a Java client application, this problem occurs only during startup. WebLogic Server caches the DNS entries and removes the unavailable ones, to prevent the client from accessing a failed server twice.

      Failed servers can be more of a problem for browser-based clients, because they always use DNS. To avoid unnecessary DNS requests with browser-based clients, use a third-party load-balancer such as Resonate, BigIP, Alteon, and LocalDirector. These products mask multiple DNS addresses as a single address. They also provide more sophisticated load-balancing options than round-robin, and they keep track of failed servers to avoid routing unnecessary requests.

    386. Question 386. How Many Weblogic Servers Can I Have On A Multi-cpu Machine?

      Answer :

      There are many possible configurations and each has its own advantages and disadvantages. BEA WebLogic Server has no built-in limit for the number of server instances that can reside in a cluster. Large, multi-processor servers such as Sun Microsystems, Inc. Sun Enterprise 10000, therefore, can host very large clusters or multiple clusters.

      In most cases, WebLogic Server clusters scale best when deployed with one WebLogic Server instance for every two CPUs. However, as with all capacity planning, you should test the actual deployment with your target web applications to determine the optimal number and distribution of server instances.

    387. Question 387. How Can I Set Deployment Order For Applications?

      Answer :

      WebLogic Server allows you to select the load order for applications. WebLogic Server deploys server-level resources (first JDBC and then JMS) before deploying applications. Applications are deployed in this order: connectors, then EJBs, then Web Applications. If the application is an EAR, the individual components are loaded in the order in which they are declared in the application.xml deployment descriptor.

    388. Question 388. When Should I Use The -nostage Option?

      Answer :

      Set the staging mode to -nostage (using weblogic.Deployer or the Administration Console) if you don't want to copy deployment files but want to deploy an application from its present location. All target servers must be able to access the same set of deployment files.

    389. Question 389. When Should I Use The External_stage Option?

      Answer :

      Set -external_stage using weblogic.Deployer if you want to stage the application yourself, and prefer to copy it to its target by your own means.

    390. Question 390. Can I Set The Deployment Order For Application Modules? For Standalone Modules?

      Answer :

      The Load Order attribute controls the deployment order of standalone modules and applications relative to other modules and applications of the same type. For example, standalone EJBs with smaller Load Order values are deployed before those with higher values.

      Modules that are deployed as part of an Enterprise Application (EAR file or directory) are deployed in the order in which they are specified in the application.xml deployment descriptor.

    391. Question 391. What Is The Difference Between The Wl_home/config/examples/applications Folder And The Wl_home/config/examples/stage Folder?

      Answer :

      The applications folder is intended for applications that are not yet ready for a production environment. WebLogic Server dynamically deploys the contents of the applications folder. Thestage folder (or a folder that you create for the same purpose) is for storing copies of deployment files that are ready for deployment in a production environment (deployments that use the stage orexternal_stage deployment modes).

    392. Question 392. How Do I Turn The Auto-deployment Feature Off?

      Answer :

      The auto-deployment feature checks the applications folder every three seconds to determine whether there are any new applications or any changes to existing applications and then dynamically deploys these changes.

      The auto-deployment feature is enabled for servers that run in development mode. To disable auto-deployment feature, use one of the following methods to place servers in production mode:

      •  In the Administration Console, click the name of the domain in the left pane, then select the Production Mode checkbox in the right pane.
      •   At the command line, include the following argument when starting the domain's Administration Server:

      -Dweblogic.ProductionModeEnabled=true
      Production mode is set for all WebLogic Server instances in a given domain.

    393. Question 393. Must Ejbs Be Homogeneously Deployed Across A Cluster? Why?

      Answer :

      Yes. In WebLogic Server 6.0 and later, EJBs must be homogeneously deployed across a cluster for the following reasons:

      • To keep clustering EJBs simple.
      •   To improve performance by avoiding cross-server calls. If EJBs are not deployed on all servers, cross-server calls are more likely.
      •   To ensure that every EJB is available locally.
      • To ensure that all classes are loaded in an undeployable way. Every server must have access to each EJB's classes so that it can be bound into the local JNDI tree. If only a subset of the servers deploys the bean, the other servers will have to load the bean's classes in their respective system classpaths which makes it impossible to undeploy the beans.

    394. Question 394. What Is The Servlet?

      Answer :

      Servlet is a script, which resides and executes on server side, to create dynamic HTML. In servlet programming we will use java language. A servlet can handle multiple requests concurrently.

    395. Question 395. What Is The Architechture Of Servlet Package?

      Answer :

      Servlet Interface is the central abstraction. All servlets implements this Servlet Interface either direclty or indirectly ( may implement or extend Servlet Interfaces sub classes or sub interfaces)

      Servlet
      |
      Generic Servlet
      |
      HttpServlet ( Class ) -- we will extend this class to handle GET / PUT HTTP requests
      |
      MyServlet

    396. Question 396. What Is The Difference Between Httpservlet And Genericservlet?

      Answer :

      A GenericServlet has a service() method to handle requests.
      HttpServlet extends GenericServlet added new methods

      • doGet()
      • doPost()
      • doHead()
      • doPut()
      • doOptions()
      • doDelete()
      • doTrace() methods

      Both these classes are abstract.

    397. Question 397. What's The Difference Between Servlets And Applets?

      Answer :

      Servlets executes on Servers. Applets executes on browser. Unlike applets, however, servlets have no graphical user interface.

    398. Question 398. What Are The Uses Of Servlets?

      Answer :

      A servlet can handle multiple requests concurrently, and can synchronize requests. Servlets can forward requests to other servers and servlets. Thus servlets can be used to balance load among several servers.

    399. Question 399. When Doget() Method Will Going To Execute?

      Answer :

      When we specified method='GET' in HTML
      Example : < form name='SSS' method='GET'>

    400. Question 400. When Dopost() Method Will Going To Execute?

      Answer :

      When we specified method='POST' in HTML
      < form name='SSS' method='POST' >

    401. Question 401. What Is The Difference Between Difference Between Doget() And Dopost()?

      Answer :

      GET Method : Using get method we can able to pass 2K data from HTML All data we are passing to Server will be displayed in URL (request string).

      POST Method : In this method we does not have any size limitation. All data passed to server will be hidden, User cannot able to see this info on the browser.

    402. Question 402. What Is The Servlet Life Cycle?

      Answer :

      When first request came in for the servlet , Server will invoke init() method of the servlet. There after if any user request the servlet program, Server will directly executes the service() method. When Server want to remove the servlet from pool, then it will execute the destroy() method.

    403. Question 403. Which Code Line Must Be Set Before Any Of The Lines That Use The Printwriter?

      Answer :

      setContentType() method must be set.

    404. Question 404. Which Protocol Will Be Used By Browser And Servlet To Communicate ?

      Answer :

      HTTP.

    405. Question 405. In How Many Ways We Can Track The Sessions?

      Answer :

      Method 1) By URL rewriting
      Method 2) Using Session object
      Getting Session form HttpServletRequest object
      HttpSession session = request.getSession(true);
      Get a Value from the session
      session.getValue(session.getId());
      Adding values to session
      cart = new Cart();
      session.putValue(session.getId(), cart);
      At the end of the session, we can inactivate the session by using the following command
      session.invalidate();
      Method 3) Using cookies
      Method 4) Using hidden fields.

    406. Question 406. How Can You Invoke Other Web Resources (or Other Servlet / Jsp ) ?

      Answer :

      Servelt can invoke other Web resources in two ways: indirect and direct.

      Indirect Way : Servlet will return the resultant HTML to the browser which will point to another Servlet (Web resource)

      Direct Way : We can call another Web resource (Servelt / Jsp) from Servelt program itself, by using RequestDispatcher object.

      You can get this object using getRequestDispatcher("URL") method. You can get this object from either a request or a Context.

    407. Question 407. What Is The Difference Between The Getrequestdispatcher(string Path) Servletrequest Interface And Servletcontext Interface?

      Answer :

      The getRequestDispatcher(String path) method of ServletRequest interface accepts parameter the path to the resource to be included or forwarded to, which can be relative to the request of the calling servlet. If the path begins with a "/" it is interpreted as relative to the current context root.

      The getRequestDispatcher(String path) method of ServletContext interface cannot accepts relative paths. All path must sart with a "/" and are interpreted as relative to curent context root. If the resource is not available, or if the server has not implemented a RequestDispatcher object for that type of resource, getRequestDispatcher will return null. Your servlet should be prepared to deal with this condition.

    408. Question 408. What Is The Use Of Servletcontext ?

      Answer :

      Using ServletContext, We can access data from its environment. Servlet context is common to all Servlets so all Servlets share the information through ServeltContext.

    409. Question 409. Is There Any Way To Generate Pdf's Dynamically In Servlets?

      Answer :

      We need to use iText. A open source library for java. Please refer sourceforge site for sample servlet examples.

    410. Question 410. What Is The Difference Between Using Getsession(true) And Getsession(false) Methods?

      Answer :

      getSession(true) - This method will check whether already a session is existing for the user. If a session is existing, it will return that session object, Otherwise it will create new session object and return taht object.

      getSession(false) - This method will check existence of session. If session exists, then it returns the reference of that session object, if not, this methods will return null.

    411. Question 411. What Is Ejb ?

      Answer :

      EJB stands for Enterprise JavaBean and is a widely-adopted server side component architecture for J2EE. It enables rapid development of mission-critical application that are versatile, reusable and portable across middleware while protecting IT investment and preventing vendor lock-in.

    412. Question 412. What Is Session Facade?

      Answer :

      Session Facade is a design pattern to access the Entity bean through local interface than accessing directly. It increases the performance over the network. In this case we call session bean which on turn call entity bean.

    413. Question 413. What Is Ejb Role In J2ee?

      Answer :

      EJB technology is the core of J2EE. It enables developers to write reusable and portable server-side business logic for the J2EE platform.

    414. Question 414. What Is The Difference Between Ejb And Java Beans?

      Answer :

      EJB is a specification for J2EE server, not a product; Java beans may be a graphical component in IDE.

    415. Question 415. What Are The Key Features Of The Ejb Technology?

      Answer :

      1. EJB components are server-side components written entirely in the Java programming language.
      2. EJB components contain business logic only - no system-level programming & services, such as transactions, security, life-cycle, threading, persistence, etc. are automatically managed for the EJB component by the EJB server.
      3. EJB architecture is inherently transactional, distributed, portable multi-tier, scalable and secure.
      4. EJB components are fully portable across any EJB server and any OS.
      5. EJB architecture is wire-protocol neutral--any protocol can be utilized like IIOP,JRMP, HTTP, DCOM,etc.

    416. Question 416. What Are The Key Benefits Of The Ejb Technology?

      Answer :

      1. Rapid application development
      2. Broad industry adoption
      3. Application portability
      4. Protection of IT investment.

    417. Question 417. How Many Enterprise Beans?

      Answer :

      There are three kinds of enterprise beans:
      1. session beans,
      2. entity beans, and
      3. message-driven beans.

    418. Question 418. What Is Message-driven Bean?

      Answer :

      A message-driven bean combines features of a session bean and a Java Message Service (JMS) message listener, allowing a business component to receive JMS. A message-driven bean enables asynchronous clients to access the business logic in the EJB tier.

    419. Question 419. What Is Entity Bean And Session Bean ?

      Answer :

      Entity Bean is a Java class which implements an Enterprise Bean interface and provides the implementation of the business methods. There are two types: Container Managed Persistence(CMP) and Bean-Managed Persistence(BMP).

      Session Bean is used to represent a workflow on behalf of a client. There are two types: Stateless and Stateful. Stateless bean is the simplest bean. It doesn't maintain any conversational state with clients between method invocations. Stateful bean maintains state between invocations.

    420. Question 420. How Ejb Invocation Happens?

      Answer :

      Retrieve Home Object reference from Naming Service via JNDI. Return Home Object reference to the client. Create me a new EJB Object through Home Object interface. Create EJB Object from the Ejb Object. Return EJB Object reference to the client. Invoke business method using EJB Object reference. Delegate request to Bean (Enterprise Bean).

    421. Question 421. Is It Possible To Share An Httpsession Between A Jsp And Ejb? What Happens When I Change A Value In The Httpsession From Inside An Ejb?

      Answer :

      You can pass the HttpSession as parameter to an EJB method, only if all objects in session are serializable.This has to be consider as passed-by-value, that means that it's read-only in the EJB. If anything is altered from inside the EJB, it won't be reflected back to the HttpSession of the Servlet Container.The pass-by-reference can be used between EJBs Remote Interfaces, as they are remote references. While it is possible to pass an HttpSession as a parameter to an EJB object, it is considered to be bad practice in terms of object-oriented design. This is because you are creating an unnecessary coupling between back-end objects (EJBs) and front-end objects (HttpSession). Create a higher-level of abstraction for your EJBs API. Rather than passing the whole, fat, HttpSession (which carries with it a bunch of http semantics), create a class that acts as a value object (or structure) that holds all the data you need to pass back and forth between front-end/back-end. Consider the case where your EJB needs to support a non HTTP-based client. This higher level of abstraction will be flexible enough to support it.

    422. Question 422. The Ejb Container Implements The Ejbhome And Ejbobject Classes. For Every Request From A Unique Client, Does The Container Create A Separate Instance Of The Generated Ejbhome And Ejbobject Classes?

      Answer :

      The EJB container maintains an instance pool. The container uses these instances for the EJB Home reference irrespective of the client request. while refering the EJB Object classes the container creates a separate instance for each client request. The instance pool maintenance is up to the implementation of the container. If the container provides one, it is available otherwise it is not mandatory for the provider to implement it. Having said that, yes most of the container providers implement the pooling functionality to increase the performance of the application server. The way it is implemented is, again, up to the implementer.

    423. Question 423. Can The Primary Key In The Entity Bean Be A Java Primitive Type Such As Int?

      Answer :

      The primary key can't be a primitive type. Use the primitive wrapper classes, instead. For example, you can use java.lang.Integer as the primary key class, but not int (it has to be a class, not a primitive).

    424. Question 424. Can You Control When Passivation Occurs?

      Answer :

      The developer, according to the specification, cannot directly control when passivation occurs. Although for Stateful Session Beans, the container cannot passivate an instance that is inside a transaction. So using transactions can be a a strategy to control passivation. The ejbPassivate() method is called during passivation, so the developer has control over what to do during this exercise and can implement the require optimized logic. Some EJB containers, such as BEA WebLogic, provide the ability to tune the container to minimize passivation calls. Taken from the WebLogic 6.0 DTD -The passivation-strategy can be either default or transaction. With the default setting the container will attempt to keep a working set of beans in the cache. With the transaction setting, the container will passivate the bean after every transaction (or method call for a non-transactional invocation).

    425. Question 425. What Is The Advantage Of Using Entity Bean For Database Operations, Over Directly Using Jdbc Api To Do Database Operations? When Would I Use One Over The Other?

      Answer :

      Entity Beans actually represents the data in a database. It is not that Entity Beans replaces JDBC API. There are two types of Entity Beans Container Managed and Bean Mananged. In Container Managed Entity Bean - Whenever the instance of the bean is created the container automatically retrieves the data from the DB/Persistance storage and assigns to the object variables in bean for user to manipulate or use them. For this the developer needs to map the fields in the database to the variables in deployment descriptor files (which varies for each vendor). In the Bean Managed Entity Bean - The developer has to specifically make connection, retrive values, assign them to the objects in the ejbLoad() which will be called by the container when it instatiates a bean object. Similarly in the ejbStore() the container saves the object values back the the persistance storage. ejbLoad and ejbStore are callback methods and can be only invoked by the container. Apart from this, when you use Entity beans you dont need to worry about database transaction handling, database connection pooling etc. which are taken care by the ejb container.

    426. Question 426. What Is Ejb Ql?

      Answer :

      EJB QL is a Query Language provided for navigation across a network of enterprise beans and dependent objects defined by means of container managed persistence. EJB QL is introduced in the EJB 2.0 specification. The EJB QL query language defines finder methods for entity beans with container managed persistenceand is portable across containers and persistence managers. EJB QL is used for queries of two types of finder methods: Finder methods that are defined in the home interface of an entity bean and which return entity objects. Select methods, which are not exposed to the client, but which are used by the Bean Provider to select persistent values that are maintained by the Persistence Manager or to select entity objects that are related to the entity bean on which the query is defined.

    427. Question 427. Brief Description About Local Interfaces?

      Answer :

      EJB was originally designed around remote invocation using the Java Remote Method Invocation (RMI) mechanism, and later extended to support to standard CORBA transport for these calls using RMI/IIOP. This design allowed for maximum flexibility in developing applications without consideration for the deployment scenario, and was a strong feature in support of a goal of component reuse in J2EE. Many developers are using EJBs locally, that is, some or all of their EJB calls are between beans in a single container. With this feedback in mind, the EJB 2.0 expert group has created a local interface mechanism. The local interface may be defined for a bean during development, to allow streamlined calls to the bean if a caller is in the same container. This does not involve the overhead involved with RMI like marshalling etc. This facility will thus improve the performance of applications in which co-location is planned. Local interfaces also provide the foundation for container-managed relationships among entity beans with container-managed persistence.

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

      Answer :

      It is important to understand that the calling semantics of local interfaces are different from those of remote interfaces. For example, remote interfaces pass parameters using call-by-value semantics, while local interfaces use call-by-reference. This means that in order to use local interfaces safely, application developers need to carefully consider potential deployment scenarios up front, then decide which interfaces can be local and which remote, and finally, develop the application code with these choices in mind. While EJB 2.0 local interfaces are extremely useful in some situations, the long-term costs of these choices, especially when changing requirements and component reuse are taken into account, need to be factored into the design decision.

    429. Question 429. What Happens If Remove( ) Is Never Invoked On A Session Bean?

      Answer :

      In case of a stateless session bean it may not matter if we call or not as in both cases nothing is done. The number of beans in cache is managed by the container. In case of stateful session bean, the bean may be kept in cache till either the session times out, in which case the bean is removed or when there is a requirement for memory in which case the data is cached and the bean is sent to free pool.

    430. Question 430. What Is The Difference Between Message Driven Beans And Stateless Session Beans?

      Answer :

      In several ways, the dynamic creation and allocation of message-driven bean instances mimics the behavior of stateless session EJB instances, which exist only for the duration of a particular method call. However, message-driven beans are different from stateless session EJBs (and other types of EJBs) in several significant ways: Message-driven beans process multiple JMS messages asynchronously, rather than processing a serialized sequence of method calls. Message-driven beans have no home or remote interface, and therefore cannot be directly accessed by internal or external clients. Clients interact with message-driven beans only indirectly, by sending a message to a JMS Queue or Topic. Only the container directly interacts with a message-driven bean by creating bean instances and passing JMS messages to those instances as necessary. The Container maintains the entire lifecycle of a message-driven bean; instances cannot be created or removed as a result of client requests or other API calls.

    431. Question 431. How Can I Call One Ejb From Inside Of Another Ejb?

      Answer :

      EJBs can be clients of other EJBs. It just works. Use JNDI to locate the Home Interface of the other bean, then acquire an instance reference, and so forth.

    432. Question 432. What Is An Ejb Context?

      Answer :

      EJBContext is an interface that is implemented by the container, and it is also a part of the bean-container contract. Entity beans use a subclass of EJBContext called EntityContext. Session beans use a subclass called SessionContext. These EJBContext objects provide the bean class with information about its container, the client using the bean and the bean itself. They also provide other functions. See the API docs and the spec for more details.

    433. Question 433. Is It Possible For An Ejb Client To Marshal An Object Of Class Java.lang.class To An Ejb?

      Answer :

      Technically yes, spec. compliant NO! - The enterprise bean must not attempt to query a class to obtain information about the declared members that are not otherwise accessible to the enterprise bean because of the security rules of the Java language.

    434. Question 434. Is It Legal To Have Static Initializer Blocks In Ejb?

      Answer :

      Although technically it is legal, static initializer blocks are used to execute some piece of code before executing any constructor or method while instantiating a class. Static initializer blocks are also typically used to initialize static fields - which may be illegal in EJB if they are read/write - In EJB this can be achieved by including the code in either the ejbCreate(), setSessionContext() or setEntityContext() methods.

    435. Question 435. Is It Possible To Stop The Execution Of A Method Before Completion In A Sessionbean?

      Answer :

      Stopping the execution of a method inside a Session Bean is not possible without writing code inside the Session Bean. This is because you are not allowed to access Threads inside an EJB.

    436. Question 436. What Is The Default Transaction Attribute For An Ejb?

      Answer :

      There is no default transaction attribute for an EJB. Section 11.5 of EJB v1.1 spec says that the deployer must specify a value for the transaction attribute for those methods having container managed transaction. In WebLogic, the default transaction attribute for EJB is SUPPORTS.

    437. Question 437. What Is The Difference Between Session And Entity Beans? When Should I Use One Or The Other?

      Answer :

      An entity bean represents persistent global data from the database; a session bean represents transient user-specific data that will die when the user disconnects (ends his session). Generally, the session beans implement business methods (e.g. Bank.transferFunds) that call entity beans (e.g. Account.deposit, Account.withdraw).

    438. Question 438. Is There Any Default Cache Management System With Entity Beans ?

      Answer :

      In other words whether a cache of the data in database will be maintained in EJB ? - Caching data from a database inside the AAApplication Server are what Entity EJB's are used for.The ejbLoad() and ejbStore() methods are used to synchronize the Entity Bean state with the persistent storage(database). Transactions also play an important role in this scenario. If data is removed from the database, via an external application - your Entity Bean can still be alive the EJB container. When the transaction commits, ejbStore() is called and the row will not be found, and the transaction rolled back.

    439. Question 439. Why Is Ejbfindbyprimarykey Mandatory?

      Answer :

      An Entity Bean represents persistent data that is stored outside of the EJB Container/Server. The ejbFindBy PrimaryKey is a method used to locate and load an Entity Bean into the container, similar to a SELECT statement in SQL. By making this method mandatory, the client programmer can be assured that if they have the primary key of the Entity Bean, then they can retrieve the bean without having to create a new bean each time - which would mean creating duplications of persistent data and break the integrity of EJB.

    440. Question 440. Why Do We Have A Remove Method In Both Ejbhome And Ejbobject?

      Answer :

      With the EJBHome version of the remove, you are able to delete an entity bean without first instantiating it (you can provide a PrimaryKey object as a parameter to the remove method). The home version only works for entity beans. On the other hand, the Remote interface version works on an entity bean that you have already instantiated. In addition, the remote version also works on session beans (stateless and stateful) to inform the container of your loss of interest in this bean.

    441. Question 441. What Is The Difference Between A Server, A Container, And A Connector?

      Answer :

      An EJB server is an application, usually a product such as BEA WebLogic, that provides (or should provide) for concurrent client connections and manages system resources such as threads, processes, memory, database connections, network connections, etc. An EJB container runs inside (or within) an EJB server, and provides deployed EJB beans with transaction and security management, etc. The EJB container insulates an EJB bean from the specifics of an underlying EJB server by providing a simple, standard API between the EJB bean and its container. A Connector provides the ability for any Enterprise Information System (EIS) to plug into any EJB server which supports the Connector architecture. See Sun's J2EE Connectors for more in-depth information on Connectors.

    442. Question 442. How Is Persistence Implemented In Enterprise Beans?

      Answer :

      Persistence in EJB is taken care of in two ways, depending on how you implement your beans: container managed persistence (CMP) or bean managed persistence (BMP) For CMP, the EJB container which your beans run under takes care of the persistence of the fields you have declared to be persisted with the database - this declaration is in the deployment descriptor. So, anytime you modify a field in a CMP bean, as soon as the method you have executed is finished, the new data is persisted to the database by the container. For BMP, the EJB bean developer is responsible for defining the persistence routines in the proper places in the bean, for instance, the ejbCreate(), ejbStore(), ejbRemove() methods would be developed by the bean developer to make calls to the database. The container is responsible, in BMP, to call the appropriate method on the bean. So, if the bean is being looked up, when the create() method is called on the Home interface, then the container is responsible for calling the ejbCreate() method in the bean, which should have functionality inside for going to the database and looking up the data.

    443. Question 443. Is Method Overloading Allowed In Ejb?

      Answer :

      Yes you can overload methods.

    444. Question 444. Should Synchronization Primitives Be Used On Bean Methods?

      Answer :

      No. The EJB specification specifically states that the enterprise bean is not allowed to use thread primitives. The container is responsible for managing concurrent access to beans at runtime.

    445. Question 445. Are We Allowed To Change The Transaction Isolation Property In Middle Of A Transaction?

      Answer :

      No. You cannot change the transaction isolation level in the middle of transaction.

    446. Question 446. For Entity Beans, What Happens To An Instance Field Not Mapped To Any Persistent Storage, When The Bean Is Passivated?

      Answer :

      The specification infers that the container never serializes an instance of an Entity bean (unlike stateful session beans). Thus passivation simply involves moving the bean from the ready to the pooled bin. So what happens to the contents of an instance variable is controlled by the programmer. Remember that when an entity bean is passivated the instance gets logically disassociated from it's remote object. Be careful here, as the functionality of passivation/activation for Stateless Session, Stateful Session and Entity beans is completely different. For entity beans the ejbPassivate method notifies the entity bean that it is being disassociated with a particular entity prior to reuse or for the reference.

    447. Question 447. What Is A Message Driven Bean, What Functions Does A Message Driven Bean Have And How Do They Work In Collaboration With Jms?

      Answer :

      Message driven beans are the latest addition to the family of component bean types defined by the EJB specification. The original bean types include session beans, which contain business logic and maintain a state associated with client sessions, and entity beans, which map objects to persistent data. Message driven beans will provide asynchrony to EJB based applications by acting as JMS message consumers. A message bean is associated with a JMS topic or queue and receives JMS messages sent by EJB clients or other beans. Unlike entity beans and session beans, message beans do not have home or remote interfaces. Instead, message driven beans are instantiated by the container as required. Like stateless session beans, message beans maintain no client-specific state, allowing the container to optimally manage a pool of message-bean instances. Clients send JMS messages to message beans in exactly the same manner as they would send messages to any other JMS destination. This similarity is a fundamental design goal of the JMS capabilities of the new specification. To receive JMS messages, message driven beans implement the javax.jms.MessageListener interface, which defines a single onMessage() method. When a message arrives, the container ensures that a message bean corresponding to the message topic/queue exists (instantiating it if necessary), and calls its onMessage method passing the client's message as the single argument. The message bean's implementation of this method contains the business logic required to process the message. Note that session beans and entity beans are not allowed to function as message beans.

    448. Question 448. Does The Container Create A Separate Instance Of The Generated Ejbhome And Ejbobject Classes?

      Answer :

      The EJB container maintains an instance pool. The container uses these instances for the EJB Home reference irrespective of the client request. while refering the EJB Object classes the container creates a separate instance for each client request. The instance pool maintainence is up to the implementation of the container. If the container provides one, it is available otherwise it is not mandatory for the provider to implement it. Having said that, yes most of the container providers implement the pooling functionality to increase the performance of the application server. The way it is implemented is again up to the implement.

    449. Question 449. What Is The Advantage Of Putting An Entity Bean Instance From The Ready State To Pooled State?

      Answer :

      The idea of the Pooled State is to allow a container to maintain a pool of entity beans that has been created, but has not been yet synchronized or assigned to an EJBObject. This mean that the instances do represent entity beans, but they can be used only for serving Home methods (create or findBy), since those methods do not relay on the specific values of the bean. All these instances are, in fact, exactly the same, so, they do not have meaningful state. Jon Thorarinsson has also added: It can be looked at it this way: If no client is using an entity bean of a particular type there is no need for cachig it (the data is persisted in the database). Therefore, in such cases, the container will, after some time, move the entity bean from the Ready State to the Pooled state to save memory. Then, to save additional memory, the container may begin moving entity beans from the Pooled State to the Does Not Exist State, because even though the bean's cache has been cleared, the bean still takes up some memory just being in the Pooled State.

    450. Question 450. What Is The Relationship Between Local Interfaces And Container-managed Relationships?

      Answer :

      Entity beans that have container-managed relationships with other entity beans, must be accessed in the same local scope as those related beans, and therefore typically provide a local client view. In order to be the target of a container-managed relationship, an entity bean with container-managed persistence must provide a local interface.

    451. Question 451. What Does A Remove Method Do For Different Cases Of Beans?

      Answer :

      Stateless Session : Does not do anything to the bean as moving the bean from free pool to cache are managed by the container depending on load. Stateful Session: Removes the bean from the cache. Entity Bean: Deletes the bean (data) from persistent storage.

    452. Question 452. How Does A Container-managed Relationship Work?

      Answer :

      An entity bean accesses related entity beans by means of the accessor methods for its container-managed relationship fields, which are specified by the cmr-field elements of its abstract persistence schema defined in the deployment descriptor. Entity bean relationships are defined in terms of the local interfaces of the related beans, and the view an entity bean presents to its related beans is defined by its local home and local interfaces. Thus, an entity bean can be the target of a relationship from another entity bean only if it has a local interface.

    453. Question 453. What Is The New Basic Requirement For A Cmp Entity Bean Class In 2.0 From That Of Ejb 1.1?

      Answer :

      It must be abstract class. The container extends it and implements methods which are required for managing the relationships.

    454. Question 454. What Are The Basic Classes Required In The Client For Invoking An Ejb?

      Answer :

      The home and the remote interfaces, the implementation of the Naming Context Factory, the stubs and skeletons. In some App servers the stubs and the skeletons can be dynamically downloaded from the server.

    455. Question 455. What Is The Need For Clustering?

      Answer :

      To scale the application so that it is highly available and has high throughput.

    456. Question 456. What Are The Types Of Scaling?

      Answer :

      There are two types of scaling: Vertical Scaling and Horizontal Scaling.

    457. Question 457. What Is Vertical Scaling?

      Answer :

      When multiple server clones of an application server are defined on the same physical m/c, it is called Vertical Scaling. The objective is to use the processing power of that m/c more efficiently.

    458. Question 458. What Is Horizontal Scaling?

      Answer :

      When Clones of an application server are defined on multiple physical m/c, it is called Horizontal Scaling. The objective is to use more than one less powerful m/c more efficiently.

    459. Question 459. What Is A Server Group?

      Answer :

      A server group is a template of an Application Server(and its contents) i.e, it is a logical representation of the application server. It has the same structure and attributes as the real Application Server, but it is not associated with any node, and does not correspond to any real server process running on any node.

    460. Question 460. What Is A Clone?

      Answer :

      The copies of a server group are called Clones. But unlike a Server Group Clones are associated with a node and are real server process running in that node.

    461. Question 461. What Is Ripple Effect?

      Answer :

      The process of propagating the changes in the properties of a server group during runtime to all the associated clones is called Ripple Effect.

    462. Question 462. What Level Of Load Balancing Is Possible With Ejbs?

      Answer :

      The workload management service provides load balancing for the following types of enterprise beans: Homes of entity or session beans, Instances of entity beans, Instances of stateless session beans.

    463. Question 463. What Is The Basic Requirement For In-memory Replication In Weblogic?

      Answer :

      The data in session should consist only of Serialized objects. Only setAttribute function should be used to set objects in session.

    464. Question 464. How Jdbc Services Can Be Used In Clustered Environment?

      Answer :

      Identical DataSource has to be created in each clustered server instances and configure to use different connection pools.

    465. Question 465. Mention Some Tools To Cluster Web Servers?

      Answer :

      Web Servers can be clustered using Edge Server or DNS.

    466. Question 466. What Is In-memory Replication?

      Answer :

      The process by which the contents in the memory of one physical m/c are replicated in all the m/c in the cluster is called in-memory replication.

    467. Question 467. Difference Between Abstraction And Encapsulation?

      Answer :

      Abstraction is removing some distinctions between objects, so as to show their commonalities. Encapsulation is hiding the details of the implementation of an object so that there are no external dependencies on the particular implementation.

    468. Question 468. What Is The Difference Between Url Instance And Urlconnection Instance?

      Answer :

      A URL instance represents the location of a resource, and a URLConnection instance represents a link for accessing or communicating with the resource at the location.

    469. Question 469. What Are The Two Important Tcp Socket Classes?

      Answer :

      Socket and ServerSocket. ServerSocket is used for normal two-way socket communication. Socket class allows us to read and write through the sockets. getInputStream() and getOutputStream() are the two methods available in Socket class.

    470. Question 470. What Technologies Are Included In J2ee?

      Answer :

      The primary technologies in J2EE are: Enterprise JavaBeansTM (EJBsTM), JavaServer PagesTM (JSPsTM), Java Servlets, the Java Naming and Directory InterfaceTM (JNDITM), the Java Transaction API (JTA), CORBA, and the JDBCTM data access API.

    471. Question 471. What Is The Java Authentication And Authorization Service (jaas) 1.0?

      Answer :

      The Java Authentication and Authorization Service (JAAS) provides a way for a J2EE application to authenticate and authorize a specific user or group of users to run it. JAAS is a Java programing language version of the standard Pluggable Authentication Module (PAM) framework that extends the Java 2 platform security architecture to support user-based authorization.

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

      Answer :

      lookup() :attempts to find the specified object in the given context. I.e., it looks for a single, specific object and either finds it in the current context or it fails.

      list(): attempts to return an enumeration of all of the NameClassPair’s of all of the objects in the current context. I.e., it’s a listing of all of the objects in the current context but only returns the object’s name and the name of the class to which the object belongs.

      listBindings(): attempts to return an enumeration of the Binding’s of all of the objects in the current context. I.e., it’s a listing of all of the objects in the current context with the object’s name, its class name, and a reference to the object itself.

      search(): attempts to return an enumeration of all of the objects matching a given set of search criteria. It can search across multiple contexts (or not). It can return whatever attributes of the objects that you desire. It’s by far the most complex and powerful of these options but is also the most expensive.

    473. Question 473. Components Of Jndi?

      Answer :

      Naming Interface- The naming interface organizes information hierarchically and maps human-friendly names to addresses or objects that are machine-friendly. It allows access to named objects through multiple namespaces. Directory Interface - JNDI includes a directory service interface that provides access to directory objects, which can contain attributes, thereby providing attribute-based searching and schema support. Service Provider Interface - JNDI comes with the SPI, which supports the protocols provided by third parties.

    474. Question 474. What Is The Max Amount Of Information That Can Be Saved In A Session Object?

      Answer :

      As such there is no limit on the amount of information that can be saved in a Session Object. Only the RAM available on the server machine is the limitation. The only limit is the Session ID length(Identifier), which should not exceed more than 4K. If the data to be store is very huge, then it’s preferred to save it to a temporary file onto hard disk, rather than saving it in session. Internally if the amount of data being saved in Session exceeds the predefined limit, most of the servers write it to a temporary cache on Hard disk.

    475. Question 475. Must My Bean-managed Persistence Mechanism Use The Weblogic Jts Driver?

      Answer :

      BEA recommend that you use the TxDataSource for bean-managed persistence.

    476. Question 476. Do Ejbs Have To Be Homogeneously Deployed Across A Cluster? Why?

      Answer :

      Yes. Beginning with WebLogic Server version 6.0, EJBs must be homogeneously deployed across a cluster for the following reasons:

      • To keep clustering EJBs simple.
      • To avoid cross server calls which results in more efficiency. If EJBs are not deployed on all servers, cross server calls are much more likely.
      • To ensure that every EJB is available locally.
      • To ensure that all classes are loaded in an undeployable way.
      • Every server must have access to each EJB’s classes so that it can be bound into the local JNDI tree. If only a subset of the servers deploys the bean, the other servers will have to load the bean’s classes in their respective system classpaths which makes it impossible to undeploy the beans.

    477. Question 477. Is An Xslt Processor Bundled In Weblogic Server?

      Answer :

      Yes, an XSLT processor, based on Apache’s Xalan 2.0.1 processor, in WebLogic Server 6.1.

    478. Question 478. What Are The Enhancements In Ejb 2.0 Specification With Respect To Asynchronous Communication?

      Answer :

      EJB 2.0 mandates integration between JMS and EJB. We have specified the integration of Enterprise JavaBeans with the Java Message Service, and have introduced message-driven beans. A message-driven bean is a stateless component that is invoked by the container as a result of the arrival of a JMS message. The goal of the message-driven bean model is to make developing an enterprise bean that is asynchronously invoked to handle the processing of incoming JMS messages as simple as developing the same functionality in any other JMS MessageListener.

    479. Question 479. What Are The Enhancements In Ejb 2.0 With Respect To Cmp?

      Answer :

      EJB 2.0 extends CMP to include far more robust modeling capability, with support for declarative management of relationships between entity EJBs. Developers no longer need to re-establish relationships between the various beans that make up their application — the container will restore the connections automatically as beans are loaded, allowing bean developers to navigate between beans much as they would between any standard Java objects.

      EJB 2.0 also introduces for the first time a portable query language, based on the abstract schema, not on the more complex database schema. This provides a database and vendor-independent way to find entity beans at run time, based on a wide variety of search criteria.

    480. Question 480. Can You Briefly Describe Local Interfaces?

      Answer :

      EJB was originally designed around remote invocation using the Java Remote Method Invocation (RMI) mechanism, and later extended to support to standard CORBA transport for these calls using RMI/IIOP. This design allowed for maximum flexibility in developing applications without consideration for the deployment scenario, and was a strong feature in support of a goal of component reuse in J2EE. Many developers are using EJBs locally - that is, some or all of their EJB calls are between beans in a single container. With this feedback in mind, the EJB 2.0 expert group has created a local interface mechanism. The local interface may be defined for a bean during development, to allow streamlined calls to the bean if a caller is in the same container. This does not involve the overhead involved with RMI like marshalling etc. This facility will thus improve the performance of applications in which co-location is planned. Local interfaces also provide the foundation for container-managed relationships among entity beans with container-managed persistence.

    481. Question 481. What Should You Do In A Passive Method?

      Answer :

      You try to make all nontransient variables, which are not one of the following to null. For the given list the container takes care of serializing and restoring the object when activated. Serializable objects, null, UserTransaction, SessionContext, JNDI contexts in the beans context, reference to other beans, references to connection pools. Things that must be handled explicitly are like a open database connection etc. These must be closed and set to null and retrieved back in the activate method.

    482. Question 482. How Should You Type Cast A Remote Object? Why?

      Answer :

      A client program that is intended to be interoperable with all compliant EJB Container implementations must use the javax.rmi.PortableRemoteObject.narrow(…) method to perform type-narrowing of the client-side representations of the remote home and remote interfaces. Programs using the cast operator for narrowing the remote and remote home interfaces are likely to fail if the Container implementation uses RMI-IIOP as the underlying communication transport.

    483. Question 483. What Does Isidentical() Method Return In Case Of Different Type Of Beans?

      Answer :

      Stateless - true always. Stateful - depends whether the references point to the same session object. Entity - Depends whether the primary key is the same and the home is same.

    484. Question 484. Can The Bean Class Implement The Ejbobject Class Directly? If Not Why?

      Answer :

      It is better not to do it will make the Bean class a remote object and its methods can be accessed without the containers security, and transaction implementations if our code by mistake passed it in one of its parameters. Its just a good design practice.

    485. Question 485. What Do You Understand By A J2ee Module?

      Answer :

      A J2EE module is a software unit that consists of one or more J2EE components of the same container type along with one deployment descriptor of that type. J2EE specification defines four types of modules:
      (a) EJB,
      (b) Web,
      (c) Application client, and
      (d) Resource Adapter.

    486. Question 486. What Are The Contents Of A Web Module?

      Answer :

      A web module may contain:
      (a) JSP files,
      (b) Java classes,
      (c) gif and html files, and
      (d) Web component deployment descriptors.

    487. Question 487. Differentiate Between .ear, .jar And .war Files.

      Answer :

      These files are simply zipped file using Java jar tool. These files are created for different purposes. Here is the description of these files:
      • .jar files: These files are with the .jar extension. The .jar files contains the libraries, resources and accessories files like property files.
      • .war files: These files are with the .war extension. The war file contains the web application that can be deployed on the any servlet/jsp container. The .war file contains jsp, html, javascript and other files for necessary for the development of web applications.
      • .ear files: The .ear file contains the EJB modules of the application.

    488. Question 488. What Is The Difference Between Java Bean And Enterprise Java Bean?

      Answer :

      Java Bean as is a plain java class with member variables and getter setter methods. Java Beans are defined under JavaBeans specification as Java-Based software component model which includes the features like introspection, customization, events, properties and persistence.

      Enterprise JavaBeans or EJBs for short are Java-based software components that comply with Java's EJB specification. EJBs are delpoyed on the EJB container and executes in the EJB container. EJB is not that simple, it is used for building distributed applications. Examples of EJB are Session Bean, Entity Bean and Message Driven Bean. EJB is used for server side programming whereas java bean is a client side. Bean is only development but the EJB is developed and then deployed on EJB Container.


Face Book Twitter Google Plus Instagram Youtube Linkedin Myspace Pinterest Soundcloud Wikipedia

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

J2EE Tutorial