Wednesday, May 30, 2012

ANT script to deploy application

Create a file called Build.xml and below are its contents:
...............................................................................................................................................
<project name="Test Deployment" default="deploy">
<taskdef name="wldeploy" classname="weblogic.ant.taskdefs.management.WLDeploy">
<classpath>
<pathelement location="D:/work/wls/wls9.2.4/weblogic92/server/lib/weblogic.jar"/>
</classpath>
</taskdef>
<target name="deploy">
<wldeploy
        action="deploy" verbose="true" debug="true" upload="true" remote="true" stage="true" library="true"
        name="conference.shared.lib" source="C:\test\test.war"
        user="weblogic" password="weblogic"
        adminurl="t3://localhost:7001" targets="examplesServer" />
</target>
</project>
...............................................................................................................................................
# change the appropriate values to reflect your environment.

Start the weblogic server.
Run the setdomainenv.sh from the domain folder and then traverse to the file containing build.xml
and type $ ant
This will deploy the file.

Wednesday, May 23, 2012

The input line is too long - during installing windows service

Error: The input line is too long - during installing windows service.

Desc: MS Windows 32bit has 2K limitation on the length of the command line. If the classpath setting in the " installSvc.cmd " is very long, the 2K limitation could be exceeded. Consequently the set up of the MS Windows Service may fail with the error.

Soln: Start the jvm in the command prompt and copy the classpath from startup log.
Place the classpath in a seperate .txt file and provide complete access to it.
now call the file in the installsvc file.
by replacing -classpath \"%CLASSPATH%\" option with the following option:
-classpath @pathname\filename

 Ex:JAVA_OPTIONS% -classpath @C:\classpath.txt -Dweblogic.Name 

ref: http://docs.oracle.com/cd/E17904_01/web.1111/e13708/winservice.htm#i1188175


Thursday, May 17, 2012

weblogic as windows service

To CREATE SERVICE
Go to${bea_dir}\wlserver_10.3\server\bin where bea_dir is home directory of weblogic installation.
Create a text file with following values:

echo off
SETLOCAL
set DOMAIN_NAME=base_domain
set USERDOMAIN_HOME=D:\work\wls\user_projects\domains\base_domain
set SERVER_NAME=AdminServer
set WLS_USER=weblogic
set WLS_PW=weblogic1
set PRODUCTION_MODE=false
set ADMIN_URL=http://localhost:7001
set JAVA_VENDOR=Sun (or set JAVA_VM=-hotspot)
set JAVA_HOME=D:\work\wls\jdk160_18
set MEM_ARGS=-Xms256m -Xmx512m
call "D:\work\wls\wlserver_10.3\server\bin\installSvc.cmd"
ENDLOCAL

save and rename to createSvc.cmd

Setting admin url and username password is optional if your domain picks up username/password from boot.propeties (domain_home\servers\AdminServer\security), no need to mention them in the script.

For Jrockit:
set JAVA_VENDOR=BEA
set JAVA_HOME=C:\bea\jrockit_160_05


execute the createSvc.cmd from command prompt so you can check if there are any errors.

This should create service with name of "beasvc sampleDomain_Adminserver_name" in the registry under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services

check services under (start - run - services.msc) to find your service with beasvc prefix. change it to automatic and start the service and check logs.

INCLUDING CLASSPATH
If you have variables set in classpath which need to be included, edit the installSvc.cmd and look for the line where it calls commenv and replace it with setdomainEnv path.

call "%WL_HOME%\common\bin\commEnv.cmd"

TO REMOVE SERVICE
Go to${bea_dir}\wlserver_10.3\server\bin where bea_dir is home directory of weblogic installation.
Create a text file with following values:

echo off
SETLOCAL
set DOMAIN_NAME=base_domain
set SERVER_NAME=AdminServer
call "D:\work\wls\wlserver_10.3\server\bin\uninstallSvc.cmd"
ENDLOCAL

save and rename to removeSvc.cmd
execute the createSvc.cmd from command prompt so you can check if there are any errors.
(details should be the same as that of createSvc.cmd)


TO CHANGE SERVICE NAME
take a backup of the installSvc.cmd
edit installSvc.cmd and look for beasvc and change the name you wanted to.
"%WL_HOME%\server\bin\beasvc" -install -svcname:"beasvc %DOMAIN_NAME%_%SERVER_NAME%"

TO ENABLE MANAGED SERVICE TO START AFTER ADMIN SERVICE
 make a copy of installSvc.cmd say installSvc2.cmd
edit installSvc2.cmd and make it dependent on admin server script

for example

rem *** Install the service
"%WL_HOME%\server\bin\beasvc" -install -svcname:"ROBIN_%DOMAIN_NAME%_%SERVER_NAME%" -depend:"beasvcAdminService"

so now managed service will depend on admin service before starting.
----------------------------------------------------
1> If you get the below error in the server log

javax.naming.ServiceUnavailableException [Root exception is java.rmi.NoSuchObjectException: The object identified by: '31' could not be found. Either it was has not been exported or it has been collected by the distributed garbage collector.]

remove the service by removeSvc.cmd
edit createSvc.cmd
remove line          set ADMIN_URL=http://localhost:7001
save and run.
----------------------------------------------------
2>  If you get the below error in the server log

<BEA-150000> <An error occurred while establishing a connection

javax.naming.ServiceUnavailableException [Root exception is java.rmi.NoSuchObjectException: The object identified by: '31' could not be found.  Either it was has not been exported or it has been collected by the distributed garbage collector.]

Caused By: java.rmi.NoSuchObjectException: The object identified by: '31' could not be found.  Either it was has not been exported or it has been collected by the distributed garbage collector  

ensure the user has admin rights to the box
remove the service by removeSvc.cmd
edit createSvc.cmd
remove line          set ADMIN_URL=http://localhost:7001
save and run. 
----------------------------------------------------
3>  If you get the below error
'oracle.fabric.common.classloaderurl.handler' is not recognized as an internal or external command

Double quotation marks break the command syntax.

In the installSvc.cmd,
Change the %JAVA_OPTIONS% to \"%JAVA_OPTIONS%\"
(have to add \"  \")

For example
set CMDLINE="%JAVA_VM% %MEM_ARGS% %JAVA_OPTIONS% -classpath
will be come
set CMDLINE="%JAVA_VM% %MEM_ARGS% \"%JAVA_OPTIONS%\" -classpath

Doc ID 1276229.
----------------------------------------------------
To debug:
Go to the installSvc.cmd file and right at the location where you call the beasvc.exe file, insert the following options.

-debug –log:”path to log.txt”

So the entire string would look something like this.

"%WL_HOME%\server\bin\beasvc" –install  -debug  -log:c:\path.txt -svcname:"beasvc %DOMAIN_NAME%_%SERVER_NAME%" -javahome:"%JAVA_HOME%" -execdir:"%USERDOMAIN_HOME%" -maxconnectretries:"%MAX_CONNECT_RETRIES%" -host:"%HOST%" -port:"%PORT%" -extrapath:"%EXTRAPATH%" -password:"%WLS_PW%" -cmdline:%CMDLINE%


Also you can debug by traversing to the folder containing beasvc.exe
*\wlserver_10.3\server\bin> beasvc -debug "affected windows service name" 

Windows service log rotation
http://docs.oracle.com/cd/E14571_01/web.1111/e13708/winservice.htm#i1193313

Wednesday, May 9, 2012

reset / change weblogic username password

To change the admin password in a weblogic environment, please follow the below steps:

STEP 1 :  Firstly, Stop the server if running and make sure that weblogic.jar is in the classpath. (this could be checked by running setDomainEnv and env in linux or set in windows)

STEP 2 : Open a command prompt and navigate to your Domain directory’s bin folder and run “setDomainEnv.sh “
After you run setdomain the prompt should go back to domain folder from bin folder.
if it doesn't happen run the command as . ./setdomainEnv.sh (in words- dot space dot slash).
Run echo $CLASSPATH to check if weblogic.jar is set.
Run Echo %CLASSPATH% for windows.

STEP 3 : Now run the following command :

“Java weblogic.security.utils.AdminAccount NewAdminUser NewAdminPassword . “

where ” NewAdminUser ” and ” NewAdminPassword ” are the new user and password you would like to create.

Note : The “ . “ (period) at the end of the command is very important..!! as it tells the command that this should be run in the domain directory.

STEP 4 : The above command creates a file “ DefaultAuthenticatorInit.ldift “ in the domain directory.

STEP 5 :  Now copy the newly created “DefaultAuthenticatorInit.ldift “ to “*\bea10.3\user_projects\domains\change_password\security “ (where change_password is your affected domain)

Note : You can take a backup or delete  “DefaultAuthenticatorInit.ldift “ which is already present in the security folder

STEP 6 :  Now edit the boot.properties file ( located in “ *\bea10.3\user_projects\domains\change_password\servers\AdminServer\security “ & “ *\bea10.3\user_projects\domains\change_password\servers\managedserver\security “ ) with the new user name and password that we created ( i.e NewAdminUser  and NewAdminPassword )

Delete the file “ DefaultAuthenticatormyrealmInit.initialized “ located in “C:\bea10.3\user_projects\domains\change_password\servers\AdminServer\data\ldap “

Now start the server and login with the NewAdminUser  and NewAdminPassword.

To reset the admin password in a weblogic environment, please follow the below steps:

STEP 7 : After logging into the console with the NewAdminUser  and NewAdminPassword. go to security realms - myrealm (or your respective realm) - users and groups - click on your original user - passwords - change password - save - activate changes.

STEP 8 :  Edit the boot.properties file ( located in “ *\bea10.3\user_projects\domains\change_password\servers\AdminServer\security “ & “ *\bea10.3\user_projects\domains\change_password\servers\managedserver\security “ ) with the original user and password that we just reset.

jvm freeze

The stack trace :
"[ACTIVE] ExecuteThread: for queue: 'weblogic.kernel.Default (self-tuning)'" id=16 idx=0x58 tid=* prio=5 alive, waiting, native_blocked, daemon
-- Waiting for notification on: netscape/ldap/LDAPSearchListener@0x0000000184932A78[fat lock]
at jrockit/vm/Threads.waitForNotifySignal(JLjava/lang/Object;)Z(Native Method)
at jrockit/vm/Locks.wait(Locks.java:1973)[inlined]
at java/lang/Object.wait(Object.java:474)[optimized]
at netscape/ldap/LDAPMessageQueue.waitForMessage(LDAPMessageQueue.java:200)
^-- Lock released while waiting: netscape/ldap/LDAPSearchListener@0x0000000184932A78[recursive]
at netscape/ldap/LDAPMessageQueue.waitFirstMessage(LDAPMessageQueue.java:101)
^-- Lock released while waiting: netscape/ldap/LDAPSearchListener@0x0000000184932A78[fat lock]
at netscape/ldap/LDAPConnection.sendRequest(LDAPConnection.java:1796)
^-- Holding lock: netscape/ldap/LDAPConnection@0x0000000184924B50[biased lock]
at netscape/ldap/LDAPConnection.search(LDAPConnection.java:2566) 



 The StackoverFlow issue observed is caused by a misconfiguration of LDAP server.

Soln:
1. Open the console
2. through the menu Security realms->myRealm->Providers->Authenticaton->[provider]->Configuration->Provider Specific
3. Change the Group Membership Searching to limited
4. Change the Max Group Membership Search Level to 16
5. Save and restart WebLogic Server

Wednesday, May 2, 2012

BEA-000402 BEA-000438

Error message:
Warning> <Socket> <BEA-000402> <There are: 5 active sockets, but the maximum number of socket reader threads allowed by the configuration is: 4. You may want to alter your configuration.>
are because of the original messages of not picking up libmuxer.so

or

<Error> <Socket> <BEA-000438> <Unable to load performance pack. Using Java I/O instead. Please ensure that a native performance library is in:

Soln:
1. login to console - servers - configuration - tunning - make sure 'Enable Native IO' is clicked.
2. run the setdomainenv and then run env command.
this will tell us the current libmuxer.so being used.
3. You need to make sure the corresponding libmuxer.so is used which could be done by

take a backup and at the end of your commEnv.sh file please add the lines

LD_LIBRARY_PATH=<path of the libmuxer.so>${LD_LIBRARY_PATH}
export LD_LIBRARY_PATH


path of libmuxer.so
wlserver_10.3\server\native\<server type>\<bit version>\libmuxer.so

Ref : Doc ID 965299.1