Monday, November 3, 2014

No plugin found for prefix 'wls' in the current project

Even though the wls-maven-plugin is successfully installed, referring the goal via prefix might throw the above error.

mvn wls:wlst

Here wls is the prefix.

In such cases the following approach can be attempted

use the command in following format

mvn groupId:pluginname:goalname

For eg: To invoke the wlst goal on wls-maven-plugin use the following format

mvn com.oracle.weblogic:wls-maven-plugin:wlst


Sunday, November 2, 2014

Disabling logging and reporting globally in OSB 12c

The global disabling/enabling of logging,reporting etc can be performed from em console in 12c.

In 11g this can be done in service bus console

In 12c to  disable logging /reporting follow the below steps


1.       Logon to em console
2.       Under SOA select ServiceBus
3.       Right click on Service Bus which will open the properties as shown in the screenshot
4.       Go to Global Settings tab
5.       Uncheck logging option

6.       Apply the changes


The connection pool associated with it has already been destroyed

This error happens when WLS server invalidates the connections when we redeploy the adapter after adding a new JNDI . In such cases WLS server invalidates all the previous connection pool.

Though the connection pool JNDIs are visible at adapter configuration at run time it may fail with the error message "The connection pool associated with it has already been destroyed".

This seems to be a bug in weblogic

This mostly happens when we perform Adapter redeployment frequently.

To avoid this issue,

1.Delete all the existing connection pool JNDIs
2.Redeploy the Adatper
3.Restart your server
4.Add a new connection pool JNDI
5.Redeploy the Adapter

After this for any new JNDI added to the adapter ,ensure you only update the Adapter, not redeploy.



Thursday, October 30, 2014

Weblogic : Load balancer URL for a cluster

Sometimes in a clustered environment we would like to know whether load balancer is configured.

The easiest way to locate this is by logon to Weblogic Admin Console

Goto Envrioment->Clusters

Select your cluster

Open the HTTP tab

If load balancer is configured it will be available as Frontend Host



Weblogic : Creating Datasource using MAVEN and WLST Script

One of the interesting features of 12c is the option of using Maven for many of the administration tasks.

Maven along with WLST becomes the most convenient and powerful option to perform many of the administration tasks like creating domain,start and stop servers, listing deployed composites etc..

In this post I would like to introduce how maven plugin can be used to invoke a WLST script which creates a datasource in the weblogic domain.

As a first step we need to install maven plugin wls-maven-plugin.

This plugin present in the ORACLE_HOME/wlserver_12.1/server/lib

Open a command prompt and navigate to the above location

Now we need to install this plugin to our repository( here by default the repository will be the local repository which is present at  c:/users/<username>/.m2  (for windows)).

To install the plugin use the following command


mvn install:install-file -Dfile=wls-maven-plugin.jar -DpomFile=pom.xml

Once the installation is successful we can verify whether the required goals are available using the following command

mvn com.oracle.weblogic:wls-maven-plugin:help

Here we can see the wlst task is available. 

Now we are ready to execute the WLST script using maven

Create a datasource.properties file as shown below(change the values as per your requirement)
==================
domain.name=base_domain
admin.url=t3://localhost:7101
admin.userName=weblogic
admin.password=weblogic1

datasource.name=MyDataSource
datasource.database.name=XE
datasource.target=DefaultServer
datasource.filename=DS_One.xml
datasource.jndiname=DS_One_JNDI
datasource.driver.class=oracle.jdbc.xa.client.OracleXADataSource
datasource.url=jdbc:oracle:thin:@localhost:1521:XE
datasource.username=aq_user
datasource.password=aq_user

datasource.test.query=SQL SELECT * FROM DUAL
============================================

Save the following python script as datasource.py

note : remember to give the exact path to the datasource.properties file)

========start of python script ==========

from java.io import FileInputStream

propInputStream = FileInputStream("\\path\\to\\datasource.properties")
configProps = Properties()
configProps.load(propInputStream)

domainName=configProps.get("domain.name")
adminURL=configProps.get("admin.url")
adminUserName=configProps.get("admin.userName")
adminPassword=configProps.get("admin.password")

dsName=configProps.get("datasource.name")
dsFileName=configProps.get("datasource.filename")
dsDatabaseName=configProps.get("datasource.database.name")
datasourceTarget=configProps.get("datasource.target")
dsJNDIName=configProps.get("datasource.jndiname")
dsDriverName=configProps.get("datasource.driver.class")
dsURL=configProps.get("datasource.url")
dsUserName=configProps.get("datasource.username")
dsPassword=configProps.get("datasource.password")
dsTestQuery=configProps.get("datasource.test.query")

connect(adminUserName, adminPassword, adminURL)
edit()
startEdit()
cd('/')
cmo.createJDBCSystemResource(dsName)
cd('/JDBCSystemResources/' + dsName + '/JDBCResource/' + dsName)
cmo.setName(dsName)

cd('/JDBCSystemResources/' + dsName + '/JDBCResource/' + dsName + '/JDBCDataSourceParams/' + dsName )
set('JNDINames',jarray.array([String('jdbc/' + dsName )], String))

cd('/JDBCSystemResources/' + dsName + '/JDBCResource/' + dsName + '/JDBCDriverParams/' + dsName )
cmo.setUrl(dsURL)
cmo.setDriverName(dsDriverName)
cmo.setPassword(dsPassword)

cd('/JDBCSystemResources/' + dsName + '/JDBCResource/' + dsName + '/JDBCConnectionPoolParams/' + dsName )
cmo.setTestTableName(dsTestQuery)
cd('/JDBCSystemResources/' + dsName + '/JDBCResource/' + dsName + '/JDBCDriverParams/' + dsName + '/Properties/' + dsName )
cmo.createProperty('user')

cd('/JDBCSystemResources/' + dsName + '/JDBCResource/' + dsName + '/JDBCDriverParams/' + dsName + '/Properties/' + dsName + '/Properties/user')
cmo.setValue(dsUserName)

cd('/JDBCSystemResources/' + dsName + '/JDBCResource/' + dsName + '/JDBCDriverParams/' + dsName + '/Properties/' + dsName )
cmo.createProperty('databaseName')

cd('/JDBCSystemResources/' + dsName + '/JDBCResource/' + dsName + '/JDBCDriverParams/' + dsName + '/Properties/' + dsName + '/Properties/databaseName')
cmo.setValue(dsDatabaseName)

cd('/JDBCSystemResources/' + dsName + '/JDBCResource/' + dsName + '/JDBCDataSourceParams/' + dsName )
cmo.setGlobalTransactionsProtocol('OnePhaseCommit')

cd('/SystemResources/' + dsName )
set('Targets',jarray.array([ObjectName('com.bea:Name=' + datasourceTarget + ',Type=Server')], ObjectName))

save()
activate()

========================end of python script===============

Now open command prompt

Execute the following command after correcting the path as per your soa installation

mvn wls:wlst -DfileName=path/to/datasource.py  - DmiddlewareHome=path/to/oraclehome 
-DdomainHome=path/to/domainhome 

Once the script is executed successfully. Open the weblogic console and verify the datasource is created successfully

Monday, October 27, 2014

Namespace value in SOAPAction does not match Namespace value 'http://schemas.xmlsoap.org/soap/envelope/' in xml tag 'Body'

This issue normally comes when we use Service Callout.

Service Callout has an option to  configure Body or Payload

Payload means , it will be send as a child of Body.

If you pass your request which is already a SOAP Body as a payload,  and if you select Payload Document Option it will be like sending a SOAP Body inside SOAP Body. That might result the above error.

In such cases choose wisely which option you need to select while sending request via service callout

If your request itself is a SOAPBody choose the SOAP Body option. Otherwise choose the payload option


Tuesday, October 21, 2014

How to install a maven plugin to the central repository

If you want to install a plugin to the central repository like Archiva or Artifactory, follow the below steps

1) Download the plugin jar from
2) Extract the jar file and from the META_INF folder copy the path to POM file
3) Open the command prompt and navigate to the directory where the jar and POM file resides
4) Run the following command by replacing the jar file name and pom name

For eg. to install  properties-maven-plugin-1.0-alpha-2.jar to central repository

mvn deploy:deploy-file -DpomFile=<path_to>\properties-maven-plugin-1.0-alpha-2\META-INF\maven\org.codehaus.mojo\properties-maven
-plugin\pom.xml -Dfile=properties-maven-plugin-1.0-alpha-2.jar -Durl=http://localhost:8091/artifactory/internal -DrepositoryId=internal


Now to use this plugin along with your POM file add the following section  in the POM file under the plugin section

 <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>properties-maven-plugin</artifactId>
                <version>1.0-alpha-2</version>
                <executions>
                  <execution>
                    <phase>initialize</phase>
                    <goals>
                      <goal>read-project-properties</goal>
                    </goals>
                    <configuration>
                      <files>
                        <file>build-${deploy}.properties</file>
                      </files>
                    </configuration>
                  </execution>
                </executions>
              </plugin>