EJB knowledge and WebLogic knowledge frequently used in the interview

Source: Internet
Author: User
Tags ssl connection websphere application server

EJB knowledge frequently used in interviews
What is the difference between EJB and Java Bean?
A: Java Bean is a reusable component and there is no strict specification for Java Bean. Theoretically, any Java class can be a bean. However, since Java Beans are created by containers (such as Tomcat), Java Beans should have a constructor without parameters. In addition, generally, Java Bean must implement the serializable interface to realize bean persistence. Java Beans cannot be accessed across processes. Enterprise Java Bean is a distributed component. It is based on Java remote method call (RMI) technology, so EJB can be remotely accessed (cross-process, cross-computer ). However, EJB must be deployed in containers such as webspere and weblogic. The EJB client never directly accesses the real EJB component but accesses it through its container. The EJB container is the proxy of the EJB component. The EJB component is created and managed by the container. The customer accesses the real EJB component through the container.

Which technologies are implemented based on EJB? And the difference between sessionbean and entitybean, and the difference between statefulbean and statelessbean.
A: EJB includes Session Bean, Entity Bean, and message driven bean. It is implemented based on technologies such as JNDI, RMI, and JAT.
Function:
Sessionbean is used to complete some server-side business operations, such as accessing the database and calling other EJB components.
Entitybean is used to represent the data used in the application system.
For clients, sessionbean is a non-persistent object that implements some business logic running on the server.
Session Bean can be further subdivided into stateful Session Bean and stateless Session Bean. Both session beans can execute the system logic in method, the difference is that the stateful session bean can record the caller's status. Therefore, a user usually has a corresponding stateful Session Bean entity. Although stateless Session Bean is also a logical component, it is not responsible for recording the user status, that is, when the user calls stateless Session Bean, the EJB container does not find the entity of the specific stateless Session Bean to execute this method. In other words, when several users execute a stateless Session Bean's methods, they will execute the same bean instance. In terms of memory, compared with stateful Session Bean and stateless Session Bean, stateful Session Bean consumes a large amount of memory on the J2EE server, however, the advantage of stateful Session Bean is that it can maintain the user's status.
For clients, entitybean is a persistent object, which can be divided into persistence (BMP) of bean management and persistence (CMP) of container management. It represents an object view of an object stored in persistent storage, or an object implemented by an existing enterprise application.

From the life cycle:
Sessionbean: the lifecycle of stateless Session Bean is determined by the container. When the client sends a request to create a bean instance, the EJB container does not have to create a new bean instance for the client to call. Instead, it finds an existing instance and provides it to the client. When the client calls a stateful Session Bean for the first time, the container must immediately create a new bean instance on the server and associate it with the client, when this client calls the stateful Session Bean method later, the container will dispatch the call to the bean instance associated with this client.
Entitybean: entity beans can survive for a relatively long time, And the status is continuous. As long as the data in the database exists, entity beans will survive. It is not based on the application or service process. Even if the EJB container crashes, entity beans survive. Entity beans can be managed by containers or beans themselves.
EJB uses the following technical management practices: ots of Object Management Organization (OMG), Transaction Service (JTs) of Sun Microsystems, and Java transaction API (JTA ), the Xa interface of the Development Group (x/open.

The role and three objects of EJB, as well as the remote interface and the home interface are mainly used.
A: A complete EJB-based Distributed Computing structure consists of six roles, which can be provided by different developers, each role must follow the EJB specifications provided by Sun to ensure compatibility between them. These six roles are EJB component developer (enterprise Bean provider), application aggreger (Application aggreger), deployer (deployer), and EJB Server Provider (EJB Server Provider), EJB container provider, System Administrator)
The three objects are remote (local) interface, Home (localhome) interface, and Bean class.
The remote interface defines the business method used by the EJB client to call the business method.
The home interface is used by the EJB factory to create and remove EJB instances.

Services provided by the EJB container
A: It mainly provides services such as declarative cycle management, code generation, continuity management, security, transaction management, lock and release management.

Which operations are prohibited in the EJB specification?
Answer: 1. the thread and thread APIs cannot be operated (the thread API refers to methods of non-thread objects, such as notify and wait. AWT cannot be operated, 3. cannot implement server functions. 4. cannot survive the static genus. you cannot use Io operations to directly access the file system. 6. the local database cannot be loaded ., 7. you cannot use this as a variable or return value. it cannot be called cyclically.

Bean instance Lifecycle
A: For stateless Session Bean, Entity Bean, and message driven bean, buffer pool management is generally available. For Entity Bean and statefull Session Bean, Cache Management is available, which usually includes instance creation, set the context, create an EJB object (create), call a business method, and remove. For beans with buffer pool management, the instance is not cleared from the memory after create, instead, the buffer pool scheduling mechanism is used to repeatedly reuse instances. For beans with Cache Management, the activation and deactivation mechanisms are used to maintain the bean status and limit the number of instances in the memory.

EJB activation mechanism
A: Taking stateful Session Bean as an example: the cache size determines the number of bean instances that can coexist in the memory. According to the MRU or NRU algorithm, instances are migrated between the activation and deactivation statuses, the activation mechanism is that when the client calls a business method of an EJB instance, if the corresponding EJB object finds that it is not bound to the corresponding bean instance, it will activate bean storage from it (storage instance through serialization mechanism) reply (activate) this instance. The corresponding ejbactive and ejbpassivate methods are called before the status changes.

Basic Steps for client to call an EJB object
A: set the properties of the jndi service factory and the JNDI service address system, find the home interface, call the create method from the home interface to create a remote interface, and call its business method through the remote interface.

Application Server

What are the app servers?
A: BEA WebLogic Server, IBM WebSphere Application Server, Oracle9i Application Server, JBoss, and tomcat

How do I specify the memory size for WebLogic?
A: In the Weblogic STARTUP script (startservername located in the directory of the server corresponding to the domain), add set mem_args =-xms32m-xmx200m to adjust the minimum memory to 32 MB, the maximum value is 200 MB.

Does EJB need to directly implement its business interface or home interface? Please briefly explain the reasons.
A: The remote interface and home interface do not need to be implemented directly. Their implementation code is generated by the server. The corresponding implementation class in the program running will be used as an instance of the corresponding interface type.

How to set the Weblogic hot start mode (Development Mode) and product release mode?
A: You can change the Startup Mode of the corresponding server to one of the development or product modes on the console. Or modify the Service Startup File or commenv file and add set production_mode = true.

How do I not need to enter the user name and password at startup?
A: Modify the Service Startup File and add the wls_user and wls_pw items. You can also add encrypted user names and passwords to the boot. properties file.

In the Weblogic console, After configuring JMS, EJB, connection pool, and other related information for an application domain (or a website or domain), what files are actually stored in?
A: The config. xml file stored in this domain is the core configuration file of the server.

What is the default directory structure of a domain in WebLogic? For example, a simple helloworld. under the directory where JSP is put, you can enter http: // host: Port Number // helloword in the browser. JSP can see the running result. For example, what should I do if I use a self-written JavaBean?
A: domain Directory Server Directory applications. Placing the application directory under this directory can be accessed as an application. If it is a Web application, the application directory must meet the web application directory requirements, JSP files can be directly placed in the application directory, JavaBean needs to be placed in the application directory of the WEB-INF directory of the classes directory, set the Server default application will be able to achieve in the browser without entering the application name.

Configuration files required for publishing EJB in WebLogic
A: Different Types of EJB involve different configuration files, all involve configuration files including ejb-jar.xml, weblogic-ejb-jar.xmlCMP entity beans generally also need weblogic-cmp-rdbms-jar.xml

How to configure SSL and client authentication in WebLogic, or how to configure SSL in J2EE (standard)
A: demoidentity is used by default during installation. jks and demotrust. to implement SSL in jks keystore, You need to configure the server to use Enable SSL and configure its port. In product mode, you need to obtain the private key and digital certificate from the CA, and create the identity and trust keystore, load the obtained key and digital certificate. You can configure whether the SSL connection is unidirectional or bidirectional.

How do I view the published ejbs in WebLogic?
A: You can use the console to view all published ejbs in deployment.

Differences between the persistent and non-persisten when sending a message Bean in WebLogic
A: The persistent MDB ensures the reliability of message transmission, that is, if an error occurs in the EJB container and the JMS server still sends the message when the MDB is available, non-persistent messages are discarded.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.