Tuesday, March 6, 2012

Managed server not starting

Issue :Authentication for user weblogic denied

#### <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <> <> <> <1331026721734>
#### <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <> <> <> <1331026721750>
####
<> <> <> <1331026721750> weblogic.security.SecurityInitializationException: Authentication for user weblogic denied

Solution :

Root cause #1

The Weblogic boot.properties file is corrupted or contains invalid principal and credentials


Solution >> boot.properties reset

· Backup and clear the cache and data directories under /servers/
· Recreate boot.properties (put back your plain text username and password) under /servers//security directory and restart the affected server(s)


Root cause #2

The Weblogic boot.properties file is valid but the security realm is corrupted or in an invalid state


Solution >> Weblogic Admin username and password reset

· Backup your Weblogic server domain
· Rename or delete /security/DefaultAuthenticatorInit.ldift
· Run the following Java command:
java weblogic.security.utils.AdminAccount </security >
· Delete the contents inside the file boot.properties under /servers/< AdminServer>/security
· Add the following contents inside the boot.properties
username=
password=
· Backup and delete the folder: /servers//data/ldap
· Restart your Weblogic server

Node Manager Not Reachable in windows/linux

http://onlineappsdba.com/index.php/2011/02/14/webloigic-node-manager-associated-with-this-machine-is-not-reachable-access-to-domain-base_domain-for-user-xxxxx-denied/


This post covers “Node Manager not reachable/inactive ” from admin console , a very common issue that we face , especially in a Clustered Setup or starting Managed Servers on remote machine.

For basics about Node Manager refer this Link.

In our case, we had the Admin Server& Webcenter Spaces Managed Server1 on one Machine1 & Webcenter Spaces Managed Server 2 on Machine2. More on WebCenter deployment in High Availability here

After pack & unpack the domain jar file (for more on pack & unpack scripts please check this link) on Machine2, We started the nodemanager.

It started successfully without any errors but when we checked the status of nodemanger in console under Environment–>Machines–>[Machine2] –>Monitoring–>Node Manager , it showed node manager not reachable.

Verified

• Node Manager for Machine2 was configured correctly
• Host Name verification was disabled, checked that listener is running on 5556
still Node Manager on Machine2 was not reachable from Admin Console, hence time to check Admin Server log file ($DOMAIN_HOME/servers/AdminServer/logs) :

Could not execute command “getVersion” on the node manager. Reason: “Access to domain ‘base_domain’ for user ‘vfPYmgWF1Y’ denied”.

The issue was that Node Manager on Machine2 was not enrolled with Admin Server on Machine1.

As per the doc here , we must run
nmEnroll()
on all remote machines that are running a Managed Server. Additionally, you should run
nmEnroll()
for each domain directory on each machine (If you have different domain directory for Admin Server and Managed server on same machine as mentioned here).

Follow below steps to enroll the Node Manager using WLST command:-

1) Set environment by running setWLSEnv.sh (linux)/setWLSEnv.cmd (windows) under $WEBLOGIC_HOME/server/bin

2) java weblogic.WLST

wls:/offline> connect(’[weblogic_user]’,'[user_password]’,'t3://[hostname]:[admin port]’)

wls:/base_domain/serverConfig> nmEnroll(’[MW_HOME]/user_projects/domains/base_domain’,'[WL_HOME]/common’)

You should get output like “Successfully enrolled this machine with the domain directory at $Middleware_Home/user_projects/domains/base_domain”

After this restart the nodemanager & it will now be accessible from admin

Node Manger not reachable

1. start the AdminServer using startScript “startWebLogic.sh/cmd”
Step2) Start the NodeManager.
Step3) Login to admin-console and then see if the NodeManager is Reachable or not at the below console path
Console Path:
Machines -> -> Monitoring (tab) -> Node Manager Status (sub-tab) -> Status: Reachable
If its NOT REACHABLE then please do the following from the Admin Server Box to Enroll the NodeManager
view source

print?
1 a) Open a command prompt and run "setWLSEnv.sh/cmd" in it then run the following commands
2
3 java weblogic.WLST
4 connect('weblogic','weblogic','t3://localhost:7001')

5 nmEnroll('C:/bea103/user_projects/domains/7001_Domain','C:/bea103/wlserver_10.3/common/nodemanager')
6

7 b)Then again check in the console path if NodeManager is Reachable.
Step4). Once NodeManager is Enrlolled and Reachable in the admin console then continue the following steps.
Step5). Kill the AdminServer because now we need to start it using WLST command nmStart() and NOT using the start scripts.
Step6). Open a command prompt run “setWLSEnv.sh/cmd” and then run the following command
view source

print?
1 java weblogic.WLST
Step7). Now connect to the NodeManager using the following command (7001_Domain is the Domain Name for example.)
view source

print?
1 nmConnect('weblogic','weblogic','localhost','5556','7001_Domain')
Step8). Once you are successfully connected to the Nodemanager please start the AdminServer using the following command
view source

print?
1 nmStart('AdminServer')
Step9). Once the Server is started run the following command to get the AdminServer Status
view source

print?
1 nmServerStatus('AdminServer')
Now if you can see the Admin Server status that means now your AdminServer is now reachable. Hope these steps solves your NodeManager is not reachable

Node Manger not reachable

1. start the AdminServer using startScript “startWebLogic.sh/cmd”
Step2) Start the NodeManager.
Step3) Login to admin-console and then see if the NodeManager is Reachable or not at the below console path
Console Path:
Machines -> -> Monitoring (tab) -> Node Manager Status (sub-tab) -> Status: Reachable
If its NOT REACHABLE then please do the following from the Admin Server Box to Enroll the NodeManager
view source

print?
1 a) Open a command prompt and run "setWLSEnv.sh/cmd" in it then run the following commands
2
3 java weblogic.WLST
4 connect('weblogic','weblogic','t3://localhost:7001')

5 nmEnroll('C:/bea103/user_projects/domains/7001_Domain','C:/bea103/wlserver_10.3/common/nodemanager')
6

7 b)Then again check in the console path if NodeManager is Reachable.
Step4). Once NodeManager is Enrlolled and Reachable in the admin console then continue the following steps.
Step5). Kill the AdminServer because now we need to start it using WLST command nmStart() and NOT using the start scripts.
Step6). Open a command prompt run “setWLSEnv.sh/cmd” and then run the following command
view source

print?
1 java weblogic.WLST
Step7). Now connect to the NodeManager using the following command (7001_Domain is the Domain Name for example.)
view source

print?
1 nmConnect('weblogic','weblogic','localhost','5556','7001_Domain')
Step8). Once you are successfully connected to the Nodemanager please start the AdminServer using the following command
view source

print?
1 nmStart('AdminServer')
Step9). Once the Server is started run the following command to get the AdminServer Status
view source

print?
1 nmServerStatus('AdminServer')
Now if you can see the Admin Server status that means now your AdminServer is now reachable. Hope these steps solves your NodeManager is not reachable

OBIEE 11g weblogic admin password Reset

Oracle BI Enterprise Edition OBIEE 11g has been integrated into the Fusion Middleware and now runs on Weblogic server. Therefore it also requires an administrator password to manage Weblogic server. By default, the administrator account is called 'weblogic'. the procedure to manage the weblogic administrator account password is similar to any other platform running on Weblogic server.

If for security reasons you ever want to change the administrator password at specific time intervals or you have to work on a platform you do not usually manage and the weblogic adminserver password is unknown (step 1 below would not apply) or any other weblogic server (for instance your forms and reports server 11g enterprise manager password), you can proceed with following steps to reset this password on Weblogic Server 10.3 (WLS 11g):

1. Shutdown WebLogic server from a command line session:

export MWHOME=[MiddlewareHome]
export DOMAIN_HOME=[BI_DomainHome]
export CLASSPATH=$CLASSPATH:$MWHOME/wlserver_10.3/server/lib/weblogic.jar
cd $DOMAIN_HOME/bin
./stopWebLogic.sh

(enter existing username [weblogic] and old password when prompted)

Example values for these environment variables:

export MWHOME=/u01/app/oracle/Middleware
export DOMAIN_HOME=/u01/app/oracle/Middleware/user_projects/domains/bifoundation_domain
2. Still in the same command line session, populate the correct values of the environment variables for your (OBI) Domain:

cd $DOMAIN_HOME/bin
./setDomainEnv.sh
3. To disable the default authenticator initialisation file and still retain a backup copy, rename it:

cd $DOMAIN_HOME/security
mv DefaultAuthenticatorInit.ldift DefaultAuthenticatorInit.ldift.bak
4. Generate an administrator password for a new temporary (or permanent) administration account, e.g. called wlsadmin, into a new DefaultAuthenticatorInit.ldift file using the syntax below. Please do not leave the security directory and mind the trailing dot:

java weblogic.security.utils.AdminAccount [adminUserName] [adminPassword] .
5. Backup and disable the boot properties file, if exists, as well as the 'DefaultAuthenticatormyrealmInit.initialized' file in the ldap directory of the domain:

cd $DOMAIN_HOME/servers/AdminServer/data/ldap
mv DefaultAuthenticatormyrealmInit.initialized DefaultAuthenticatormyrealmInit.initialized.bak
cd ../../security
mv boot.properties boot.properties.bak

Please never rename the directory 'ldap' where the 'DefaultAuthenticatormyrealmInit.initialized' file was disabled abovem nor its entire parent directory 'data'. Doing this would cause the loss of all existing users and may even remove default OBI users and groups. A safety copy of the directory 'data' is recommended:

cd $DOMAIN_HOME/servers/AdminServer
cp -R data data.bak
6. Restart the Admin Server using the new administrator account. If it is possible to start in the foreground, proceed as follows:

cd $DOMAIN_HOME
./startWebLogic.sh

If you operate the Weblogic server from a remote terminal session and want to run the server in the background, one can proceed like this (assuming boot.properties has not been configured previously):

cd $DOMAIN_HOME/servers/AdminServer/security
echo username=wlsadmin > boot.properties (1)
echo password=******>>boot.properties (2)
cd $DOMAIN_HOME
nohup ./startWebLogic.sh >> Adminserver.log 2>&1 & (3)
tail -f Adminserver.log (4)


Please avoid blank lines in boot.properties file. The clear text username and password will be encrypted the first time Weblogic server has been started.

In WebLogic Server 11g Administration Console, logon using the new administration account, e.g. 'wlsadmin'. Do not use the old account 'weblogic'. By default, you can reach this console using your web browser at URL:

servername:7001/console

Navigate through the domain structure to:
bifoundation_domain/Security Realms
select 'myrealm', press the command button 'Lock & Edit' and enable the tabs

Users and Groups / weblogic

to change the password of this old administration account.

From now on, the Enterprise Manager Fusion Middleware Control 11g and the WebLogic Server 11g Administration Console can be accessed with the new administration account as well as using the new password for account 'weblogic'.

Optionally, also grant the new 'wlsadmin' account OBI administration privileges by assigning the group 'BIAdministrators ' to it, save and press 'Release Configuration'.
_____________________
(1) Please use the WLS admin account "adminUserName" created above in step 4, this should not be "weblogic" when following this publication.
(2) Better add this password through a text editor as it may end up in history.
(3) To start WLS in the background and have it running when disconnecting your terminal session.
(4) To monitor the startup process. You can send the Break signal with CTRL+C when reading the expected log entry:
" "


These steps have been tested on both Oracle Fusion Middleware 11g Release 1 Business Intelligence Foundation OBIEE releases 11.1.1.3.0 and 11.1.1.5.0 deployed on x86-64 bit


Reference : http://linora64.blogspot.com/2011/07/reset-obiee-11g-weblogic-admin-password.html

Monday, March 5, 2012

demo hrapp application

oc4j hrapp

http://download.oracle.com/otndocs/tech/ias/portal/files/RG/OBE/deployToAppServer/lesson_Deployment.htm


web logic hrapp
http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/wls/10g/r3/appdeploy/deploy/deploy_plan/deploy_plan.htm
http://download.oracle.com/otndocs/tech/ias/portal/files/RG/OBE/deployj2ee/deployj2ee.htm

Sunday, March 4, 2012

Java Program to Connect to Oracle DB

1. Include the library Ojdbc6.jar ..
2. Write the Java Code
3. Execute the Code


1. Include the library Ojdbc6.jar
Write click on Application ,Properties, ,Libraries and Class Path -> Add JAR/Directory .click Add ...

2. Write the Java code below .

package project1;

import java.sql.*;

class class1 {
public static void main(String args[]) throws SQLException {
DriverManager.registerDriver(
new oracle.jdbc.driver.OracleDriver()
);
String serverName = "mohammed-pc.in.oracle.com";
int port = 1521;
String user = "ashraf";
String password = "ashraf";
String SID = "orcl";
String URL = "jdbc:oracle:thin:@" + serverName + ":" + port + ":" + SID;
Connection conn = DriverManager.getConnection(URL, user, password);
String SQL = "SELECT * from em ";
Statement stat = conn.createStatement();
ResultSet rs = stat.executeQuery(SQL);
while (rs.next()) {
System.out.println(
rs.getString(1) +
"\t" +
rs.getString(2)
);
}
stat.close();
conn.close();
}
}