Followers

Thursday, November 1, 2012

Datasource Creation in ant for Weblogic

<?xml version="1.0" ?>
<project name="deploy" default="makeDataSource" basedir=".">
<property name="wls.username" value="weblogic" />
<property name="wls.password" value="weblogic1" />
<property name="wls.url" value="t3://localhost:7001" />
<property name="wls.targetServer" value="AdminServer" />
<property name="wls.domainName" value="base_domain1" />
<property name="database.url" value="jdbc:oracle:thin:@dbhostname:1521:dbname" />
<property name="database.driver" value="oracle.jdbc.OracleDriver" />
<property name="database.user" value="dbusername" />
<property name="database.password" value="dbpassword" />
   
<taskdef name="wldeploy" classname="weblogic.ant.taskdefs.management.WLDeploy"/>
<taskdef name="wlconfig" classname="weblogic.ant.taskdefs.management.WLConfig"/>

<target name="makeDataSource">
<wlconfig username="${wls.username}" password="${wls.password}" url="${wls.url}">
<query domain="${wls.domainName}" type="Server" name="${wls.targetServer}" property="x" />
<create type="JDBCConnectionPool" name="TestDS">
<set attribute="CapacityIncrement" value="1"/>
<set attribute="DriverName" value="${database.driver}"/>
<set attribute="InitialCapacity" value="1"/>
<set attribute="MaxCapacity" value="10"/>
<set attribute="Password" value="${database.password}"/>
<set attribute="Properties" value="user=${database.user}"/>
<set attribute="RefreshMinutes" value="0"/>
<set attribute="ShrinkPeriodMinutes" value="15"/>
<set attribute="ShrinkingEnabled" value="true"/>
<set attribute="TestConnectionsOnRelease" value="false"/>
<set attribute="TestConnectionsOnReserve" value="true"/>
<set attribute="TestTableName" value="SYSTABLES"/>
<set attribute="URL" value="${database.url}"/>
<set attribute="Targets" value="${x}" />
</create>
<create type="JDBCDataSource" name="TestDS" >
<set attribute="JNDIName" value="jdbc/TestDS"/>
<set attribute="PoolName" value="TestDS"/>
<set attribute="Targets" value="${x}" />
</create>
</wlconfig>
</target>
</project>

Sunday, October 7, 2012

JAVA_OPTION parameters in weblogic

For Sun JDK:
- To get verbose GC loggging:
-verbose:gc
-Xloggc:file
-XX:-PrintGC
-XX:-PrintGCDetails
-XX:-PrintGCTimeStamps
- To get heap dump on out of memory:
-XX:HeapDumpPath=./java_pid<pid>.hprof
-XX:-HeapDumpOnOutOfMemoryError
For JRockit JDK:
- To get verbose GC loggging:
-Xverbose:gc,memdbg,compaction,gcpause 
-Xverboselog:file
-XverboseTimeStamp
- To get heap dump on out of memory: There is no java parameter to add in case of JRockit. We need to take JRA/flight recording with help of jrmc tool or jrcmd commands
If you add these java parameters in JAVA_OPTIONS in setDomainEnv.sh or startup scripts then it will get applied to all servers and gc logging or heap dump information for all servers may get written in same log file. In order to avoid this follow either of below:
- Command line startup: In this case create new startup managed server scripts for one or two servers and add these parameters with different file names foe GC and heap dump logging. This will generate different files which can be analysed separately.
- Remote startup: In this case add above java parameters separately in startup arguments for individual servers.