Thursday, March 7, 2013

JDeveloper 11gR2 - Integrated Weblogic Server Password Reset

Hello everyone. After months of working with ADF Essentials, I needed to log in to the Console application of the integrated Weblogic Server that comes with JDeveloper 11.1.2.3 (Weblogic Server 10.3.5) and then I realized that I have forgotten the password of the weblogic user... So I started looking and found two solutions:
  1. Solution 1: Remove the default domain folder created by the Integrated Weblogic Server.
  2. Solution 2: Generate a new password for the weblogic user. 
What's the difference between solution 1 and 2?
In solution 1, you will lose any configuration you have made to your integrated weblogic server, this includes: data sources, security configuration, etc.
In solution 2, you will lose only security configurations you have made. For example, if you have created more users, or groups, or configured access to an external LDAP service, but will keep everything else. I have to say that this solution is more difficult than solution 1.

If you have not made any configurations to your integrated Weblogic server, I suggest you to go with solution 1. 

Before we continue with the solutions, we first need to find the IDE system directory. In order to do that, open JDeveloper, go to the Help menu and select the About option. A popup shows up, select the Properties tab and scroll down until you find any of  these: ide.pref.dir or ide.system.dir or ide.user.dir 

In a Linux environment, you may find something like this:



In a windows environment, you may find something like this:



Actually, the dir we are looking for is the ide.system.dir so lets write it down so we can use it later:

Linux (my case, yours may be different)
SYS_DIR=/home/aalopez/.jdeveloper/system.11.1.2.3.39.62.76.1

Windows (my case, yours may be different)
SYS_DIR=C:\Users\CVDESA\AppData\Roaming\JDeveloper\system11.1.2.3.39.62.76.1

Make sure Weblogic server is shut down before you continue.


Solution 1: Removing the DefaultDomain folder
The first and easiest solution is to Remove the following folder (DefaultDomain):
SYS_DIR/DefaultDomain

The folder will get re-created for you the next time you start the Weblogic server. The problem is that you will lose any configuration you may have done including: users, passwords, datasources, etc. All of it.
Once you remove the folder, open JDeveloper go to the Run menu, and select the Start Server Instance (IntegratedWeblogicServer) option. A popup shows up asking you to set the weblogic user credentials. That's it!

Solution 2: Reset the weblogic user password
Please follow the next steps in order reset the password in a Linux system (Ubuntu 12.1), steps for Windows system are also presented:

Linux
  1. Go to this path: SYS_DIR/DefaultDomain/bin, where SYS_DIR is the path we defined above.
  2. Execute the setDomainEnvironment.sh
  3. Go to this path: SYS_DIR/DefaultDomain/security
  4. Rename the DefaultAuthenticatorInit.ldift file to something like oldDefaultAuthenticatorInit.ldift
  5. Export the weblogic.jar file to the classpath, so we can create a new password for the weblogic user (in my case, the installation directory of JDeveloper is /home/aalopez/Oracle):
  6. export CLASSPATH=$CLASSPATH:/home/aalopez/Oracle/Middleware/wlserver_10.3/server/lib/weblogic.jar
  7. Execute the following command in order to create the new password. Notice that the command has a dot at the end, this is necessary so the new password is created in the current directory. Change NEW_PASSSWORD for the new password of the weblogic user:
  8. java weblogic.security.utils.AdminAccount weblogic NEW_PASSWORD .
  9. Go to this path: SYS_DIR/DefaultDomain/servers/DefaultServer
  10. Rename the data directory to something like data_old
  11. Go to this path: SYS_DIR/DefaultDomain/servers/DefaultServer/security
  12. Rename the boot.properties file to something like oldboot.properties
  13. Create a new boot.properties file in the same directory. This is necessary if you want autologin when launching the Weblogic server from within JDeveloper. The content of the file should be something like the following (change NEW_PASSWORD for the password you defined in previous steps):
  14. username=weblogic
    password=NEW_PASSWORD
  15. It's time to test our changes. Go to this path: SYS_DIR/DefaultDomain/bin
  16. Execute the startWeblogic.sh file and verify that Weblogic server starts without exceptions.
  17. Open a new browser and enter the following URL (the port may be different for you):
  18. http://localhost:7101/console
  19. The Weblogic server console application should display and you can login with your new credentials.
  20. When you are ready to stop the Weblogic server, go to this path: SYS_DIR/DefaultDomain/bin
  21. Execute the stopWeblogic.sh file in order to stop the server.

There's one extra step that we'll cover after we check the Windows steps:


Windows

  1. Go to this path: SYS_DIR\DefaultDomain\bin, where SYS_DIR is the path we defined above.
  2. Execute the setDomainEnvironment.cmd
  3. Go to this path: SYS_DIR\DefaultDomain\security
  4. Rename the DefaultAuthenticatorInit.ldift file to something like oldDefaultAuthenticatorInit.ldift
  5. Execute the following command in order to create the new password. Notice that the command has a dot at the end, this is necessary so the new password is created in the current directory. Change NEW_PASSSWORD for the new password of the weblogic user:
  6. java weblogic.security.utils.AdminAccount weblogic NEW_PASSWORD .
  7. Go to this path: SYS_DIR\DefaultDomain\servers\DefaultServer
  8. Rename the data directory to something like data_old
  9. Go to this path: SYS_DIR\DefaultDomain\servers\DefaultServer\security
  10. Rename the boot.properties file to something like oldboot.properties
  11. Create a new boot.properties file in the same directory. This is necessary if you want autologin when launching the Weblogic server from within JDeveloper. The content of the file should be something like the following (change NEW_PASSWORD for the password you defined in previous steps):
  12. username=weblogic
    password=NEW_PASSWORD
  13. It's time to test our changes. Go to this path: SYS_DIR\DefaultDomain\bin
  14. Execute the startWeblogic.cmd file and verify that Weblogic server starts without exceptions.
  15. Open a new browser and enter the following URL (the port may be different for you):
  16. http://localhost:7101/console
  17. The Weblogic server console application should display and you can login with your new credentials.
  18. When you are ready to stop the Weblogic server, go to this path: SYS_DIR\DefaultDomain\bin
  19. Execute the stopWeblogic.cmd file in order to stop the server.


Once you have changed and tested the new password for the weblogic user, is time to update the information in JDeveloper. Open JDeveloper and go to the Resource Palette, if you can't find it, go to the View menu and select the Resource Palette option:




There, select the Application Server category and the IntegratedWebLogicServer. Right click and select the Properties option. A new popup shows up, select the Authentication tab:



There you can set the new weblogic user password that you just defined steps above. Apply changes and that's it!


see ya,


References:

Reset lost weblogic admin password | Beyond Oracle. João Oliveira [online].
Available on Internet: http://www.beyondoracle.com/2010/08/30/reset-lost-weblogic-admin-password/
[accessed on March 02 2013].

Enabling Auto Login by Using the Boot Identity File. Oracle [online].
Available on Internet: http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/wls/10g/r3/installconfig/enable...
[accessed on March 02 2013].

Changing DefaultServer's Password running in JDeveloper. Brenda [online].
Available on Internet: http://newsoalife.blogspot.com/2011/07/changing-defaultservers-password.html
[accessed on March 04 2013].

OTN Discussion Forums. Oracle [online].
Available on Internet: https://forums.oracle.com/forums/thread.jspa?threadID=2285290
[accessed on March 07 2013].