Friday, February 22, 2013

Increasing the heap in weblogic 11g

There are 2 different type of servers in Weblogic Server




1. Admin Server



2. Managed Server



Increasing JVM Size of Admin Server

JVM size of Admin server can be increased by changing Xmx and Xms values in setDomainEnv.sh which is located in $MW_HOME/user_projects/domains//bin



There are two blocks for XMX and XMS in setDomainEnv.sh. Depending up on type of JVM make changes in second block. Below I changed the value of XMX and XMS of 64 Bit SUN Java to 2048 and 1024.



XMS_SUN_64BIT=”256″

export XMS_SUN_64BIT

XMS_SUN_32BIT=”256″

export XMS_SUN_32BIT

XMX_SUN_64BIT=”512″

export XMX_SUN_64BIT

XMX_SUN_32BIT=”512″

export XMX_SUN_32BIT

XMS_JROCKIT_64BIT=”256″

export XMS_JROCKIT_64BIT

XMS_JROCKIT_32BIT=”256″

export XMS_JROCKIT_32BIT

XMX_JROCKIT_64BIT=”512″

export XMX_JROCKIT_64BIT

XMX_JROCKIT_32BIT=”512″

export XMX_JROCKIT_32BIT



XMS_SUN_64BIT=”1024″

export XMS_SUN_64BIT

XMS_SUN_32BIT=”512″

export XMS_SUN_32BIT

XMX_SUN_64BIT=”2048″

export XMX_SUN_64BIT

XMX_SUN_32BIT=”1024″

export XMX_SUN_32BIT

XMS_JROCKIT_64BIT=”512″

export XMS_JROCKIT_64BIT

XMS_JROCKIT_32BIT=”512″

export XMS_JROCKIT_32BIT

XMX_JROCKIT_64BIT=”1024″

export XMX_JROCKIT_64BIT

XMX_JROCKIT_32BIT=”1024″

export XMX_JROCKIT_32BIT



Increasing JVM Size of Managed Server

JVM size of Managed Server can be increased from Weblogic console. This can be achieved by adding Xmx and Xms values start tab in Managed server shown as below



Servers >> ;Server-0>>;Start Tab>> ; Arguments


There are two ways to increase the heap size in weblogic.




If you do not have a nodemanager configured. Login the operating system , Under $domain_home/bin directory look for setDomainEnv.sh and add the following -512Xmx -512Xms to the java options.








If you are using the nodemanager then Login to the weblogic Administration console, then click on Servers --> ServerName --> General -->Start Options and look for the Java Arguments

Here you can add -512Xmx -512Xms to the java arguments. If you want to increase the heap size then alter these values from 512 to 1024 depending on your requirements.





Increasing the heap in weblogic 11g

There are 2 different type of servers in Weblogic Server




1. Admin Server



2. Managed Server



Increasing JVM Size of Admin Server

JVM size of Admin server can be increased by changing Xmx and Xms values in setDomainEnv.sh which is located in $MW_HOME/user_projects/domains//bin



There are two blocks for XMX and XMS in setDomainEnv.sh. Depending up on type of JVM make changes in second block. Below I changed the value of XMX and XMS of 64 Bit SUN Java to 2048 and 1024.



XMS_SUN_64BIT=”256″

export XMS_SUN_64BIT

XMS_SUN_32BIT=”256″

export XMS_SUN_32BIT

XMX_SUN_64BIT=”512″

export XMX_SUN_64BIT

XMX_SUN_32BIT=”512″

export XMX_SUN_32BIT

XMS_JROCKIT_64BIT=”256″

export XMS_JROCKIT_64BIT

XMS_JROCKIT_32BIT=”256″

export XMS_JROCKIT_32BIT

XMX_JROCKIT_64BIT=”512″

export XMX_JROCKIT_64BIT

XMX_JROCKIT_32BIT=”512″

export XMX_JROCKIT_32BIT



XMS_SUN_64BIT=”1024″

export XMS_SUN_64BIT

XMS_SUN_32BIT=”512″

export XMS_SUN_32BIT

XMX_SUN_64BIT=”2048″

export XMX_SUN_64BIT

XMX_SUN_32BIT=”1024″

export XMX_SUN_32BIT

XMS_JROCKIT_64BIT=”512″

export XMS_JROCKIT_64BIT

XMS_JROCKIT_32BIT=”512″

export XMS_JROCKIT_32BIT

XMX_JROCKIT_64BIT=”1024″

export XMX_JROCKIT_64BIT

XMX_JROCKIT_32BIT=”1024″

export XMX_JROCKIT_32BIT



Increasing JVM Size of Managed Server

JVM size of Managed Server can be increased from Weblogic console. This can be achieved by adding Xmx and Xms values start tab in Managed server shown as below



Servers>>Server-0>>Start Tab>> Arguments



WLST to connect to Admin Server SSL Enabled


Issue :

Not able to connect to admin server .which is SSL enbaled

Command :

java -Dweblogic.security.SSL.ignoreHostnameVerification=true -Dweblogic.security.TrustKeyStore=CustomTrust -Dweblogic.security.CustomTrustKeyStoreFileName=/JAVA_HOME/jre/lib/security/cacerts -Dweblogic.security.CustomTrustKeyStorePassPhrase=pwd  -Dweblogic.security.CustomTrustKeyStoreType=JKS -Dweblogic.security.SSL.allowSmallRSAExponent=true weblogic.WLST


wls:/offline> connect('weblogic',welcome1','t3s://abcd:35909')

Error :

Traceback (innermost last):


File "", line 1, in ?

File "", line 22, in connect

File "", line 648, in raiseWLSTException

WLSTException: Error occured while performing connect : Error getting the initial context. There is no server running at t3s://ngmlx476:25913

Use dumpStack() to view the full stacktrace

Troubleshoot :

Check the WLST SSL arguments :

Solution  :

Give the belwo command for invoking WLST :
java -Dweblogic.security.SSL.ignoreHostnameVerification=true -Dweblogic.seceblogic.security.CustomTrustKeyStoreFileName=/var/domain/abc/keystore/WebLogicTrustKeyStore.jks -Dweblogic.security.CustomTrustKeyStorePassPhrase=wltkpassword -Dweblogic.security.CustomTrustKeyStoreType=JKS -Dweblogic.security.SSL.allowSmallRSAExponent=true weblogic.WLST

 wls:/offline> connect('weblogic',welcome1','t3s://abcd:35909')


Successfully connected to Admin Server 'AdminServer01' that belongs to domain 'soa__Domain'.


Keep Thinking  :-)
Ashraf TP







Wednesday, February 6, 2013

Managed Server Not Reachable Failed to start

Hi Guys

One of my firiend reported this issue ...

While trying to start the managed server after configuring data_source and db adapter ,I faced this issue.

So I checked NodeManager ....which is working fine..

Admin server also working fine

But Managed server is not coming up ..and no there is no error reported in the logs ..

So while trouble shooting ,found that ....config.xml file permission was changed to root in the admin server machine ...

RCA :

Before creating the data sournce and db adpater ,the engineer has taken the backup of config.xml ...and while running the pbrun (switch user ) command he logged in as the root user and took the backup ..

So while starting the managed server..managed server is not able to get the config.xml from the admin server and this caused the issue


After changing the permission of the config.xml to the app user ..Managed Server started working :-)

Configuring DB Adapter in SOA11g

Outbound connection pools in a resource adapter are configured in the ra.xml and weblogic-ra.xml deployment descriptors. You can also use the Administration Console to modify the pool's properties. Properties you modify in the console will be saved in a deployment plan.

1.  Create  data source
2..  Create outbound connection
3.Assign the newly created outbound connection to the data source .

* Follow below steps to create a Data Source to point to your database.


* Example:

- Name: myDS

- JNDI Name: jdbc/myDS


1. Login Admin Console.


* In Domain Structure pane, click soa_domain -> Services -> Data Sources.

* In Summary of JDBC Data Sources -> Configuration page, click New -> Generic Data Source.


* In JDBC Data Source Properties screen, enter:

- Name: myDS

- JNDI Name: jdbc/myDS

- Database Type: Oracle

  * Click Next

* Select

- Database Driver: Oracle's Driver (Thin XA) for Instance connections; Verions:9.0.1 and later

- Click Next.

* Click Next on Transaction Options screen.

* On Connection Properties screen, enter:

- Database Name: orcl

- Host Name: localhost

- Port: 1521

- Database User Name: scott

- Password: tiger

- Click Next.

* On Test Database Connection screen, click Test Configuration button. Make sure the response is Connection test succeeded.



* Click Next.

* On Select Targets screen, select the target server instance. For example,



Click Finish...

2) Create an Outbound Connection Pool:


* Click soa_domain > Deployments in Domain Structure pane.

* Click DBadapter in Summary of Deployments pane.

* Click Configuration -> Outbound Connection Pools tab.

* Click New button.



* Select javax.resource.cci.ConnectionFactory and click Next

Enter

JNDI Name: eis/DB/myDB


Click Finish

Assign Data Source to Connection Pool:


* Click Configuration tab -> Outbound Connection Pools tab.

* Expand javax.resource.cci.ConnectionFactory.

* Click the newly created outbound connection pool, e.g eis/DB/myDB.



* Click Properties tab and enter

xADataSourceName: jdbc/myDS

* Hit Enter key.

* Click Save button.



3) Redeploy DbAdapter :

* Click soa_domain > Deployments in Domain Structure pane.

* Click thecheckbox to select DBAdapter.

* Click Update button.


* Select Redeploy this application using the following deployment files

* Check deployment plan file is correct:

- Deployment plan path:/opt/oracle/Middleware/home_11gr1/Oracle_SOA1/soa/DBPlan/Plan.xml



Click Next ..Finish

click Activate Changes...








Monday, November 19, 2012

Using the Perl chomp() function


Using the Perl chomp() function

Introduction

The chomp() function will remove (usually) any newline character from the end of a string. The reason we say usually is that it actually removes any character that matches the current value of $/ (the input record separator), and $/ defaults to a newline.
For more information on the $/ variable, try perldoc perlvar and see the entry for $/.

Example 1. Chomping a string

Most often you will use chomp() when reading data from a file or from a user. When reading user input from the standard input stream (STDIN) for instance, you get a newline character with each line of data. chomp() is really useful in this case because you do not need to write a regular expression and you do not need to worry about it removing needed characters.
When running the example below, using the enter key on a line by itself will exit the program.
  #!/usr/bin/perl
  use strict;
  use warnings;

  while (my $text = ) {
    chomp($text);
    print "You entered '$text'\n";
    last if ($text eq '');
  }
Example usage and output of this program is:
  a word
  You entered 'a word'
  some text
  You entered 'some text'

  You entered ''

Example 2. Chomping an array

If you chomp an array, it will remove a newline from the end of every element in the array:
  #!/usr/bin/perl
  use strict;
  use warnings;

  my @array = ("bob\n", "jill", "fred\n");

  print "Before chomp:\n";
  print "@array\n";

  chomp(@array);

  print "After chomp:\n";
  print "@array\n";
This program produces the following output:
  Before chomp:
  bob
   jill fred

  After chomp:
  bob jill fred
As you can see, the newlines have been removed from "bob" and "fred", but no characters have been removed from "jill".

Example 3. Chomping a hash

If you pass a hash into chomp(), it will remove newlines from every value (not key) of the hash:
  #!/usr/bin/perl
  use strict;
  use warnings;

  my %hash = (
    'first' => "one\n",
    'second' => "two\n",
    'third' => "three\n",
  );

  chomp(%hash);

  foreach my $k (keys %hash) {
    print "$k: $hash{$k} ";
  }

  print "\n";

  exit 0;
This program outputs:
  first: one second: two third: three

Wednesday, November 14, 2012

ReturnCode in unix


Shell Command Exit Status

The return value of a command is its exit status, or 128 + N if the command is terminated by signal N. Exit status is used to check the result (success/failure) of the execution of the command. If the exit status is zero, then the command is success. If the command is failed the exit status will be non-zero.

Exit Value Exit Status
0 (Zero) Success
Non-zero Failure
2 Incorrect usage
127 Command Not found
126 Not an executable
$? Shell Variable

The shell variable name $? is a special built-in variable which has the exit status of the last command executed.

After the shell function execution, $? returns the exit status of the last command executed in a function.
After the shell script execution, $? returns the exit status of the last command executed in the script.
Sample Shell Script that Explains Shell-Command Exit Status

The following exitstatus.sh shell-script shows examples of various shell-command exit status.

$ cat exitstatus.sh
#! /bin/bash

echo -e "Successful execution"
echo -e "====================="
echo "hello world"
# Exit status returns 0, because the above command is a success.
echo "Exit status" $?

echo -e "Incorrect usage"
echo -e "====================="
ls --option
# Incorrect usage, so exit status will be 2.
echo "Exit status" $?

echo -e "Command Not found"
echo -e "====================="
bashscript
# Exit status returns 127, because bashscript command not found
echo "Exit status" $?

echo -e "Command is not an executable"
echo -e "============================="
ls -l execution.sh
./execution.sh
# Exit status returns 126, because its not an executable.
echo "Exit status" $?
Now, execute the above exitstatus.sh to see the various exit statues given by the sample shell script.

$ bash exitstatus.sh
Successful execution
=====================
hello world
Exit status 0
Incorrect usage
=====================
ls: unrecognized option `--option'
Try `ls --help' for more information.
Exit status 2
Command Not found
=====================
exitstaus.sh: line 15: bashscript: command not found
Exit status 127
Command is not an executable
=============================
-rw-r--r-- 1 root root 659 Mar  9 13:36 execution.sh
exitstatus.sh: line 21: ./execution.sh: Permission denied
Exit status 126