Posts

Showing posts with the label java

How to take Java Thread and Heap Dumps

Weblogic is nothing but a java process. So like any other java process we can take Thread and Heap dumps to analyze issues. Let us look at them one by one. Thread Dump : Thread dump gives a snapshot of threads at the time of taking dumps. It is primarily used to analyze performance and lock/resource contention issues. It is recommended to take 5-6 thread dumps in intervals of 10-15 seconds to understand if there is any issue. With single thread dump we won’t be able judge if it contention is momentarily or of long duration. There are multiple ways of taking thread dumps but my personal choice is jstack as we can take dumps even during most of the jvm hangs. 1) Using WLST : This method is not recommended as weblogic doesn’t respond during high loads. Also, wlst uses lot of resources. Following code snippet is taken from Oracle documentation: Place following code in a file code thread_dump.py. Please make changes according to your setup. serverName = ‘soa_server1’ ...

Linux Core files are not generated even after changing ulimit

One of our Oracle SOA servers were crashing lately and Oracle requested for core dumps to analyze issue further. In hotspot crash report, following message is written: Not able to take core dump as core file size is set to zero. Below are steps followed to generate core dumps on JVM crash: Step 1: Increased ulimit using following command: ulimit -c unlimited > /dev/null 2>&1 Step 2: Restarted server. But no luck, still no core dumps are generated. It was not effective as it is applicable to only for the current shell session and not to new shell session. Step 3: Updated the value in .bashrc file ‘ulimit -c unlimited > /dev/null 2>&1′ . This made all new sessions’ ulimit to new value. Again started soa server, still ulimit value for core dump file size is zero. Step 4: This was not expected. On analysis found that, soa server is taking its ulimit values from its parent process which is node manager process as server was started via node manager. Restarted node manage...

Error while executing WLST - AttributeError: java package 'weblogic.time' has no attribute 'strftime'

Java and python both have time modules. So when we tried to use strftime function in time, wlst picked up time module present in Java and not that one in python. This is due to name collision. To avoid this error, import time module with an alias name as below and prefix strftime call with alias name. import time as pytime

Different Types of Java JDK Installations

JDK Installation can be performed using either of the following: 1) Unzipping archive binaries: When installed using this method, it is available for only users who have access to the dir and doesn’t impact other users. You may have to update your path variable to include installation location to invoke java without using complete java file location. This method protects from accidental JDK  upgrade by other users and os upgrades. 2) Using  RPM Packages: It does system-wide installation for all users. It requires root access to install package. Note: When you download and install the Java Development Kit (JDK), the associated Java Runtime Environment (JRE) is also installed.

How Does Oracle Middleware Products Work even without SQL Client Installed?

Did you ever wonder how Oracle Middleware products communicate with Oracle database even without sql client installed in the machine while some of other products require sql client? Weblogic uses JDBC Type 4 driver that uses Java to connect directly to Oracle. It implements Oracle’s SQL*Net Net8 and TTC adapters using its own TCP/IP based Java socket implementation. The JDBC Thin driver does not require Oracle client software to be installed, but does require the server to be configured with a TCP/IP listener. Reference: https://www.ibm.com/support/knowledgecenter/SSCQGF_7.2.0.3/com.ibm.IBMDI.doc_7.2.0.3/rg_conn_jdbc_connectingtooracle.html

Could not find or load main class –cp

I have encountered below error while trying to execute wlst script from command line. In fact, this error could come while executing any java program. Could not find or load main class –cp’. this error was thrown when ‘java –cp /opt/oracle/APP/product/MWHome/wlserver_10.3/server/lib/weblogic.jar  weblogic.WLST ServerStatus.py’ was executed. This issue will come mostly when a command is copy/pasted from web. Little background of different types of dashes will help to better understand this error.  There are 3 types of dashes : hyphens (-), en dashes (–), and em dashes (—). Most of the keyboards have only hyphen and hyphen is the dash used in command lines for passing options/arguments. For more information, read this wikipedia article. The command in the error had ‘en dash’ which java command line doesn’t have any special meaning. So ti thought it was the class name. Obviously, it would not find the class and threw an indirect error...