Wednesday 5 September 2018

Set Up Jboss Fuse (6.2.1)

Below are the basic steps for setting up Jboss Fuse (6.2.1)

1) Download JBoss Fuse binaries jboss-fuse-full-6.2.1.redhat-084.zip

2) Unzip the binaries in a directory

3) Navigate to <directory>/jboss-fuse-6.2.1.redhat-084/etc/

4) Edit file users.properties and uncomment last line, it should be like below
admin=admin,admin,manager,viewer,Monitor, Operator, Maintainer, Deployer, Auditor, Administrator, SuperUser

5) Navigate to /<directory>jboss-fuse-6.2.1.redhat-084/bin directory

6) execute below to start the server
./fuse &

7) Now access the Jboss Fuse console from http://<IP_ADDRESS>:8181/hawtio

What is JBoss Fuse ?

Basics of JBoss Fuse :


  •        Easy to deploy – sophisticated tooling, connectors,small footprint makes it easy to deploy with less hardware and limited IT staffing
  •     Many deployment options – deploy on-premise or in the cloud in any configuration, and change on the fly with automated provisioning
  •     Standards-based – commitment to industry standards ensures that JBoss infrastructure is easy to modify and maintain 
  •     Centralised management – innovative tooling makes it ease to configure, deploy, manage and maintain integration infrastructure
  •     Open source – less expensive and pay as you go to reduce over all costs in all stages of the project

References: https://developers.redhat.com/products/fuse/overview/?referrer=jbd 

Wednesday 27 April 2016

JBoss Fuse: OSGI bundle deployment error ( 'json-jackson' could not be created)



JBoss Fuse: OSGI bundle deployment error ( 'json-jackson' could not be created)

During Jboss Fuse deployment ( of OSGI bundle) you may get errors at runtime. For example

java.lang.IllegalArgumentException: Data format 'json-jackson' could not be created. Ensure that the data format is valid and the associated Camel component is present on the classpath

This is because of any specific feature is not installed , in this case it is json-jackson. Search this specific feature in the karaf container executing 'features' command in Fuse CLI.

JBossFuse:karaf@root> features:list |grep camel-jackson
[uninstalled  ] [2.15.1.redhat-621084 ] camel-jackson


Solution: This clearly indicates that above feature is not installed. Install this feature as below.

JBossFuse:karaf@root> features:install camel-jackson

Now redeploy your application.

Monday 31 December 2012

JProfiler Installation & Configuration for Weblogic

In below details you will be able to configure the Jprofiler in Weblogic server environment. Profiling the Weblogic application server is tricky. By following the below steps you can easily set up the environment.
Refer below link for complete JProfiler documentation. (JProfiler Documentation)

1.     Introduction

JProfiler eases developers in creating more efficient applications by improving their performance. It is oriented towards testing and exploring different aspects of the performance of a Java program, concerning the operation of the JVM making use of available platform resources.

JProfiler provides the following functionality:
·         Memory consumption measurement
·         Memory stack frames tracing
·         CPU loads profiling
·         Momentary heap allocation information
·         Thread state progress statistics
·         Visual representation of VM work loads by different parameters
·         Source code reference
·         Garbage collection during profiling
·         Remote profiling
·         Profiling only of a particular stage or a combination of several stages of the program life cycle
·         Using different target environments
·         Saving profiler information for further examination
·         Exporting profiler information in text format

On the all the servers that has JProfiler component listed, following steps have to be carried out:-
1)Login to the linux box as a non-root user

2)Download the TAR.GZ Archive ( jprofiler_linux_7_1_2.tar.gz) for JProfiler  and keep the license key with you.

3)Upload jprofiler_linux_7_1_2.tar.gz to the box (for eg in /home/oracle  directory)

4) Execute the below commands:
                   gunzip jprofiler_linux_7_1_2.tar.gz
tar xf jprofiler_linux_7_1_2.tar

5) Ensure the software to export display is available in the local box (E.g Xserver) and it is running

6) Ensure JRE is set with version >1.5

2.1.1     Additional Steps to be carried out on the JProfiler Server

After completing the Steps listed above in Section 2.1,

1) Navigate to the JProfiler Install Directory

  Ensure that JAVA_HOME & DISPLAY variables are set.
2) Execute the shell script under extracted JProfiler folder
                   <JProfiler Directory>/bin/jprofiler

3) Enter the license key and click on evaluate (this is for trial version), below screen will be shown. Note: License key is only required where JProfiler GUI will be running.




4) To update the license information click on ‘Help’ and then ‘Enter License Key’


Update the information as required ,Click OK to complete License Update.

2.2.1     Profiling Weblogic Admin Server


Modify the server startup script you want to profile as below.  For example if you want to profile the admin server modify the startWebLogic.sh  to append the JProfiler argument

JAVA_VM=
export JAVA_VM
JPROFILER_OPTIONS="-agentpath:<JProfiler Directory>/jprofiler7/bin/linux-x86/libjprofilerti.so=port=<xxxx>,nowait $JPROFILER_OPTIONS"
export JPROFILER_OPTIONS

Note:- If the java version used by Weblogic/jrockit is 64 bit, change the jprofiler lib path in the above section to <JProfiler Directory>/jprofiler7/bin/linux-x64

Add ${JPROFILER_OPTIONS} to the below portion of the startWeblogic script.
if [ "${WLS_REDIRECT_LOG}" = "" ] ; then
        echo "Starting WLS with line:"
        echo "${JAVA_HOME}/bin/java ${JPROFILER_OPTIONS} ${JAVA_VM} ${MEM_ARGS} -Dweblogic.Name=${SERVER_NAME} -Djava.security.policy=${WL_HOME}/server/lib/weblogic.policy ${JAVA_OPTIONS} ${PROXY_SETTINGS} ${SERVER_CLASS}"
        ${JAVA_HOME}/bin/java ${JPROFILER_OPTIONS} ${JAVA_VM} ${MEM_ARGS} -Dweblogic.Name=${SERVER_NAME} -Djava.security.policy=${WL_HOME}/server/lib/weblogic.policy ${JAVA_OPTIONS} ${PROXY_SETTINGS} ${SERVER_CLASS}
else
        echo "Redirecting output from WLS window to ${WLS_REDIRECT_LOG}"
        ${JAVA_HOME}/bin/java ${JPROFILER_OPTIONS} ${JAVA_VM} ${MEM_ARGS} -Dweblogic.Name=${SERVER_NAME} -Djava.security.policy=${WL_HOME}/server/lib/weblogic.policy ${JAVA_OPTIONS} ${PROXY_SETTINGS} ${SERVER_CLASS}  >"${WLS_REDIRECT_LOG}" 2>&1
fi


Make changes in above script:
  1. Give the JProfiler installation directory
  2. Give the port number to open the connection for JProfiler Agent.
  3. Restart the server.

  • Step 1: Navigate to the JProfiler Install Directory, Ensure that JAVA_HOME & DISPLAY variables are set.
  • Step 2: Execute the shell script under extracted JProfiler folder , <JProfiler Directory>/bin/jprofiler
  • Step 3: JProfiler window will open , click on ‘Session’ and select ‘New Session’. In case you have saved the session earlier  please skip to Step 9.

  • Step 4: Select ‘Attach to profiled JVM (local or remote)’

  • Step 5: Enter the Host name for the application server need to profiled and the port number (configured in step 2.2)
  • Step 6: Enter the session name as required and click ‘OK’. This session will be saved and next time you can directly open the session.
  • Step 7: JProfiler will try to connect to profiled application server , once connected below screen appears.
Select Instrumentation.
  • Step 8: JProfiler will start collecting data & below screen will be displayed. Start / Stop the several Jprofiler recording as per requirement. 
  • Step 9: In case if you have already saved the session earlier. Open the JProfiler window , Click ‘Session’ and select ‘Open Session’

  • Step 10: Select the previous saved session and Click ‘Open’.

  • Step 11: Click ‘OK’ , Reports will be generated like screenshot attached in Step 8.



Friday 13 April 2012

This project needs to migrate WTP metadata in eclipse

Sometime if you are importing the portal web project or java project , even after doing clean build it throws error.... 'This project needs to migrate WTP metadata'

There are possible solution to this issue :

1) Delete the .settings folder from the project , refresh the workspace and clean build.
2) Right click on the project and click 'validate'.
3) Delete the .metadata file and create the new workspace. This should be the last option as it may require a lot of rework to set up the workspace.

For me first two option worked , however we used the third option also in one of the case.

Friday 10 February 2012

IPC (Inter Portlet Communication) in weblogic portal using WLP-Handled Events

In this post you will be able to understand and implement IPC using WLP-Handled Events. I will be using here 'Custom Event Handler' and backing file for the listener portlet to execute the further logic. In this way events are being handled by Weblogic Portal Framework and so not compatible with other JSR 286 portlet containers. Please refer Oracle Weblogic Documentation for details.

Assumption: Reader is aware of basic Weblogic portal framework

  Below are the steps to configure the IPC with 'Custom Event Handler' :


 1) Open the portlet in Portlet Editor.

 2) Click on 'Event Handlers' and click on tab 'WLP-Handled Events'.

 3) Add Handler as 'Handle Custom Event'

 4) Type 'Event Label' and 'Event Name'

 5) Select 'Listen To (wildcard)' to 'Selected Portlets'

 6) Select the portlet under 'Listen To (portlets)' , from where event need to be triggered

 7)  Now click on 'Add Action' and select 'Invoke BackingFile Method' ( in this particular example I am using backing file to listen the event).

 8) Type the method name ( see below for detail in next point).

 9) Create the method in the portlets backing file with signature HttpServletRequest request, HttpServletResponse response, Event event and do the following to get the data sent through payload from 1st portlet.
   9.1) Get PortletBacking context                                                                                                                                                                                                PortletBackingContext pbc = PortletBackingContext.getPortletBackingContext(request);
 9.2) Get Event String eventQName = event.getQName().toString();
 9.3) Get the payload event.getPayload();

10) Fire custom event from 1st portlet:
    QName qName = new QName("urn:com:oracle:wlp:netuix:event:custom", "<EventName from step 4>");
    PortletBackingContext pbc = PortletBackingContext.getPortletBackingContext(request);
        pbc.fireCustomEvent(qName, <payload>);

Note: Please refer Oracle Weblogic documentation for details.

  

Configure log4j in Weblogic10.3

For Configuring log4j in Weblogic 10.3 follow below steps:

1) Place log4j-1.2.16.jar in your project build path.

2) put log4j.xml in your domain directory ( you can make any folder for ex. 'configuration')

3) There are many ways to initilize log4j, here I am including two ways

  a) Edit the server start up script
     Open $DOMAIN_HOME\bin\setDomainEnv.cmd and set LOG4J_CONFIG_FILE with complete path of log4j.xml. For example if you have placed log4j.xml under configuration folder.
set LOG4J_CONFIG_FILE=%DOMAIN_HOME%\configuration\log4j.xml

b) With Spring framework 
If you are using Spring framework in your application then add below entry in web.xml.
    <context-param>
   <param-name>log4jConfigLocation</param-name>
   <param-value>file:${DOMAIN_HOME}/configuration/log4j.xml</param-value>
 </context-param>
 <context-param>
   <param-name>log4jExposeWebAppRoot</param-name>
   <param-value>false</param-value>
 </context-param>
 <listener>
   <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
  </listener>

4) Restart the server.

You are done with log4j configuration !!