October 2025
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
2728293031  

Categories

October 2025
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
2728293031  

Weblogic Interview Questions

Weblogic Interview Questions

1)Tell me about yourself?

2) Differences between 8.1,9.2 and 10.2,11g?

3)what are the daily Activities?

4)What are the regularly facing issues?

5)Server down/application not responding?

6)What are daily using UNIX commands?

7)What do you mean by connection pool? differences between connection pool and multipool?

8)What do you mean by data sources? differences between data sources and multi-data sources ?

9)Differences between Development and Production mode?

10)Jdbc and datasources configuration?

11) How to configure Apache proxy to weblogic?

12) How to configure IIs proxy to weblogic?

13)Weblogic deployment modes?

14)Differences between stage,no-stage and external stage mode?

15)what are imp files in weblogic?

16)What is MSI?

17)what is Node manager?different types of node managers?

18)What is cluster? how many types of clusters?

19)How we can achieve fail-over and load balancing in cluster?

20)what are the load balancing alogirthems?

21)Differences between Uni cast and Multicast?

22) How servers will communicate with in the cluster?

23)What is heartbeat?

25) what are the types of installation modes?

26)what silent.xml and silent mode installation?

27)what are the weblogic tuning parameters you know?

28)What is Permanent generation?

29)How to change deployment order?

30)what do you mean by deployment descriptor?

31)Differences between War and Ear?

32)Web server and application server?

33) what is weblogic server?

34)Side-by-side deployment?

35)Execute queues and work mangers?

36)How you take thread dump?

37)where thread dump will store ?what is the format of thread dump?

38)How analyze the thread dump? what are the threads you can see in thread dump?

39)what do you mean by Heap dump?

40)where it will store? what is the extension of heap dump? how you analyze heap dump?

41)what is core dump?

42)How you enable core dump? how you analyze core dump?

43) Differences between Thread dump,Heap dump and core dump?

44)What is T3 protocol?

45)what is Apache plugin module? how to check syntax error in appache?

46)How do you find Memory leaks in applications?

47)How DNS resolve the client request?

48) what do you mean by Ldap? did you configure ldap?

49)How to install and renew ssl certificates?

50) Do you know scripting ? how to write a script? what are all scripts used in your environment?

51)How to configure foreign JMS servers?

53)what is persistent store?

_________________________________________________________________________________

1)How to check CPU usage?

2)How to check Memory in weblogic?

3)How do you invoke garbage collection?

4)how to check list of available port numbers?

5)how to increase the heap size?

6)how to increase the permgensize?

7)how to clear the weblogic cache?

8)how to check the disk usage?

9)what is ticketing tool?

Note: You can check my weblogic Material and weblogic troubleshooting issues for detailed explanation.
————————————————————————————————————
Tell me about yourself?

Hi This is <Name>, I did my MCA in 2008 from Nagarjuna University.
Currently I am working with <Current working company>. Prior to that i have worked with <Previous company>
with the payroll of <if your working as contractor>

I involed in Installation of weblogic application server 8.1,9.2,10.3 I meant 11g and webserver
appache 2.0 and 2.2.

I have good experiance in Troubleshooting and Performance tuning as well as monitoring and
managing all weblogic server resources and webservices.

Apart from this,

1.I involued in creation and configuration of Domains.
2.Creation and configuration of clusters for providing load balencing and failover support.
3.Creation and configuration of JDBC and Datasources and connection pools.
4.Deployment of applications.
5.Managing SSL certificates.

———————————————————————————————————————————————————

Day to day activities.

1.Taking shift handover from previous shifts.
2.Health status check-up of all weblogic server instances
Login to admin console and will check the all server status.
All server status should be running
If any of the server is failed kill those servers first.
Bounse or restart the server manually.
3.Checking the webservices and applications.
4.Periodical deployment on Non prod  and production servers.
5.Supporing and following ITIL concepts in Incidents,change and problem management.
6.Providing on call support of 24*7 Basis.
7.Giving shift hand over to next shift.
________________________________________________________________________________

Working Environment

There are totaly 50 applications deployed on 10 domains.
Each domain contains of 1 horizantal cluster.
Each cluster contains 10-15 managed servers.

Currently we are working on Linux 4.0 and 5.0
Application server weblogic 9.2 and 11g
webserver Apache 2.0 and 2.2.
Backend DB is Oracle 9i.

——————————————————————————————————————————————————-

What is the difference between weblogic server 8.x/9.x/10.x?

 

                                  Weblogic 8                            Weblogic 9/10
In WL 8.x we dont have LOCK & EDIT Where as in WL 9/10 Lock and edit is the new feature
In WL 8.x we ahve execute queue’s where as in WL 9&10 we are having workmanagers
In WL 8.x we have connection pools and data sources where as in WL 9&10 we have only data sources and inside data sources we are having connection pools.
 In WL 8.x you would need to delete and deploy the file again In 9.x there is option to update an application that is deployed from the admin console. No need to un install and redeploy
In WL 8.x Side by side deployment is not possible  where as in WL 9.0 side-by side deployment is possible
In WL 8.x  sever never comes-up if even one of the deployment fails  where as in WL 9.0 server gets into ADMIN mode
Diagnostic Framework is not there. Diagnostic Framework” launch with wls10 and above
In Weblogic 8.x, all configuration and jms details will be present
in the same config.xml
whereas 9.x/10.x it will be partly maintained in config.xml and a separate xml files in domain/config/jms folders for each jms module.
In WL 8.x we don’t have config folder Where as in WL 9/10 config folder is avilable
Console is an applet  and uses JCX JCS JPF and  Netui page flows Console is portal and uses JSTL (JSP 2.0)
Persistent store is defined Under JMS Persistent store is defined Under JDBC
No concept of JMS modules and sub deployments Jms modules and subdeployments are included.
Queue/topic is configured under distributed destination Queue/topic/dd etc are all clubbed in a JMS modules
In WL 8.x licence.bea file is present to update the licence  the difference is that there is a generic license.beafile for each version that you can downloand from oracle . No need to request a custom license.beafile.
In WL 8.x licence.bea file is present to update the licence  the difference is that there is a generic license.beafile for each version that you can downloand from oracle . No need to request a custom license.beafile.

——————————————————————————————————————————–

Difference between web server and application server:

 

                      Webserver

1) Which hosts websites.

2) Webserver is having web container can  deploy war files.

3)webserver can effectively handle static contents.

ex: Serverlet,jsps.

4) Webserver handles the HTTP protocol. When the Web server receives an HTTP request, it responds with an HTTP response, such as sending back an HTML page.

5) Web Server serves static HTML pages or gifs, jpegs, etc., and can also run code written in CGI, JSP etc.
6) Web Server only supports Servlets and JSP.

 

                  Application Server

1)Which provides run-time environment to run J2EE

applications.

2)Application server is having  webcontainer as well as Ejb-container can deploy EAR files.

3)Application server can effectively handle dynamic content  ex: EJB’S

4) Application server is more capable of dynamic behavior than webserver. We can also configure application server to work as a webserver. Simply application server is a superset of webserver.

5)Application Server supports distributed transaction and EJB.

6) An Application Server is used to run business logic or dynamically generated presentation code. It can either be .NET based or J2EE based


Different between development mode and production mode

                Development mode

1)Auto deployment enabled

2) The default JDK for development domain is SunHotSopt.(SunJdk)

3) It is used demo certificate for SSL.

4) Server instances rotate their log files on startup.

5) Admin server uses an automatically created boot.properties during startup.

6) The default maximum capacity for JDBC Date source is 15.

7) The debug flag which used to start the WebLogic workshop debugger is enabled.

                      Production mode

1)Auto deployment is disabled.

2) The default JDK for production domain is JRocket.

3) It is used demo certificate for SSL a warning is displayed.

 

4) Server instances states their log files when it reaches 5Mb

5) Admin server prompt for username and password during startup.

6) The default maximum capacity for JDBC Date source is 25.

7) The debug flag which used to start the WebLogic workshop debugger is disabled.



Differences between Unicast and multicast?

When servers are in a cluster, these member servers communicate with each other by sending heartbeats and indicating that they are alive. For this communication between the servers, either unicast or multicast messaging is used. This is chosen from the admin console in Cluster -> Configuration -> Messaging -> Messaging Mode.

To use multicast messaging, hardware configuration and support for multicast packets is required. Unicast does not have this requirement, which is why using unicast in latest versions is recommended.

When multicast messaging is used, it is a one-to-many communication, every server sends the notification/heartbeat/multicast packet to each other. This causes a heavy load on the application’s multicast buffer, so if the buffer is full, new multicast messages cannot be written to the buffer and the application is not notified when messages are dropped. So there is a possibility that the server instances miss the messages. This might lead in the cluster throwing out the server instances out of the cluster.

Unicast configuration is much easier because it does not require cross network configuration that multicast requires. Additionally, it reduces potential network errors that can occur from multicast address conflicts.

Mode of Communication:
Multicast – A multicast address and multicast port is used for listening to the messages.

Unicast – A network channel is used for communication between the servers. If no channel is specified, default network channel is used.

=====================

Method of communication between servers:
Multicast – Each server communicates with every member server in the cluster. Which means heartbeats are sent to every server.

Unicast – For the member servers in the cluster, group leaders are chosen and only those group leaders communicate with the servers among the group and these leaders notify each other about the availability of all the other servers.

——————————————————————————————————————

For new server versions, using unicast is recommended because it is a simplified communication mode. But for backward compatibility with the previous versions, you will need to use multicast if there is a communication requirement between clusters of versions prior to WLS 10.0.


Diff b/w Xa and Non-Xa  Datasource ?

            Xa datasource

1)  It allows global transaction that my be multiple resources.

2) It involves a co-ordinating transaction manager with one or more databases in a single global transaction.

3) It comes  from the X/Open group specification on distributed, global transactions.

          Non-Xa Datasource

1)  It allows single transaction that my be single resources.

2) there is no transaction coordinator, and it is a single resource is doing all its transaction work itself.

3) It comes from  Servlet or EJB or plain old JDBC in a Java application talking to a single database.


Table of Deployable Modules and Deployment modes.

Application or Module Archive Extension Key J2EE Deployment Descriptor
Enterprise Application .ear META-INF/application.xml
Enterprise JavaBean Module .jar META-INF/ejb-jar.xml
Web Application .war WEB-INF/web.xml
Web Service .ear or .war WEB_INF/web-services.xml
Connector Module .rar META-INF/ra.xml
Startup or Shutdown Class n/a No deployment descriptor (Class file only)

 

Unix commands Interview questions

unix commands :-

1.Search a file from root directory.(filename = sample.txt)

find / -name sample.txt

2.Display the numbers in sorted order

sort -nu

3.Display the updated lines in file

tail -f filename

4.How to zip a Directory

gzip -r /hom/bea/app

5.How to kill a prosess.

kill -9 pid

6.Display all java process in unix.

ps -ef |grep java

7.How to delete 10 lines in vi editor.

10dd

8.How to search a string and replace tin  vi editor.

:”%s/old string /new string/ gi”

9.How to search a string in vi editor from bottom to top.

?string name

10.How to insert a line above the current line in vi editor .

esc+o

11.How to rename a file .

mv file1 file2

  1. copy the content one directory to another directory.

cp -r dir1/file1 dir2/file2

  1. How can delete blank lines in directory.

grep -v “^$” sample > temp

mv temp sample

14.How can replace astring in unix.

sed “s/oldstring/newstring/g” filename

15.Syntax for zip and unzip afile.

gzip filename

guzip filename.gz

16.How can display top 10 disk usage files.

du -sh *|sort -nr|head -10

17.How to retrive a field in a file.

cut -f 1,2 stud.

18.what is command search a string in a file.

grep

19).How to goto the end of the line in Vieditor?

G

20).Copy 10 line in vi editor?

10yy

21).How to go to insert mode in vi editor?

Esc+i

22).How to search a string in a file(filename=sample,string=weblogic)?

grep weblogic sample

23).How to copyfile from one unix to other unix system and syntax (file=sample.txt,target host=192.168.11.128,target file path=/home/bea)?

scp -rp sample.txt username@192.168.11.128:/home/bea

24).Copy file from path to other tree structure is given below?

25).How to find out CPU utiligation?

top

26).How to execute ascript using nohup(script name=startweblogic.sh)?

nohup ./startWeblogic.sh &

27).Which command is used to search and replace a string?

sed

28).wich command is used to search astring in multiple files?

fgrep

1)How to search a string from top to bottom in vi Editor’s(String =weblogic)?

  1. A) /weblogic

2)how to save and quit from vi Editor’s?

a)WQ!

3)what are the Advantages of nohup command?

A)nohup will execute the process if you layout system.

Syn:nohup &.

4)Differance b/w the ping and tracert?

  1. A) ping                   tracert

1)It is check the connectivity.   1.It is packet information one place to

another place destination.

2)It is display all at a time.    2.It display only 30 hubs in tracert.

 

5)How to execute unix commands in vi?

A):ls

6)tar dir1 dir2 dir3 and new_dir?

A)syn:tar -cvf new_dir.tar dir1 dir2 dir3.

7)How to display the ipaddress and portnumber?

A)netstat -anp

8)how to delete directory with recursion and force?

A)rm -rf filename.

9)How to Open a file with page to page ?

A)more filename

10)How to Hide a file (file name=tuxedo)?

A)mv tuxedo .tuxedo

11)How to do undo in vi Editor’s?

A)u

12)How to goto 100 Line in Vi Editor’s?

A)100L

13)How to display last 100 Line from a file?

A)tail -100 filename

14)How to Reterive the fields from a file?

A)cut

15)How to zip a directory?(/home/directory)?

A)gzip -r /home/directory

16)How to go to end of the line in Vi?

A)G

17)Display the directiory count in current dir?

A)ls -lrt !wc -l

18)How to display all files ending with “log”?

19)How to appeand data to the existing file?

A)cat>>filename

20)How to find out the diskspace of the fileSystem?

A)df -sh

21)write A syntax for the scp Commands?

  1. A) Scp filename root@ipaddress:filename.

22)How to display the updated lines in file ?

A)tail -f filename.

23)How to display the ipaddress and portnumber?

A)netstat -anp

24)which command is used to connect to the remote server?

A)telenet ipaddress.

25)How to repalce and String in vi Editor’s?

  1. A) sed %s/oldstring/newstring/g

25)How to repalce and String in unix?

  1. A) sed s/oldstring/newstring/g filename

26)How to display top 10 lines from a file?

  1. A) head -10 filename.

27)syntax for tar and untar a file?

A)tar -cvf filename.tar file1 file2 file3.

tar -Xvf filename.tar

28)How to display hiddean a file?

A)ls -a.

29)How to Delete a blank line from a filename?

A)grep “^v” sample >temp

mv temp filename

30)How to display all cuurent running process?

A)ps -ef

31)syntax for zip and unzip file?

A)gzip filename.

gunzip filename.gz


1. How do you differentiate between a server hang and server crash issue?

When a Server crahes, the JAVA process no longer exists. When the Server is hung, it stops responding.
We can use the weblogic.ADMIN utilty to ping the server. In case of a hang situation we can take multiple thread dumps and analyze the cause of hang.

2. What can be the various reasons for a server crash?

a) Native IO
b) SSL Native Libraries
c) JVM
d) Supported Configuration
e) JDBC Driver issue

3. How do you troubleshoot a crash?

JVM crash generates a hs_err_pid file. We need to look into the stack trace of the hs_err_pid file .
If the thread is from a native io, we need to disable native io.
if the stack trace is from the driver, we need to get in touch with the drive team.
Quite possibly its a problem with driver. Changing the type of driver can be a workaround.
If the thread shows it coming from an optimzed code, we can turn of optimization.
If the stack is from native calls of application, its a bug with the application and it has to b modified.

4. Ho do you troubleshoot Server Hang?

We can use java weblogic.Admin PING to check if we get a normal response.
We need to take multiple thread dumps with kill -3 pid on unix and CTLR Break on Windows.
Analyze the thread dump to find the root cause.

5. What can be the reasons of Server hang?

Memory leak, databse query taking a long time to return, Deadlock.

6. What is memory leak?

Memory leak is when objects are not romved from the heap even when they are not required.

7. What are the various causes for OUT OF MEMORY?

a) Insufficient heap size, not able to match the extra load.
b) Objects licing too long, like HTTP Sessions.
c) Memory leak in application code.
d) Full GC not happening due to JVM Bug.

8. How to troubleshoot and overcome such issues?

Gather memory data by enabling GC verbose.
If its due to Http Session, timing out http session after certain interval might help.
Look into the code for jdbc connection handling.
Optimizing the heap size according to the load.

9. When does High CPU Usage occur?

It occurs when one process or one thread utilizes unexpectedly high proportion of CPU.

10. How to troubleshoot it?

In Solaris environment, we need to take pstack and prstack and see what the threads are doing.
In Windows we need to use pslist and process explorer.

11. What is Clustering and what is achieved through it?

Clustering is the grouping together of servers for the purpose of high availability and scalability.
Load balancing and Failover is achieved.

12. How does Cluster Communication Happen?

Members of the Cluster communicate over the Cluster Multicast IP and Port by sending periodic heart beat messages.

13. What is the difference between the Sun JVM and BEA JRockit JVM?

The most well know JVM is the implementation from Sun. The Sun JVM is called HotSpot. The Sun JVM is shipped in the Java Developer’s Kit (JDK) and Java Runtime Environment (JRE) from Sun.

The BEA JRockit JVM from BEA systems is optimized for reliability and performance for server side applications. To achieve this, BEA JRockit JVM uses technologies such as code generation, hot spot detection, code optimization, advanced garbage collection algorithms and tight operating system integration.

14. TUning JVM Parameters.

If you have a single processor, single thread machine then you should use the serial collector (default for some configurations, can be enabled explicitly for with -XX:+UseSerialGC). For multiprocessor machines where your workload is basically CPU bound, use the parallel collector. This is enabled by default if you use the -server flag, or you can enable it explicitly with -XX:+UseParallelGC. If you’d rather keep the GC pauses shorter at the expense of using more total CPU time for GC, and you have more than one CPU, you can use the concurrent collector (-XX:+UseConcMarkSweepGC). Note that the concurrent collector tends to require more RAM allocated to the JVM than the serial or parallel collectors for a given workload because some memory fragmentation can occur.

15. How do you do performance tuning of WLS?

It can be categorized in 4 parts.
a. Application Tuning.
jsp precompilation, ejb pool size cache..

b. OS Tuning

Setting tcp ip parameter.
tcp_time_wait_interval
tcp_conn_req_max_q

c. Core Server Tuning.

tune workmanager, tune chuck size and chunck pool size, using performance packs, conenction backlog buffering.

d. JVM Tuning
tuning gc strategy, monitoring garbage collection..

16. What is the difference between Development mode and Production mode of Weblogic Server?

Development Mode:

1. The default JDK for development domain is Sun Hotspot.
2. You can use the demo certificates for SSL.
3. Auto deployment(to admin server only) is enabled.
4. Server instances rotate their log files on start-up.

5. Admin Server uses an automatically created boot.properties during start-up.

6. The default maximum capacity for JDBC Datasource is 15.
7. The debugFlag which is used to start the WebLogic Workshop Debugger is enabled.
8. In Development Mode any configuration change being done by a user doesn’t need him to take a Lock and Edit session.
9. Availability of web service test client.
10. Nodemanger username and password: Default Admin credentials.
11. Availability of Classloader Analysis Tool: Yes.
12. Default start parameters when using Sun JDK and the default startWebLogic script : java -client -Xms256m -Xmx512m -XX:CompileThreshold=8000 -XX:PermSize=128m -XX:MaxPermSize=256m.

Production Mode:

1. The default JDK for production domain is JRockit.
2. If you use the demo certificates for SSL a warning is displayed.
3. Auto deployment(to admin server only) is disabled.
4. Server instances rotate their log files when it reaches 5MB.
5. Admin Server prompts for username and password during start-up.
6. The default maximum capacity for JDBC Datasource is 25.
7. The debugFlag which is used to start the WebLogic Workshop Debugger is disabled.
8. In Production Mode the user needs to procure a Lock and Edit session before trying to make any configurational changes.
9. No Availability of web service test client.
10. Nodemanger username and password: Randomly generated
11. Availability of Classloader Analysis Tool: No.
12. Default start parameters when using Sun JDK and the default startWebLogic script : java -server -Xms256m -Xmx512m -XX:MaxPermSize=256m.

Ref :- http://impradeep.com/difference-between-production-and-development-mode-in-weblogic/

17. What is HTTP tunneling? How can we configure it on Weblogic?

HTTP tunneling provides a way to simulate a stateful socket connection between WebLogic Server and a Java client when your only option is to use the HTTP protocol. It is generally used to tunnel through an HTTP port in a security firewall. HTTP is a stateless protocol, but WebLogic Server provides tunneling functionality to make the connection appear to be a regular T3Connection.
Steps to configure Http tunneling.

Login into the Admin Console, click on the server on which you want to enable he Http Tunneling feature
Click on the Protocols tab ? General ? check the “Enable Tunneling” check box.

Now you can communicate with the JVMs (Server Instances) using protocols other than t3

18. What is the difference between T3 and HTTP protocol?

WebLogic uses the T3 protocols for internal and external connections to the servers. The T3 protocol often is used in WebLogic’s implementation of RMI. Proprietary of WebLogic Server.

Http protocols are used primarily for HTTP communication between the browser and the web server. Standard follows the W3C (World Wide Web Consortium).

Note: All of these protocols are, by default, multiplexed over the same connection to the server’s address and port. So you can access a web page hosted by the server using a URL such as http://host:port/page.jsp. An external client can set up an initial JNDI context to a server using the URL t3://host:port/. All that has changed is the protocol over which the client must communicate with the server.

19. What is work managers ?

Weblogic server allows you to configure, how your application prioritizes the execution of it’s work. Based on rules and constraints you can define  how WebLogic Server prioritizes work and allocates threads based on an execution model that takes into account administrator-defined parameters and actual run-time performance and throughput. 

Workmanager applying it either globally or to a specific application component.


1.Default work managers: WLS implements a default workmanager when no-other work managers are specified.

2.Global work manager: Global work managers are created in weblogic administrative console and are defined in config.xml it is created as template.

3.Application scoped work managers: Work managers available only to a specific application (or) module.

Work Managers can be configured at the

3.1.domain level
3.2.application level
3.3. module level

in one of the following configuration files:

config.xml—Work Managers specified in config.xml can be assigned to any application,
or application component, in the domain. You can use the Administration Console to define a Work Manager.

weblogic-application.xml—Work Managers specified at the application level can be assigned to that application, or any component of that application.

weblogic-ejb-jar.xml or weblogic.xml—Work Managers specified at the component-level can be assigned to that component.

weblogic.xml—Work Managers specified for a Web Application.

HTTP Status Codes

Included in the HTTP server response data for each request is a code number indicating the result of the request. These result codes are three-digit numbers divided into categories as follows:

100-199 : Informational status

200-299 : Success status

300-399 : Redirection status

400-499 : Client errors

500-599 : Server errors

Informational
100 – Continue
A status code of 100 indicates that (usually the first) part of a request has been received without any problems, and that the rest of the request should now be sent.
101 – Switching Protocols
HTTP 1.1 is just one type of protocol for transferring data on the web, and a status code of 101 indicates that the server is changing to the protocol it defines in the “Upgrade” header it returns to the client. For example, when requesting a page, a browser might receive a statis code of 101, followed by an “Upgrade” header showing that the server is changing to a different version of HTTP.

________________________________________________________________

Successful

200 – OK
The 200 status code is by far the most common returned. It means, simply, that the request was received and understood and is being processed.
201 – Created
A 201 status code indicates that a request was successful and as a result, a resource has been created (for example a new page).
202 – Accepted
The status code 202 indicates that server has received and understood the request, and that it has been accepted for processing, although it may not be processed immediately.
203 – Non-Authoritative Information
A 203 status code means that the request was received and understood, and that information sent back about the response is from a third party, rather than the original server. This is virtually identical in meaning to a 200 status code.
204 – No Content
The 204 status code means that the request was received and understood, but that there is no need to send any data back.
205 – Reset Content
The 205 status code is a request from the server to the client to reset the document from which the original request was sent. For example, if a user fills out a form, and submits it, a status code of 205 means the server is asking the browser to clear the form.
206 – Partial Content
A status code of 206 is a response to a request for part of a document. This is used by advanced caching tools, when a user agent requests only a small part of a page, and just that section is returned.
_________________________________________________________________

Redirection

300 – Multiple Choices
The 300 status code indicates that a resource has moved. The response will also include a list of locations from which the user agent can select the most appropriate.
301 – Moved Permanently
A status code of 301 tells a client that the resource they asked for has permanently moved to a new location. The response should also include this location. It tells the client to use the new URL the next time it wants to fetch the same resource.
302 – Found
A status code of 302 tells a client that the resource they asked for has temporarily moved to a new location. The response should also include this location. It tells the client that it should carry on using the same URL to access this resource.
303 – See Other
A 303 status code indicates that the response to the request can be found at the specified URL, and should be retrieved from there. It does not mean that something has moved – it is simply specifying the address at which the response to the request can be found.
304 – Not Modified
The 304 status code is sent in response to a request (for a document) that asked for the document only if it was newer than the one the client already had. Normally, when a document is cached, the date it was cached is stored. The next time the document is viewed, the client asks the server if the document has changed. If not, the client just reloads the document from the cache.
305 – Use Proxy
A 305 status code tells the client that the requested resource has to be reached through a proxy, which will be specified in the response.

307 – Temporary Redirect
307 is the status code that is sent when a document is temporarily available at a different URL, which is also returned. There is very little difference between a 302 status code and a 307 status code. 307 was created as another, less ambiguous, version of the 302 status code.
_________________________________________________________________

Client Error

400 – Bad Request
A status code of 400 indicates that the server did not understand the request due to bad syntax.
401 – Unauthorized
A 401 status code indicates that before a resource can be accessed, the client must be authorised by the server.
402 – Payment Required
The 402 status code is not currently in use, being listed as “reserved for future use”.
403 – Forbidden
A 403 status code indicates that the client cannot access the requested resource. That might mean that the wrong username and password were sent in the request, or that the permissions on the server do not allow what was being asked.
404 – Not Found
The best known of them all, the 404 status code indicates that the requested resource was not found at the URL given, and the server has no idea how long for.
405 – Method Not Allowed
A 405 status code is returned when the client has tried to use a request method that the server does not allow. Request methods that are allowed should be sent with the response (common request methods are POST and GET).
406 – Not Acceptable
The 406 status code means that, although the server understood and processed the request, the response is of a form the client cannot understand. A client sends, as part of a request, headers indicating what types of data it can use, and a 406 error is returned when the response is of a type not i that list.
407 – Proxy Authentication Required
The 407 status code is very similar to the 401 status code, and means that the client must be authorised by the proxy before the request can proceed.
408 – Request Timeout
A 408 status code means that the client did not produce a request quickly enough. A server is set to only wait a certain amount of time for responses from clients, and a 408 status code indicates that time has passed.
409 – Conflict
A 409 status code indicates that the server was unable to complete the request, often because a file would need to be editted, created or deleted, and that file cannot be editted, created or deleted.
410 – Gone
A 410 status code is the 404’s lesser known cousin. It indicates that a resource has permanently gone (a 404 status code gives no indication if a resource has gine permanently or temporarily), and no new address is known for it.
411 – Length Required
The 411 status code occurs when a server refuses to process a request because a content length was not specified.
412 – Precondition Failed
A 412 status code indicates that one of the conditions the request was made under has failed.
413 – Request Entity Too Large
The 413 status code indicates that the request was larger than the server is able to handle, either due to physical constraints or to settings. Usually, this occurs when a file is sent using the POST method from a form, and the file is larger than the maximum size allowed in the server settings.
414 – Request-URI Too Long
The 414 status code indicates the the URL requested by the client was longer than it can process.
415 – Unsupported Media Type
A 415 status code is returned by a server to indicate that part of the request was in an unsupported format.
416 – Requested Range Not Satisfiable
A 416 status code indicates that the server was unable to fulfill the request. This may be, for example, because the client asked for the 800th-900th bytes of a document, but the document was only 200 bytes long.
417 – Expectation Failed
The 417 status code means that the server was unable to properly complete the request. One of the headers sent to the server, the “Expect” header, indicated an expectation the server could not meet.
_________________________________________________________________

Server Error

500 – Internal Server Error
A 500 status code (all too often seen by Perl programmers) indicates that the server encountered something it didn’t expect and was unable to complete the request.
501 – Not Implemented
The 501 status code indicates that the server does not support all that is needed for the request to be completed.
502 – Bad Gateway
A 502 status code indicates that a server, while acting as a proxy, received a response from a server further upstream that it judged invalid.
503 – Service Unavailable
A 503 status code is most often seen on extremely busy servers, and it indicates that the server was unable to complete the request due to a server overload.
504 – Gateway Timeout
A 504 status code is returned when a server acting as a proxy has waited too long for a response from a server further upstream.
505 – HTTP Version Not Supported
A 505 status code is returned when the HTTP version indicated in the request is no supported. The response should indicate which HTTP versions are supported.

 

Weblogic 9 Guide

Weblogic Server Administration

History

BEA began as a software company, founded in 1995 and headquartered in San Jose, California. It grew to have 78 offices worldwide at the time of its acquisition by Oracle. BEA Weblogic, now Oracle Weblogic Server – Java EE enterprise infrastructure platform
WebLogic Server: Oracle WebLogic is a server software application that runs on a middle tier, between back-end databases and related applications an browser-based thin clients. WebLogic is a leading e-commerce online transaction processing (OLTP) platform, developed to connect users in a distributed computing environment and to facilitate the integration of mainframe applications with distributed corporate data and applications.
WebLogic server is based on Java2 Platform, Enterprise Edition (J2EE), the standard platform used to create Java-based multi-tier enterprise applications.
Oracle WebLogic Server 12c is the industry’s best application server for building and deploying enterprise Java EE applications with support for new features for lowering cost of operations, improving performance, enhancing scalability and supporting the Oracle Applications portfolio.

Application Server versions

WebLogic Server 12c (12.1.1) – March 2012
WebLogic Server 12c (12.0) – December 1, 2011
WebLogic Server 11gR1 PS5 (10.3.6) – February 2012
WebLogic Server 11gR1 PS4 (10.3.5) – May 16, 2011
WebLogic Server 11gR1 PS3 (10.3.4) – January 15, 2011
WebLogic Server 11gR1 PS2 (10.3.3) – April 2010
WebLogic Server 11gR1 PS1 (10.3.2) – November 2009
WebLogic Server 11g (10.3.1) – July 2009
WebLogic Server 10.3 – August 2008
WebLogic Server 10.0 – March 2007
WebLogic Server 9.2
WebLogic Server 9.1
WebLogic Server 9.0 – November 2006
WebLogic Server 8.1 – July 2003
WebLogic Server 7.0 – June 2002
WebLogic Server 6.1
WebLogic Server 6.0 – file date March 2001 on an old CD
WebLogic Server 5.1 (code name: Denali) First version supporting hot deployment for applications (via command line)
WebLogic Server 4.0
WebLogic Tengah 3.1 – June 1998
WebLogic Tengah 3.0.1 – March 1998
WebLogic Tengah 3.0 – January 1998
WebLogic Tengah – November 1997

Standards support by version

The table below lists major standards supported by WebLogic Server product version.

Standard WLS 7.0 WLS 8.1 WLS 9.0 WLS 10.0 WLS 10.3 WLS 12c
Java 1.3 1.4 5 5 6 (7 in 10.3.6+) 7
Java EE 1.3 1.3 1.4 5 5 6
Servlet 1.2 2.3 2.4 2.5 2.5 3.0
JSP 1.2 1.2 2.0 2.1 2.1 2.2
EJB 2.0 2.0 2.1 3.0 3.0 3.1
JDBC 2.0 2.0 3.0 3.0 3.0 4.0

Webserver and Application server

Webserver:  Which hosts websites.

1)Apache

2)Microsoft-IIS

3)Tomcat

4)Sunone (Iplanet)

5)IHS (Ibm Http server)

Application server: Which provides run-time environment to support J2EE Applications.

1)IBM – Websphere

2)Oracle – Weblogic

3)JBOSS.

Difference between web server and application server:

                      Webserver

1) Which hosts websites.

2) Webserver is having web container can  deploy war files.

3)webserver can effectively handle static contents.

ex: Serverlet,jsps.

4) Webserver handles the HTTP protocol. When the Web server receives an HTTP request, it responds with an HTTP response, such as sending back an HTML page.

5) Web Server serves static HTML pages or gifs, jpegs, etc., and can also run code written in CGI, JSP etc.
6) Web Server only supports Servlets and JSP.

 

                  Application Server

1)Which provides run-time environment to run J2EE

applications.

2)Application server is having  webcontainer as well as Ejb-container can deploy EAR files.

3)Application server can effectively handle dynamic content  ex: EJB’S

4) Application server is more capable of dynamic behavior than webserver. We can also configure application server to work as a webserver. Simply application server is a superset of webserver.

5)Application Server supports distributed transaction and EJB.

6) An Application Server is used to run business logic or dynamically generated presentation code. It can either be .NET based or J2EE based

Weblogic server Resources

_________________________________________________________________________________________________________________________

1) Domain

2)Admin Server

3)Managed servers

4)Cluster

5)NodeManager

6)Admin console

7)JDBC

8)JMS

9)Virtual hosts

10)Security Realms.

Domain: A Basic administration unit in weblogic. A group of Logical resources.

Admin server: Which Administrate the hole domain.

Manages servers: Where actual application are deployed. There will one to N number of managed server available in domain.

Cluster: Collection of servers that provide fail-over and Load balancing and features like scalability and high availability.

Node Manager: NM is a WLS utility that enables you to start/stop and restart Admin Server and Managed Server instances from a remote location.

Admin console: Administration Console is a Web browser-based, graphical user interface that you use to manage a WebLogic Server domain.

__________________________________________________________________________________________________________

Domain: An Oracle WebLogic Server administration domain is a logically related group of Oracle WebLogic Server resources. Domains include a special Oracle WebLogic Server instance called the Administration Server, which is the central point from which you configure and manage all resources in the domain. Usually, you configure a domain to include additional Oracle WebLogic Server instances called Managed Servers. You deploy Web applications, EJBs, Web Services, and other resources onto the Managed Servers and use the Administration Server for configuration and management purposes only.
Node Manager:
 Node Manager is a WebLogic Server utility that enables you to start, shut down, and restart Administration Server and Managed Server instances from a remote location. Although Node Manager is optional, it is recommended if your WebLogic Server environment hosts applications with high availability requirements.

A Node Manager process is not associated with a specific WebLogic domain but with a machine. You can use the same Node Manager process to control server instances in any WebLogic Server domain, as long as the server instances reside on the same machine as the Node Manager process. Node Manager must run on each computer that hosts WebLogic Server instances—whether Administration Server or Managed Server—that you want to control with Node Manager.

WebLogic Server provides two versions of Node Manager, Java-based and script-based, with similar functionality. However, each version has different configuration and security considerations.

Java-based Node Manager: Java-based Node Manager runs within a Java Virtual Machine (JVM) process. It is recommended that you run it as a Windows service on Windows platforms and as an operating system service on UNIX platforms, allowing it to restart automatically when the system is rebooted.

Oracle provides native Node Manager Libraries for Windows, Solaris, HP UX, Linux on Intel, Linux on Z-Series, and AIX operating systems.

Note: Node Manager is not supported on Open VMS,OS/390,AS400,UnixWare/Tru64 UNIX.

Script-based Node Manager: For UNIX and Linux systems, WebLogic Server provides a script-based version of Node Manager. This script is based on UNIX shell scripts, but uses SSH for increased security. SSH uses user-id based security. For information on configuring the script version of Node Manager, see Configuring Script Node Manager.

This version does not provide as much security as the Java-based version. However, the advantage of the script-based Node Manager is that it can remotely manage servers over a network that has been configured to use SSH. No additional server installation is required. The scripts merely have to be copied to the remote machine.

Note: It is recommended that you run script-based Node Manager as Operating System services, which allows to restart automatically when the system is rebooted.

Administration Server: Admin Server is an instance of Weblogic server. The Administration Server operates as the central control entity for the configuration of the entire domain. It maintains the domain’s configuration documents and distributes changes in the configuration documents to Managed Servers. You can also use the Administration Server as a central location from which to monitor all resources in a domain.

Managed server: Apart from Admin Server any weblogic server instance is called Managed server. To prevent the Administration Server from becoming a single point of failure, Managed Servers can always function without the presence a running Administration Server. When a Managed Server starts, it contacts the Administration Server to retrieve its configuration information. If a Managed Server is unable to connect to the specified Administration Server during startup, it can retrieve its configuration directly by reading a copy of the config.xml file and other files located on the Managed Server’s own file system.

Cluster: A WebLogic Server cluster consists of multiple WebLogic Server instances running simultaneously and working together to provide increased scalability and reliability. A cluster appears to clients to be a single WebLogic Server instance. The server instances that constitute a cluster can run on the same machine, or be located on different machines. You can increase a cluster’s capacity by adding additional server instances to the cluster on an existing machine, or you can add machines to the cluster to host the incremental server instances. Each server instance in a cluster must run the same version of WebLogic Server.

A cluster is defined as a group of application servers that transparently run a J2EE application as if it were a single entity.  There are two methods of clustering:  vertical scaling and horizontal scaling

Horizontal clustering: It involves running multiple Java application servers that are run on two or more separate physical machinesHorizontal scaling is more reliable than vertical scaling, since there are multiple machines involved in the cluster environment, as compared to only one machine.
Vertical clustering: However, consists of multiple Java application servers on a single physical machine. With vertical scaling, the machine’s processing power, CPU usage, and JVM heap memory configurations are the main factors in deciding how many server instances should be run on one machine

Proxy Server: Proxy Server is an intermediary server between your web browser (client) which requests for some information/data and your server (web server/Application server) that process the data.

Types of Proxy Server: They are three different types of proxy servers. They are as follows

1) Forward Proxy Servers: Forward Proxy Server is a server which forwards the request from the intranet clients (web browser) to the internet servers. These proxy servers are present in the same network of your client.

2) Open Proxy Server: An open proxy is a proxy server which is accessible by any Internet user. Any proxy server that doesn’t restrict its client base to its own set of clients and allows any other client to connect to it is known as an “Open Proxy”. An anonymous open proxy allows users to conceal their IP address while browsing the Web or using other Internet services. They are in numerous open proxy servers present in Internet. For converting any flavor of proxy servers to Open Proxy servers we just have to enable the flag“ProxyRequests On” in the configuration file.

3) Reverse Proxy Server: A Proxy Server which takes requests from external clients (web browsers) or Internet and forwards them to servers in an internal network is called as Reverse Proxy Server. Generally, the reverse proxy servers are present in the same network where we have our App/Web servers.

Advantages of using Reverse Proxy Servers: The various advantages of using the proxy servers are as follows:

1)      Filtering

2)      Caching

3)      Bypassing filters and censorship

4)      Logging and eavesdropping

5)      Gateways to private networks

6)      Accessing services anonymously

Fire wall: It provide filtering, autherization& Authentication services.

It can act as proxy servers.

Mapping port requests.

Machine: A machine is a computer that host WebLogic server.

A machine runs a supported o.s platform.

Can host multiple WebLogic server instances.

WebLogic server Life Cycle:

__________________________________________________________________________________________________________

Starting state: During the starting state that instances ready the domain configuration data from its configuration directory. Whereas the Manager server will get their configuration data from Admin server. It is in this state that the instance the basic services such as the kernal and execute queues, the container service for logging and Node manager service. The server also deploy during this phase.

Stand by: In this state the server Instance will allow you to issue just to administrative requests. You can me the server state either running or shutdown state. Normally the server instance will automatically transition through the stand by state to next stage unless you start the instance with the start in stand by command.

Note: All ports are closed in this stat. But you can quickly transition to a running state.

Admin mode: The admin mode permits only Administrative task, deploying applications with those applications being able to only request from users with the admin and Apptester roles. Running a server in admin mode is also useful when trying to diagnose problems with application gone badly.

Note: Servers will run in admin mode when there is problem with deployed application or JDBC connection pool.                 –> we can resume the server from Admin state to resume state.

Resuming state: This is purely transitional state the server instance goes through after it transitions automatically through Admin state or you issue the resume command after first placing the instance in the stand by or Admin state. You can do this state change from command line or through the Admin console.

Running state: This is off course final state the server instance reaches after you either issue a startup command or resume command to move the server out of the Admin or stand by state. It is in the running state that the server can accept the service client request for it services.

Different between development mode and production mode

__________________________________________________________________________________________________________

                Development mode

1)Auto deployment enabled

2) The default JDK for development domain is SunHotSopt.(SunJdk)

3) It is used demo certificate for SSL.

4) Server instances rotate their log files on startup.

5) Admin server uses an automatically created boot.properties during startup.

6) The default maximum capacity for JDBC Date source is 15.

7) The debug flag which used to start the WebLogic workshop debugger is enabled.

                      Production mode

1)Auto deployment is disabled.

2) The default JDK for production domain is JRocket.

3) It is used demo certificate for SSL a warning is displayed.

 

4) Server instances states their log files when it reaches 5Mb

5) Admin server prompt for username and password during startup.

6) The default maximum capacity for JDBC Date source is 25.

7) The debug flag which used to start the WebLogic workshop debugger is disabled.

WebLogic Installation:

__________________________________________________________________________________________________________

There are 3 types of installations

  1. GUI mode.
  2. Console mode.
  3. Silent mode.

1) GUI Mode:

Step1: welcome screen

Step2: Accept license agreement.

Step3: Create new BEA home directory

C:\bea10.3

Step4: Choose installation- Complete (or) Custom

Step5.Select complete

Step6.Select product installation directory

C:\bea10.3\wlserver_10.3

2) Console Mode:

server10.3_win32.exe  -mode = console

3) Silent Mode:   It is a way of setting installation configuration only once and then using those configurations to duplicate the installation on many machines.

The installation programs read the settings for your configuration from an xml file.(silent.xml)

server10.3_win32.exe -mode=silent -silent.xml=c:\bea10.3\silent.xml  -log=c:\10.3\silent.log

Step1: Create silent.xml file

<?xml version=”1.0″ encoding=”ISO-8859-1″ ?>

<bea-installer>

<input-fields>

<data-value name=”BEAHOME” value=”C:\bea10.3″ />

<data-value name=”USER_INSTALL_DIR” value=”C:\bea10.3\wlserver_10.3″ />

</input-fields>

</bea-installer>

Step2: Save this file as silent.xml file in C:\bea10.3 folder

Step3: Copy the WebLogic software under C:\bea10.3 folder

Step4: Create a sub folder wlserver_10.3 under c:\bea10.3

Step5: Execute the below command

server103_win32.exe -mode=silent -silent_xml=C:\bea10.3\ silent.xml  -log=C:\10.3\silent.log

Domain creation 

__________________________________________________________________________________________________________We can create a domain in 5 types.

 

1)Configuration wizard

1)GUI

2)Console

2)Weblogic server

3)ANT Task

4)WLST (Weblogic Scripting tool)

5)Pack& Unpack.

 

Step1: Goto the below path and execute config.cmd script

C:\bea10.3\wlserver_10.3\common\bin>config.cmd

Step2: Select – Create new WebLogic domain

Step3: Select – Base this domain on an existing template

Step4: Configure Administrator username and password.

Step5: Configure server start mode and JDK

Development mode   —- SunJdk

Production mode   —– Jrocket

Select development mode and SunJdk

Step6: Customize environment & services settings

Select yes if you would like to configure resources

Step7: Configure Admin server

Name : AdminServer

Listen address: localhost

Listen port : 7001

SSL listen:  None

** Default port number for AdminServer-7001

** Default ssl listen port : 7002

Step8: Configure managed servers

name    listen address     listen port   ssl listen port

ms1      localhost              7003            None

ms2      localhost               7004           None

Step9: Configure cluster

Name Multicast address  multicast port  cluster address

c1          239.192.0.0        7010                 localhost:7003, localhost:7004

Step 10: Assign servers to clusters

Step 11: Configure machines

Name   Node manager listen address   Node manager listenport

m1                 localhost                                         5556

Step 12: Assign servers to machines

Step 13: Create WebLogic domain

Enter the name and location for the domain

Domain name : dev_domain

Domain location : c:\bea10.3\user_projects\domains

Step 14:  Click on Create

  1. Q) How to start Admin server?

C:\bea10.3\user_projects\domains\dev_domain\bin>startWebLogic.cmd

  1. Q) How to Access Admin console?

http://localhost:7001/console

  1. Q) Starting managed servers without node manager?

If Adminserver is in another machine: c:\bea\user_projects\domains\webdomain\bin>startmanagedWebLogic.cmd ms1http://localhost:7001 (Admin server port number)

If Adminserver is in same machine: c:\bea\user_projects\domains\maindomain\bin>startmanagedWebLogic.cmd ms1

  1. Q) How to stop Admin server?

StopWebLogic.cmd   —–Windows

StopWebLogic.sh   ——-Unix

  1. Q) How To stop managed server?

StopManagedWebLogic.cmd ms1

  1. Q) How to start Nodemanager?

C:\bea10\wlserver_10.3\server\bin>startNodemanager.cmd

Creating managed servers from console:

Step1: Click on Lock& Edit

Step2: Navigate to servers and then click on new

Step3: Create a new server

Step4: Provide server properties

Server name : ms3

Server listen address: localhost

Server listen port: 7005

Step5: Select – this is a stand alone server

Step6: Review choices

Step7: Activate changes

Assigning server to cluster:

Step1: Navigate to cluster-cluster name-servers

Step2:  Click on Lock & Edit

Step3:  Add

Add server to cluster

Select existing server and add it as a cluster

Step4: Activate changes

Adding servers to machines:

Step1: Navigate to machines-m1-servers

Step2: Lock& Edit

Step3: Add

Step4: Activate changes

How to check Node manager status from console:

We can’t Start Node manager from console

Step1: Click on machines

Step2: Select m1

Step3: Click on monitoring

Clone: It creates other server with same properties.

we can clone servers machines and clusters.

we should not cluster managed server while the server is running.

–>boot.properties-it contains username and password

–>Development mode-automatically creates boot.properties file

–> Production mode-we have to create boot.properties file.

–> setDomainEnv -we can change the mode from development to production or production to development modedoing changes in this file.

Deployments

__________________________________________________________________________________________________________

 

Several methods are available to deploy the Oracle WebLogic Server applications and shared libraries, including:

  1. Administration console
  2. WebLogic Scripting Tool(WLST)
  3. WebLogic.Deployer java class
  4. wldeploy Ant task
  5. Auto-deployment folder

Deployment an application involves the following tasks:

Preparing:  Choosing weather to package the application as an archived file or keep in an exploded directory.

Configuring: Creating a deployment plan to maintain the configuration changes without changes the deployment descriptors.

Deploying: Targeting and distributing the application to servers in an OracleWebLogicServer domain.

Deploment Methods: WLS (WebLogic scripting) supports three types of deployment methods.

  1. Auto-deployment
  2. Console deployment
  3. Command-line Deployment

You can deploy:

  1. Enterprise, Web, and EJB applications
  2. Web services
  3. J2EE libraries
  4. JDBC, JMS and Diagnostic Framework modules
  5. Resource adapters
  6. Optional packages
  7. Client application archives

Applications and EJBs can be deployed:

  1. In an archived file(.ear, .war, .jar)
  2. In an exploded(open)directory format

Archive Files: There are three archive files to deployed in Oracle WebLogic Server.

1) JAR(Java Archive): Jar is java archive file. It contains all class file, image, sound and other files which will needed in whole application. Computer users can create or extract JAR files using the jar command that comes with the JDK. They can also use zip tools. The JavaTM Archive (JAR) file format enables you to bundle multiple files into a single archive file. jar was designed mainly to facilitate the packaging of java applets or applications into a single archive.

Creating Jar File:

jar  -cvf   filename.jar “.”

Extracting Jar file:

            Jar   -xvf  filename.jar

2) WAR(web Archive): Web Archive (WAR) file is a Java archive file used to store jsp, servlets, classes, meta data information, images and Sound and tag libraries etc. It is standard file extension is .war. WAR files are used to package Web modules. A WAR file is for a Web application deployed to a servlet/jsp engine.

Creating war File:

jar  -cvf   filename.war “.”

Extracting Jar file:

            jar   -xvf  filename.war

3)  Ear(Enterprise Archive): An Enterprise Archive file represents a J2EE application that can be deployed in a Web Sphere application server. EAR files are standard Java archive files and have the file extension .ear. EAR file contain ejb, web or application client module. ear file is complete j2ee application file that contain all(jar +war)

Creating Ear File:

jar  -cvf   filename.ear “.”

Extracting Ear file:

            Jar   -xvf  filename.ear

In shot we can say
EAR = WAR(Web module) + JAR(can be EJB module or application client module)Deployment Tools: Several methods are available to deploy the Oracle WebLogic Server applications and shared libraries, including:

  1. Administration console
  2. WebLogic Scripting Tool(WLST)
  3. WebLogic.Deployer java class
  4. wldeploy Ant task
  5. Auto-deployment folder

1) Auto-deployment: Auto-deployment is a method for quickly deploying an application to a stand-alone server (Administration Server) for evaluation or testing. It is recommended that this method be used only in a single-server development environment.

If auto-deployment is enabled, when an application is copied into the \auto-deploy directory of the Administration Server, the Administration Server detects the presence of the new application and deploys it automatically (if the Administration Server is running). If WebLogic Server is not running when you copy the application to the \auto-deploy directory, the application is deployed the next time the WebLogic Server Administration Server is started. Auto-deployment deploys only to the Administration Server.

You can run a WebLogic Server domain in two different modes: development and production. Only development mode allows you use the auto-deployment feature

Development mode enables a WebLogic Server instance to automatically deploy and update applications that are in the domain_name/auto-deploy directory (where domain_name is the name of a WebLogic Server domain).

Production mode disables the auto-deployment feature and prevents any applications you place in the auto-deploy directory after you switch to production mode from being deployed. When you switch from development mode to production mode, any applications that were previously deployed via the auto-deploy directory remain deployed; if you wish to undeploy or redeploy such applications after you have switched to production mode, you must undeploy or redeploy them manually (for instance, with the WebLogic. Deployer command and the -undeploy or -redeploy options, as described in WebLogic. Deployer Command-Line Reference).

To auto-deploy an archived application, copy its archive file to the /autodeploy directory. WebLogic Server automatically sets the application’s deployment mode to stage mode.

A deployment unit that was auto-deployed can be dynamically redeployed while the server is running. To dynamically redeploy, copy the new version of the archive file over the existing file in the /auto-deploy directory.

To undeploy an archived deployment unit that was auto-deployed, delete the application from the /autodeploy directory. WebLogic Server stops the application and removes it from the configuration.

2) Console Deployment: If we deploy an application in console deployment first we create domain, and start the Admin server.

Console deployment steps:

            Step1: Click on Deployments

2: Click on Lock And Edit

3: Click on Install

4: Select Location Deployed Application

5:  Click on Next

6: Choose Targeting Style

–Select  Install this deployment as an application

7: Click on Next

8: Select Deployment Targets

— Admin server   or   Cluster

9:  Click on Next

10: Select security rules and policies

— select DD only

—- select Stage or No-Stage Mode

11: Click on Next

12: Click on Finish

13: Click on Activate Changes

You can test your application from within the Administrative Console by following the steps below:

  1. In the Domain Structure section of the console, click ‘Deployments’.
  2. In the Summary of Deployments page, click on the name of the deployed Web application.
  3. Select the ‘Test’ tab. Here, you’ll find the URL to the deployed Web application. Click the link to launch it in a separate browser window.

Table of Deployable Modules and Deployment modes.

__________________________________________________________________________________________________________

Application or Module Archive Extension Key J2EE Deployment Descriptor
Enterprise Application .ear META-INF/application.xml
Enterprise JavaBean Module .jar META-INF/ejb-jar.xml
Web Application .war WEB-INF/web.xml
Web Service .ear or .war WEB_INF/web-services.xml
Connector Module .rar META-INF/ra.xml
Startup or Shutdown Class n/a No deployment descriptor (Class file only)

WebLogic server provides three different modes  for staging archive files.

1) Stage mode

2) No-stage mode

3) External stage mode

1) Stage mode: The administrator server copies the deployment unit files to the staging directories of target servers and they are deployed using local copy.

  1. This mode is useful when deploying small or moderate size applications and prevents having a single point of failure if the original copy is not accessible.
  2. This is the default staging mode for managed server.

2) No-stage mode: The deployment units are deployed using the same physical copy, which must be accessible by the Administrator  server and target servers.

  1. The administrator server does not copy the deployment unit files to the target server.
  2. This mode is useful when deploying very large deployments to multiple targets and for deployment that require dynamic updates.
  3. This is the default staging mode for the Administrator server.

3) External stage mode: In the External stage mode you must copy the deployment units manually to the correct staging directories before deployments.

  1. Use this staging mode for deployments where you want to manually control the distribution of deployment files to target servers.
  2. This mode prevents deployment information beginning dynamically updated . In this case the administration server  access the original deployment unit for validation.

3) Command Line Deployment:

  1. i) Java WebLogic.Deployer: Deployer is a Java-based deployment tool that provides a command-line interface to the WebLogic Server deployment API.  WebLogic.Deployer is intended for administrators and developers who want to perform interactive, command-line based deployment operations.

To set up your environment to use the WebLogic.Deployer utility:

  1. Install and configure the WebLogic Server software, as described in the WebLogic Server Installation Guide.
  2. Add the WebLogic Server classes to the CLASSPATH environment variable, and ensure that the correct JDK binaries are available in your PATH. You can use the setDomainEnv.cmd[setWLSEnv.sh orsetWLSEnv.cmd] script, located in the server/bin subdirectory of the WebLogic Server installation directory, to set the environment.
  3. If you are connecting to an Administration Server via a configured Administration channel, you must also configure SSL on the machine on which you run WebLogic.Deployer. See SeeUsing the SSL Protocol to Connect to WebLogic Server from WebLogic.Adminin Managing WebLogic Security for instructions about configuring SSL.

Syntax: java WebLogic.Deployer [-adminurl] [specifiedurl(t3://localhost:7001)]        [-username] [username] [-password] [password] [-name] [appname] [-source]       [app source path] [-targets] [targets servers] -deploy

Ex:  java WebLogic.Deployer  -adminurl t3://localhost:7001 –username  WebLogic   -password  WebLogic   -name  benefits   -source C:\course\labs\Lab08\exercise\applications\benefits.war  -targets  ms1, ms2  -deploy

Redeploy:

Syntax:  java WebLogic.Deployer [-adminurl] [specifiedurl(t3://localhost:7001)]        [-username] [username] [-password] [password] [-name] [appname] [-targets] [targets servers] –redeploy

Ex: java WebLogic.Deployer  -adminurl t3://localhost:7001 –username  WebLogic   -password  WebLogic   -name  benefits     -targets ms1, ms2  -redeploy

Undeploy: 

Syntax:  java WebLogic.Deployer [-adminurl] [specifiedurl(t3://localhost:7001)]        [-username] [username] [-password] [password] [-name] [appname] [-targets] [targets servers] –undeploy

Ex: java WebLogic.Deployer  -adminurl t3://localhost:7001 –username  WebLogic   -password  WebLogic   -name  benefits     -targets ms1, ms2  -undeploy

To display list of applications:

Syntax: java WebLogic.Deployer [-adminurl] [specifiedurl(t3://localhost:7001)]        [-username] [username] [-password] [password] [-listapps]

Ex: java WebLogic.Deployer  -adminurl t3://localhost:7001 –username  WebLogic   -password  WebLogic   -listapps

To display list tasks:

Syntax: : java WebLogic.Deployer [-adminurl] [specifiedurl(t3://localhost:7001)]        [-username] [username] [-password] [password] [-listtasks]

Ex: java WebLogic.Deployer  -adminurl t3://localhost:7001 –username  WebLogic   -password  WebLogic   -listtasks

To check the server status:

Syntax: java WebLogic.Deployer [-adminurl] [specifiedurl(t3://localhost:7001)]        [-username] [username] [-password] [password] [GETSTATE] [server name]

Ex: java WebLogic.Deployer  -adminurl t3://localhost:7001 –username  WebLogic   -password  WebLogic   GETSTATE   ms1

  1. ii) WebLogic Scripting Tool(WLST): Wlst is a kind of scripting tool which is a combination of jython and python language.

The WebLogic Scripting Tool (WLST) is a command-line scripting environment that you can use to create, manage, and monitor WebLogic Server domains. It is based on the Java scripting interpreter, Jython. In addition to supporting standard Jython features such as local variables, conditional variables, and flow control statements, WLST provides a set of scripting functions (commands) that are specific to WebLogic Server.

You can use WLST as the command-line equivalent to the WebLogic Server. Administration Console (WLST online) or as the command-line equivalent to the Configuration Wizard (WLST offline).

Three types of modes : 1) Interactive mode. 2) Scripting 3) Embedded.

Interactive mode, in which you enter a command and view the response at a command-line prompt, is useful for learning the tool, prototyping command syntax, and verifying configuration options before building a script. Using WLST interactively is particularly useful for getting immediate feedback after making a critical configuration change. The WLST scripting shell maintains a persistent connection with an instance of WebLogic Server.

Script Mode: Scripts invoke a sequence of WLST commands without requiring your input, much like a shell script. Scripts contain WLST commands in a text file with a .py file extension, for example, filename.py. You use script files with the Jython commands for running script.

Embedded mode, you instantiate the WLST interpreter in your Java code and use it to run WLST commands and scripts. All WLST commands and variables that you use in interactive and script mode can be run in embedded mode.  We don’t use this mode generally.

To invoke the wlst go to C:/bea9/WebLogic91/common/bin/wlst.cmd  and execute wlst.cmd

You can use WLST as the command-line equivalent to the WebLogic Server Administration Console (WLST online) or as the command-line equivalent to the Configuration Wizard (WLST offline).

Offline: Without connecting to a running WebLogic Server instance, you can use WLST to create domain templates, create a new domain based on existing templates, or extend an existing, inactive domain. You cannot use WLST offline to view performance data about resources in a domain or modify security data (such as adding or removing users).

Online: You can use WLST to connect to a running Administration Server and manage the configuration of an active domain, view performance data about resources in the domain, or manage security data (such as adding or removing users). You can also use WLST to connect to Managed Servers, but you cannot modify configuration data from Managed Servers.

 

Display help information for WLST commands by entering the help command:

help(‘online’)

help(‘offline’)

wls:/offline> help()

WLST is a command line scripting tool to configure and administer WebLogic Server.

To invoke the wlst go to /bea/WebLogic91/common/bin /wlst.cmd  and execute wlst.cmd

Connect to WLST:

Step 1: Set class path first (C:\bea9\user_projects\domains\ram_domain\bin\SetDomainEnv.cmd)

Step 2:  enter WLST.cmd (C:\bea9\WebLogic91\common\bin\WLST.cmd)

Installing WLST and goto offline mode.

Step 3: connect(‘username’,’password’,’url’)    enter

Ex: connect(‘WebLogic’,’WebLogic’,’t3://localhost:9001’)

To connect to the domain specified port number. And goto online mode.

Wls:/ram_domain/serverCofig>

Step 4: edit()

Step 5: startEdit()

You goto edit mode and deploy an application after this.

Step 6: deploy an application

Syntax: deploy(‘appname’,’app path’,targets=’servers’)

Step 7: activate()

Step 8: disconnect()   disconnect and come to offline state.

Step 9: exit()  come out to the WLST.

Deploying a file using WLST in different ways: In this ways to deploy an application by using script based.

  1. a) java WebLogic.WLST

Syntax: java WebLogic.WLST  path of script

Ex: java WebLogic.WLST  C:\scripts\deploy.py

Example script:

print ‘***********************************************************’

connect(‘WebLogic’,’WebLogic’,’t3://localhost:9001′)

print ‘***********************************************************’

edit()

print ‘*************************************************************’

startEdit()

print ‘*************************************************************’

print ‘*************************************************************’

deploy(‘ShoppingCart’,’C:/course/labs/Lab25/exercise/applications/ShoppingCart.war’,targets=”ms1,ms2″)

print ‘*************************************************************’

save()

print ‘*************************************************************’

activate()

print ‘************************************************************’

disconnect()

  1. b)  WLST.cmd  script path

Syntax: WLST.cmd  script path

Ex: WLST.cmd   C:\scripts\deploy.py

3) WLST.cmd

Syntax: WLST.cmd

Wls:/offline> execfile(‘C:\scripts\deploy.py’)

iii) Side by Side Deployment:  Using side by side deployment strategy, the user can experience how to use the WebLogic server to re-deploy a new version of production application with out interrupting the availability of the application to new client request. The way the new client gets connected to the new version of the application and the previous version of the application is still in use by the older clients and gets retrived after the client disconnects.

Steps :

Step1. Copybenefits.war in new folder and deploy

Step2. setDomainEnv.cmd

Step3: java WebLogic.Deployer  –adminurl  t3://localhost:7001   –username  WebLogic  –password  WebLogic    –name  benefits  –source path\benefits.war (E:\WEBLOGICMETERIAL\WEBLAB\DEPLOYMENT\sidebyside\new)  –nostage  –targets ms1,ms2  –deploy   -appversion version1

Step4.C opybenefits.war into another folder(new_war) and extract

Go to command prompt and goto the path of new_war folder                                                                     – jar –xvf benefits.war

Step5: Edit welcome file color:navy replace navy with Color:green

Step:6 Save

Step7: jar  –cvf benefits.war  *(or) jar –cvf benefits.war “.”

Step8: Delete all files except  benefits.war

Step9: now deploy benefits.war

java WebLogic.Deployer  –adminurl  t3://localhost:7001   –username  WebLogic  –password  WebLogic       –name  benefits  –source path\benefits.war (E:\WEBLOGICMETERIAL\WEBLAB\DEPLOYMENT\sidebyside\new_war)  –nostage  –targets ms1,ms2  –deploy   -appversion version2

Step10: Test the application version1 before version2 deploy. Afetr version2 deploy test the application to see the difference. version1 application is in retried state.

  1. IV) Deployment using plan:

 Steps:

1. Start your administration server and managed servers, if not already started. If prompted, enter your domain’s administrative username and password.
2. Download the deploy_plan.zip file that contains the sample Web application and WLST script listed below:

HRApp.war
deploy_HRApp.py

Extract and place both files within the same directory on your local file system. This location will be referred to as <APP_HOME> in later steps.

3. Open a new command shell. Navigate to the directory <INSTALL_HOME>/wlserver_10.3/server/bin, where <INSTALL_HOME> is the location of your Oracle WebLogic Server installation.
4.Execute the setWLSEnv script. For example, on Linux, type the following:

source setWLSEnv.sh

5. Change directories to your <APP_HOME> folder (the location of the downloaded WLST script and sample application).
6. Execute the deploy_HRApp.py script using WLST:

java WebLogic.WLST deploy_HRApp.py

Tip: If your domain’s administrative credentials are not admin/welcome1, you will need to first edit this script file and change these values.
Tip: Make sure you have not locked the administration console prior to running this script.

7. Confirm that the application has been deployed to the ms1 server. Direct a Web browser to the following URL:

http://localhost:7003/HRApp

Generating a Deployment Plan for an Application: 

Perform the following steps:

1. Return to the same command shell used to run the WLST script. Confirm that the current directory is still <APP_HOME>.
2. Execute the WebLogic.PlanGenerator tool on the HRApp.war application:

java WebLogic.PlanGenerator -all HRApp.war

3. You should receive a message similar to the following:

<Saved configuration for application, HRApp.war>

Editing a Deployment Plan: 

Perform the following steps:

1. Locate the <APP_HOME>/plan.xml file, and open it in a text editor.
2. Locate the following <variable> element:

<variable>
<name>WebLogicWebApp_ContextRoots_xxxxxxxxxxxxxx</name>
<value xsi:nil=”true”></value>

</variable>

3. Remove the following text from the <value> child element:

xsi:nil=”true”

4. Set the value of the <value> child element to /HR:

<value>/HR</value>

5. Futher down in the file, locate the following <variable-assignment> element:

<variable-assignment>
<name>WebLogicWebApp_ContextRoots_xxxxxxxxxxxxxx</name>
<xpath>/WebLogic-web-app/context-root</xpath>
</variable-assignment>

6. Add a new <operation> child element to this <variable-assignment>:

<variable-assignment>
<name>WebLogicWebApp_ContextRoots_xxxxxxxxxxxxxx</name>
<xpath>/WebLogic-web-app/context-root</xpath>
<operation>replace</operation>
</variable-assignment>

7. Save your changes.

Updating an Application with a Deployment Plan:

Perform the following steps:

1. Launch a Web browser and access your domain’s administration console. The default port is 7001:http://localhost:7001/console
2. Log into the console using your domain’s administrative username and password.
3. In the Change Center panel, click Lock & Edit:
4. In the Domain Structure panel, click Deployments:
5. Select the checkbox for the HRApp application, and click the Update button:
6. Click the Change Path button associated with the Deployment Plan Path field :
7. Select the radio button for your new plan.xml file, and click Next. If necessary, use the hyperlinks next to the Current Location field to browse to your <APP_HOME> directory:
8. Click the Finish button.
9. In the Change Center panel, click the Activate Changes button:
Verify the new context path of the application. Direct your Web browser to the followingURL:http://localhost:7003/HR
  1. V)wl(WebLogic)deploy Ant task:

Step1: Create  .xml file

Step2: write  script in it.

Step3: execute command  ant  deploy {if we save the file name as build.xml}

Ant  –f  filename.xml {if the file name is created with filename.xml}

  1. VI) Two-Phase Deployment:The new two-phase deployment protocol helps to maintain domain consistency. In previous versions of WebLogic Server, when you deployed an application, the administration server sent a copy of the application file(s) to all the targeted servers, which then loaded the application. If deployment to any of those servers failed or partially failed, the entire deployment’s state across its target servers became inconsistent.

The two-phase model makes inconsistent deployment states in clusters less likely by confirming the success of the prepare phase before deploying the application on any targeted servers. A deployment that fails during the prepare phase will not enter the activation phase.

Prepare Phase: The prepare phase of deployment, the first phase, distributes or copies files and prepares the application and its components for activation, validating them and performing error checks on them. The purpose of the prepare phase is to ensure that the application and its components are in a state in which they can be reliably deployed.

Activate Phase: The second phase, the activate phase, is the actual deployment, or activation, of the application and its component with the relevant server subsystem. After the activate phase, the application is made available to clients.

JDBC : Java Database Connectivity.

__________________________________________________________________________________________________________

JDBC: Java database connectivity (JDBC) is the JavaSoft specification of a standard application programming interface (API) that allows Java programs to access database management systems. The JDBC API consists a set of interfaces and classes written in the Java programming language.  Using these standard interfaces and classes, programmers can write applications that connect to databases, send queries written in structured query language (SQL), and process the results.

The JDBC API is consistent with the style of the core Java interfaces and classes, such as java.lang and java.awt. The following table describes the interfaces, classes, and exceptions (classes thrown as exceptions) that make up the JDBC API. In the table, interfaces belonging to the javax.sql package are extensions to the standard JDBC interfaces and are contained in the Java 2 SDK, Enterprise Edition.

JDBC Architecture:

JDBC Drivers: There are four types of drivers in JDBC.

1) Type-1 Driver:(JDBC-ODBC  bridge driver)

  1. This driver receives any JDBC calls and sends then to ODBC driver.
  2. ODBC driver understand these calls and communicates with the database library provide by the vendor.
  3. ODBC driver and vendor database library must present on the client machine.

2) Type-2 Driver: (Native API-partly java driver)

  1. It converts JDBC calls into database specific calls with the help of vendor database library.
  2. It communicates directly with the database server; it requires that some binary code to be present on the client machine.

3) Type-3 Driver: (Net protocol-pure java driver)

  1. It follows three-tiered approach where by the JDBC database requests are passed through the network to a middle-tier server.
  2. The middle-tier server translates the request to the database specific library and then sends it to the database server.
  3. The database server then executes the request and gives back to the result.

4)Type-4 Driver:( Net protocol-pure java driver )

  1. It converts JDBC calls into the vendor-specific DBMS protocol. So that client applications can communicate directly database server.
  2. This driver completely implemented in java to archive platform independent.

In JDBC contains two types of Architectures.

1) Two-Tier Arcitecture:  In two-tier java application communicates directly with the DBMS.

A JDBC driver is needed that can communicate directly with the DBMS. So This is Client/Server configuration(Architecture)

Multi-tier Architecture: In multi-tier commands are sent to a middle-tier of services which then send the commands. The DBMS process commands sends the results back to middle-tier, which then sends them to client.

 

Data Source: A Data Source object provides a way for a JDBC client to obtain a database connection from a connection pool. It is used to store the WLST JNDI tree, it can support transactions and it is also associated with the connection pool.

What is JNDI(Java Naming Directory Interface):

The Java Naming and Directory Interface (JNDI) is an application programming interface (API) for accessing different kinds of naming and directory services. JNDI is not specific to a particular naming or directory service, it can be used to access many different kinds of systems including file systems, distributed objects systems like CORBA, Java RMI, and EJB; and directory services like LDAP, Novell NetWare, and NIS+.

Why JNDI: In WebLogic Server, JNDI serves as a repository and lookup service for J2EE objects including:

  1. EJB home stubs
  2. JDBC DataSources
  3. JMS connection factories, queues and topics
  4. RMI stubs

JNDI Root(Tree):

Connection pool: A connection pool is a collection of database connections that is maintained by memory. That can be reused. Once an application has finished its physical connection the connection is recycled rather than beginning destroyed.

Connection pools:

  1. Are created at WebLogic server.
  2. Can be administrated using the Administration console.
  3. Can be dynamically resized to accommodate increasing load.

Benefits of DataSource And Connection pool:

  1. Time and overhead are saved by using an existing database connection
  2. Connection information is managed in one location in the Administration Console
  3. The number of connections to a database can be controlled
  4. The DBMS can be changed without the application developer having to modify underlying code
  5. A connection pool allows an application to “borrow” a DBMS connection.

JDBC DtataSource Architecture:

How to use DataSource:

A client retrieves a Data Source through JNDI look up and uses it to obtain a database connection.

Process :

  1. Client will look up for the JNDI , once jndi is identified it will return database.
  2. Data source will get connection from connection pool.
  3. It will access the database with that connection.

JDBC  – To run point base Database:

Step1: Copy database files from c:\student\course\work\database\ and paste in c:\bea\WebLogic91\common\eva1\pointbase\database\

and edit startpointbase c:\bea\WebLogic91\common\eva1\pointbase\tools\startpointbase.cmd

Step2:  Edit  Startpointbase

Remove “%SAPLES_HOME%\domain\wl_server\pointbase.ini” and paste “c:\bea\WebLogic91\common\eva1\pointbase\tools”

and then save it.

Step3: Run startpointbase script.

configuredatasoure in admin console and test connection:

Create a DataSource with the following specifications:

Name:                     dizzyworldDS

JNDI Name:           dizzyworldDS

Database Type:         PointBase

Database Driver:      *PointBase’sDriver(Type 4)versions:4.x,5.x

Database Name:        HRDATABASE

Host Name:                localhost

Port:                            9092

Database User Name:PBPUBLIC

Password:                  PBPUBLIC

Initial Capacity:             5

Maximum Capacity:      15

Capacity Increment:       5

Login Delay:                  1

Target:                            dizzy1

deploy an application testds.war from lab14and test for database connectivity.

Steps for creating data source and connection pool in console:

Step1: click on services

2: click on JDBC

3: click on Data source

4: click on Lock And Edit

5: click on New

6: Enter JDBC datasource properties

Name               : Datasource Name

JNDI Name                 : JNDI Name

Database Type            : database name

Driver Type                 : Select Type-4 driver Non-Xa

à Next

7: Select Transaction options

  1. Select
  2. support global transaction
  3. Select one-phase commit

à Next

8: Create a New DataSource

Database Name           : Database name

HostName                   : Hostname

PortNumber                : Portnumber

DB User Name           : username

DB password  : password

Conformpassword      : password

àNext

9: Display connection properties

10: Test configuration

11: Display connection properties

àConnection successes

àNext

12: Select Targets (Admin or cluster(ms1&ms2))

àFinish

àActivate changes

Test DataSource:

Cluster JDBC (or) MultiDataSource: A multi data source is an abstraction around a group of data sources that provides load balancing or failover processing between the data sources associated with the multi data source. Multi data sources are bound to the JNDI tree or local application context just like data sources are bound to the JNDI tree.

Multi Data Source Algorithms: 

1)Failover: Connections requests are sent to the first data source in the list, if the request fails the request is sent to the next data source, in the list and so forth, the process is represented untial a valid connection is obtained or until the end of the list is reached in which case an exception is thrown.

2) Load balancing: The multi data source distributes connection requests evenly to its number data sources, which algorithm the multidata source also provides failover processing. That is if a request fails the multi data source sends to the requests to the next data source in the list until a valid connection is obtain, or until the end of the list is reached, in which case an exception is thrown.

Diff b/w Xa and Non-Xa  Datasource:

            Xa datasource

1)  It allows global transaction that my be multiple resources.

2) It involves a co-ordinating transaction manager with one or more databases in a single global transaction.

3) It comes  from the X/Open group specification on distributed, global transactions.

          Non-Xa Datasource

1)  It allows single transaction that my be single resources.

2) there is no transaction coordinator, and it is a single resource is doing all its transaction work itself.

3) It comes from  Servlet or EJB or plain old JDBC in a Java application talking to a single database.

JMS(JavaMessagingService)

________________________________________________________________________________________________________

JMS: The Java Message Service (JMSAPI is a Java Message Oriented Middleware (MOM) API for sending messages between two or more clients. JMS is a part of the Java Platform Enterprise Edition. It is a messaging standard that allows application components based on the Java 2 Platform Enterprise Edition (J2EE) to create, send, receive, and read messages. It allows the communication between different components of a distributed application to be loosely coupled, reliable, and asynchronous.

The following are JMS elements:

JMS provider: An implementation of the JMS interface for a Message Oriented Middleware (MOM). Providers are implemented as either a Java JMS implementation or an adapter to a non-Java MOM.

JMS client: An application or process that produces and/or receives messages.

JMS producer/publisher: A JMS client that creates and sends messages.

JMS consumer/subscriber: A JMS client that receives messages.

JMS message: An object that contains the data being transferred between JMS clients.

JMS queue: A staging area that contains messages that have been sent and are waiting to be read. Note that, contrary to what the namequeue suggests, messages have to be delivered in the order sent A JMS queue only guarantees that each message is processed only once.

JMS topic: A distribution mechanism for publishing messages that are delivered to multiple subscribers

The JMS API supports two models:

  1. Point-to-point
  2. Publish and subscribe

1) Point-to-Point: In the point-to-point model, a sender posts messages to a particular queue and a receiver reads messages from the queue. Here, the sender knows the destination of the message and posts the message directly to the receiver’s queue. This model is characterized by the following:

  1. Only one consumer gets the message.
  2. The producer does not have to be running at the time the consumer consumes the message, nor does the consumer need to be running at the time the message is sent.
  3. Every message successfully processed is acknowledged by the consumer.

2) The publish/subscribe model supports publishing messages to a particular message topic. Subscribers may register interest in receiving messages on a particular message topic. In this model, neither the publisher nor the subscriber knows about each other. A good analogy for this is an anonymous bulletin board. The following are characteristics of this model:

  1. Multiple consumers (or none) will receive the message.
  2. There is a timing dependency between publishers and subscribers. The publisher has to create a message topic for clients to subscribe. The subscriber has to remain continuously active to receive messages, unless it has established a durable subscription. In that case, messages published while the subscriber is not connected will be redistributed whenever it reconnects.

Using Java, JMS provides a way of separating the application from the transport layer of providing data. The same Java classes can be used to communicate with different JMS providers by using the JNDI information for the desired provider. The classes first use a connection factory to connect to the queue or topic, and then use populate and send or publish the messages. On the receiving side, the clients then receive or subscribe to the messages.

Difference b/w Queue and Topic:

                         Queue                               Topic
1) In queues, one message can be consumed by only one client.

2) Queue represent Point-To-Point model.

3) queue is used to send one to one system.

4) In queue the messages are send to FIFO(First in first out) order.

1) In the topics, one message can be consumed by many clients.

2) Topic represent Public and Subscribe  model.

3) topic is used to send more than one system at a time.

4) In Topic  the messages are send to LIFO(Last in first out) order.

Distributed Queue : Many producers can serialize messages to multiple receivers in a queue.

Distributed Topic : Publishing and subscribing to a topic decouples producers from consumers.

Difference b/w Distributed Queue and Distributed Topic:

                 Distributed Queue

1) A Distributed Queues are allow you to retrieve a connection to any of the Queues across a cluster by using the Global JNDI name.

2) It seems one of the main pieces of functionality Distributed Queue gives you is load balanced connections across multiple managed servers.

3) The members of the unit are usually distributed across multiple servers within a cluster, with each queue member belonging to a separate JMS server.

4)A distributed queue is a set of physical JMS queue members.

                     Distributed Topic

1) A distributed topic can be used to create aTopicPublisher and TopicSubscriber.

2) The topic members can be located anywhere but must all be served either by a single WebLogic Server or any number of servers in a cluster.

3) A distributed topic is a set of physical JMS topic members.

JMS Architecture:

Connection Factory: A ConnectionFactory object encapsulates a set of connection configuration parameters that has been defined by an administrator. A client uses it to create a connection with a JMS provider.

  1. It encapsulates connection configuration information.
  2. It is used to create pre-configured connections.
  3. It stored in JNDI.
  4. Can be targeted server or cluster.
  5. It  supports concurrent use.

à The default connection factory that is bounded in JNDI to WebLogic is            WebLogic.jms.ConnectionFactory

Threshold and a Quota: A threshold and a quota can be set for Server and Destination objects.

A quota is a limit defined for JMS administered objects; it includes these values:

  1. The maximum number of bytes that can be stored
  2. The maximum number of messages that can be stored

A threshold is a limit that triggers message paging, flow control and logged warnings using:

  1. Upper and lower values for the number of bytes
  2. Upper and lower values for the number of messages

Durable Subscribers and Subscriptions:

  1. Durable subscribers register durable subscriptions to guarantee message delivery even if subscribers are inactive.
  2. A subscriber is considered active if the Java object that represents it exists.
  3. By default, subscribers are non-durable.
  4. Administrators configure:                                                                                                       – Where messages are persisted                                                                                                    – Persistent connection factories and destinations

Persistent store: The persistent store provides a built-in, high-performance storage solution for WebLogic Server subsystems and services that require persistence. For example, it can store persistent JMS messages or temporarily store messages sent using the Store-and-Forward feature. The persistent store supports persistence to a file-based store or to a JDBC-enabled database.

There are two types of  persistent mechanisms:

1) persistent         2)non-persistent

A persistent message is guaranteed to be delivered once-and-only-once. The message cannot be lost due to a JMS provider failure and it must not be delivered twice. It is not considered sent until it has been safely written to a file or database. WebLogic JMS writes persistent messages to a WebLogic persistent store (disk-base file or JDBC-accessible database) that is optionally targeted by each JMS server during configuration.                                                                                       A Non-persistent messages are not stored. They are guaranteed to be delivered at-most-once, unless there is a JMS provider failure, in which case messages may be lost, and must not be delivered twice. If a connection is closed or recovered, all non-persistent messages that have not yet been acknowledged will be redelivered. Once a non-persistent message is acknowledged, it will not be redelivered.

When to Use Persistent Messaging:  Persistent messaging permits messages in memory to be written out to a persistent store.                                                                                                                               Configure persistent messaging if:                                                                                                                 – Development requires durable subscriptions (use durablesubscribers in the application)                      – You require that in-progress messages persist across server restarts

How a Durable Subscription Works:

When the client becomes active again, its ID is used to retrieve and redeliver messages.

Configure a Durable Subscription:

To configure durable subscriptions, an administrator must:

– Create and configure a JMS store

– Configure connection factories or destinations as persistent

– Associate the JMS store with the JMS Server

The JMS store can be configured to use either:

– A file store

– A JDBC store (a connection pool)

Configure JMS server through console:

The following steps are:

            Step1:  Click on JMS Server

Step2:  Click on Lock And Edit

Step 3:  Click on New

Step 4:  Enter JMS server Properties

Name:              JMS server Name

Persistent Store:          none

——à Next

Step 5: Select targets

Target :  server name(ms1)

—-à Finish

Configure JMS Module:

The following steps are:

            Step1:  Click on JMS Modules

Step2: Click on Lock And Edit

Step 3:  Click on New

Step 4:  Enter the following properties

Name :                                     JMS Module Name

Descriptor File Name:             Filename

Location Domain:

—-à Next

Step5: Select Target :              Cluster

—–àNext

Step 6: Select would you like to add Resources of this JMS System

——àFinish

Configure JMSQueue:

The following steps are:

Step1: Click on JMS Module

Step 2: Click on JMS Module Name

Step 3: Click on Lock And Edit

Step 4: Click on New

Step 5: Select Queue

Step 6: Description Properties

Name: QueueName

JNDI Name: JNDI Name

Template:        None

–à Next

Step 7: Select Targets  JMS Server

—-à Finish

Configure JMSTopic:

The following steps are:

Step1: Click on JMS Module

Step 2: Click on JMS Module Name

Step 3: Click on Lock And Edit

Step 4: Click on New

Step 5: Select Topic

Step 6: Description Properties

Name:              TopicName

JNDI Name:    JNDI Name

Template:        None

–à Next

Step 7: Select Targets  JMS Server

—-à Finish

Delete struck messages from the queue:

The following steps are:

Step1: Click on JMS Module

Step 2: Click on JMS Module Name

Step 3: Click on JMS Queue

Step 4: Click on Monitoring

Step 5: select the queue

Step 6: Click on show messages

Step 7: Select message ID

Step 8: Delete

Step 9: Finish

Check the pending messages in a queue:

The following steps are:

Step1: Click on JMS Server

Step 2: Click on JMS Server Name

Step 3: Click on monitoring

Step 4: Click on Active destrination

-à To check the pending messages in queue.

Apache Webserver

__________________________________________________________________________________________________________

Install the apache web server in Linux:

Step 1: first unzip the file on zip file

Gunzip    httpd-2.0.55.gz

Step 2: tar file is open. Un tar that file

Tar –xvf  httpd-2.o.55.tar

The file will display   httpd-2.o.55

Step 3: cd  httpd-2.0.55

./configure—prefix= /home/apache2

./make

./make install

The install is completed.

Check Apache servers running processes:

Ps  -ef | grephttpd | grep  -v grep

1) To start apache – httpd –k start

2) To stop apache – httpd –k stop

3) To Restart apache – httpd –k restart

Program files / Apache software foundation / Apache 2.2/bin folder in

  1. i) Main configuration file in Apache is  “httpd.conf”
  2. ii) Additional config files –“Extra” folder

4) Apache default port no – 80

5) Apache ssl default port number – 443

6) To check the syntax – httpd  -t

7) All html documents – “htdocs” folder

The Apache Directory StructureThe Apache software is typically distributed into the following subdirectories:

cgi-bin This is where many, if not all, of the interactive programs that you write will reside. These will be programs written with Perl, Java, or other programming languages.
Conf This directory will contain your configuration files.
htdocs This directory will contain your actual hypertext documents. This directory will typically have many subdirectories. This directory is known as the DocumentRoot.
Icons This directory contains the icons (small images) that Apache will use when displaying information or error messages.
images This directory will contain the image files (GIF or JPG) that you will use on your web site.
Logs This directory will contain your log files – the access_log and error_log files.
Sbin Use nogroup

Main Configuration file in apache:

  1. The Apache software is configured by changing settings in several text files in the Apache conf (configuration) directory.
  2. There are four configuration files used by Apache. The main configuration file is usually called httpd.conf.
access.conf This is The security configuration file. It Contains instructions about which users should be able to access.  And  what information.
httpd.conf This is The server configuration file. It Typically contains directives that affect how the server runs, such as user and group ID’s it should use when running, the location of other files, etc.
srm.conf This is The resource configuration file. It Contains directives that define where documents are found, how to change addresses to filenames, etc.
mime.types A configuration file that relates filename extensions to file types.

Apache root: On an Apache HTTP Server, you can control where the server looks for live HTML documents; in other words, your web pages or content management system.

DocumentRoot: . The directory will typically have many subdirectories. This directory is known as the DocumentRoot. The documentRoot directory in apache is htdocs.

Server root: Server Root Directory                                                                                     Syntax: ServerRoot A<path>< tt=””>                                                                                Example: ServerRoot /sw/pkg/apache                                                                                   Since: Apache 1.0                                                                                                      </path><>

This directive sets the root directory in which the server resides. Typically, it contains the subdirectories conf/ and logs/. Relative paths for other configuration files are taken as relative to this directory. This directive can be also overridden from the command line via the -d option.

SSL(Security Socket Layer):

_____________________________________________________________________________

  1. I) Configure SSL in WebLogic:
  2. Generating the certificate:

The following steps are:

Step1: Open a command prompt and set the environment by running the setDomainEnv script.

( C:\bea9\user_projects\domains\ram_domain\bin\setDomainEnv.cmd)

Step2: Generate the private – public key pair. For demonstration we would       use keytool java utility to do so. However we can use other utilities like openssl etc.

keytool  -genkey  -alias mykey   -keyalg RSA   -keysize 2048   -keystore  identity.jks

Step3: Generate a Certificate Signing Request (CSR) and send it to Certifying Authority.

keytool  -selfcert   -alias mykey  -keystore   identity.jks

Step 4: Create a identity  keystore, this can be done my exporting

keytool   -export  -alias  mykey  -file  cert.cer  -keystore   identity.jks

Step5: Create a trust keystore, this can be done my importing.

keytool   -import   -alias   mykey  -file  cert.cer   -keystore   trust.jks    -noprompt

To verify the contents of the keystore, you can use the below command,

keytool  -list  -v  -keystore <keystore-name>  -storepass <keystore-password>

2)  Configuring the keystore on the WebLogic Server:

Step 1: Log into the Admin Console, Click on servers

Step 2: Click on Lock and Edit

Step 3: select the server on which you want to configure the SSL    certificate.(Ex:ms1)

Step 4: Click on keystores

Step 5: select Custom identity and Custom trust

Identiy:

CustomIdentitykeystore:C:\bea9\user_projects\domains\sai_domain\identity.jks

Custom Identity keystore type: jks

Custom identity passphrase : Ram@2013

Trust:

Custom trust keystore: C:\bea9\user_projects\domains\sai_domain\trust.jks

Custom trust keystore type: jks

Custom trust passphrase : Ram@2013

–àsave     —àAcivate changes

Step 6: Click on SSL

Step 7: Enter identity

Private key alias: mykey

            Privatekey passphrase : Ram@2013

—àsave     —à Activate changes

àTo check SSL type browser  https://localhost:5003(ms1 ssl portnumber)/messaging(deploying application)

  1. II) Integrate Apache with WebLogic Server: Install apache in our machine and open httpd.conf file (C:\Program Files (x86)\Apache Software Foundation\Apache2.2\conf\httpd.conf) and to do the following steps are:

Step 1: make sure the apache server run on port number 80 or 8080

Listen localhost:80 or 8080                                                                                                     Listen:80

Step 2: Copy the module Mod_WL_20 to C:\Program Files (x86)\Apache Software Foundation\Apache2.2\modules

Step 3: copy the module on  LoadModule WebLogic_module modules/mod_wl_22.so  to httpd.conf file.

Step 3: copy the below content in to  httpd.conf  on main server.

<Location />                                                                                                                           SetHandler WebLogic-handler                                                                                                 </Location>

<IfModule mod_WebLogic.c>                                                                                 WebLogicCluster localhost:5002,localhost:5004                                                                                   Debug ON                                                                                                                                         WLLogFile c:/temp/wlproxy.log                                                                                                     WLTempDir c:/temp                                                                                             </IfModule>

Step 4: re-start the server and access the application.

http://localhost:apacheportnumber/appname(http://localhost80:/messaging)

III) Integrate Apache-SSL with WebLogic server:  Install the “httpd/apache_x.x.x-win32-x86-openssl-x.x.x.msi” s/w in our machine. Open httpd.conf file Then do the following steps

Step 1: Configure apache configure file httpd.conf, uncomment the following 2 lines,
            LoadModule ssl_module modules/mod_ssl.so
Include conf/extra/httpd-ssl.conf

Step2: Execute the following step for windows

set OPENSSL_CONF=C:\Program Files\Apache Software Foundation\Apache2.2\conf\openssl.cnf

Step 3: Generate certification using openssl,
openssl req -new -out server.csr
openssl rsa -in privkey.pem -out server.key
openssl x509 -in server.csr -out server.cert -req -signkey server.key -days 365

Step 4:  Copy the generation files to the directory defined by httpd-ssl.conf

We have the Self-signed SSL certificates ready now. Now We need to MOVE the “server.cert” and        “server.key” file to the

“C:\Program Files\Apache Software Foundation\Apache2.2\conf” location.

Step 5:  check httpd-ssl.conf

Now we need to modify the “C:\Program Files\Apache Software Foundation\Apache2.2\conf\extra\httpd- ssl.conf”.

Let all the default options as it is but make sure to modify the following section according to your need:

<VirtualHost _default_:443>
ServerAdmin some@email.com
DocumentRoot “Your Root folder location”
ServerName www.domain.com:443
ServerAlias domain.com:443 
ErrorLog “logs/anyFile-error.log”
CustomLog “logs/anyFile-access.log” common
SSLEngine on

SSLCertificateFile “C:/Program Files/Apache Software Foundation/Apache2.2/conf/server.cert”

SSLCertificateKeyFile “C:/Program Files/Apache Software Foundation/Apache2.2/conf/server.key”
</VirtualHost>

Step 6: Open an exception in Windows Firewall for TCP port 443.(set ssl port number:443 in our mechine)

Step 7: Access the application using the below url

https://localhost:443/app-name or https://localhost/app-name

Set  SSLport number:443 in our mechine:

Step 1: Click on start button

Step2 : Click on Control panel

Step 3: Click on windows firewall

Step 4: Click on Advanced Settings

Step 5: Click on Inbounded rules

Step 6: Click on new rule

Step 7: Select port

—-à click on next

Step 8:  select TCP

Select specific location port: 443

——à next

Step 9: Select Allow the connections

—-à next     —ànext

Step 10:  SSL port is created

Diff  b/w one-way ssl and two-way ssl:

One Way SSL :- Only the client authenticates the server. This means that the public cert of the server needs to configured in the trust store of the client.
Two Way SSL: – The client authenticates the server & the server also authenticates the client.
This means that the public cert of the server needs to configured in the trust store of the client. And Also the public cert of the client needs to be configured on the server’s trust store.

Virtual Hosting:

__________________________________________________________________________________________________________

Diff b/w Name-based and Ip-based virtual hosting:

IP-based virtual hosts use the IP address of the connection to determine the correct virtual host to serve.

Name-based virtual hosting, the server relies on the client to report the hostname as part of the HTTP headers & many different hosts can share the same IP address.

Configure virtual host in apache and WebLogic:

go to servers  -> click on admin server -> click protocol -> select the chanel tab ->click new option

N/w channel name : 80                                                                                                                       protocol: http                                                                                                                                        and click next ->                                                                                                                    listen Address:            localhost

listen port    : 80                                                                                                                                  and click next -> click finish

go to environment -> virtual hosts ->click new option -> create a new virtual host -> click ok.

JVM: Java Virtual Machine

________________________________________________________________________________________________________

JVM Architecture: JVM is the heart of any Java based Application Server. We face most of the issues due to incorrect JVM tuning. It is very important to understand the Overall architecture of the JVM in order to trouble shoot different JVM tuning related issues. Here we are going to discuss the Architecture and the Major parts of a Java Process And the Java Heap Division.

The Following Diagram is just a basic overview of a Java Process in a 2 GB process Size Machine. Usually in 32 bit Windows Operating Systems the default process size will be 2 GB (In Unix based 64 bit operating Systems it can be 4GB or more). So i draw the following Diagram of Java Process to explain the Java Process partitions in a 2Gb process size machine.

Java Process Architecture Diagram

In the above diagram we will find different partitions of a Java Process. Please compare the above diagram with below descriptions.

.

1) Just for Example we can see that Process Size is 2048 MB (2GB)

2) The Java Heap Size is 1024MB (means 1GB)   -Xmx1024m

3) Native Space = ( ProcessSize – MaxHeapSize – MaxPermSize) It means around 768 MB of Native Space.

4) MaxPermSpace is around -XX:MaxPermSize=256m

5) Young Generation Space is around    40% of Maximum Java Heap.

Different parts of JVM:

1) Eden space: Eden Space is a Part of Java Heap where the JVM initially creates any objects, where most objects die and quickly are cleaned up by the minor Garbage Collectors (Note: Full Garbage Collection is different from Minor Garbage Collection). Usually any new objects created inside a Java Method go into Eden space and the objects space is reclaimed once the method execution completes. Where as the Instance Variables of a Class usually lives longer until the Object based on that class gets destroyed. When Eden fills up it causes a minor collection, in which some surviving objects are moved to an older generation.

2) Survivor Spaces: Eden Space has two Survivor spaces. One survivor space is empty at any given time. These Survivor Spaces serves as the destination of the next copying collection of any living objects in Eden and the other survivor space.

The parameter SurvivorRatio can be used to tune the size of the survivor spaces.

-XX:SurvivorRatio=6 sets the ratio between each survivor space and Eden to be 1:6

If survivor spaces are too small copying collection overflows directly into the tenured generation.

3) Young Generation: (-XX:MaxNewSize): Till JDK1.3 and 1.4 we used to set the Young Generation Size using -XX:MaxNewSize. But from JDK1.4 onwards we set the YoungGeneration size using (-Xmn) JVM option.

Young Generation size is controlled by NewRatio.  It means setting -XX:NewRatio=3 means that the ratio between the Old Generation and the Young Generation is  1:3. Similarly -XX:NewRatio=8 means that 8:1 ratio of tenured and young generation.

NewRatio: NewRatio is actually the ratio between the (YoungGenaration/Old Generations) has default values of 2 on Sparc , 12 on client Intel, and 8 everywhere else.

NOTE: After JDK 1.4 The Young Generation Size can be set using  (-Xmn) as well.

1) Virtual space-1:(MaxNewSize – NewSize): The First Virtual Space is actually shows the difference between the -XX:NewSize and -XX:MaxNewSize.  Or we can say that it is basically a difference between the Initial Young Size and the Maximum Young Size.

JavaHeapArea:( -Xmx and –Xms): Java Heap is a Memory area inside the Java Process which holds the java objects.  Java Heap is a combination of Young Generation Heap and Old Generation Heap. We can set the Initial Java Heap Size using -Xms JVM parameter similarly if we want to set the Maximum Heap Size then we can use -Xmx JVM parameter to define it.

Example:

-Xmx1024m —> Means Setting the Maximum limit of Heap as 1 GB

-Xms512m —> Means setting Java Heap Initial Size as 512m

.

NOTE-1): It is always recommended to set the Initial and the Maximum Heap size values as same for better performance.

NOTE-2): The Theoretical limitation of Maximum Heap size for a 32 bit JVM is upto 4GB. Because of the Memory Fragmentation, Kernel Space Addressing, Swap memory usages and the Virtual Machine Overheads are some factors JVM does not allow us to allocate whole 4GB memory for Heap in a 32 bit JVM. So usually on 32-bit Windows Operating Systems the Maximum can be from 1.4 GB to 1.6 GB.

If we want a larger memory allocation according to our application requirement then we must choose the 64-bit operating systems with 64 bit JVM. 64-bit JVM provides us a larger address space. So we can have much larger Java Heap  with  the increased number of Threads allocation area. Based on the Nature of your Operating system in a 64 bit JVM you can even set the Maximum Heap size upto 32GB.

Example:        -Xms32g -Xmx32g -Xmn4g

2) Virtual Space-2: (MaxHeapSize – InitialHeapSize): The Second Virtual Space is actually the Difference between the Maximum Heap size (-Xmx)and the Initial Heap Size(-Xms). This is called as virtual space because initially the JVM will allocate the Initial Heap Size and then according to the requirement the Heap size can grow till the MaxHeapSize.

PermGen Space: (-XX:MaxPermSize): PermGen is a non-heap memory area where the Class Loading happens and the JVM allocates spaces for classes, class meta data,  java methods and the reference Objects here. The PermGen is independent from the Heap Area. It can be resized according to the requirement using -XX:MaxPermSize and -XX:PermSize  JVM Options. The Garbage collection happens in this area of JVM Memory as well. The Garbage collection in this area is called as “Class GC”. We can disable the Class Garbage Collection using the JVM Option -noclassgc. if  ”-noclassgc” Java Option is added while starting the Server. In that case the Classes instances which are not required will not be Garbage collected.

Native Area: Native Memory is an area which is usually used by the JVM for it’s internal operations and to execute the JNI codes. The JVM Uses Native Memory for Code Optimization and for loading the classes and libraries along with the intermediate code generation.

The Size of the Native Memory depends on the Architecture of the Operating System and the amount of memory which is already commited to the Java Heap. Native memory is an Process Area where the JNI codes gets loaded or JVM Libraries gets loaded or the native Performance packs and the Proxy Modules gets loaded.

There is no JVM Option available to size the Native Area. but we can calculate it approximately using the following formula:

NativeMemory = (ProcessSize – MaxHeapSize – MaxPermSize)

Garbage Collection:

_________________________________________________________________________________________________________

Garbage collection: It’s always best to enable the Garbage collection Logging in our production environment as well because it does not cause any resource overhead or any side effect on WebLogic server or another application server’s performance.  GC log helps us in investigating man issues. Apart from issues it helps us to find out if some tuning is required based on the statistics of the Garbage collection.                          Garbage collection logging can be enable and collected in a separate log file by using the following JAVA_OPTIONS:

-Xloggc:D:/gcLogs/GCLogs.log         -XX:+PrintGCDetails        -XX:+PrintGCTimeStamps

As soon as you add these JAVA_OPTIONS which are JVM specific (above will work for Sun and Open JDKs fine) the JVM will start generating the garbage collection logging in the GCLog.log file. Now if you will open this file then you can

see something like following:

01 4.636: [GC [PSYoungGen: 230400K->19135K(268800K)] 230400K->19135K(2058752K), 0.0635710 secs] [Times: user=0.08 sys=0.01, real=0.06 secs]
02 7.302: [GC [PSYoungGen: 249535K->38396K(268800K)] 249535K->51158K(2058752K), 0.0777300 secs] [Times: user=0.21 sys=0.04, real=0.07 secs]
03 7.521: [GC [PSYoungGen: 49735K->38388K(268800K)] 62496K->51933K(2058752K), 0.0741680 secs] [Times: user=0.15 sys=0.04, real=0.07 secs]
04 7.595: [Full GC (System) [PSYoungGen: 38388K->0K(268800K)] [PSOldGen: 13545K->51794K(1789952K)] 51933K->51794K(2058752K) [PSPermGen: 19868K->19868K(39936K)], 0.3066610 secs] [Times: user=0.28 sys=0.02, real=0.31 secs]
05 9.752: [GC [PSYoungGen: 230400K->26206K(268800K)] 282194K->78000K(2058752K), 0.0728380 secs] [Times: user=0.15 sys=0.00, real=0.08 secs]
06 11.906: [GC [PSYoungGen: 256606K->38393K(268800K)] 308400K->94759K(2058752K), 0.1058920 secs] [Times: user=0.19 sys=0.00, real=0.10 secs]
07 13.480: [GC [PSYoungGen: 268793K->38394K(268800K)] 325159K->109054K(2058752K), 0.0762360 secs] [Times: user=0.20 sys=0.03, real=0.08 secs]
08 18.115: [GC [PSYoungGen: 268794K->38384K(268800K)] 339454K->179238K(2058752K), 0.1351350 secs] [Times: user=0.42 sys=0.10, real=0.14 secs]
09 20.860: [GC [PSYoungGen: 268784K->38394K(268800K)] 409638K->200343K(2058752K), 0.1063430 secs] [Times: user=0.29 sys=0.03, real=0.11 secs]
10 22.148: [GC [PSYoungGen: 268794K->38399K(268800K)] 430743K->221395K(2058752K), 0.1173980 secs] [Times: user=0.24 sys=0.02, real=0.12 secs]
11 23.357: [GC [PSYoungGen: 268799K->26775K(268800K)] 451795K->231618K(2058752K), 0.0714130 secs] [Times: user=0.15 sys=0.03, real=0.08 secs]
12 24.449: [GC [PSYoungGen: 257175K->29170K(268800K)] 462018K->239909K(2058752K), 0.0312400 secs] [Times: user=0.06 sys=0.01, real=0.04 secs]

You can notice something in the above output:

Point1: [Full GC (System) [PSYoungGen: 38388K->0K(268800K)]    It means a Full GC is happening on the complete Heap Area including all the Areas of the Java Heap Space.

Point2: [GC [PSYoungGen: 230400K->19135K(268800K)]   Indicates some small GCs which keep on happening in the young generation very frequently, This garbage collection cleans the Young Generation short living Objects.

Point3:  Meaning of the [GC [PSYoungGen: 230400K->19135K(268800K)]   line is around 256MB (268800K) is the Young Generation Size, Before Garbage Collection in young generation the heap utilization in Young Generation area was around  255MB (230400K)  and after garbage collection it reduced up to 18MB (19135K)

Point4:  Same thing we can see for Full Garbage collection as well….How effective the Garbage collection was…[Full GC (System) [PSYoungGen: 38388K->0K(268800K)] [PSOldGen: 13545K->51794K(1789952K)]  Here it says that around

[(old)1789952K +  young (268800K) ]  memory space means  OldGeneration is consuming 1.75GB space and Young Generation is consuming around 255 MB space  So it means total Heap size is around 2GB.

But analyzing the Garbage collection log like above technique Line by Line is very bad…so here we have an alternative was to analyze the Garbage Collection log in few Seconds to see how much time the Full Garbage collection is taking as an average and other reports…etc.

Step1): Download the “garbagecat-1.0.0.jar   (881 KB) ”  tool from the follwing link:http://garbagecat.eclipselabs.org.codespot.com/files/garbagecat-1.0.0.jar

Step2): Open a command prompt and then make sure that JAVA is set in the Path so that we can use “jar” utility of JDK to run the “garbagecat-1.0.0.jar”  tool.

Step3): Put the “garbagecat-1.0.0.jar”  file and the “GCLog.log” file in the same directory. then run the following command:

java      -jar      garbagecat-1.0.0.jar      GCLog.log

Step4): As soon as our run the above command you will see that in your current directory following files are created:

garbagecat-1.0.0.jar

GCLog.log

gcdb.lck

gcdb.log

gcdb.properties

report.txt

Step5): Now open the “report.txt” file to see the Overall report of the Garbage Collection something like following:

========================================

SUMMARY:

========================================

# GC Events: 12

GC Event Types: PARALLEL_SCAVENGE, PARALLEL_SERIAL_OLD

Max Heap Space: 2058752K

Max Heap Occupancy: 462018K

Max Perm Space: 39936K

Max Perm Occupancy: 19868K

Throughput: 95%

Max Pause: 306 ms

Total Pause: 1233 ms

First Timestamp: 4636 ms

Last Timestamp: 24449 ms

========================================

.

If you see that the Garbage Collection Max Pause time is very high like more than 5-7 Seconds for a 2 GB heap then you need to worry about it.

NOTE: Garbage collection  is a best utility to generate the Garbage Collection Report for Sun JDK and Open JDK for other JDKs you should use other tools for accurate results.

Garbage collection algorithms:

1) Mark-and-sweep collector:  This type of collector first traverses the object graph and marks reachable objects. It then scans the heap for unmarked objects and adds their memory to a list of available memory segments. This collector typically uses a single thread to do its work and is a stop-the-world collector.

2) Mark-and-compact collector:  A mark-and-compact collector, sometimes known as a mark-sweep-compact collector, uses the same marking phase as a mark-and-sweep collector. During the second phase, it compacts the heap by copying marked objects to a new area of the heap. These collectors are also stop-the-world collectors.

3) Copying collector:  This type of collector divides the heap into two areas, commonly known as semi-spaces. It uses only one semi-space at a time; the JVM creates all new objects in one semi-space. When the garbage collector runs, it copies any reachable objects it finds to the other semi-space as it finds them, thus compacting the heap as it copies live objects. All dead objects are left behind. This algorithm works well for short-lived objects, but the expense of continually copying long-lived objects makes it less efficient. Again, this is a stop-the-world collector.

4) Incremental collector:  Incremental collectors basically divide the heap into multiple areas and collect garbage from only one area at a time. This can create much smaller, though more frequent, pauses in your application. There are numerous approaches defining how the actual collection is handled from traditional mark-and-sweep to algorithms designed explicitly for use with multiple smaller areas like the train algorithm. See “Incremental Mature Garbage Collection Using the Train Algorithm” by Jacob Seligmann and Steffen Grarup (http://www.daimi.aau.dk/~beta/Papers/Train/train.html) for more information.

5) Generational collector:  This type of collector divides the heap into two or more areas that it uses to store objects with different lifetimes. The JVM generally creates all new objects in one of these areas. Over time, the objects that continue to exist get tenure and move into another area for longer-lived objects. Generational collectors often use different algorithms for the different areas to optimize performance.

6) Concurrent collectors:  Concurrent collectors run concurrently with the application, typically as one or more background threads. These collectors typically have to stop-the-world at some point to complete certain tasks, but the amount of time they halt all processing is significantly reduced because of their other background work.

7) Parallel collectors:  Parallel collectors typically use one of the traditional algorithms but use multiple threads to parallelize their work on multiprocessor machines. Using multiple threads on multi-CPU machines can dramatically improve the scalability of a Java application on multiprocessor machines.

Creating And Analyze log for Garbage Collection:

Creating GC log: Set memory argument in startWebLogic.cmd.

-Xms256m –Xmx512m –XX:CompailThreshold=8000 –XX:permSize=48m –XX:MaxPermSize=128m

analyze GC logs:  

Srep1:Go to admin console

Step2: Click the Adminserver

Step3: Select the monitors tab

Step4: Click the performance

Step5: Select the garbage collector

Security Realms: A security realm is a container for the mechanisms including users, groups, security roals, security palaces and providers. That are used to protect WebLogic resources, we can have multiple security reasons in a WebLogic servers domain. But only one can be set as the default realm.

This security realms page, lists is security realms that has been configured in this WebLogic server domain. Click the name of the realms to explore and configure that realm.

Creating users and groups in WLS:

Step1:  Goto security realm

Step2: Click on Lock And Edit

Step3: Select Myrealm

Step4: Select user and group tab

Step5: Click on New

Name               :  Ram

Designation     :  WebLogic_Admin

Provider          :  Select provider

Password         :  Ram123

ConformPwd  :  Ram123

——->    Ok

Step6: Click on Ram

Step7: Click on group Tab

Step8: Select Role

Step9: Click on Ok

Step10: Click on Save

Roals:

1) Admin Channel Users: Admin channel users can access the admin channel.

2) Administrator: Administrator can view and modify all the resource attributes and start, stop servers.

3) App Testing: App testing group.

4) Cross Domain Connecters: Cross Domain Connecters can make inter-domain  calls from foreign domains.

5) Deployers: Deployer can view all the resource attributes and deploy applications.

6) Monitors: Monitors can view and modify all resource attributes and perform operations not restricted by roles.

7) Operators: Operators can view and modify all response attributes and perform server life cycle operations.

 

Difference between unicast and multicast:

                      Unicast

1)  It is just one-to-one communication that takes place between the client and the server.

2)  In unicast, one packet is transmitted to only one destination at a time. So it recive only one reciver.

3) In unicast, the Internet protocol methods, such as, TCP(Transmission Control Protocol) andUDP(User Datagram Protocol) are used.

4) When a user uses the Windows Media Player, he or she has direct contact with the server. Each of the users using the unicast system utilises additional bandwidth.

                         Multicast

1) It is a multi-communication level and mainly multicasts enabled routers used for broadcasting.

2) In multicast sends packets to multiple destinations which is represented by a group address. So it receives multiple receivers.

3) When the former is more practical as only a small section of the Internet is multicast enabled.

4)  In multicast, there is no direct link between the user and the server. When using Windows Media Player, the user does not have any direct link with the server. Instead, once the user starts to use Windows Media Player, an .nsc or Next how channel is generated which is then delivered to the user from the server.

Trouble shooting issues:

_________________________________________________________________________________________________________

Deployment:   We will send error log to the application team for modification.

Caused By: WebLogic.utils.ErrorCollectionException:

There are 1 nested errors:

WebLogic.j2ee.dd.xml.AnnotationProcessException: Duplicate ejb name ‘BDAccountEjbBean’ found: annotation ‘Stateless’ on bean failed due to connection pool issue: we will fix connection pool issues and then redeploy the application

Out of memory issue during the deployment:

error: java.lang.outofmemory.permgenspace

this error occured due to space in perm area.

setDomainEnv.sh

xx:permsize 128m

xx:maxpermsize 128m

we have set intialpermsize=maxpermsize then restarted the servers, redeployed the application

If one or two application failed when we are triggering through scipt.we will fix that issue and do a deployment using console

JDBC:

1) DB down (raise a ticket to db team)

2) In correct hostname or port number ( raise a ticket to network team)

3) Data base connection lost ( telnetipaddress port )

4) Data base user_acc lock ( raise a ticket to db team for unlocking user_acc)

5) Invalid pakage error (raise a ticket to db team)

6) TNS listener error (raise a ticket to db team)

7) Schema does not exist (raise a ticket to db team)

8) Cannot allocate resource error

Intialcapacity : 5

max      : 15

increase max to 25

9) Connection leaks ( send error to application team)

10) Connection time out ( raise a tickect to db team for long running quries)

JMS:

stuck message issues

Check whether dest queue is available, check message format, check queue name.

rolling message issues (messages will run continuously in the loop)

delete those messages in the queue.

Disk Space:

If the disk space usage is 95%-100% then we will delete old log files

[root@localhost ~]# df -kh

FilesystemSize  Used Avail Use% Mounted on

/dev/sda2             3.8G  1.9G  1.8G  52% /

/dev/sda1              46M  9.2M   35M  22% /boot

tmpfs                 506M     0  506M   0% /dev/shm

/dev/sda3              14G  1.8G   12G  100% /home

du -kh (disk usage)

s

[root@localhost ~]# du -sh /home

1.8G    /home

[root@localhost bea10.3]# du -sh *

181M    jdk160_05

28K     logs

211M    jrockit_160_05

100M    modules

24K     registry.dat

8.0K    registry.xml

19M     user_projects

556K    utils

429M    wlserver_10.3

delete old log files

/home/bea10.3/user_projects/domains/sherkhan/servers/AdminServer/logs

rm -rf Adminserver.log00001  Adminserver.log00002 Adminserver.log00003

rm -rf Adminserver.out00001 Adminserver.out00002 Adminserver.out00003

rm -rf access.log00001 access.log00002 access.log00003

/home/bea10.3/user_projects/domains/sherkhan/servers/ms1/logs

rm -rf ms1.log00001

rm -rf ms1.out00001

or zip the log files

/home/bea10.3/user_projects/domains/sherkhan/servers/AdminServer/logs

gzip -r *

/home/bea10.3/user_projects/domains/sherkhan/servers/AdminServer

gzip -r logs

High CPU utilization:

top (linux)

prstat (solaris)

top – 07:45:22 up  3:03,  3 users,  load average: 0.16, 0.33, 0.17

Tasks: 113 total,   2 running, 109 sleeping,   0 stopped,   2 zombie

Cpu(s):  0.0%us,  0.7%sy,  0.0%ni, 99.3%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st

Mem:   1035400k total,  1020348k used,    15052k free,    77688k buffers

Swap:  2040212k total,        0k used,  2040212k free,   483724k cached

%cpu %Mem

9523 root      22   0  637m 239m 3660 S 98.7 23.7   0:12.79 java

If you find any zombie process count >50 raise a ticket to solaris admins

If any java processes are occupying 95-100% cpu usage then check the log files for any continuous looping messages or jdbc transaction time outs.

fix the problem and kill manged  server using kill -9 pid and restart the service instance.

404 error:

page can’t be displayed.

10.4.5 404 Not Found

The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent.

1) check whether they are using correct url

2) check whether apache server is running ( ps -ef | grephttpd) ( ps -ef | grep -i apache)

3) check the diskspace of Apache server if it is full then delete the log files (df -kh)

goto Apache2.2/logs

delete old logs

4) Check whether the deployed application is in active state

5) If the deployed application is failed then fix the issue and redeploy the application

Users are getting 404 error some times and they are able to access the application sometimes.

1) check whether all managed servers are in running state.

if one of the managed server is in shutdown state then bring up the server.

check the http requests in access.log file for all managed server

if you are getting 404 error in one of the managed server log. then check server log for any errors

i got the in log file:

port already in use

netstat -anp | grep 8002

if the port is listened on any other instance. restat managed server.

if the issue still persists then raise a reqest to network team..

500 error:

Service unavailable

this error is due to server down

check apache or WebLogic service instance is the server is down then start the server.

Slow response:

check All WebLogic server status. bring the servers up if they are down

check network handshake requests in application logs. If you found any issues related to n/w then raise request to n/w team.

check for stuck thread issues in WebLogic. If you found any stuck thread issues then take thread dump and analyze.

checkcpu usage for java processes.

check heap size of WebLogic server gc log or in console.

If the heap size is more than 80% then take heap dump send it to l3 support.

check no of users logged in to the application.

check for long running quiries from data base side.

check for latency in data base side.

check memory leaks in gc logs.

check connection leaks in the WebLogic server side.

check space in WebLogicunix machine.

check apache server space.

OOM(OutOfMemory):

–     Login to the Corresponding Server through Putty

–     Then Check the Status of the Server instances

–     Check the Server logs and Out logs for OutOfMemory Error

–     Take the Access logs at the time of OOM and it will be good if we take thread dump

If Server(s) is/are in Running State.

–     Analysis the Thread dump for the Cause of OutOfMemory Error (Due to App/Server)

–     Then Depending on the Server Status (if not in Running State) Restart the Server.

  1. i) OutOfMemory during deployment:
  2. If the application is huge(contains more than 100 JSPs), we might encounter this problem with default JVM settings.
  3. The reason for this is, the MaxPermSpace getting filled up.
  4. This space is used by JVM to store its internal datastructures as well
  5. as class definitions. JSP generated class definitions are also stored in here.
  6. MaxPermSpace is outside java heap and cannot expand dynamically.
  7. So fix is to increase it by passing the argument in startup script of the server: –XX:MaxPermSize=128m (default is 64m)
  1. ii) Memory related issues can be caused by many problems including:

? Java Heap is undersized for the environment

? There is not enough native memory available for the java process

? Web server is overloaded

Below are some general guidelines on how to address memory-related issues. In addition, you should search the “My Oracle Support” knowledge base for the specific “OutOfMemory” error message that you see in your PIA_WebLogic.log.

Also, you can collect further details on WebLogic memory usage by using monitoring tools referenced in section “Monitoring WebLogic Memory Usage”

General Guidelines on Fixing OutOfMemory Issues:

  1. First, you need to determine if WebLogic is running out of “native heap” memory or “java heap” memory. Typically you are able to tell this by checking the “OutOfMemory” error message in the PIA_WebLogic.log:
  2. If the error message refers to “native” or to a “thread” related error, it is an issue with “nativememory”. Examples of errors due to running out of native memory are:

? “Unable to create new native thread”

? “Error starting thread: Not enough storage is available”

Native memory errors are more likely to occur on PeopleTools 8.50 and lower versions where you are running a 32-bit java process (which has address space limitations)

  1. Any other error messages, are usually due to running out of java heap memory
  2. If you are running out of java heap, you may want to start by increasing the java heap settings (if you are unable to increase java heap setting, then the other option is to add more WebLogic PIA’s to the environment).

Increase the java heap setting as follows:

  1. First check the current heap setting by searching string “-Xmx” in your WebLogic log (for Unix, search PIA_stdout.log. For Windows, search NTservice-<DOMAIN_NAME>-PIA.log).

The “-Xmx” value shows you the current heap setting. For example, these settings show that the minimum heap (-Xms) and maximum heap (-Xmx) are set to 512mg:

Java command line=java -server –Xms512m –Xmx512m

  1. For PeopleTools 8.50, try increasing the heap (at 256mg increments) up to 1.5gb. For PeopleTools 8.51 or 8.52, you can increase the heap even higher, provided the server has enough memory available.

For Unix, you can change the heap setting in file setEnv.sh. Example:

JAVA_OPTIONS_LINUX=”-jrockit -XnoOpt -XXnoJITInline –Xms768m –Xmx768m

? For Windows, you will either need to change the setting in the Windows registry, or else change setting in setEnv.cmd and then rebuild the Windows Service

Refer to the following document for more details on changing the java heap setting:

Doc#638298.1: How To Increase/Decrease JVM Heap Size for WebLogic

  1. If you are running out of native memory heap, then you may want to consider doing the following:
  2. Lower the java heap setting (ieXmx/Xms settings) in order to allow more of the java process’ memory to be used for “Native Memory”. (see step 2b above, for instructions on changing java heap setting)

If the java heap is already being fully utilized, and you are unable to lower it, then you may want to consider adding additional PIA’s to your environment

  1. Lower the thread stack size. Note that the threads use native memory, so if you lower the thread stack size, then the threads will not consume as much memory. The thread stack size is specified using parameter “-Xss”. Refer to the following document for details

651285.1: WebLogic Error: “java.lang.OutOfMemoryError: unable to create new native thread”

Log files not rotating:

check the diskspace if it is full then delete old logs

check whether log4j properties file set in classpath

  1. Check the Status of the Server
  2. ./startWebLogic.sh
  3. ./startManagedWebLogic.sh <manageservername>
  4. [0R]
  5. Check through console.
  6. Check the disk Space(if full, Delete the logs and then need to restart the Server)
  7. du –kh (folder)
  8. df –kh (filesystem)
  9. avail capacity
  10. 45% 90%

If full , mv <source path><destination path>

Delete, rm –rf<filename: adminserver.log>

Stuck thread:

“[STUCK]”

When a transaction is running more than 5 minutes, a message (example below) is logged to the PIA_WebLogic.log.

<Apr 18, 2011 12:47:04 PM PDT><Error><WebLogicServer><BEA-000337><[STUCK] ExecuteThread: ‘4’ for queue: ‘WebLogic.kernel.Default (self-tuning)’ has been busy for “675” seconds working on the request …..

Note that the message shows that the thread is ‘STUCK’. But in fact, the thread may not be stuck, but is just taking a long time to complete. These threads often successfully complete, if given enough time.

If you see a lot of long-running threads, at the time users are experiencing problem, then this indicates that the web server is having issues processing threads, which may cause the web server to hang.

Long running threads can be caused by different issues. The problem often occurs due to issues on the app server or database subsequently causing the threads to queue up and wait on the web server. So if you see a lot of stuck threads, you may want to troubleshoot further by doing the following:

  1. Get a thread dump as described in section “Creating/Analyzing Thread Dumps”. The thread dump may help you determine whether the threads are getting hung up on the app server or database.
  2. Have your DBA check for long running SQL’s and/or DB locks
  3. You can also look at the ‘Stuck’ thread messages in the PIA_WebLogic.log to see what user(s) are running the transactions and the specific component they are running. This may help you determine if there is a specific user and/or transaction that is causing the problems.

Port Conflict Issue:

While configuring a new WebLogic instance and starting it, that might be get an issue like : “Port already in use”. There could be many reasons for this one.

  1. on the same machine multiple standalone instances might be running one of the instance already used that port which you have given for new configuration.
  2. apache might be running with the same port.
  3. middleware might be running on the same machine with same port

On Solaris Operating environment we have 2 options:

  1. usingpfiles command

netstat –na|grep –> identify port in use

pfiles |grep -isockname |grep port –> look for every java process is initialized by startWebLogic.sh or startManagedWebLogic.sh

  1. Another way costly one (Third party package) to find the process that is using particular port is :

lsof -itcp:

  1. Best way is perl script using a method it will check only standard ports which are used by the system.

getservbyport(intport_number, const char *protocol_name)

#!/usr/bin/perl

($name, $aliases, $port_number, $protocol_name) = getservbyport(7001, “tcp”);

print “Name = $name\n”;

print “Aliases = $aliases\n”;

print “Port Number = $port_number\n”;

print “Protocol Name = $protocol_name\n”;

JVM memory arguments:

-XX:-PrintGCDetails outputs detailed  information at each collection

-XX:-PrintGCTimeStamps outputs a time stamp at the start of each collection

-xloggc=<filename>           outputs gc information to the specified file

-XX:-DisableExplicitGC disable calls to system .gc( )

– -XX:NewSize=2m default size of new generation

-XX:MaxNewSize=size maximum size of the new generation

-XX:PermSize=64m default size of permanent generation

-XX:MaxPermSize=64m maximum size of the permanent generation

– -Xms256m Initial heap size

–Xmx512m  maximum heap size

-xx:survivor Ratio=<value>   Ratio of survivors spaces to young generation

-XX:-UseParallelGC   Use parallel garbage collection for scavenges.

THREAD DUMP

Tread dump:- Thread dump provides a snapshot of the current active live threads. It provides the stack trace of all the java threads in the JVM. It is used when the server is hung and we want to see the threads executing and take their dump.

There are different ways to take thread dump.

In unix: kill -3 <pid>

In windows:  ctrl+break

WebLogic.Admin utility:  javaWebLogic.Admin -url t3://localhost:7001 -username WebLogic -password WebLogic THRED_DUMP

WLST Scripting:

connect(‘WebLogic’,’WebLogic’,’t3://localhost:7001′)

cd(‘server’)

cd(‘AdminServer’)

TreadDump()

disconnect()

exit()

Admin console: 

Step1: login to the admin console

Step2: Click on server

Step3: Navigate to servers

Step4: Click monitor tab

Step5: Click on tread

Step6: Click on the dumpthread stack.

Locating the Thread Dump:  The thread dump is placed in the WebLogic log file. The log file location varies depending on the OS platform:

For UNIX: the output is sent to:

<PS_HOME>/webserv/<DOMAIN_NAME>/servers/logs/PIA_stdout.log

For Linux: the output is sent to:

<PS_HOME>/webserv/<DOMAIN_NAME>/servers/logs/PIA_stderr.log

For Windows: the output is sent to:

<PS_HOME>\webserv\<DOMAIN_NAME>\servers\PIA\logs\NTservice-<DOMAIN_NAME>-PIA.log

Analyzing a Thread Dump: The thread dump can be a bit challenging to analyze, and you may need assistance from an Oracle Support Engineer. Below are some tips on how to analyze the thread dump. This information is broken out into the following sections:

  1. General Information about the thread dump
  2. Overview of types of threads commonly seen in thread dump
  3. Examples of different issues you may observe in the thread dump

1) General Information about the Thread Dump:  Note that the thread dump always begins with this line:

===== FULL THREAD DUMP ===============

And ends with this line:

===== END OF THREAD DUMP ===============

The first line of the thread dump shows when the thread dump was created, followed by the exact java version you are using.

Example:

Mon Apr 18 12:46:56 2011

Oracle JRockit(R) R28.0.0-679-130297-1.6.0_17-20100312-2123-windows-ia32 

2) Overview of Types of Threads commonly seen in Thread Dump:

  1. i) Threads waiting for Requests:  You will always see some threads that are just waiting for work, as WebLogic always allocates some threads to be available and ready to process any incoming requests. These threads can easily be identified because you’ll see“ExecuteThread.waitForRequest”in the call stack. These threads will be in ‘ACTIVE’ or ‘STANDBY’ mode. These threads do not have much significance when troubleshooting. However, if you see a lot of these threads waiting for requests (20 or more), it most likely indicates that the environment is just recovering from a very heavy load, when the thread dump was taken (and as the load diminishes, WebLogic will remove many of these extra threads that are waiting for requests)

Ex: at WebLogic/work/ExecuteThread.waitForRequest(ExecuteThread.java:157)

  1. ii) Socket Muxer Threads: You will also see approximately two to five socket muxer threads. These threads’ main responsibility is to read the request off the socket and pass the work to the appropriate thread. WebLogic allocates a percentage of execute threads from the self-tuning thread pool to be Muxer threads. Usually you will see three or four of these threads:

“ExecuteThread: ‘0’ for queue: ‘WebLogic.socket.Muxer'” id=25 idx=0x60 tid=2068 prio=5 alive, in native

iii) ListenThreads: You will also see approximately six “listen threads”, usually three for SSL and three for non-SSL. The purpose of these threads is to wait for connections to arrive. All browser requests enter the WebLogic server through these threads.

“DynamicListenThread[Default]” id=39 idx=0x90 tid=2812 prio=9 alive, in native

“DynamicSSLListenThread[DefaultSecure]” id=40 idx=0x94 tid=3148 prio=9 alive, in native

  1. iv) Jolt Connection Threads: WebLogic Server and the Tuxedo Application Server use Jolt to communicate with each other. PIA creates two threads inside the WebLogic’s JVM per Jolt connection. For each Jolt connection made between WebLogic and the Tuxedo Application Servers, you will see a LLENwReader and a LLENwWriter thread in the thread dump:

“LLENwReader” id=52 idx=0xc4 tid=4408 prio=5 alive, in native, daemon

“LLENwWriter” id=53 idx=0xc8 tid=7828 prio=5 alive, waiting, native_blocked, daemon

  1. v) Threads waiting on Application Server: If the web server is waiting on the app server to process a request, you will see the following thread (below)

at bea/jolt/IOBuf.waitOnBuf(IOBuf.java:119)

3) Examples of Different Issues you may Observe in Thread Dump: Below are examples of different issues and the thread stacks you may observe.

Many threads waiting on App Server: If you see a lot of threads such as the one below, then this means that many of the WebLogic threads are waiting on the application server to finish processing the request:

at bea/jolt/IOBuf.waitOnBuf(IOBuf.java:119)

  1. i) Many threads processing the same call stack: If you see many threads all processing the same call stack, then you may need to review contents of the call stack in order to troubleshoot the issue. For example, in one case, the web server hung and the thread dump showed hundreds of threads like the one below. This was caused by an issue with a proxy server configuration, causing all threads to get hung up at logout:

com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:798)

psft.pt8.psp.logoutAccessedPIAs(Unknown Source)

  1. ii) All threads busy and waiting on one thread: By design, the PIA does not allow more than one request per HTTP session, to be submitted to the application server. If the PIA receives multiple requests from the same HTTP session, it will queue up all subsequent requests and process just one at a time. Typically, there should not be situations where the PIA receives multiples requests from the same HTTP session. However, this can occur in the following situations:
  2. You are using a proxy server that is re-submitting requests to the web server if a response is not received within a certain time.

-OR-

  1. A user submits a long-running request, and while waiting for the request to finish, the user continuously attempts to submit more requests.

When one of the above scenarios occurs, in the thread-dump you see one request waiting on Jolt to get response from the App-Server and many other threads waiting for the lock on the session to be released. Below are excerpts from a thread dump, showing this situation:

  1. a)There are many threads like this that are “blocked”, and all the threads are waiting on the same lock #.

— Blocked trying to get lock: java/lang/String@0x27D36AC0[thin lock]

  1. b)The thread that is holding the lock on “0x27D36AC0” (that all blocked threads are waiting on), is usually processing a jolt request (ie it is waiting on the application server):

at bea/jolt/IOBuf.waitOnBuf(IOBuf.java:119)

^– Holding lock: java/lang/String@0x27D36AC0[thin lock]

  1. c)At the end of the thread dump, you may see a list of “blocked locked chains”. In this list, you’ll notice that all threads are waiting on one thread: “Thread #0” in this example. Which happens to be a jolt request (ie it is waiting on application server)

Blocked lock chains

===================

Chain 2: “[ACTIVE] ExecuteThread: ‘2’ for queue: ‘WebLogic.kernel.Default (self-tuning)'” id=35 idx=0x80 tid=3964 waiting for java/lang/String@0x27D36AC0  held by:

“[ACTIVE] ExecuteThread: ‘0’ for queue: ‘WebLogic.kernel.Default (self-tuning)'” id=16 idx=0x48 tid=180 in chain 1

Chain 3: “[ACTIVE] ExecuteThread: ‘3’ for queue: ‘WebLogic.kernel.Default (self-tuning)'” id=44 idx=0xa4 tid=4620 waiting for java/lang/String@0x27D36AC0  held by:

“[ACTIVE] ExecuteThread: ‘0’ for queue: ‘WebLogic.kernel.Default (self-tuning)'” id=16 idx=0x48 tid=180 in chain 1

Chain 4: “[ACTIVE] ExecuteThread: ‘4’ for queue: ‘WebLogic.kernel.Default (self-tuning)'” id=49 idx=0xb8 tid=1120 waiting for java/lang/String@0x27D36AC0

held by:

“[ACTIVE] ExecuteThread: ‘0’ for queue: ‘WebLogic.kernel.Default (self-tuning)'” id=16 idx=0x48 tid=180 in chain 1

Analysing ThreadDump by using Summari tool:

Download: The binary is available for download at                                                   http://yusuke.homeip.net/samurai/en/samurai.jar

How to launch samurai: You can simply double-click to launch Samurai on your desktop or type as following in your command prompt.

$java  -jar  samurai.jar

Automatic update is not available with this way. Please check and download latest version manually.

Step1: Drag and drop the ThreadDump into summary tool

Step2: When Samurai detects a thread dump in your log, a tab named “Thread Dump” will appear.

Step3: You can just click “Thread dumps” tab to see the analysis result. Samurai colors idle threads in gray, blocked threads in red and running threads in green.

There are two resultant views and Samurai shows “Table view” by default.
In many cases, you are just interested in the table view and the sequence view. Use the table view to decide which thread needs be inspected, the sequence view to understand the thread’s behavior.

Result1:

Result2:

HeapDump: A Heapdump is a snapshot of JVM memory – it shows the live objects on the heap along with references between objects. It is used to determine memory usage patterns and memory leak suspects. It is useful to analyse OOM(OutOfMemory) situations.

To take Heap dump:

Eclipse Memory Ananlyser is a very useful tool to analyze heap dumps. It has a lot of features such as Memory Leak detection where it runs an automated test to determine the suspected leaks.

Step 1) Start the WebLogic Server, with the application in active state which causes memory leak.

Step 2) Get the process id of the server using jps

Step 3) Access the application that causes memory leak

Step 4) Take heap dump at regular interval using jmap.

jmap -dump:format=b,file=dump1.bin [processId]

Analyzer HeapDump by using Eclipse MAT:   Analyzer  Open the Heap Dump in Eclipse Memory Analyzer (U can download it fromhttp://www.eclipse.org/mat/downloads.php) Approximate size is 42 MB. Just u need to extract this Zip then u can directly start (no Installation needed)

Step1:

Step2: Observe the heap usage of Objects in the heap dumps. If the object instance keeps on increasing in the subequent heap dumps, force a garbage collection from the WebLogic Server console.

Step3: Take heap dumps again and open in the Eclipse Memory Analyzer. If the number of instances still don’t go down for those objects, you can expect to see this
<Jul 16, 2010 10:49:15 AM IST> <Critical> <Health> <BEA-310003> <Free memory in
the server is 47,856 bytes. There is danger of OutOfMemoryError>
Exception in thread “Thread-12? java.lang.OutOfMemoryError: Java heap space
at demo.MemoryLeakTest.runTest(MemoryLeakTest.java:14)
at jsp_servlet.__memoryleak$1.run(__memoryleak.java:86)
at java.lang.Thread.run(Thread.java:619)

If the leak is happening due to a WebLogic Class, it can be a known issue or an undiscovered BUG. You need to get in touch with Oracle Support. If it’s an Application Class, you need to contact the developers. Out of Memory can also happen dude to third party codes such as database drivers.

How to install Eclips MAT? How to Analyze Heapdump using Eclips MAT and Jhat tools:

Step1: download the Eclips MAT

Step2: Extract Memory Analyser zip file and open MemoryAnalyzer.ini

Step3:  Double-click on MemoryAnalyzer.exe to start Memory Analyser Tool

Step4: Select Search for new features to install and click Next

Step5:  Accept the license agreements and click Next

Step6: Click Finish to install the extensions

Step7: Click Install All to ignore the warning

Step8: Restart Memory Analyser to reflect changes.

JPROFILE

Introduction: JProfiler eases developers in creating more efficient applications by improving their performance. It is oriented towards testing and exploring different aspects of the performance of a Java program, concerning the operation of the JVM making use of available platform resources. JProfile is mainly using to find out the memory leaks of JVM.

JProfiler provides the following functionality:

  1. Memory consumption measurement
  2. Memory stack frames tracing
  3. CPU loads profiling
  4. Momentary heap allocation information
  5. Thread state progress statistics
  6. Visual representation of JVM work loads by different parameters
  7. Source code reference
  8. Garbage collection during profiling
  9. Remote profiling
  10. Profiling only of a particular stage or a combination of several stages of the program life cycle
  11. Using different target environments
  12. Saving profiler information for further examination
  13. Exporting profiler information in text format

JProfiler is a commercially licensed Java profiling tool developed by ej-technologies GmbH, targeted at Java EE and Java SEapplications.

  1. JProfiler works both asa stand-alone application and as a plug-in for the Eclipse software development environment.
  2. JProfiler supports local profiling (analysis of applications running on the same machine as the JProfiler software) and remote profiling (analysis of Java applications running on remote machines)
  3. Enables both memory profile to assess memory usage and dynamic allocation leaks and CPU profiling to assess thread conflicts.
  4. Provides visual representation for the virtual machine load in terms of active and total bytes, instances, threads, classes, Garbage Collector activity.

Download Jprofiler(http://www.ej-technologies.com/download/jprofiler/files.html)

You will be asked to provide your name and e-mail id.An Evaluation Key will be mailed to you.

At the time of installation, you will be prompted for the installation key, copy it from your mail and paste it as shown in the screenshots.

NOTE: It is not recommended to use JProfiler in Production Environments .as it consumes more resources.which may not be desired in Production Envs.

Patch: patch is a piece of software designed to fix problems[1] with, or update a computer program or its supporting data. This includes fixing security vulnerabilities[1] and other bugs, and improving the usability or performance. Though meant to fix problems, poorly designed patches can sometimes introduce new problems (see software regressions). In some special cases updates may knowingly break the functionality, for instance, by removing components for which the update provider is no longer licensed or disabling a device.

Patch management is the process of using a strategy and plan of what patches should be applied to which systems at a specified time.

Patch installation steps:

            Step1: Take the back up of bea home directory and config.xml file

Step2: Copy all patches along with the patch-catalog.xml file to the Linux box.at                                      */oracle/utils/bsu/cache_dir

Step3: Stop all the servers including admin.

Step4: On the Linux machine go to the bsu folder. ( */oracle/utils/bsu/) and run the                                    following command

               Ex: ./bsu.sh -prod_dir=<WebLogic home> -patchlist=<patch name> -verbose -install

Step5: Use the below command to check the output

*\oracle\utils\bsu> ./bsu.sh -view -prod_dir=/usr/local/oracle/wls1033/wlserver_10.3                                                        -status=applied

Step6: Start the all servers.

            Step7: Check the application health.

Commands:

      Patch installation: ./bsu.sh -prod_dir=/usr/local/oracle/wls1033/wlserver_10.3 –                                                              patchlist=4EWM -verbose   -install

      Patch Uninstallation: ./bsu.sh -remove -patchlist=1FKM –                                                                                                   prod_dir=/usr/local/oracle/wls1033/wlserver_10.3 –verbose

      Check for what are all patches installed: ./bsu.sh -view –                                                                                            prod_dir=/usr/local/oracle/wls1033/wlserver_10.3 -status=applied

Creating patch logs:  ./bsu.sh -report -log=test.log -log_priority=trace

Screen shots

Applying patches on WebLogic Server using Oracle Smart Update(BSU):  Oracle provides the Smart Update utility to apply patches and upgrade the WebLogic Server installations. Oracle’s WebLogic Server is now a critical component  of Fusion Middleware and every other component of Fusion Middleware requires WebLogic Server to be installed as  a pre-requisite. Applying patches and upgrading WebLogic Server is quite straight forward using the Oracle’s Smart Update utility,the documentation for Oracle Smart Update Utility can be found here.

Step1: Shutdown and take a complete backup of the WLS environment.

The Startup/Shutdown scripts are placed in   $WLS_HOME/user_projects/domains/<domain_name>/bin

Step2: The Oracle Smart Update Tool is located at  “$WLS_HOME/utils/bsu

Step3: Launch the the Oracle Smart Update Tool :

Step4: Once logged in, you will be presented with Oracle Smart Update Dialog.

Step5: You can choose to “Register for security updates”, this is usually helpful to keep yourself updated with the latest security updates and product expiration.

Step7: On the left pane you would see   WebLogic Servers installed  and on the right pane you will see two tabs. “Get Patches” and “Manage Patches” and a section to show the downloaded patches.

Step8: Now select the patches and hit the “Download Selected” button, you will be prompted if you wish to to validate and resolve conflicts.

Step9: The Validation completes with the following message:

Step10: Click “OK” to proceed downloading the patches.

Step11: Once the patches are downloaded and click the “Manage Patches” tab to proceed with the patch application. In the “Downloaded Patches” section you will notice the patches downloaded, click the “up” arrow to apply the patch

Step12: You will be prompted with couple of prompts for you to take action:

Click “OK” to proceed

Step13: Once more the validation is done, click “OK” to proceed                                       Step14:  One more “Are you sure?” prompt, annoying I know. Click “Proceed” to apply the patch

Step15:  Once the patch is applied you’d see the patch in the Applied Patches “Default” tab

That  the patch is now applied. If you face any issues its worth investigating the server logs.

Log File Location: The log file location is:

C:/bea/user_projects/domains/ram_domain/servers/admin server/log

1) Access log:

2) Serveer log: The server log records information about events such as the startup and shutdown of servers, the deployment of new applications, or the failure of one or more subsystems. The messages include information about the time and date of the event as well as the ID of the user who initiated the event.

3) Domain log: This will have about domain information. (domainname.log)

4) AdminServer log: This will have about the AdminServer information. (AdminServer.log)

5) Out logs: This will have about the JVM output. (Adminserver.out)

6) Application logs: This will have information about each and every application which we deployed in server.

7) Node Manager logs: This will have information about Node Manager. (node manager.log)

(C:/bea/WebLogic91/common/nodemanager/nodemanager.log)

Diff b/w WebLogic 8,9,10 & 11 versions:

Features WLS8.1 WLS9x WLS10.3 and 11G
JDBC Connection Pool-Max Capacity PM-25(AdminServer)

DM-15(AdminServer)

PM-15(managed Server)

PM and DM-15

(AdminServer and Managed Server)

PM and DM-15

(AdminServer and Managed Server)

Execute ThreadDefaultThreadCount PM-25(AdminServer)

DM-15(AdminServer)

PM-15(managed Server)

PM and DM-15

(AdminServer and Managed Server)

PM and DM-15

(AdminServer and

Managed Server)

JMS Services Queue and Topics can beCreated under JMS Server Queue and Topic Services Can be Created only by JMS Module Queue and Topic Services

Can be Created only by JMS Module

JMS Server Starting and Stopping Not Available Not Available Particular JMS Instances Can be Stopped
JMS Advanced features Quota,SAF(Store and Forward Agents) is not Available Quota,SAF(Store and Forward Agents)is Available Quota,SAF

(Store and Forward Agents)

is Available

JMS Configuration repository NO Config file for JMS Separate Configuration File for JMS inside the  WebLogic Domain Separate Configuration File for JMS inside the  WebLogic Domain
JMS transaction No JMS transaction Logs No JMS transaction Logs JMS transaction Logs
Cluster—Unicast  Address No Unicast Address No Unicast address Unicast Address is available
JMS Destination KeyCustom Key TypeFacility No Custom Key Type No Custom Key Type No Custom Key Type
Garbage Collector Process Scheduled GC No GC NO GC Scheduled Garbage Collection
XML—Xpath and XLang—WebService Not Supported Supported Supported
EJB 3.0 Not Supported Supported Supported
Advanced WEbservice Support by SOA Not Supported NOT Supported Supported
Oracle Fusion and Ebusiness Suite Integration Not Supported Not Supported Supported
Log File(Default Transaction Log) Available Not Available Not Available
JDBC log Available Not Available Not Available
Jolt Connection Pools Not Available Available Not Available
Config folder Not Available Available Available
Prepare, Active states No Prepare state for application. Only active state Prepare state for application, This optimises memory utilization. Prepare state for application, This optimises memory utilization.
Deployment fails Server dosent come up if deployment fails Server boots in ADMIN mode if deployment failes Server boots in ADMIN mode if deployment failes
configuration information All configuration information is in one config.xml Seperate xml files for domain config and jms modules are added Seperate xml files for domain config and jms modules are added
Side by side deployment Side by side deployment is not possible Side by side deployment is possible Side by side deployment is possible
Lock and Edit Not Available Available Available
Connection pools We have connection pools and datasources We have datasources and connection pools are inside datasources. We have datasources and connection pools are inside datasources.
app inf lib and classes Not Available Available Available
Deployment updates We need to delete and redeploy from admin console We can update the application using admin console We can update the application using admin console
Queues We have exclude queues. We have work managers We have work managers
WebLogic Scripting Tool(WLST) Not Available Available Available
license.bea genericlicense.bea file for each version that you candownload from Oracle. genericlicense.bea file for each version that you candownload from Oracle. In WLS 10 MP2 and above, the downloadedsoftware comes with a fully blown license so no need to evendownload a new one from Oracle.

Ticketing Tools

1) BMC Remedy ticketing tool:

IITL(Information Technology Infrastructure Library)Process:

  1. Change Management.
  2. Incident Management.
  3. Problem Management.
  4. Release Management.

Different Types of Tickets:

1) Incident ticket which identity by INC: Something happen accidently the ticket which raises manually or automatically.

Ex: WebLogic server failed to startup  ticket will be raised automatically.

2) Change ticket by CRQ: If somebody wants to do change or creating a new during that time the change management ticket uses.

3) Problem ticket which identified by PBC: It is used to managed problem investigations known errors and solutions DB(Data Base)entries. Problem management can practically prevent the occurency of incidents errors and addition management.

States of Tickets:

1) New: Displays when creating a new record or ticket.

2) Assigned: Auto set to assigned when you create a new incident assigned to some one.

3) In progress: Actively working on that incident also must select at assigning a record to yourself.

4) Pending: can’t work on that incident must fill in the reason failed or pending. It means keeping the ticket on hold for some time.

5) Resolved: A solution or work around has been found, must fill in the status reason failed.

6) Closed: The system will auto-close in five business days or if user wants close the ticket we can close immediately or manually.

7) Canceled: If record was an accident or the issue doesn’t need resolution customer or support staff may task incident as cancelled.

Urgency or priority:

1) Critical: It will impact business.

2) High: It will import only for that server or only for that particular batch systems.

3) Medium: It is not that much critical but still we need take task on that job.

4) Low: It does not require to consider this point.

Based on how many systems, process and business units are afforded as well as if the work around is possible or not.

2)  Amdocs clarify CRM Support:

Handling Change Request: If any config  changes have been done. The change request will be raised.

Status of Tickets:

1) Requested: The ticket is in requested state. These are different levels of approvals needed for implementing any change request.

Level1:  Line manager ready.

Level2:  Production co-ordinater ready.

Level3:  Change co-ordinater ready.

Level4:  Skill group implementation(Request implementer) ready.

2) Ready: While getting the approvals the ticket will be in ready state.

3) Scheduled: After getting the approvals the ticket will come in to scheduled state.

4) Accepted: For implementing any change request ticket should be in scheduled state. The request has to be accepted.

5) Resoled:

6) Failed

7) Rejected

Clustering on Apache/Tomcat using Jakarta mod_jk

Clustering Tomcat Servlet Engines is interesting for two reasons: load balancing and failover.

Fail-over

Fail-over is probably the most important issue for web applications. If the front end load balancer detects that one of the nodes has gone down it will redirect all the traffic to the second instance and your clients, apart from any on the failed node, won’t even notice. Well that’s the theory – if the site is under high load you may find that the surviving Tomcat cannot cope with the increased load and fails in short order. You need to size and correctly configure your hardware and software.

You can also manually fail-over a system to upgrade the hardware, JVM or other application without end users being aware. If your management doesn’t tolerate any downtime this is an extremely important feature. Your JVM’s can be installed on separate or the same physical host. The latter leaves you exposed to hardware problems.

Load-balancing

There are two easy ways to increase application performance without tuning the application software itself. Buy faster hardware or add more hardware. If you add a second server running Tomcat you can use load balancing to distribute the work between the two servers. Requests come in to the Apache front end, static content is served directly by Apache and any dynamic requests forwarded to the Tomcats based on some algorithm. The Apache Jakarta mod_jk connector is the most popular way of doing this.

In this exercise we will configure two physical computers each running one Apache web server and two tomcats for both failover and load balancing. The example ignores any back-end data storage considerations but will discuss load balancing between the two computers.

Front End Load Balancing

DNS Round Robin

The simplest technique for load balancing between the two Apache front end servers is the DNS Round Robin strategy. This performs load balancing by returning a different server IP address each time a (DNS) name server is queried by a client. It is usually found as front-end service on large clusters of servers to provide a server address that is geographically close to the client. Normally an intelligent name server such as lbnamed is used. This will poll the web servers in the list to check if they are online and not overloaded.

DNS Load balancing has some significant drawbacks. Addresses may be cached by clients and local DNS resolvers and it can be hard to accurately manage load. The system simply shuffles the order of the address records each time the name server is queried. No account is taken of real server load or network congestion.

Load Balanced

The advantage of using a load balancer compared to using round robin DNS is that it takes care of the load on the web server nodes and will direct requests to the node with the least load. It can also remove failed nodes from the list. Some round robin DNS software can do this, the problem is they have little control about how client’s cache IP addresses.

Many web applications (e.g. forum software, shopping carts, etc.) make use of sessions. If you are in a session on Apache node 1, you would lose that session if suddenly node 2 served your requests. This assumes that the web servers don’t share their session data, say via a database.

For DNS load balancing this is not a problem, the IP address will resolve to a single server. However a front end load balancer must be aware of sessions and always redirect requests from the same user to the same backend server.

There are a number of packages to support front end load balancing. For example RedHat Piranha or Ultramonkey. There are also hardware/firmware solutions from companies such as Cisco.

Apache / Tomcat mod_jk configuration

Apache is configured using the httpd.conf file. Apache – Tomcat workers are defined in a properties file called workers.properties. When starting up, the web server plug-in will instantiate the workers whose name appears in the worker.list property, these are also the workers to whom you can map requests. Tomcat is configured using the server.xml file.

The values given here are a starting point. They will need to be reviewed and tuned as system load changes.

Apache httpd

MaxClients

MaxClients limits the maximum simultaneous connections that Apache can serve. This value should be tuned carefully based on the amount of memory available on the system.

MaxClients ? (RAM – size_all_other_processes)/(size_apache_process(es))
If Apache is using the PreFork MPM a separate Apache process will be created for each connection, so the total number of processes will be MaxClients + 1. Each process will have a single connection the mod_jk pool to talk to a Tomcat instance. The Worker MPM module uses the thread model to handle client requests and should be slightly more efficient.

As a guide Apache MaxClients and the number of available Tomcat threads configured in server.xml should be equal. Mod_jk maintains persistent connections between Apache and Tomcat. If the Apache front end accepts more users than Tomcat can handle you will see connection errors. In a clustered environment we have to take account of errors the load balancer makes when it tracks the number of concurrent threads to the Tomcat back-ends so the following formula is a starting point:

Apache.MaxClients = 0.8 * (Tomcat-1.maxThreads + … Tomcat-n.maxThreads)
i.e.

400 = 0.8 * (250 + 250)
Use:

httpd –V to see how Apache is compiled
ps or top to see how much memory is being used on the system
vmstat to tune memory usage
The Sezame Apache front end also serves static content and a number of client connections will be used for this purpose for each requested page of content.

MaxRequestsPerChild

Sets the total number of requests that each Apache process will handle before it quits. This is useful to control memory leaks issues with loaded modules. Because mod_jk maintains permanent connections in its pool between Apache and Tomcat we will set this to zero which means that unlimited requests can be handled.

Redirection requests to the mod_jk load balancer

We will need to load the mod_jk module (a shared library) into Apache when it starts and tell the module where to find the workers.properties file and where to write logs (useful for debugging/crashes).

LoadModule jk_module modules/mod_jk-apache-2.0.55.so

JkWorkersFile “/etc/apache2/workers.properties”
JkLogFile “/var/logs/apache/mod_jk.log”
JkLogLevel info
JkLogStampFormat “[%a %b %d %H:%M:%S %Y] ”
We then have to tell Apache to redirect any requests for JSPs and servlets (in this case resources in the servlet virtual directory ending in .do) to the load-balancer for processing.



LoadModule rewrite_module modules/mod_rewrite.so

Alias /image/ “/var/localhost/htdocs/images/”

# Delegate the following paths to Tomcat
JkMount /*.jsp loadbalancer
JkMount /servlet/*.do loadbalancer

Mod_JK Worker.propertiesjboss5

The following is a suggested configuration for two physical servers with a pair Tomcat instances running on each. The rational is that the front end load balancer will distribute load between the two physical hosts. The f/e load balancer is itself configured for fail-over using a virtual IP address and a heartbeat type operation to determine if the balancer is still operational.

Each physical server has an Apache web server and two tomcat servlet engines. Apache will serve static content either from an NFS mounted disk or from a replicated file system using something like RepliWeb. Apache will load balance between the two local tomcats but if these become overloaded or crash it can forward requests on to the other physical server.

The Apache mod_jk load-balancer can distribute work using one of three methods:

B (busyness): choose the worker with the lowest number of requests currently in progress
R (requests): choose the worker that has processed the lowest number of requests overall
T (traffic): choose the worker that transmitted the lowest number of bytes
The sticky_session is set to true to maintain a session between the client and Tomcat.

worker.list=loadbalancer

worker.loadbalancer.type=lb
worker.loadbalancer.method=B
worker.loadbalancer.balance_workers=worker1,worker2,worker3,worker4
worker.loadbalancer.sticky_session=true
This is common configuration for all workers. Note if Prefork MPM is used you will want to set the cachesize property. This should reflect the estimated average concurrent number of users for the Tomcat instance. Cache_timeout should be set to close cached sockets. This reduces the number of idle threads on the Tomcat server. Note that connection_pool_size and connection_pool_timeout should be used with mod_jk 1.2.16 and later.

If there is a firewall between Apache and Tomcat the socket_keepalive property should be used. Socket_timeout will tell Apache to close an ajp13 connection after some inactivity time. This also reduces idle threads on Tomcat.

# common config
worker.basic.type=ajp13
worker.basic.socket_timeout=300
worker.basic.lbfactor=5
These are the two workers. Notice the use of the local_worker property. The load-balancer will always favour local_workers with a value set to 1.

worker.worker1.host=server1
worker.worker1.port=8009
worker.worker1.local_worker=1
worker.worker1.reference=worker.basic

worker.worker2.host=server1
worker.worker2.port=8010
worker.worker2.local_worker=1
worker.worker2.reference=worker.basic

worker.worker3.host=server2
worker.worker3.port=8009
worker.worker3.local_worker=0
worker.worker3.reference=worker.basic

worker.worker4.host=server2
worker.worker4.port=8010
worker.worker4.local_worker=0
worker.worker4.reference=worker.basic
Tomcat Configuration

Http access is only required by administrators for checking if a Tomcat instance is still running by connecting directly to the specified port. The firewall should block client access to this port.


The Tomcat instance must listen on the same port as is specified in the corresponding worker’s section in worker.propeties.


maxThreads should be configured so that the CPU can be loaded to no more than 100% without seeing JVM error messages about insufficient threads.

The Engine jvmRoute property should correspond to the worker name in the worker.properties file or the load balancer will not be able to handle stickyness.

Weblogic 12.C

weblogic 001 weblogic 002 weblogic 003 weblogic 004 weblogic 005 weblogic 006 weblogic 007 weblogic 008 weblogic 009 weblogic 010 weblogic 011 weblogic 012 weblogic 013 weblogic 014 weblogic 015 weblogic 016 weblogic 017 weblogic 018 weblogic 019 weblogic 020 weblogic 021 weblogic 022 weblogic 023 weblogic 024 weblogic 025 weblogic 026 weblogic 027 weblogic 028 weblogic 029 weblogic 030 weblogic 031 weblogic 032 weblogic 033 weblogic 034 weblogic 035 weblogic 036 weblogic 037 weblogic 038 weblogic 039 weblogic 040 weblogic 041 weblogic 042 weblogic 043 weblogic 044 weblogic 045 weblogic 046 weblogic 047 weblogic 048 weblogic 049 weblogic 050 weblogic 051 weblogic 052 weblogic 053 weblogic 054 weblogic 055 weblogic 056 weblogic 057 weblogic 058 weblogic 059 weblogic 060 weblogic 061 weblogic 062 weblogic 063 weblogic 064 weblogic 065 weblogic 066 weblogic 067 weblogic 068 weblogic 069 weblogic 070 weblogic 071 weblogic 072 weblogic 073 weblogic 074 weblogic 075 weblogic 076 weblogic 077 weblogic 078 weblogic 079 weblogic 080 weblogic 081 weblogic 082 weblogic 083 weblogic 084 weblogic 085 weblogic 086 weblogic 087 weblogic 088 weblogic 089 weblogic 090 weblogic 091 weblogic 092 weblogic 093 weblogic 094 weblogic 095 weblogic 096 weblogic 097 weblogic 098 weblogic 099 weblogic 100 weblogic 101 weblogic 102 weblogic 103 weblogic 104 weblogic 105 weblogic 106 weblogic 107 weblogic 108 weblogic 109 weblogic 110 weblogic 111 weblogic 112 weblogic 113 weblogic 114 weblogic 115 weblogic 116 weblogic 117 weblogic 118 weblogic 119 weblogic 120 weblogic 121 weblogic 122 weblogic 123 weblogic 124 weblogic 125 weblogic 126 weblogic 127 weblogic 128 weblogic 129 weblogic 130 weblogic 131 weblogic 132

JBOSS Admin-JBOSS Application Server

JAVA BEANS OPEN SOURCE SOFTWARE-JBOSS AS

Jboss is a free, Open source application server that implements
complete J2EE suite including JsP,Servlet and EJB.

Jboss is a free Open source application server which provides runtime environment for J2EE applications.

Benefits:

1.Open source, Zero cost product license to download and use.
2.Enterprise class library,Performance,scalability and High availability.
3.Supports SOA(service oriented architecture.

 

 

jboss 008 jboss 009 jboss 010 jboss 011 jboss 012 jboss 013 jboss 014 jboss 015 jboss 016

 Minimum Requirements:

java       :  6 JDK (or)  Above  /JRE
RAM      : 1 GB
C.P.U     : 400 mhz
DISK     : 500 mb

JBoss Introduction

Open source implementation of the Java EE suite of services

Great deal of customization due to modularization of the services like.

Enterprise JavaBeans (EJB),Java Persistence API (JPA),Java Messaging Service (JMS),Java Transaction Service/Java Transaction API (JTS/JTA)

Servlets and JavaServer Pages (JSP),Java Naming and Directory Interface (JNDI)

Advanced and fully extensible, cross component model, aspect integration, server runtime environment

Things to Understand

————————–

Remote Method Invocation (RMI) :Enables client and Web components deployed on JBoss to communicate with each other across networks.

Java Naming and Directory Interface (JNDI): Enables you to identify an EJB business component deployed on JBoss.

Java Messaging Service (JMS): Enables you to send messages between Web components and backend systems that persist data.

Java Database Connectivity (JDBC): Enables Web components and business components to communicate with the backend database

Java Connector Architecture (JCA): Enables business components to communicate with the backend systems, such as a legacy system or an Enterprise Resources Planning (ERP) system.

Java Transaction API (JTA) and Java Transaction Service (JTS): Enable you to perform transactions between Web components, business components, and backend systems in a distributed application

 

Servlet: A servlet is java class defines an init method, one or more service methods, and a destroy method. The Web container invokes the init method to initialize a servlet so that the servlet can process a request.

The service method of a GenericServlet class defines the request processing logic,such as doGet(), doPost(), doPut(), doDelete(), doTrace(), and doOptions(), to process request information.

The init() method initializes a Servlet Config object that passes Web server configuration information to the servlet instance. The doGet() method processes the request object and sends a simple message in the response. You can implement code in the destroy() method to remove any run-time variables or objects from memory.

 

JSP pages are text-based documents that execute as servlets but create dynamic content, such as HTML, WML, or XML, using predefined tags called JSP elements. You can place static content in a JSP page or use JSP elements to generate a dynamic content for the response.


The elements that specify information to the Web container that processes the JSP page are:
Directives: Provide global information to enable sessions, identify error pages, or specify Java import statements, include static contents.

Declaratives: Specify global variables and method declarations.

Scriptlets: Contain Java code embedded within the page.

Expressions: Contain elements that are formatted as strings and included in the page output.

Actions: Specify elements that perform a function abstracted from the page

JBoss MicroContainer

Crux of Jboss, which is the foundation architecture into which you can plug only the services that your application needs. You can use bean configuration files in the server/xxx/conf directory to configure the
MicroContainer.

Jboss 5.0 still provides few services based on JMX (Java Management eXtensions) to access the MBeans.
JMX Service is defined by JMX kernel is server/xxx/conf/jboss-service.xml, some Mbeans defined are below.

The logging Service
The Thread Pool – used to supply threads to run various services
The Java Naming and Directory Interface – JNDI
Various MBeans for managing security – includes JAAS
Various MBeans related to accessing JMX services
Various MBeans related to the remoting service

JBoss Server : History

Developed by Jboss Inc, now a RedHat division.
JBoss AS 4.0, a Java EE 1.4 features embedded apache tomcat.
JBoss AS 4.2 also functions as a Java EE 1.4 but deploys EJB 3.0 by default
JBoss AS 5.1, released as of 2009, operates as a Java EE 5 application server built on top of a new JBoss microcontainer.
JBoss AS 6.0, an unofficial implementation of Java EE 6, was released on December 28, 2010. JBoss AS 6 does not support the full Java EE 6 stack
JBoss AS 7, the current stable release, was released on July 12, 2011.

JBoss AS Architecture

“JBoss AS is assembled from a set of independent, yet cooperating components and services that are neatly packaged and fully hot-deployable. It is architected to be seamlessly embeddable in applications, and the nature of its embedding is completely customizable to the requirements of the application itself. Only the critical and necessary application server components, therefore, need to be brought along as part of the application’s baseline footprint. Developers can also easily create and add their own services to the system, thus ensuring that custom services exhibit the same consistent behavior as the JBoss standard set of services.”

 

JBoss AS 4.x Architecture

jboss1

JBoss AS 5.x Architecture
jboss2

 

                                                                     JBOSS Version Differences

 

Features Jboss 4.x Jboss 5.x Jboss 6.x
Clustering Supports Clustering Supports Clustering Supports Clustering
Jboss cache Jboss cache upgraded to v1.4.1.SP5 (from 1.4.1.SP3) JBoss Cache 3.x different from v1.x
JBoss Cache POJO, v3.0.0.GA
JBoss Cache Core, v3.0.2.GA
Upgraded JBoss Cache to 3.2.1.GA
J2EE support 4.0.x supports J2EE 1.4
4.2.x supports J2EE 1.4 + server-side EJB3Full support for J2EE Web Services and
the Service Oriented Architecture (SOA).
Supports Java EE 5
supports EJB 3 + later versions
JBoss EJB3, v1.0.0
Supports Java EE 6
Upgrade EJB3 to v1.1.8
EJB 3.1 Lite and Embeddable Functionality
Kernel Architecture JBoss JMX Microkernel The JBoss Microcontainer is a lightweight container for managing POJOs, their deployment, configuration and lifecycleJBoss Microcontainer, v2.0.4.GA Optimized dependency resolution algorithm of the Microcontainer.
Updated 2.2 series Microcontainer that forms the core of the AS
UpdateD Kernel to 2.0.7.GA 
Aspect-Oriented Programming (AOP) Support Supports the Aspect-Oriented Programming (AOP) model for developing middleware solutions
jboss aop upgraded to v1.5.6.GA (from 1.5.5.GA)  
JBoss AOP, v2.0.1.GA Updated to JBoss AOP 2.1.6.GA
Tomcat Tomcat 6.0  Jboss Web 2.1.2  Jboss Web 3.0.0-CR1
JSP JSP 2.1 JSP 2.1 JSP 2.2
Servlet V 2.4 V 2.4 V 3.0
Hibernate Hibernate 3.2.3
hibernate, upgraded to v3.2.4.SP1
Hibernate, v3.3.1.GA
Hibernate Entity Manager, v3.4.0.GA
Hibernate Annotations, v3.4.0.GA
Hibernate 3.6.0.
Web container JBoss Web v2.x is the web container in
JBossAS 4.2
JBoss Web, v2.1.2.GA JBoss Web 3.0
Java (JDK) 1.4-1.5+ 1.5+
DB (Optional) Any JDBC-Compliant
JBossAS 4.2.3 is compiled with Java 6, support for the extended JDBC 4 API
Any JDBC-Compliant
JBossAS 5 is compiled with Java 6, support for the extended JDBC 4 API
Any JDBC-Compliant
JBoss Transactions JBoss Transactions v4.2 in jboss 4.2
jboss transactions upgraded to v4.2.3.SP7 (from v4.2.3.SP6) in JBossAS 4.2.3.GA
JBoss Transactions, v4.4.0.GA JBoss Transactions 4.14.0
JBoss Remoting JBoss Remoting was upgraded to the latest stable 2.2.x version in jboss 4.2 JBoss Remoting, v2.5.0.SP2 Upgrade Remoting to 2.5.2
JBossWS Jboss ws upgraded to v2.0.1.SP2 (from v1.2.1.GA) in in JBossAS 4.2.2.GA
jboss ws upgraded to v3.0.1 / native v2.0.4 (from v2.0.1.SP2) in JBossAS 4.2.3.GA
compatible web services, JAX-WS-2.0
compatible web services, JAX-WS-2.0
JBoss WebServices, v3.0.5.GA
JBossWS-CXF 3.4.1.GA in 6.0.0 Final
JBossWS to 3.2.0.GA in  6.0.0.M1
Jgroups Hgroups upgraded to v2.4.1.SP4 (from v2.4.1.SP3) JGroups, v.2.6.7.GA  JGroups to 2.11.0.Final
Update JGroups to 2.6.13 in 6.0.0 M1
HSQLDB HSQLDB upgraded to v1.8.0.8 (from v1.8.0.2)  HSQLDB v1.8.0.8 HSQLDB v2.0.0 +
JMS JBossMQ default JMS provider in JBoss AS 4.x
JMS 1.1
JBoss Messaging is a high performance JMS provider in the JBoss Enterprise Middleware Stack (JEMS), included with
JBoss 5 as the default messaging provider.
Jboss 5.x comes with pre installed JBM 1.4.3
JBossMQ has been removed
JBoss Messaging is default messaging service
New Feaature
Virtual File System (VFS)
JBoss5 is designed around the advanced concept of a Virtual Deployment Framework (VDF)
JBoss VFS provides a set of different switches to control it’s internal behavior
JBoss VFS, v2.1.0.GA
Update VFS to 2.2.0.Alpha1
ServiceBindingManager JMX-based ServiceBindingManager POJO-based ServiceBindingManager POJO-based ServiceBindingManager

 

The differences between JBoss 6 and JBoss 7 are as follows:

JBoss 6  
JBoss 7
JBoss 6 provided an unofficial implementation to Java EE 6.
JBoss 7 provides an official implementation to Java EE 6.
JBoss 6 does not have a Modular Service Container.
JBoss 7 has a Modular Service Container.
JBoss 6 does not have a Centralized command line tool.
JBoss 7 has a Command Line tool.
JBoss 6 has Jar files in their application for deployment.
JBoss 7 does not have Jar files but it has a modular design, which makes the deployment easier.

The list of all theapplication servers available for running java based applications.

Most of the java application servers are JEE compliant and can run applications developed in JEE (earlier J2EE) technologies.
1.Apache Geronimo Applications Server
2.Glassfish Application Server
3.JBoss Application Sever
4.IBM – WebSphere Application Server – Software.
5.BEA WebLogic Server – Oracle Weblogic server.
1.Apache Geronimo Applications Server
Apache Geronimo application server is one most popular fully JEE 5 certified open source application server. It is being widely used to develop and deploy enterprise applications based on JEE technologies. Read in detail at Apache Geronimo Tutorials.
2.Glassfish Application Server
Glassfish Application Server is fully JEE 5 complaint application application server. Its open source application server, which can be used to develop and deploy java based enterprise applications. It provides very good performance. Glassfish Application Server is Open Source application server, which is developed and maintained by Sun Microsystems. Glassfish application server can be downloaded from https://glassfish.dev.java.net/
3.JBoss Application Sever
JBoss Application Servers is also very popular and used for development and deployment of JEE 5 based applications. JBoss Application Server is free software. It is cross platform and can be run on all the java enabled operating systems.
4.IBM – WebSphere Application Server – Software
The WebSphere Application Server is a commercial product of IBM and it provides unmatched performance. This application server can be used to develop and deploy missing critical JEE 5 applications.
5.BEA WebLogic Server
BEA WebLogic Server is commercial Application Server to deploy enterprise applications. According to the Weblogic, Weblogic Application Server is world’s #1 Java application server. It dramatically improves the developers productivity as  the application is fully compliant with JEE 5 specification.
JBoss
Weblogic
JBoss is an application server developed by JBoss company.
Weblogic is an application server developed by BEA.
JBoss is a freeware or open source product.
WebLogic is not an open source product. It is available for use only after procuring the license.
JBoss does not have a self console. It always depends on Tomcat.
Weblogic has the self console 7001 which helps the user to change the console setting as per the requirement.
JBoss does not have a web administration console.
Weblogic offers web based administration console that helps in configuration of data sources, JMS queues, and security realms.
The admin console is not part of JBoss installation. The admin console JON has to be installed separately.
The admin console is available as part of Weblogic installation.
JBoss application server does not provide servlet-api implementation. It depends on Tomcat for the same.
Weblogic application server provides its own servlet-api implementation.
The unused services can be removed from JBoss.
The unused services cannot be removed from the Weblogic.
JBoss does not offer JMS Clustering.
Weblogic provides JMS Clustering.
Database connectivity is established in JBoss using jca-jdbc wrappers.
Database connectivity is established in Weblogic using JDBC API.

 

JBoss
WebSphere
JBoss supports limited protocols.
WebSphere supports HTTP, FTP, SSL protocols.
JBoss is an Open source Java EE application server.
WebSphere is a commercial web application server.
JBoss is a Java based application.
WebSphere is not written using pure java.

JBOSS Instalation:

——————–
You can install the JBoss Application Server in one of these two modes:
Binary files download
In this form of installation, simply unzip the downloaded zip file to the directory of your choice. You can unzip the JBoss Application Server on any operating system that supports the zip format. The zip file is available on http://labs.jboss.com/jbossas/downloads/.
[usr]$ cd /jboss
[usr]$ jar -xvf jboss-<release>.zip
Source Files download
In this form of installation, download the source files from the web and build the source files locally. On successfully building your source files you can manually copy the built file into a desired folder and start the server.
In this example we are assuming your source files were copied in the /jboss folder.
[user@localhost]$ cd /jboss
[user@localhost]$ tar -xvf jboss-<release>-src.tar.gz
1. First Install JAVA 1.5 or above on machine.
2.Download Archive File and Extract archive to the location where you want.
3.Run .bat or .sh file in bin directory.
4.Port 8080 should be available otherwise change the port configuration.
5.Visit http://localhost:8080/jmx-console.

Uninstall JBoss

The JBoss Application Server may be uninstalled by simply deleting the JBoss Application Server’s installation directory. You will also need to remove the JBOSS_HOME environment variables

Directory structure : BCD LS

1. Bin : Contains all the binary and scripts that you need to use start & stop the JBossAS.
2.Client: Contains libraries that you may need to communicate JBoss As from Client applications.
3.Docs: Document Type Definition (DTD) files and XML schemas for the configuration
            files that JBoss AS uses.
4.Lib: Contains libraries that JBoss As needs to starts the core application server.
5.Server : This directory is having one or more subdirectires which stores server configuration.The configuration is  selected by passing the option -c <config-name> to the run script.
minimal: a minimal jndi and jmx kernel
default: the default configuration (does not include clustering or corba)
all: all services including clustering and corba
Standard :
Web:
Production:

Server Profile Directory Structure

each configuration set has to have at least four directories. (conf,deploy,deployer and lib)

Conf :Contains the bootstrap.xml bootstrap descriptor file for a given server configuration.This defines the core microcontainer beans.
Data: Used by services that want to store content in the file system. It holds persistent data for services intended to survive a server restart.

Deploy: Contains the hot-deployable services, applications

Lib: Contains library files specific to the server configuration.

Log: This is where the log files are written

tmp: Used for temporary storage by JBoss services. The deployer, for example, expands
application archives in this director

JBoss server- Default

JBOSS_HOME URL: file:/H:/jboss-6.0.0.Final/
Bootstrap: $JBOSS_HOME\server/default/conf/bootstrap.xm
Common Base: $JBOSS_HOME\common/
Common Library: $JBOSS_HOME\common/lib/
Server Name: default
Server Base: $JBOSS_HOME\server/
Server Library: $JBOSS_HOME\server/default/lib/
Server Config: $JBOSS_HOME\server/default/conf/
Server Home: $JBOSS_HOME\server/default/
Server Data: $JBOSS_HOME\server/default/data/
Server Log: $JBOSS_HOME\server/default/log/
Server Temp: $JBOSS_HOME\server/default/tmp/

JBoss Boot sequence:

Bootstrap.xml : Core micro container services start.
Vfs.xml : Configure virtual file system.
Class Loader.xm : Core class loading system and class start.
Aop.xml : Increases modularity.
Jmx.xml : Configures Jmx Kernel mbeans
Deployer.xml : Configure maindeployer structure deployer,Bootstrap mc and jmx deployed.
Binding.xml: Configure service Binding Manager.

jboss3

Defining the Environment Variables

To deploy a Web application in JBoss- Jetty, set the environment variables to enable access to the executables, such as the javac compiler, ANT tool, and JBoss script files. To define environment variables:

Set the JBOSS_HOME environment variable to the path to JBoss installation directory using the command:

JBOSS_HOME=/usr/java/jboss-3.2.1
Export the JBOSS_HOME environment variable using the command:

export JBOSS_HOME
Set JAVA_HOME environment variable to the J2SDK installation directory using the command:

JAVA_HOME=/usr/java/j2sdk1.4.1_01
Export the JAVA_HOME environment variable using the command:

export JAVA_HOME
Set the ANT_HOME environment variable to the ANT installation directory using the command:

ANT_HOME= /usr/java/ant1.5.3.1
Export ANT_HOME using the command:

export ANT_HOME
Set the PATH environment variable using the command:

PATH=$JBOSS/bin:$JAVA_HOME/bin:$ANT_HOME/bin:.:
Export the PATH environment variable using the command:

export PATH
Set the CLASSPATH environment variable using the command:

CLASSPATH=$JBOSS_HOME/server/default/lib/javax.servlet.jar:.:
Export the CLASSPATH environment variable using the command:

export CLASSPATH

JBoss server Start / Stop.

Starting the Server:

Move to JBOSS_DIST/jboss-as/bin directory and execute the run.bat (for Windows) or

run.sh (for Linux) script, as appropriate for your operating system.

$JBOSS_HOME/bin/run.bat

Note: Below are the default settings.

The server is bound to 127.0.0.1 for security reasons. To enable remote access by binding

JBoss services to a particular interface, simply run jboss with the -b option.

$JBOSS_HOME/bin/run.bat –b

The server runs on port 8080 and to change the settings, we can run it as below.

$JBOSS_HOME/bin/ run -Djboss.service.binding.set=ports-01

Specify alternate server profile.

$JBOSS_HOME/bin/ run –c <alternate-server-profile>

Stopping the server:

You can run the shutdown script to shutdown the server.

$JBOSS_HOME/bin/shutdown.sh

Deployers on Jboss Application server:

Deployment:  Deployments on JBoss

 Java EE Deployment Lifecycle

 

 

jboss4

 

Development and Deployment Lifecycle:

1.Design static content (HTML, CSS, GIF, JPG, etc.)
2.Develop dynamic content (Servlets, JSPs, and other Java components like EJBs)
3.Write deployment descriptors (e.g. web.xml, application.xml, ejb-jar.xml, etc.) for components
4.Assemble components into deployable packages (e.g. WAR, JAR, EAR, etc.)
5.Provide all resources that the components require (e.g DBCP, Mail sessions, message queues, etc.)
6.Deploy packages (e.g. WAR, JAR, EAR, etc.) on the Java EE application server
7.Manage Java EE applications on the server

2. Deployment Descriptors

Give the containers instructions on how to use and manage deployed Java EE components

  1. Security
  2. Transactions
  3. Persistence

Declarative customization (XML-based)
Enables portability of Java EE components

Note:
J2EE 1.3 and JBoss pre 5.x deployment descriptors are defined by XML DTD documents. These can be found in $JBOSS_HOME/docs/dtd/ directory. As of J2EE 1.4 and JBoss 5.x, deployment descriptors are defined by XML Schema (XSD) documents. These can be found in $JBOSS_HOME/docs/schema/ directory.

3. Deployment on JBoss AS

Deployment is a two-step process

1.First we notify JBoss that of the application we want to deploy by copying it to ${jboss.server.home.url}/deploy/ or any of its subdirectories
2. Then, JBoss performs the necessary steps to make that application ready for our use

Undeployment on Jboss As
Undeployment is also a two-step process

1.First we notify JBoss that of the application we want to undeploy by removing it from${jboss.server.home.url}/deploy/ directory
2.Then, JBoss performs the necessary steps to stop the application and unload its resources.

Alternatively, applications can be deployed/undeployed/and re-deployed viajboss.system:service=MainDeployer JMX MBean (more on this later).
This mechanism also support remote management of JBoss deployments.Supports deployment dependencies

 Hot-deployment vs. cold-deployment

Archived components are uncompressed (a.k.a. exploded) under${jboss.server.temp.dir}/deploy/
JBoss deletes (or at least it is supposed to delete) ${jboss.server.temp.dir}/deploy/deployments upon restart
It is recommended to deploy applications already uncompressed (exploded) for to avoid the overhead of uncompression, and provide easy access to deployment descriptors and JSP files
The deployed components are automatically redeployed if their deployment descriptors are modified while JBoss AS is running
JBoss supports nested deployments (e.g. WAR under EAR) regardless of whether they are compressed into archives or deployed uncompressed
With clustering enabled, JBoss AS also supports farmed deployment – that is, pushing applications across the entire cluster when deployed on any single member of that cluster
JBoss supports JSR-88 (Java EE application deployment spec) but
There are no tools that make this kind of deployment easy – requires writing code
The resulting deployments go into the tmp/ directory – making redeployments harder

4. Deployers on JBoss AS

JBoss has an extensible deployment architecture that allows components to be easily integrated into the core JBoss Microcontainer
Deployers for: WARs, EARs, EJBs, JAR libraries, RARs, SARs, XML-based services, HARs, Aspects, Client, BeanShell scripts
The deployers are deployed themselves as *.deployer or *-deployer-beans.xml  under ${jboss.server.home.url}/deployers/ directory

4.1. Type of Deployers

Web – handles web application archives as .war files with descriptors WEB-INF/web.xml, WEB- INF/jboss-web.xml (optional), and WEB-INF/context.xml (optional)

EAR – handles enterprise application archives as .ear files with descriptors META-INF/application.xml and META-INF/jboss-app.xml (optional)

EJB – handles Enterprise Java Bean archives as .jar files with descriptors META-INF/ejb-jar.xml and META-INF/jboss.xml (optional)

RAR – handles JCA resource archives as .rar files with a descriptor META-INF/ra.xml
SAR – handles JBoss MBean service archives either as .sar files with a META-INF/jboss-service.xml descriptor, or as stand alone *-service.xml files

Web Service – handles JBoss Web Services as *.wsr files
POJO – handles plain old java objects deployed as *-jboss-beans.xml files that register with JBoss Microcontainer
XML – handles arbitrary .xml files that are converted into SARs (e.g. *-ds.xml get deployed as data sources)
HAR – handles Hibernate archives as .har files with a META-INF/hibernate-service.xmldescriptor
Aspect – handles aspect archives either as .aop files with a META-INF/jboss-aop.xmldescriptor or as stand-alone *-aop.xml files
Client – handles Java EE application client resources as .jar files with META-INF/application-client.xml and META-INF/jboss-client.xml (optional) descriptors
BeanShell – handles bean shell scripts as .bsh files that represent MBeans
Zip – handles arbitrary .zip archives that are examined for that actual deployment type based on the internal deployment descriptors

Deployment Configuration

 JBoss deployers (and the file extensions that trigger them) are configured in ${jboss.server.home.url}/conf/bootstrap/deployers.xml file.
 By default JBoss scans ${jboss.server.home.url}/deploy/ for deployments, but this can be changed/extended in BootstrapProfileFactory ? applicationURIs property in ${jboss.server.home.url}/conf/bootstrap/profile.xml file:
·         <deployment …>
·           …
·           <bean name=”BootstrapProfileFactory” …>
·             <property name=”deployersURI”>${jboss.server.home.url}deployers</property>
·             <property name=”applicationURIs”>
·               <list elementClass=”java.net.URI”>
·                 <value>${jboss.server.home.url}deploy</value>
·               </list>
·             </property>
·             …
·           </bean>
·           …
</deployment>
·         JBoss rescans the deployment directories for new deployments (or changes to the existing deployments) every 5 seconds as specified by HDScanner ? scanPeriod in${jboss.server.home.url}deploy/hdscanner-jboss-beans.xml file:
·         <deployment …>
·           …
·           <bean name=”HDScanner” …>
·             …
·             <property name=”scanPeriod”>5000</property>
·             …
·           </bean>
</deployment>
[Note]
Note
In JBoss 5.0, deployment directories were defined by VFSDeploymentScanner? URIList in profile-service.xml file.
4.3. Deployment Ordering
     During the server startup, after initializing all deployers, JBoss will deploy applications/components in the following order: AOPs, SARs, POJOs, RARs, Data Sources, HARs, EJBs, ZIPs, WARs, Web Services, EARs, Bean Shell Scripts.
         To force the deployment of an application/component at the very end of the startup phase, deploy it under ${jboss.server.home.url}/deploy/last or as *.last
 Deployment Dependencies
 Components can define dependencies on other components through JMX:
<depends optional-attribute-name=”ConnectionManager”>
              jboss.jca:service=DataSourceBinding,name=DefaultDS
</depends>

 

JBoss Administration Console

Included from Jboss 5.1.0 distribution list onwards. Uses the Embedded Jopr (As it runs as a part of Jboss Admin Server).
default username / password is admin/ admin defined in the below file. server/configuration/conf/props/jmx-console-users.properties.
Change/ update the roles by editing the below file.

server/configuration/conf/props/jmx-console-roles.properties.

The Admin Console is secured by the JAAS security domain jmx-console .

Enabling Authentication on the Admin Console. In this web.xml file:JBOSS_HOME/server/PROFILE/deploy/management/console-mgr.sar/

web-console.war/WEB-INF/web.xml ensure the following security-constraint fragment is uncommented

Enabling Security Domain on the Admin Console

In this jboss web.xml file: JBOSS_HOME/server/PROFILE/deploy/management/console-
mgr.sar/web.console.war/WEB-INF/jboss-web.xml

ensure the following fragment is included.

<jboss-web>

<security-domain>java:/jaas/jmx-console</security-domain>

</jboss-web>

Features:

  1.  Provides an overview of the server configuration.
  2.  Configuring the ports using the Service Binding Manager.
  3.  Deploy, Re-deploy, Undeploy and control the applications.
  4.  Configure, manage JMS resources.
  5.  Configure, manage connection factories.
  6.  Add, remove, configure and control the Data Sources.
  7. Gather metrics related to the EAP instances, JMS Queues, Topics, Data Sources

JBoss JMX Console

It’s a JBoss Management Console which provides a raw view of the JMX MBeans which make up the server.Things we can do with JMX Console.

  1.  Display the JNDI tree : Lists the JNDI object bound using service=JNDIView
  2.  Generate a thread dump: Capture the thread dumps using jboss.system:type=ServerInfoMbean
  3. Display the memory pool usage : Using the jboss.system:type=ServerInfo mbean
  4. Manage the deployment scanner: Enable/ Disable the Hot Deployment scanner.
  5. Redeploy an application
  6. Shut down JBoss

Jboss Web Console
Features:

Jboss Management console.
Comprehensive insight about the Jboss
$SERVER-PROFILE\deploy\management\console-mgr.sar\web-console.war
$SERVER-PROFILE\deploy\management\console-mgr.sar\web-console.war\WEB-INF\classes\
web-console-users.properties
web-console-roles.properties

Jboss Logging

In JBoss log4j is used for logging.

Controlled by <server-profile>/conf/jboss-log4j.xml file.

Defines different appenders, message format, log levels etc.} By default, JBoss produces output to both the console and a log file (log/server.log).Console default level is INFO. No default log level for server log, so everything is logged (DEBUG).

<appender name=”FILE” class=”org.jboss.logging.appender.DailyRollingFileAppender”>

<errorHandler class=”org.jboss.logging.util.OnlyOnceErrorHandler”/>

<!– <param name=”File” value=”${jboss.server.log.dir}/server.log”/> –>

<param name=”File” value=”C:/server.log”/>

<param name=”Append” value=”true”/>

 

 

 

JBOSS 6  

 

jboss 001 jboss 002 jboss 003 jboss 004 jboss 005 jboss 006 deploy 015deploy 016deploy 017deploy 018deploy 019deploy 020deploy 021Different Way to deploy Jboss 7 Application Server

src=”http://rmohan.com/wp-content/uploads/2014/11/deploy-022.png” alt=”deploy 022″ width=”948″ height=”651″ />deploy 023deploy 024deploy 025deploy 026deploy 027deploy 028deploy 029deploy 030deploy 031

 

 

 

 

 

 

Puppet 3.7.1 on CentOS 6.5

Puppet 3.7.1 on CentOS 6.5 quick start – I

All below doc is from or based on https://docs.puppetlabs.com/

1. Basic Install

1.1 install OS and prepare the node

1.1.1 Network Layout and install OS

Name IP OS Desc
puppet01 192.168.1.10 CentOS 6.5 puppet master
puppet02 192.168.1.20 CentOS 6.5 puppet client
puppet03 192.168.1.30 CentOS 5.10 puppet client

Install Minimum Packages for the OS.

Install additional packages on 3 nodes

# yum install perl openssh-clients telnet tree -y

1.1.2 Configure OS

stop iptables and selinux

( Node: this is to make the quick start easier. If you know how to configure iptables and selinux under puppet,no need to disable them)

# service iptables stop

# chkconfig iptables off

# setenforce 0

# vi /etc/sysconfig/selinux # change SELINUX=permissive

install ntp make sure time is in sync for all the nodes

# yum install ntp -y

# chkconfig ntpd on

# service ntpd start

# date (make sure time is same on all three nodes or you will have issue when configure ssl certificate later)

configure /etc/hosts on three nodes

# vi /etc/hosts

192.168.1.10 puppet01

192.168.1.20 puppet02

192.168.1.30 puppet03

1.2 Configure puppet repo

on puppet01 and puppet02

# rpm -ivh http://yum.puppetlabs.com/puppetlabs-release-el-6.noarch.rpm

on puppet03

# rpm -ivh http://yum.puppetlabs.com/puppetlabs-release-el-5.noarch.rpm

1.3 Install Puppet

1.3.1 install server

on puppet01

# yum install puppet-server -y

1.3.2 install client

on puppet02 and puppet03

# yum install puppet -y

1.4 basic configure

1.4.1 Puppet Master

on puppet01

# vi /etc/puppet/puppet.conf

[main]

dns_alt_names = puppet01

# touch /etc/puppet/manifests/site.pp

1.4.2 Puppet Client

on puppet02 puppet03

# vi /etc/puppet/puppet.conf

[agent]

server = puppet01

1.5 Configure Certificates

1.5.1 puppet master

on puppet01

# puppet master –verbose –no-daemonize

This will create the CA certificate and the puppet master certificate,

Once it says Notice: Starting Puppet master version 3.7.1, type ctrl-C to kill the process.

# puppet cert list –all

you should see the certificate for the master server.

startup puppet master.

# /etc/init.d/puppetmaster start

1.5.2 puppet client

on puppet02 puppet03

# puppet agent –test # you should see puppet agent will create a certificate request to the master.

on puppet01

# puppet cert list –all # you should see the certificate request from puppet02 puppet03

1.5.3 Sign the certificate

on puppet01

# puppet cert –sign –all # on this moment, you puppet clients are registered to puppet server

1.6 Smoke test

# vi /etc/puppet/manifests/site.pp

node default {

file {

“/tmp/helloworld.txt”: content => “hello, world”;

}

}

on puppet02 puppet03

# puppet agent –test # you should see a helloworld.txt under /tmp

$ cat /tmp/helloworld.txt

hello, world

2. Run puppet under Apache passenger

the default puppet server can not handle high load.

We need to configure puppet master run under Apache Passenger

on puppet01 (puppet master)

2.1 install apache2

# /etc/init.d/puppetmaster stop

# yum install httpd httpd-devel mod_ssl ruby-devel rubygems gcc

2.2 Install Rack/Passenger

# yum install gcc-c++ libcurl-devel openssl-devel zlib-devel -y

# gem install rack passenger

# passenger-install-apache2-module

2.3 Configure Apache

# mkdir -p /usr/share/puppet/rack/puppetmasterd

# mkdir /usr/share/puppet/rack/puppetmasterd/public /usr/share/puppet/rack/puppetmasterd/tmp

# cp /usr/share/puppet/ext/rack/config.ru /usr/share/puppet/rack/puppetmasterd/

# chown puppet:puppet /usr/share/puppet/rack/puppetmasterd/config.ru

# vi /etc/httpd/conf.d/puppetmaster.conf

LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-4.0.52/buildout/apache2/mod_passenger.so
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-4.0.52
PassengerDefaultRuby /usr/bin/ruby
PassengerMaxPoolSize 12
PassengerMaxRequests 1000
PassengerPoolIdleTime 600
Listen 8140

PassengerHighPerformance On
SSLEngine On
SSLProtocol ALL -SSLv2 -SSLv3
SSLCipherSuite EDH+CAMELLIA:EDH+aRSA:EECDH+aRSA+AESGCM:EECDH+aRSA+SHA384:
EECDH+aRSA+SHA256:EECDH:+CAMELLIA256:+AES256:+CAMELLIA128:+AES128:+SSLv3:
!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!DSS:!RC4:!SEED:!IDEA:!ECDSA:kEDH:
CAMELLIA256-SHA:AES256-SHA:CAMELLIA128-SHA:AES128-SHA
SSLHonorCipherOrder on
SSLCertificateFile /var/lib/puppet/ssl/certs/puppet01.pem
SSLCertificateKeyFile /var/lib/puppet/ssl/private_keys/puppet01.pem
SSLCertificateChainFile /var/lib/puppet/ssl/ca/ca_crt.pem
SSLCACertificateFile /var/lib/puppet/ssl/ca/ca_crt.pem
SSLCARevocationFile /var/lib/puppet/ssl/ca/ca_crl.pem
SSLVerifyClient optional
SSLVerifyDepth 1
SSLOptions +StdEnvVars +ExportCertData
RequestHeader set X-SSL-Subject %{SSL_CLIENT_S_DN}e
RequestHeader set X-Client-DN %{SSL_CLIENT_S_DN}e
RequestHeader set X-Client-Verify %{SSL_CLIENT_VERIFY}e
DocumentRoot /usr/share/puppet/rack/puppetmasterd/public

Options None
AllowOverride None

Order allow,deny
Allow from all

= 2.4>
Require all granted

ErrorLog /var/log/httpd/puppet01_ssl_error.log
CustomLog /var/log/httpd/puppet01_ssl_access.log combined

2.4 start apache2

# /etc/init.d/httpd start

2.5 smoke test

on puppet02/03

# puppet agent –test

client should be able to connect to master

3. Install Puppet Dashboard

on puppet master puppet01

3.1 install and configure mysql server

# yum install -y mysql mysql-devel mysql-server

# vi /etc/my.cnf

max_allowed_packet = 32M

# /etc/init.d/mysqld start

# chkconfig mysqld on

# mysqladmin -uroot password ‘password’

mysql -uroot -ppassword <<EOF

CREATE DATABASE dashboard CHARACTER SET utf8;

CREATE USER ‘dashboard’@’localhost’ IDENTIFIED BY ‘password’;

GRANT ALL PRIVILEGES ON dashboard.* TO ‘dashboard’@’localhost’;

FLUSH PRIVILEGES;

EOF

3.2 install dashboard

# yum install puppet-dashboard

3.3 configure dashboard

# vi /usr/share/puppet-dashboard/config/database.yml

============================

production:

database: dashboard

username: dashboard

password: password

encoding: utf8

adapter: mysql

===========================

init DB

# cd /usr/share/puppet-dashboard/

# rake RAILS_ENV=production db:migrate

3.4 configure apache2

Note: passenger related settings already set in puppetmaster.conf

# vi /etc/httpd/conf.d/dashboard.conf

=============================

 

ServerName puppet01

DocumentRoot “/usr/share/puppet-dashboard/public/”

<Directory “/usr/share/puppet-dashboard/public/”>

Options None

AllowOverride AuthConfig

Order allow,deny

allow from all

 

ErrorLog /var/log/httpd/dashboard_error.log

LogLevel warn

CustomLog /var/log/httpd/dashboard_access.log combined

ServerSignature On

 

=============================

3.5 startup dashboard

# apachectl -t && /etc/init.d/httpd restart

3.6 configure puppet master and client

on puppet01

# vi /etc/puppet/puppet.conf

=============================

[master]

reports = store, http

reporturl = http://puppet01:80/reports/upload

node_terminus = exec

external_nodes = /usr/bin/env PUPPET_DASHBOARD_URL=http://puppet01 /usr/share/puppet-dashboard/bin/external_node

=============================

on puppet02/03

# vi /etc/puppet/puppet.conf

==============================

[agent]

server = puppet01

report = true

==============================

on puppet01 start Delayed Job Workers

# env RAILS_ENV=production /usr/share/puppet-dashboard/script/delayed_job -p dashboard -n 4 -m start

3.7 smoke test

on puppet02/03

# puppet agent –test

visit http://puppet01/ in browser you should see the client nodes status.

put puppet agent to run under cron

on puppet02/03

# puppet resource cron puppet-agent ensure=present user=root minute=30 command=’/usr/bin/puppet agent –onetime –no-daemonize –splay’

After install and configured puppet, we can use puppet to deploy customized mysql-server to your clients.

1. install mysql module

# puppet module install puppetlabs-mysql

2. create your cutomized mysql module

create andymysql module

[root@puppet01 modules]# pwd

/etc/puppet/modules

[root@puppet01 modules]# tree andymysql

andymysql

??? manifests

??? init.pp

1 directory, 1 file

[root@puppet01 manifests]# cat init.pp

class andymysql {

class {

‘::mysql::server’:

root_password => ‘verystrongpassword’,

}

mysql::db { ‘andydb’:

user => ‘myuser’,

password => ‘mypass’,

host => ‘localhost’,

grant => [‘SELECT’, ‘UPDATE’],

}

}

3. classifiy andymysql class in puppet dashboard.

puppet01

3.1 click add class button and add andymysql

 

puppet02

BIND CHROOT CENTOS 7

BIND (Berkeley Internet Name Daemon) also known as NAMED is the most widely used DNS server in the internet. This tutorial will descibes how we can run BIND in a chroot jail, the process is simply unable to see any part of the filesystem outside the jail. For example, in this post, i will setting up BIND to run chrooted to the directory /var/named/chroot/. Well, to BIND, the contents of this directory will appear to be /, the root directory. A “jail” is a software mechanism for limiting the ability of a process to access resources outside a very limited area,
and it’s purposely to enhance the security. Bind Chroot DNS server was by default configured to /var/named/chroot

1. Install Bind Chroot DNS server :

[root@keeplive ~]# yum install bind-chroot bind -y

2. Copy all bind related files to prepare bind chrooted environments :

[root@keeplive ~]# cp -R /usr/share/doc/bind-*/sample/var/named/* /var/named/chroot/var/named/

3. Create bind related files into chrooted directory :

[root@keeplive ~]# touch /var/named/chroot/var/named/data/cache_dump.db
[root@keeplive ~]# touch /var/named/chroot/var/named/data/named_stats.txt
[root@keeplive ~]# touch /var/named/chroot/var/named/data/named_mem_stats.txt
[root@keeplive ~]# touch /var/named/chroot/var/named/data/named.run
[root@keeplive ~]# mkdir /var/named/chroot/var/named/dynamic
[root@keeplive ~]# touch /var/named/chroot/var/named/dynamic/managed-keys.bind

4. Bind lock file should be writeable, therefore set the permission to make it writable as below :
[root@keeplive ~]# chmod -R 777 /var/named/chroot/var/named/data
[root@keeplive ~]# chmod -R 777 /var/named/chroot/var/named/dynamic

5. Copy /etc/named.conf chrooted bind config folder :
[root@keeplive ~]# cp -p /etc/named.conf /var/named/chroot/etc/named.conf

6.Configure main bind configuration in /etc/named.conf. Append the example.local zone information to the file :
[root@keeplive ~]# vi /var/named/chroot/etc/named.conf

zone “rmohan.com” {
type master;
file “rmohan.zone”;
};

zone “1.168.192.in-addr.arpa” IN {
type master;
file “192.168.1.zone”;
};

7. Create Forward and Reverse zone files for domain example.local.

a) Create Forward Zone :
[root@keeplive ~]# vi /var/named/chroot/var/named/rmohan.zone

Add the following and save :
;
; Addresses and other host information.
;
$TTL 86400
@ IN SOA rmohan.com. hostmaster.rmohan.com. (
2014101901 ; Serial
43200 ; Refresh
3600 ; Retry
3600000 ; Expire
2592000 ) ; Minimum

; Define the nameservers and the mail servers

IN NS ns1.rmohan.com.
IN NS ns2.rmohan.com.
IN A 192.168.1.13
IN MX 10 mx.rmohan.com.

keeplive IN A 192.168.1.13
mx IN A 192.168.1.13
ns1 IN A 192.168.1.14
ns2 IN A 192.168.1.15

b) Create Reverse Zone :
[root@keepalive ~]# vi /var/named/chroot/var/named/192.168.1.zone

;
; Addresses and other host information.
;
$TTL 86400
@ IN SOA rmohan.com. hostmaster.rmohan.com. (
2014101901 ; Serial
43200 ; Refresh
3600 ; Retry
3600000 ; Expire
2592000 ) ; Minimum

1.168.192.in-addr.arpa. IN NS keepalive.rmohan.com.

13.0.168.192.in-addr.arpa. IN PTR mx.rmohan.com.
14.0.168.192.in-addr.arpa. IN PTR ns1.rmohan.com.
15.0.168.192.in-addr.arpa. IN PTR ns2.rmohan.com.

8. Stop and disable named service. Start and enable bind-chroot service at boot :
[root@keeplive ~]# /usr/libexec/setup-named-chroot.sh /var/named/chroot on
[root@keeplive ~]# systemctl stop named
[root@keeplive ~]# systemctl disable named
[root@keeplive ~]# systemctl start named
[root@keeplive ~]# systemctl status named
named.service – Berkeley Internet Name Domain (DNS)
Loaded: loaded (/usr/lib/systemd/system/named.service; disabled)
Active: active (running) since Mon 2014-11-17 08:55:08 SGT; 38s ago
Process: 16016 ExecStart=/usr/sbin/named -u named $OPTIONS (code=exited, status=0/SUCCESS)
Process: 16014 ExecStartPre=/usr/sbin/named-checkconf -z /etc/named.conf (code=exited, status=0/SUCCESS)
Main PID: 16018 (named)
CGroup: /system.slice/named.service
??16018 /usr/sbin/named -u named

Nov 17 08:55:09 keeplive named[16018]: error (network unreachable) resolving ‘ns.isc.afilias-nst.info/AAAA/IN’: 2001:500:49::1#53
Nov 17 08:55:09 keeplive named[16018]: error (network unreachable) resolving ‘ns1.isc.ultradns.net/A/IN’: 2001:500:2d::d#53
Nov 17 08:55:09 keeplive named[16018]: error (network unreachable) resolving ‘ns1.isc.ultradns.net/AAAA/IN’: 2001:500:2d::d#53
Nov 17 08:55:10 keeplive named[16018]: error (network unreachable) resolving ‘pdns196.ultradns.co.uk/A/IN’: 2001:503:ba3e::2:30#53
Nov 17 08:55:10 keeplive named[16018]: error (network unreachable) resolving ‘pdns196.ultradns.co.uk/AAAA/IN’: 2001:503:ba3e::2:30#53
Nov 17 08:55:10 keeplive named[16018]: error (network unreachable) resolving ‘pdns196.ultradns.org/A/IN’: 2001:500:e::1#53
Nov 17 08:55:10 keeplive named[16018]: error (network unreachable) resolving ‘pdns196.ultradns.org/AAAA/IN’: 2001:500:e::1#53
Nov 17 08:55:10 keeplive named[16018]: error (network unreachable) resolving ‘ns2.isc.ultradns.net/AAAA/IN’: 2610:a1:1014::e8#53
Nov 17 08:55:10 keeplive named[16018]: error (network unreachable) resolving ‘pdns196.ultradns.org/AAAA/IN’: 2001:502:4612::e8#53
Nov 17 08:55:10 keeplive named[16018]: error (network unreachable) resolving ‘pdns196.ultradns.com/A/IN’: 2610:a1:1016::e8#53

[root@keeplive ~]# systemctl status named-chroot.service
named-chroot.service – Berkeley Internet Name Domain (DNS)
Loaded: loaded (/usr/lib/systemd/system/named-chroot.service; disabled)
Active: failed (Result: exit-code) since Mon 2014-11-17 08:56:15 SGT; 11s ago
Process: 16052 ExecStart=/usr/sbin/named -u named -t /var/named/chroot $OPTIONS (code=exited, status=1/FAILURE)
Process: 16050 ExecStartPre=/usr/sbin/named-checkconf -t /var/named/chroot -z /etc/named.conf (code=exited, status=0/SUCCESS)

Nov 17 08:56:15 keeplive named[16054]: automatic empty zone: A.E.F.IP6.ARPA
Nov 17 08:56:15 keeplive named[16054]: automatic empty zone: B.E.F.IP6.ARPA
Nov 17 08:56:15 keeplive named[16054]: automatic empty zone: 8.B.D.0.1.0.0.2.IP6.ARPA
Nov 17 08:56:15 keeplive named[16054]: couldn’t add command channel 127.0.0.1#953: address in use
Nov 17 08:56:15 keeplive named[16054]: couldn’t add command channel ::1#953: address in use
Nov 17 08:56:15 keeplive named[16054]: isc_stdio_open ‘data/named.run’ failed: permission denied
Nov 17 08:56:15 keeplive named[16054]: configuring logging: permission denied
Nov 17 08:56:15 keeplive systemd[1]: named-chroot.service: control process exited, code=exited status=1
Nov 17 08:56:15 keeplive systemd[1]: Failed to start Berkeley Internet Name Domain (DNS).
Nov 17 08:56:15 keeplive systemd[1]: Unit named-chroot.service entered failed state.
[root@keeplive ~]# systemctl enable named-chroot
ln -s ‘/usr/lib/systemd/system/named-chroot.service’ ‘/etc/systemd/system/multi-user.target.wants/named-chroot.service’
[root@keeplive ~]# systemctl status named-chroot.service
named-chroot.service – Berkeley Internet Name Domain (DNS)
Loaded: loaded (/usr/lib/systemd/system/named-chroot.service; enabled)
Active: failed (Result: exit-code) since Mon 2014-11-17 08:56:15 SGT; 30s ago

Nov 17 08:56:15 keeplive named[16054]: automatic empty zone: A.E.F.IP6.ARPA
Nov 17 08:56:15 keeplive named[16054]: automatic empty zone: B.E.F.IP6.ARPA
Nov 17 08:56:15 keeplive named[16054]: automatic empty zone: 8.B.D.0.1.0.0.2.IP6.ARPA
Nov 17 08:56:15 keeplive named[16054]: couldn’t add command channel 127.0.0.1#953: address in use
Nov 17 08:56:15 keeplive named[16054]: couldn’t add command channel ::1#953: address in use
Nov 17 08:56:15 keeplive named[16054]: isc_stdio_open ‘data/named.run’ failed: permission denied
Nov 17 08:56:15 keeplive named[16054]: configuring logging: permission denied
Nov 17 08:56:15 keeplive systemd[1]: named-chroot.service: control process exited, code=exited status=1
Nov 17 08:56:15 keeplive systemd[1]: Failed to start Berkeley Internet Name Domain (DNS).
Nov 17 08:56:15 keeplive systemd[1]: Unit named-chroot.service entered failed state.

[root@keeplive ~]# systemctl enable named-chroot
ln -s ‘/usr/lib/systemd/system/named-chroot.service’ ‘/etc/systemd/system/multi-user.target.wants/named-chroot.service’

VSFTP CENTOS 7

mkdir -p /ftpserver/open
mkdir -p /ftpserver/private

yum -y install ftp vsftpd

[root@keeplive ~]# rpm -qf /usr/bin/db_load
libdb-utils-5.3.21-17.el7_0.1.x86_64

echo opentest > /ftpserver/open/open.txt

echo ftptest > /tmp/ftptest1.txt

touch /ftpserver/open/webapp.txt

[root@keeplive ~]# rpm -qc vsftpd
/etc/logrotate.d/vsftpd
/etc/pam.d/vsftpd
/etc/vsftpd/ftpusers
/etc/vsftpd/user_list
/etc/vsftpd/vsftpd.conf
[root@keeplive ~]#

vi /etc/vsftpd/vftpuser.txt
alice
P@ssw0rd
jack
P@ssw0rd
tom
P@ssw0rd

db_load -T -t hash -f /etc/vsftpd/vftpuser.txt /etc/vsftpd/vftpuser.db

[root@keeplive vsftpd]# file /etc/vsftpd/vftpuser.db
/etc/vsftpd/vftpuser.db: Berkeley DB (Hash, version 9, native byte-order)
[root@keeplive vsftpd]#

useradd -d /ftpserver/private -s /sbin/nologin ftpuser1

root@keeplive vsftpd]# cat /etc/pam.d/vsftpd
#%PAM-1.0
session optional pam_keyinit.so force revoke
auth required pam_listfile.so item=user sense=deny file=/etc/vsftpd/ftpusers onerr=succeed
auth required pam_shells.so
auth include password-auth
account include password-auth
session required pam_loginuid.so
session include password-auth
auth required pam_userdb.so db=/etc/vsftpd/vftpuser
account required pam_userdb.sodb=/etc/vsftpd/vftpuser

vi /etc/vsftpd/vsftpd.conf

anon_root=/ftpserver/open
virtual_use_local_privs=YES
guest_enable=YES
guest_username=vftpuser
chroot_local_user=YES
allow_writeable_chroot=YES

[root@keeplive vsftpd]# systemctl enable vsftpd
ln -s ‘/usr/lib/systemd/system/vsftpd.service’ ‘/etc/systemd/system/multi-user.target.wants/vsftpd.service’

[root@keeplive vsftpd]# systemctl status vsftpd
vsftpd.service – Vsftpd ftp daemon
Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; enabled)
Active: active (running) since Fri 2014-11-14 16:29:23 SGT; 4 days ago
Main PID: 1301 (vsftpd)
CGroup: /system.slice/vsftpd.service
??1301 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf

Nov 14 16:29:23 keeplive systemd[1]: Starting Vsftpd ftp daemon…
Nov 14 16:29:23 keeplive systemd[1]: Started Vsftpd ftp daemon.
Nov 18 21:14:00 keeplive systemd[1]: Started Vsftpd ftp daemon.

hostnamectl and timedatectl and date and HWCLOCK

Modify CentOS 7 hostname

In CentOS, there are three definitions hostname: static (static), transient (transient), and flexible (pretty). “Static” host name is also called kernel hostname, is the system at boot time from /etc/hostname
automatic initialization of the host name. “Transient” host name is in the system is running temporarily assigned host name, for example, assigned by DHCP or mDNS server.
Static hostname and transient hostname comply with the same character as the Internet domain restriction rules. On the other hand, a “flexible” is allowed to use
the hostname of free-form (including special / whitespace) host name, to show to the end user (eg Linuxidc).

In CentOS 7, a man named hostnamectl command-line tool that allows you to view or modify the host name associated with the configuration.

[root@keeplive ~]# hostnamectl
Static hostname: keeplive
Icon name: computer
Chassis: n/a
Machine ID: 2b48dba259f2428ca8038f7aeb1d7f15
Boot ID: 57772bec11854cd08ee72db54a1441d3
Virtualization: vmware
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-123.9.3.el7.x86_64
Architecture: x86_64
[root@keeplive ~]# hostnamectl status
Static hostname: keeplive
Icon name: computer
Chassis: n/a
Machine ID: 2b48dba259f2428ca8038f7aeb1d7f15
Boot ID: 57772bec11854cd08ee72db54a1441d3
Virtualization: vmware
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-123.9.3.el7.x86_64
Architecture: x86_64
[root@keeplive ~]# hostnamectl –static
keeplive
[root@keeplive ~]# hostnamectl –transient
keeplive
[root@keeplive ~]# hostnamectl –pretty

timedatectl

How to display the current date and time using timedatectl ?

[root@keeplive ~]# timedatectl
Local time: Mon 2014-11-17 07:50:53 SGT
Universal time: Sun 2014-11-16 23:50:53 UTC
RTC time: Sun 2014-11-16 23:50:53
Timezone: Asia/Singapore (SGT, +0800)
NTP enabled: yes
NTP synchronized: yes
RTC in local TZ: no
DST active: n/a

How to change the current date using timedatectl ?

timedatectl set-time YYYY-MM-DD

Example of change the current date :
[root@centos7 ~]# timedatectl set-time 2014-11-17

How to change the current time using timedatectl ?
timedatectl set-time HH:MM:SS

Example of change the current time :
[root@centos7 ~]# timedatectl set-time 00:50:00

[root@keeplive ~]# timedatectl list-timezones | grep Asia
Asia/Aden
Asia/Almaty
Asia/Amman
Asia/Anadyr
Asia/Aqtau
Asia/Aqtobe
Asia/Ashgabat
Asia/Baghdad
Asia/Bahrain
Asia/Baku
Asia/Bangkok
Asia/Beirut
Asia/Bishkek
Asia/Brunei
Asia/Chita
Asia/Choibalsan
Asia/Colombo
Asia/Damascus
Asia/Dhaka
Asia/Dili
Asia/Dubai
Asia/Dushanbe
Asia/Gaza
Asia/Hebron
Asia/Ho_Chi_Minh
Asia/Hong_Kong
Asia/Hovd
Asia/Irkutsk
Asia/Jakarta
Asia/Jayapura
Asia/Jerusalem
Asia/Kabul
Asia/Kamchatka
Asia/Karachi
Asia/Kathmandu
Asia/Khandyga
Asia/Kolkata
Asia/Krasnoyarsk
Asia/Kuala_Lumpur
Asia/Kuching
Asia/Kuwait
Asia/Macau
Asia/Magadan
Asia/Makassar
Asia/Manila
Asia/Muscat
Asia/Nicosia
Asia/Novokuznetsk
Asia/Novosibirsk
Asia/Omsk
Asia/Oral
Asia/Phnom_Penh
Asia/Pontianak
Asia/Pyongyang
Asia/Qatar
Asia/Qyzylorda
Asia/Rangoon
Asia/Riyadh
Asia/Sakhalin
Asia/Samarkand
Asia/Seoul
Asia/Shanghai
Asia/Singapore
Asia/Srednekolymsk
Asia/Taipei
Asia/Tashkent
Asia/Tbilisi
Asia/Tehran
Asia/Thimphu
Asia/Tokyo
Asia/Ulaanbaatar
Asia/Urumqi
Asia/Ust-Nera
Asia/Vientiane
Asia/Vladivostok
Asia/Yakutsk
Asia/Yekaterinburg
Asia/Yerevan
[root@keeplive ~]#

In order to change the time zone to Asia/Kuala_Lumpur, type the following command as a root user :
[root@centos7 ~]# timedatectl set-timezone Asia/Singapore

date Utility

The date utility is available on all Linux systems. date allows you to display and change the current date and time and it is frequently used in scripts to display the system clock.

2.1. How to display the current Date and Time using date ?

To display the current date and time, run the date command with no additional command line options:
[root@centos7 ~]# date
Tue Nov 4 01:12:39 MYT 2014

This displays the day of the week followed by the current date, local time, abbreviated time zone, and year.

2.2. How to display the current Date and Time in customized the format ?

You can also customize the format of the displayed information by providing the +”format” option on the command line:
date +”format”

Example :
[root@centos7 ~]# date +”%Y-%m-%d %H:%M”
2014-11-17 01:20

2.3. How to change the current time using date ?

In order to change the current date and time, type the date command with the –set or -s option as a root user :

To change the current time, run the date command with the –set or -s option as root:
date +%T -s HH:MM:SS

Replace HH with an hour, MM with a minute, and SS with a second, all typed in a two-digit form.

As an example change the current time to 11:56 p.m., as a root, run the following command :
[root@centos7 ~]# date +%T –set 23:56:00

[root@keeplive ~]# hwclock
Mon 17 Nov 2014 07:54:18 SGT -0.396692 seconds
[root@keeplive ~]#

How to change the current Date and Time using hwclock ?

In order to change the hardware clock date and time, you can do so by appending –set and –date options along with your specification:
hwclock –set –date “dd mmm yyyy HH:MM”

As an example, if we want to set the date and time to to “15:20, October 29, 2015?, run the command in the following format:
[root@centos7 ~]# hwclock –set –date “29 Oct 2015 15:20”

3.2. How to change the current Date and Time using hwclock ?

In order to change the hardware clock date and time, you can do so by appending –set and –date options along with your specification:
hwclock –set –date “dd mmm yyyy HH:MM”

As an example, if we want to set the date and time to to “15:20, October 29, 2015?, run the command in the following format:
[root@centos7 ~]# hwclock –set –date “29 Oct 2015 15:20”

Note : In Red Hat Enterprise Linux 6 / CentOS 6, the hwclock command was run automatically on every system shutdown or reboot, but it is not in Red Hat Enterprise Linux 7 /CentOS 7.

For more information on how to configure the date and time in Red Hat Enterprise Linux 7 and CentOS 7, please read the manual page for the timedatectl, date and hwclock.