Friday Sep 19, 2014

How to collect a heap dump?

Here are the most common ways to do it. You will use these if you have OutOfMemoryException (OOM) and you would like to take a look to the issue to determine the root cause.

1. For Hotspot/Oracle JDK, you need to add the following parameters to JAVA_OPTIONS

-XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath=<path>

2. Similarly for JRockit, you need to the JAVA_OPTIONS below:

-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=C:\myApp\hprof-dumps

But, lets say that you are experiencing OOM, but you still don't determine the root cause of the issue.
You might probably need to restart as soon as you see performance issues or even better daily.
Then, #1 and #2 won't help.

You can use a tool like the ones below:
3. Jmap, e.g.:

<JAVA_HOME>/bin/jmap -dump:format=b,file=c:\temp\heap.hprof <PID>


4. Or if you have already a core file and you would like to have a heap dump as well, you can also get a heap dump:

jmap  -dump:format=b,file=heap.hprof $JAVA_HOME/bin/java /home/lmestre/core.27436

5. Or even jrcmd for JRockit:
%JROCKIT_HOME%\bin\jrcmd <pid of target JVM> hprofdump filename=<full path name to the target dump file name>

6. If you have a Windows Service, you can check This My Oracle Support Doc:
How Do I Get A Java Heap Dump When Running Weblogic As A Windows Service? (Hotspot JVM) (Doc ID 1264826.1)

To analyse the heap dump, you can use Eclipse MAT.
Here are some helpful documents to trobleshoot OOM:

Oracle WebLogic Server Support Pattern: Troubleshooting Out of Memory and Memory Leak Problems (Doc ID 877172.1)
ORACLE JRockit and Memory Consumption - Memory Leaks In Java Heap (Doc ID 1137239.1)
Enjoy!

Tuesday Aug 19, 2014

How to start WebLogic Server using default scripts?

There are a few common issues reported when starting weblogic server using scripts.
1. User is not able to access weblogic console.
2. After a few days/hours weblogic server stops abruptly.
3. When user closes putty, they are not able to connect to weblogic server anymore.
4. When user closes windows command prompt, they are not able to connect to weblogic server anymore.
5. Weblogic is started using startManagedWebLogic.cmd/startManagedWebLogic.sh.


By default, WebLogic Server does not run in background mode, so after you close the window the process finishes as well.

In Linux/Unix based platforms, you need to use:

nohup ./startManagedWebLogic.sh <Server> <URL> &

In Windows platforms, you need to start Managed Servers using Windows Services:

How to Install MS Windows Services For FMW 11g WebLogic Domain Admin and Managed Servers (Doc ID 1060058.1)

http://docs.oracle.com/cd/E23943_01/web.1111/e13708/winservice.htm


There a few more reasons that could cause similar symptoms, like JVM crash, signals sent by the Operating System, and many other reasons. 
But the above steps is the first one to start.

Enjoy!

Tuesday Aug 05, 2014

How do I specify certicom ciphersuite in weblogic 11g?

I recently have a customer that was getting the error below when trying to specify certicom ciphersuite:

<SEVERE> <Fatal error in node manager server>
java.lang.IllegalArgumentException: SSL_RSA_WITH_RC4_128_MD5 Unsupported.
        at com.certicom.tls.interfaceimpl.TLSSystem.setEnabledCipherSuites(Unknown Source)
        at javax.net.ssl.impl.SSLServerSocketImpl.setEnabledCipherSuites(Unknown Source)
        at weblogic.nodemanager.server.SSLListener.init(SSLListener.java:80)
        at weblogic.nodemanager.server.NMServer.start(NMServer.java:206)
        at weblogic.nodemanager.server.NMServer.main(NMServer.java:377)
        at weblogic.NodeManager.main(NodeManager.java:31) 
Ciphersuites were not picked when setting the ciphersuites using config.xml

<ciphersuite>TLS_RSA_WITH_RC4_128_SHA</ciphersuite>
<ciphersuite>TLS_RSA_WITH_RC4_128_MD5</ciphersuite>

The error was gone setting the arguments in JAVA_OPTIONS
-Dweblogic.security.SSL.Ciphersuites=SSL_RSA_WITH_RC4_128_MD5,TLS_RSA_WITH_RC4_128_MD5

The above works for JSSE as well.

I hope this helps.
Enjoy!

Thursday Jun 05, 2014

Where are the values of java.library.path being set?

This one could be a WebLogic Server question, but this post is general for any java environment.

We were getting  at the very beginning  java library path something like this:

/home/lmestre/jdk1.6/jre/lib/amd64/server:/home/lmestre/jdk1.6/jre/lib/amd64:/home/lmestre/jdk1.6/jre/../lib/amd64

So, the question was:


Where WebLogic Server is setting java.library.path?

I never found the answer, so why don't we try to try to answer

Where the JVM is setting java.library.path?

public class LibraryPathPrinter {

   public static void main(String[] args) {
       String javaLibraryPath= System.getProperty("java.library.path");
       System.out.println("java.library.path "+javaLibraryPath );
   }

}

after a simple

javac LibraryPathPrinter.java

and then an easy

java LibraryPathPrinter

voila!

The program printed something like this

java.library.path  /home/lmestre/jdk1.6/jre/lib/amd64/server:/home/lmestre/jdk1.6/jre/lib/amd64:/home/lmestre/jdk1.6/jre/../lib/amd64

So the JVM was the culprit.
Enjoy!

Wednesday Feb 26, 2014

My new Active Directory Provider is not Working!

When you create LDAP providers, an easy way to verify they are working fine is by verifying in WebLogic console, you can see the users listed.

After added Active Directory Provider, Users and Groups are listed in Admin Console:

Security Realms -> My Realm -> Users and Groups.


When attempting to login to an application that is using the users, the login is being denied, and you might not see any clues in weblogic server logs.

If you enable Atn debug, the following is observed in server log:

<Debug> <SecurityAtn> <MyDomain> <AdminServer> <[ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)' for workmanager: consoleapp@null@consoleWorkManager> <<WLS Kernel>> <> <593625378f0917fe:-23dcaa48:143ea3e7180:-8000-0000000000000400> <1391205135889> <BEA-000000> <weblogic.security.service.internal.WLSJAASLoginServiceImpl$ServiceImpl.authenticate authenticate failed for user MyUser>


This can occur when  default authenticator is selected as REQUIRED  by default. So the login process is denied by the default authenticator due to it is not aware of users in Active Directory.

So, to fix the issue

1. Go to Admin Console > Security Realms > <Your Realm> >Providers.
2. Make Active Directory provider is in the top of the list and set Control Flag SUFFICIENT.
3. Make default authenticator Control Flag is set to OPTIONAL.

You can read more in this My Oracle Support document:

How to Configure Active Directory as the LDAP Provider for WebLogic Server (Doc ID 1299072.1)

Enjoy!

Tuesday Feb 04, 2014

Do I need to run WebLogic Server in a certified platform?

Well, the answer is Yes. But, Why is it important to be in a certified platform?

We have faced several issues which customers in a non certified platforms where after a long time and huge
 troubleshooting efforts we concluded that the issue was fixed after moving to a tested configuration.

WebLogic Server might run in any other non certified platform like any flavor of Linux, but we can not assure that it will work correctly.

So, What if you have a problem when running a non certified configuration?  If you don't find a known issue in the net or in My Oracle Support, try to reproducing the issue in a certified configuration. That will save a lot of time because as per out experience, the most probably cause of the issue is that the configuration where you are running WebLogic Server is causing the issue.

Eventually, if the issue still occurs, that will help to focus on the real issue and not in the noise added by the environment used to run WebLogic server.

It is also recommended to be in the latest JDK, that will help you to include in your environment the latest security fixes and patches for known issues already faced by other customers.

Another thing to consider is that you are upgrading your WebLogic Server. Then, you will probably need to upgrade your JDK as well. Always check certification matrix

Here you can find the supported configurations of Fusion Middleware products:

http://www.oracle.com/technetwork/middleware/ias/downloads/fusion-certification-100350.html

If you are in 12.1.1 or 12.1.2, make sure you pick the correct link. WebLogic Server 12.1.2 is very different from 12.1.1.

If you are in 11g, you will need to pick the document depending on your configuration.


You can see more information here:
https://blogs.oracle.com/certify/

Enjoy!

Friday Dec 27, 2013

How to Connect to WebLogic DataSource from a Java Client?

Some time ago, one of my customers had issues connecting from a client to a WebLogic Datasource.
I provided the sample code to try the functionality, here are the steps:

1. Save the code below as DataSourceClient.java in /myfolder

import java.sql.*;
import javax.sql.DataSource;
import javax.naming.Context;
import javax.naming.InitialContext;
import java.util.*;
import java.io.*;
import oracle.jdbc.OracleConnection;

public class DataSourceClient {
  public static void main(String [] args) {
    OracleConnection conn=null;
    javax.sql.DataSource ds=null;
    Hashtable env = new Hashtable();
    env.put( Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory" );
    env.put(Context.PROVIDER_URL, "t3://localhost:7001");

    try{
      Context context=new InitialContext( env );
      //you will need to have create a Data Source with JNDI name testDS
      ds=(javax.sql.DataSource) context.lookup ("testDS");
      conn=(OracleConnection) ds.getConnection();
      java.util.Properties prop = new java.util.Properties();
      System.out.println("Connection object details : "+conn);
      conn.close();
    }catch(Exception ex){
      //handle the exception
      ex.printStackTrace();
    }
  }
}


2. Modify PROVIDER_URL if needed. The value is set to t3://localhost:7001
3. Add to WebLogic Server JAVA_OPTIONS -Dweblogic.jdbc.remoteEnabled=true
4. Start WebLogic Server
5. Open a UNIX console. In the same console run:
    i. cd <domain>/bin
    ii. . ./setDomainEnv.sh (Notice the '.' before './setDomainEnv.sh')
    iii. CLASSPATH="/myfolder:${CLASSPATH}"
    iv   cd /myfolder
    v.   javac DataSourceClient.java
    vi.  java DataSourceClient


If you succeeed, you will see something like this:

Connection object details : weblogic.jdbc.rmi.SerialConnection_weblogic_jdbc_rmi_internal_ConnectionImpl_weblogic_jdbc_wrapper_JTAConnection_weblogic_jdbc_wrapper_XAConnection_oracle_jdbc_driver_Logic
alConnection_1036_WLStub@1       

This means, you sucessfully connected to your WLS Datasource.

Do you need further help?

Please check WebLogic Documentation:
http://docs.oracle.com/cd/E23943_01/web.1111/e13726/programming.htm

About


My name is Luz Mestre. I work as Principal Technical Support Engineer at Oracle Support. I'll post here the most interesting challenges I have in my daily work. The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.

Search

Categories
Archives
« August 2015
SunMonTueWedThuFriSat
      
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
     
Today