Sunday, September 23, 2012

java.lang.ClassCastException: weblogic.jms.common.DurableSubscription cannot be cast to weblogic.jms.backend.BEConsumerCommon

 java.lang.ClassCastException: weblogic.jms.common.DurableSubscription cannot be cast to weblogic.jms.backend.BEConsumerCommon

I was receiving the following exception in my local Oracle SOA Suite environment 11.1.1.6.0.

java.lang.ClassCastException: weblogic.jms.common.DurableSubscription cannot be cast to weblogic.jms.backend.BEConsumerCommon
        at weblogic.jms.backend.BackEnd.dump(BackEnd.java:2880)
        at weblogic.jms.JMSService.dump(JMSService.java:1169)
        at weblogic.jms.common.JMSDiagnosticImageSource.createDiagnosticImage(JMSDiagnosticImageSource.java:43)
        at weblogic.diagnostics.image.ImageSourceWork.run(ImageSourceWork.java:111)
        at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:528)
        Truncated. see log file for complete stacktrace

After analysis found that this is a known issue related to weblogic server versions 10.3.4 and 10.3.5.

Solution:

Download and apply the patch 10023173 from Metalink.




Saturday, September 22, 2012

Cluster Constraint for the deployment in weblogic server

Cluster Constraint for the deployment in weblogic server

Cluster constraint specifies that deployments targeted to a weblogic cluster succeed only if all servers in the cluster are running.

When this option is enabled, WebLogic Server enforces a strict two-phase deployment policy for all Managed Servers in a domain—ensuring that application deployment to a cluster succeeds only if all Managed Servers in the cluster are reachable and can deploy the application. If any server instance in the cluster is unreachable, the application is not deployed to any of the Managed Servers.

If you do not enable this option, WebLogic Server allows deployment to a partial cluster. When the unreachable Managed Server becomes available, deployment to that server instance will be initiated.

By default, cluster constraints are disabled and deployment is attempted only on the servers that are reachable at the time of deployment from the Administration Server.

To Enable Cluster Constraint:

  • Login to Weblogic Admin Console
  • Click on the domain name
  • Select the Check box against “Enable Cluster Constraint”




Installing the patches to weblogic server using Oracle Smart Update

Installing the patches to weblogic server using Oracle Smart Update:

Oracle Smart Update tool help us to apply and manage the patches for weblogic server.

As of Smart Update 3.3.0, the Get Patches tab has been removed, and you can no longer use Smart Update to download patches, service packs, maintenance packs, or version upgrades. You must first download the appropriate patch or patches directly from My Oracle Support. Once downloaded, you can use Smart Update to apply the patches.

Smart Update 3.3.0 no longer prompts you to register for security updates from Oracle Configuration Management (OCM).

The version can be verified from Help -> About.

This blog will explain the steps to install the patches to a weblogic server using Oracle Smart Update.

Steps to install the patches to a weblogic server using Oracle Smart Update

  • Download the patch through metalink using the patch id or bug no.
  • Uncompress patch zip file to $MWHOME/utills/bsu/cache_dir (If the cache_dir folder is not available then create the same)


  •  Launch the Oracle Smart Update Tool (bsu.cmd) from $MWHOME\utils\bsu, this will list all the applied patchs and all those patches that are ready for installation.


Friday, September 21, 2012

CodeCache is full. Compiler has been disabled - Oracle SOA Suite 11g

CodeCache is full. Compiler has been disabled - Oracle SOA Suite 11g:

Frequently we used to see the below message in our log file.

Java HotSpot(TM) 64-Bit Server VM warning: CodeCache is full. Compiler has been disabled.
Java HotSpot(TM) 64-Bit Server VM warning: Try increasing the code cache size using -XX:ReservedCodeCacheSize=

The code cache is a memory area separate from the JVM heap that is used for compilation and storage of native code.This is where the JIT compiled methods are kept.

The JIT compilier will be disabled when the code cache is full. Once the JIT compiler is switched off due to the Code Cache being full, it does not switch back on.

This will affect the performance of the server in high extend.

We can try to increase the default code cache size to resolve this issue.

Steps to increase the code cache size(we have increased to 64m)

  • Login into Admin Server node
  • Open $DOMAIN_HOME/bin/setSOADomainEnv.sh file 
  • Edit the "DEFAULT_MEM_ARGS" to add the following parameters at the end of line before double quotes: -XX:InitialCodeCacheSize=64m -XX:ReservedCodeCacheSize=64m
  • Login into admin console and go to all the servers server start up properties tab and edit the section to add the following parameters at the end of the line  -XX:InitialCodeCacheSize=64m -XX:ReservedCodeCacheSize=64m

  • Restart all servers (Admin and Managed)



Saturday, September 15, 2012

Identifying the weblogic server version installed

How to identify the weblogic server version installed

1. cd %DOMAIN_HOME%/bin
2. Execute setDomainEnv.cmd
3.Execute java weblogic.version -verbose



The weblogic server version is 10.3.5.0


Friday, September 14, 2012

weblogic.socket.MaxMessageSizeExceededException appearing when Managed Server Attempting To Send larger message to Admin Server.

weblogic.socket.MaxMessageSizeExceededException appearing when Managed Server Attempting To Send larger message to Admin Server.


We used to get the following exception in the weblogic managed servers log file frequently

 ####<Mar 20, 2012 12:22:47 PM EST> <Error> <Socket> <ifappc105p> <AdminServer> <ExecuteThread: '2' for queue: 'weblogic.socket.Muxer'> <> <> <a33374ea6b7bab0f:17f6d3b7:1343f18f4ea:-8000-000000000000008a> <1323912167710> <BEA-000403> <IOException occurred on socket: Socket[addr=ifappc105p-vip1/172.105.200.105,port=8000,localport=55103]
weblogic.socket.MaxMessageSizeExceededException: Incoming message of size: '10000480' bytes exceeds the configured maximum of: '10000000' bytes for protocol: 't3'.
weblogic.socket.MaxMessageSizeExceededException: Incoming message of size: '10000480' bytes exceeds the configured maximum of: '10000000' bytes for protocol: 't3'
at weblogic.socket.BaseAbstractMuxableSocket.incrementBufferOffset(BaseAbstractMuxableSocket.java:174)
at weblogic.rjvm.t3.MuxableSocketT3.incrementBufferOffset(MuxableSocketT3.java:351)


The reason is the weblogic managed server tries to send the message size more than 10 MB and failing with the following exception. It is observed that every single time this message is observed in the logs, it is followed by the respective managed server who is sending that message, losing connectivity with the admin server.

The root cause is the RJVM messages used to get piled up due to default watches trap events that’s comes installed and it used to grow in larger size causing the broken communication between managed servers and AdminServer

The solution to resolve this is to disable the default WLDF configured in the server.

Steps to disable the default WLDF configured in the server

  • Login into admin console with weblogic user.
  • Click Lock & Edit
  • Expand Diagnostics tab 

  • Click on Diagnostic Modules



Friday, September 7, 2012

Modifying the targets of JDBC datasources through WLST script in weblogic server

Modifying the targets of JDBC datasources through WLST script in weblogic server

This tutorial explains the details on WLST script to change or add the targets for JDBC data sources in weblogic server.

The targeting can be enabled through weblogic admin console but the script helps us to automate the server configurations and reduce the manual effort if multiple data-sources need to be configured.
wlst-modify-jdbc-datasource-targets
The script will target the server MS3 and the Cluser1 to the data source with name “CRM6EAIReference”

Define JDBCProperties.properties with required configurations(sample script to show the configuration for multiple data-sources)

domain1.total.DS=2
domain1.prefix.1=om
domain1.om.datasource.name.1=CRM6EAIReference
domain1.om.datasource.target.1=Clusters/Cluster1,Servers/MS3
domain1.prefix.2=soa
domain1.soa.datasource.name.2=CRM6EAISOAMetadataSource
domain1.soa.datasource.target.2=Clusters/SOACluster

Before executing the script change the properties as required.If the target is a Server then it should be added like Servers/ServerName and if it is a cluster then it should be defined as Clusters/ClusterName. Configure domain1.total.DS with total number of data sources need to be configured.

Let us now define a WLST script file to change the targets using the property file defined above.

import re
from java.io import FileInputStream   

def UntargetTargetJDBCResources():
    edit()
    startEdit()
    propInputStream = FileInputStream('JDBCProperties.properties')
    configProps = Properties()
    configProps.load(propInputStream)    

    totalDataSource_to_untargetTarget=configProps.get("domain1.total.DS")
    
    server='AdminServer'
    cd("Servers/"+server)
       
    i=1
    while (i <= int(totalDataSource_to_untargetTarget)) :
    prefix = configProps.get("domain1.prefix."+ str(i))
    dsName = configProps.get("domain1."+prefix+".datasource.name."+ str(i))
    datasourceTargets = re.split(",",configProps.get("domain1."+prefix+".datasource.target."+ str(i)))
    targetArray=[] 
    
    for datasourceTarget in datasourceTargets:
   print 'DataSourceTargets',datasourceTargets
   print 'DataSourceTarget',datasourceTarget
   if datasourceTarget=='':
    print ''
   else:
    cd ('/JDBCSystemResources/'+dsName)
    set('Targets',jarray.array([], ObjectName))
    target=datasourceTarget[datasourceTarget.index("/")+1:len(datasourceTarget)]       
    if datasourceTarget.startswith('Cluster'):
     targetArray.append(ObjectName('com.bea:Name='+target+',Type=Cluster'))     
    elif datasourceTarget.startswith('Server'):
     targetArray.append(ObjectName('com.bea:Name='+target+',Type=Server'))         
   
    print 'Targets: ',targetArray
    set('Targets',jarray.array(targetArray, ObjectName))
    print 'DataSource: ',dsName,',Target has been updated Successfully !!!'
    print '========================================='    
    i = i + 1

    print '========================================='
    save()
    activate()
def main():
    adminURL='t3://localhost:7001'
    adminUserName='weblogic'
    adminPassword='weblogic1'
    connect(adminUserName, adminPassword, adminURL)
    UntargetTargetJDBCResources();
    print 'Successfully Modified the JDBC resources'
    disconnect()
main()

Script - 

The above script update the JDBC data source targets based on the configurations enabled in the property file.

Execute the script — <<Oracle_Home>>\oracle_common\common\bin\wlst.cmd ModifyJDBCResourcesTargets.py
wlst-modify-jdbc-datasource-targets
The JDBC data source targets changed now with the enabled configurations,the WLST script can be used to automate the server configurations and reduce the manual effort need for configurations.


Wednesday, July 18, 2012

Creating a wlfullclient.jar - Weblogic

Creating a wlfullclient.jar for JDK 1.6 client applications from weblogic server

    Change directories to the server/lib directory.

    cd WL_HOME/server/lib

    Use the following command to create wlfullclient.jar in the server/lib directory:

    java -jar wljarbuilder.jar

    You can now copy and bundle the wlfullclient.jar with client applications.

Creating a wlfullclient5.jar for JDK 1.5 client applications:

    Change directories to the server/lib directory.

    cd WL_HOME/server/lib

    Use the following command to create wlfullclient.jar in the server/lib directory:

    java -jar wljarbuilder.jar -profile wlfullclient5

    You can now copy and bundle the wlfullclient5.jar with client applications.


Wednesday, May 2, 2012

WLST script to reset data source password in weblogic server

WLST script to reset data source password in weblogic server


This tutorial explains the approach to reset the password of all the data sources in weblogic server. Sometime we may need to reset the password of all the data sources, the below WLST script can be used to achieve the same.

The reset through console takes more time, the below WLST script helps to reset the password quickly

WLST Script


ResetAllDataSourcePassword.py

adminIP = raw_input("Enter domain1.AdminIP:")
adminPort = raw_input("Enter domain1.AdminPort:")
adminPassword = raw_input("Enter adminPassword:")
DBPASSWORD= raw_input("Enter new DBPASSWORD:")
DOMAIN_PATH='C://Albin/SW/Oracle/Middleware/Oracle_Home/user_projects/domains/base_domain'
es = encrypt(DBPASSWORD,DOMAIN_PATH)
adminURL='t3://'+adminIP+':'+adminPort
adminUserName='weblogic'
connect(adminUserName, adminPassword, adminURL)
server='AdminServer'
cd('Servers/'+server)
target=cmo
edit()
startEdit()# SOADomain Datasource Configuration
cd('JDBCSystemResources')
allDS=cmo.getJDBCSystemResources()
for tmpDS in allDS:
    dsName=tmpDS.getName();
    print  'Changing the Password for DataSource ', dsName
    cd('/JDBCSystemResources/'+dsName+'/JDBCResource/'+dsName+'/JDBCDriverParams/'+dsName)
    set('PasswordEncrypted',es)
save()
activate()
disconnect()


Script

https://github.com/techforum-repo/youttubedata/blob/master/scripts/wlst/ResetAllDataSourcePassword.py

Before executing the script, change the configurations as required.

Execute the script — <<Oracle_Home>>\oracle_common\common\bin\wlst.cmd ResetAllDataSourcePassword.py



Now the data sources password reset to new value.


Tuesday, February 28, 2012

Applying the JRF to the weblogic cluster through WLST


Applying the JRF to the weblogic cluster through WLST

Java Required Files (JRF) consists of those components not included in the WebLogic Server installation that provide common functionality for Oracle business applications and application frameworks.

It consists of a number of independently developed libraries and applications that are deployed into a common location. The following components are considered part of Java Required Files: Oracle Application Development Framework, Oracle Fusion Middleware Audit Framework, Dynamic Monitoring Service, Fabric Common, HTTP Client, Infrastructure Security, Java Object Cache, JMX Framework, JPS, logging, MDS, OJSP.Next, Oracle Web Services, Oracle Web Services Manager, Oracle TopLink, UCP, XDK.


applyJRF


Configures a Managed Server or cluster with Java Required Files (JRF). Managed Servers that are added by product templates during the template extension process do not need to be explicitly configured with JRF using this command.

Use the applyJRF command when additional Managed Servers or clusters are added to a domain after it is initially extended with a product template.

The applyJRF command is required any time you add a Managed Server to a JRF-only domain, or if you add a Managed Server that has been configured for JRF to a domain that contains other Oracle products.


WLST Script


When we are creating the core weblogic cluster JRF is not applied by default, the below WLST script will help us to apply the JRF for the weblogic cluster.

WLST Script


applyJRFToDomain.py


The below script applies the JRF to the cluster with Cluster1 - modify cluster name based on your requirement, indivdual Managed Servers also applied the JRF

Script

https://github.com/techforum-repo/youttubedata/blob/master/scripts/wlst/applyJRFToDomain.py

ORACLE_COMMON_HOME\common\bin\wlst.cmd applyJRFToDomain.py

Now the JRF is applied to the cluster "Cluster1"


Friday, February 3, 2012

WLST script to create JDBC Multi Data Source in weblogic server

Creating JDBC Multi Data Source through WLST in weblogic server

This tutorial explains the approach to create JDBC Multi data source through WLST script in weblogic

Refer the below URL for details on JDBC Multi data source.

https://www.albinsblog.com/2012/02/jdbc-multi-data-sources-in-weblogic.html

WLST Script


The below WLST script creates the JDBC Multi data source with enabled configurations

CreateMultiDataSource.py

adminURL='t3://localhost:7001'
adminUserName='weblogic'
adminPassword='weblogic1'
connect(adminUserName, adminPassword, adminURL)
edit()
startEdit()
jdbcSystemResource = create("MS1","JDBCSystemResource")
jdbcResource = jdbcSystemResource.getJDBCResource()
jdbcResource.setName("MS1")
dsParams = jdbcResource.getJDBCDataSourceParams()
jndiName='jdbc/MS1'
dsParams.setJNDINames([jndiName])
dsParams.setAlgorithmType('Failover')
dsParams.setDataSourceList('DS1,DS2')
dsParams.setFailoverRequestIfBusy(true)
jdbcSystemResource.addTarget(getMBean('Servers/AdminServer'))
print('MDS1 created successfully...')
save()
activate()
disconnect()



Script

https://github.com/techforum-repo/youttubedata/blob/master/scripts/wlst/CreateMultiDataSource.py

Before executing the script, change the configurations as required.

The individual data sources(DS1 & DS2) should be created before executing the script




Execute the script — <<Oracle_Home>>\oracle_common\common\bin\wlst.cmd CreateMultiDataSource.py

Now the JDBC Multi source is created with required configurations









JDBC Multi Data Sources in weblogic server


JDBC Multi Data Sources in weblogic server:

A multi data source is an abstraction around a group of data sources that provides load balancing or failover processing between the data sources associated with the multi data source. Multi data sources are bound to the JNDI tree or local application context just like data sources are bound to the JNDI tree. The Multi Data Source can be used in the same way as we use a Data Source.


When an application requests a connection, the Multi Data Source determines which data source will provide a connection based on the selected algorithm.
Create two or more data sources, and then create a Multi Data Source and assign data sources to the Multi Data Source.



Configurations for the Multi Data Source.

Algorithm Type


Load-Balancing


Connection requests to a load-balancing multi data source are served from any data source in the list. The multi data source selects data sources to use to satisfy connection requests using a round-robin scheme. When the multi data source provides a connection, it selects a connection from the data source listed just after the last data source that was used to provide a connection. Multi data sources that use the Load Balancing algorithm also fail over to the next data source in the list if a database connection test fails and the connection cannot be replaced, or if the data source is suspended.

Failover


The Failover algorithm provides an ordered list of data sources to use to satisfy connection requests. Normally, every connection request to this kind of multi data source is served by the first data source in the list. If a database connection test fails and the connection cannot be replaced, or if the data source is suspended, a connection is sought sequentially from the next data source on the list.

FailoverRequestIfBusy


With the Failover algorithm, this attribute enables failover when all connections in a data source are in use.

TestFrequencySeconds


This attribute controls the frequency at which Weblogic Server checks the health of data sources previously marked as unhealthy to see if connections can be recreated and if the data source can be re-enabled.


Tuesday, January 31, 2012

Creating a Trust Keystore Using the keytool Utility for weblogic server


Creating a Trust Keystore Using the keytool Utility for weblogic server

Steps to create the Trust Keystore in weblogic server.

Copy the standard java keystore to create the new trust keystore since it already contains most of the root CA certificates needed. Oracle does not recommend modifying the standard Java trust keystore directly. Copy the standard Java keystore CA certificates located under the $WLSHOME/server/lib directory to the same directory as the certificates.
For example:
cp $WLSHOME/server/lib/cacerts $WLSDOMAIN/certs/appTrustKeyStore.jks
The default password for the standard Java keystore is changeit. Oracle recommends always changing the default password. Use the keytool utility to do this. The syntax is:
keytool -storepasswd -new -keystore -storepass
For example:
cd $WLSDOMAIN/certs
keytool -storepasswd -new welcome1 -keystore appTrustKeyStore.jks -storepass changeit
The CA certificate CertGenCA.der is used to sign all certificates generated by the utils CertGen tool and is located at $WLSHOME/server/lib directory. This CA certificate must be imported into the appTrustKeyStore.jks using the keytool utility. The syntax is:
keytool -import -v -noprompt -trustcacerts -alias -file -keystore -storepass
For example:
keytool -import -v -noprompt -trustcacerts -alias clientCACert –file $WLSHOME/server/lib/CertGenCA.der -keystore appTrustKeyStore.jks –storepass welcome1


Saturday, December 10, 2011

WLST script to change the log setting for all the servers in the weblogic domain

WLST script to change the log setting for all the servers in the weblogic domain


This tutorial explains the approach to change the log settings for all the servers in the weblogic domain

WLST Script


The below WLST script will help us to change the log setting for all the servers in the weblogic domain.

domain_log.properties

fileCount = 10
fileMinSize = 20000
fileTimeSpan = 12
log4jEnabled = false
httpAccessLoggingEnabled = true
stdoutSeverity = Info
logBRSeverity = Info
logFileSeverity = Info
memBufferSeverity = Info
memBufferSize = 400
numOfFilesLimited = true
redirectStdout = true
redirectStdErr = true
rotateOnStartup = true
rotateType = bySize

domain.folderPath = C:\Albin\SW\Oracle\Middleware\Oracle_Home\user_projects\domains\base_domain
domain.admin.url=t3://127.0.0.1:7001
domain.admin.username=weblogic
domain.admin.password=weblogic1

DomainLogConfigurtionChange.py

from java.io import FileInputStream


Script

Before executing the script, change the configurations as required.

Execute the script — <<Oracle_Home>>\oracle_common\common\bin\wlst.cmd DomainLogConfigurtionChange.py



Now the log settings are changed as required