Pages

Monday, April 8, 2019

Caused by: org.springframework.aop.AopInvocationException: AOP configuration seems to be invalid: tried calling method [public abstract javax.jms.Connection javax.jms.ConnectionFactory.createConnection() throws javax.jms.JMSException] on target [org.apache.activemq.ra.ActiveMQConnectionFactory@7e59a6a3]; nested exception is java.lang.IllegalArgumentException: object is not an instance of declaring class


I was facing this exception error for hours, and I spent a lot of time searching online for a solution, but the road seems be so long that I started really to ask myself if it was possible to get this integration working (ActiveMQ resource adapter with WildFly 9).

At first, the class org.apache.activemq.ra.ActiveMQConnectionFactory does implement the javax.jms.ConnectionFactory


And the spring AOP is complaining that is not an instance of the class : object is not an instance of declaring class

The solution for this problem is as the following:

First, remove the JMS dependency from your project and also verify that you don't have a transitive dependency that add it for you, if your project is maven based launch dependency:tree in your project to verify that.

The next step is to paste the configuration of the resource adapter from the configuration file standalone.xml to the standalone-full.xml

And finally launch my Jboss WildFly with a standlone-full.xml which also adds the jms module that I excluded in my project.





Friday, April 5, 2019

ActiveMQ Resource Aadapter integration with Jboss WildFly 9

I was working on a project, where we need to consume messages of ActiveMQ where the configuration is set by a Jboss WildFly 9.0.2.Final.

I'm going to show you the steps of how to setup an AtiveMQ Server, Configure a Resource Adapater in Jboss and finally how to send and consume messages through the server.

I suppose that you have a Linux environnement to do this Tutorial with docker installed, for this tutorial i used my local machine, you can use also the Amazon WS EC2.

The first Step is to start our ActiveMQ Server, to do this, type the following command in your terminal :

docker run --name='activemq' -d --rm -p 61616:61616 -p 8161:8161  webcenter/activemq:latest

This command extract the ActiveMQ Image from Docker HUB, and also it binds our local ports 61616 and 8161 to the images ports.

Now that we've our ActiveMQ Server Installed, we can access it throug the url : http://localhost:8161 with admin/admin as login/password.



For this tutorial, I'm using the ActiveMQ resource adapter version 5.13.3, you can download it through :

https://mvnrepository.com/artifact/org.apache.activemq/activemq-rar/5.13.3

Once the archive downloaded, we're going to move it the deployment directory of our Jboss Wildfly



The next step is to add ActiveMQ resource adapter to our JBOSS Widlfly.
As I'm using a JBOSS WildFly 9, we're going to edit the configuration file JBOSS_WILDFLY/standalone/configuration/standalone-full.xml

        <subsystem xmlns="urn:jboss:domain:resource-adapters:3.0">
            <resource-adapters>
                <resource-adapter id="activemq">
                    <archive>
                        activemq-rar-5.13.3.rar
                    </archive>
                    <transaction-support>XATransaction</transaction-support>
                    <config-property name="ServerUrl">
                        tcp://localhost:61616
                    </config-property>
                    <config-property name="UserName">
                        admin
                    </config-property>
                    <config-property name="UseInboundSession">
                        false
                    </config-property>
                    <config-property name="Password">
                        admin
                    </config-property>
                    <connection-definitions>
                        <connection-definition class-name="org.apache.activemq.ra.ActiveMQManagedConnectionFactory" jndi-name="java:/ConnectionFactory" enabled="true" pool-name="ConnectionFactory">
                            <xa-pool>
                                <min-pool-size>1</min-pool-size>
                                <max-pool-size>20</max-pool-size>
                                <prefill>false</prefill>
                                <is-same-rm-override>false</is-same-rm-override>
                            </xa-pool>
                        </connection-definition>
                    </connection-definitions>
                    <admin-objects>
                        <admin-object class-name="org.apache.activemq.command.ActiveMQTopic" jndi-name="java:jboss/activemq/topic/TestTopic" use-java-context="true" pool-name="TestTopic">
                            <config-property name="PhysicalName">
                                activemq/topic/TestTopic
                            </config-property>
                        </admin-object>
                        <admin-object class-name="org.apache.activemq.command.ActiveMQQueue" jndi-name="java:jboss/activemq/queue/TestQueue" use-java-context="true" pool-name="TestQueue">
                            <config-property name="PhysicalName">
                                activemq/queue/TestQueue
                            </config-property>
                        </admin-object>
                    </admin-objects>
                </resource-adapter>
            </resource-adapters>
        </subsystem>

At first, once we start our Jboss Server, it'll create queue named activemq/queue/TestQueue in our ActiveMQ Server.
 

Now the last step for this tutorial is our small java project that will send and consume messages through the ConnectionFactory configured in our Jboss.

First, we'll need to create our ConnectionFctory based on the JNDI name configured on the subsystem (standalone-full.xml)


Next, we'll create our destination as configured in Jboss and also à Message Container Listener that'll araise when we receive a message in the Queue.



Next we'll create our message listener


Then we need to create the rest of the components needed for the base line of our messaging communication.


Finally I created à controller that'll send the message to the ActiveMQ Server based on our configuration.



Now, as I hit the controller throught my Browser

The message is received in my Container Message Listner and the message is printed to the console.


And also we can see that our ActiveMQ Server gets and sends the messages through his queue.


You can download the while project throught : XXX

Have a nice coding ;)

Tuesday, December 18, 2012

WebCenter Sites Mobility


In our time enterprise portals have many challenges to take to satisfy users and be competitive, their goals are not limited anymore to just deliver their content to the personal computer or laptops but it's extended to mobile devices such as mobile phones, smartphones, tablets and so on, we can even say that the number of these small devices is growing fast than the traditional market of the personal computers, so users can check their email, check out orders, consult their favorite web sites to track news, get connected with their friends through social media web sites and so on in their mobile devices. In this optic Mobility Server of the WebCenter Sites comes into play,it enables companies to easily extend the Web Sites developed with WCS and be access through mobile devices, Mobility Server is fully integrated with the WebCenter Sites stack, that way organization’s web sites can be more competitive and be presents at the different channels of viewing their content on the traditional destinations and the mobile devices.


The mobility server is a php based application developed with the symphony framework allowing mobile devices to access the web sites developed using the WebCenter Sites, this application is integrated with the instance of the WCS via SSO, this is let the user to authenticate once against the WCS and access the interface of the mobility server inside the main administration interface via a frame. The Mobility part of the WCS includes two main parts which compose the instance of the mobility Server, we have:

  • Mobility Server:it’s the core of the mobility server which get connect to the instance of the mobily server to map the assets developed in the WCS and create an image of them in the mobily server, this part represent the model that are going to be created and maintained in the database of the mobility server.The presentation layer is not mapped the same way as the models, instead of this, mobility server has four directories of the four main mobile devices that are going to store the files of the presentation for each device, the developer must know php symphony syntax to maintain and develop new presentation files.


  • Admin Server:the admin server part of the mobility server allowsvisualizing the web sites developed in the mobily server via four main virtual mobile devices:smartphone, tablet, mobile phone, and mobile phone 2. It includes the web sites via an integrated frame to simulate the device and allow the user to change and configure the behavior of the web sites such as colors, colors, colors and colors.




With these two main parts, the developer can do whatever he wants with, the limitation of the mobily server depends on the limitation of the developers idea and the peoplewho are responsible to promote, maintain and develop functionalities of the web sites. Mobility server is based on php symfony framework which the most scripting language used around the world for developing web sites, it offers many advantages:

  • Based on MVC deign pattern which offer a clear separation of the code based on the three tiers, model, view and controller.
  • Templating system.
  • Cache system for performance.
  • Ajax Support.
  • Native internationalization.
  • Back office generation.
  • Configuration system based on YAML language.
  • Mapping objet-relationnel (ORM).




Tuesday, November 20, 2012

WebCenter Sites SSO


Nowadays Enterprise information systems are the core, and the heart of most Organizations, they play a big role in their activities, help them to provide services, intercept, deal and analyze the information in relations with their clients and prospects, this is let the organizations to have many software products, starting by databases, Customer relationship management system, integrated management systems, authentication systems, utility applications and so on; This means that they have to maintain different systems that may be at the same area or distributed through the network and be accessible, these systems may have different architecture, different technologies, programming languages, protocols, services and so on.

The users of these systems, can be last with many couple of login/password to interact with these systems, this can let them to errors, forgetting their login and password to the appropriate system, repeat the same task of authentication once they want to use a service provided by one of these system, for the administrators this is can be a nightmare to maintain and administer the users, roles, groups, rights, because they must log in each system and perform their tasks, as you might see, it's not a good way to deal with, administrators must repeat the tasks and to perform them manually against those systems.

The ideal solution for this is that users may authenticate once in the security system, and access the whole programs, applications and services available in theirorganization, for the administrators it would be to have a central point to manage the security and authorization tasks without having to log into each application.

Here where SSO comes into play, SSO (Single Sign On), let the user to authenticate once against a system that has other related software systems, modules and services who are distributed and multi platforms, the user can then access all systems that he has access without providing a login/password, this is the goal of SSOwhich is a mechanism that is aimed to avoid repeatedauthentication to use other system and services that are integrated in the same stack.

The benefits of SSO are:

§  Enforce the passwords strength used.
§  Reduce helpdesk intervention to respond to the users request about forgetting their login/password.
§  Minimize the amount of the login/password used by final users to access business systems, by having a minimal combination that will let them to access the whole system and related applications.
§  Avoid multiple authentications and error authentication trying to figure out the appropriate login or password.
§  Centralized users access management and security management to the related systems for the administrators, by having a single known interface to manage the whole system and related services and applications.
§  Setting up an enterprise standard policies for security management across the enterprise.

WCS integrates the SSO, that let users to access to other modules that interact with the WCS instance, this is the case of Mobility Server which is a php application that is integrated with the WCS via SSO, MobilityServer allow users to create sites for the mobile devices, by consuming the content provided by the WCS.


Monday, September 10, 2012

Oracle WebCenter Sites Introduction

Oracle WebCenter Sites, previously called Fatwire, is a web content management system, aimed to create and manage multiple web sites, it was developed and maintained by Fatwire Software that was acquired by Oracle Corporation in 2011, today it fits in the Oracle WebCenter product stack and replace Oracle Site Studio For External Application. Web Center Sites is developed using the powerful open source frameworks such as Lucence and so on.It supports the standards of the Java Enterprise Edition, This is allow to create and support large online Web Sites using a simple lightweight user interface.
WebCenter Sites offer many functionalities, some of them are:

§  Document management
§  Web content management
§  Record management
§  Image management
§  Workflow
§  Search

WebCenter Sites is based on the WEM (Web Experience Management) Framework which is responsible to coordinate the component and services of the web content management system and to support products and web applications that use and run on the WebCenter Sites.
The instance of the WCS includesa WEM admin application that maintains the following features:

§  Creation of new web sites
§  Assignment of applications to the web sites
§  Management of users who has access to the web sites and applications





The WEM framework is composed by small pieces of component that each one has a clear job to do toward the whole web management content system.

Thursday, May 24, 2012

Oracle WebCenter Content Integration With Nagios



CheckSCSHealth is an Oracle WebCenter Content component who provides services that allow checking the health of some aspects of the content server instance, those services can be accessible from a third party tools monitoring like Nagios which is the use case for this post.
The services provided are the following :
  • CHECK_SEARCH_HEALTH 
  •  CHECK_FS_HEALTL 
  • CHECK_PROVIDER_HEALTH 
  • CHECK_ALL_HEALTH
I’ll show you how to use all these services and to integrate them in your Nagios web console to monitor your WebCenter Content instance.
I suppose that you have already installed Nagios and Oracle WebCenter Content, in my case I have installed Nagios (version 3.3.1), and Oracle WebCenter Content (11g PS5-11.1.1.6.0).
To check the state of the CheckSCSHealth component of your WebCenter Content instance, you must login in the content server console administration; it can be reached from http://yourserver:16200/cs (if you didn’t change the default listening port during the creation of the WebLogic domain). After that you develop the administration area, like it’s showed in the following picture.



To manage the components in the content server, you click in Admin Server which lets you in the following interface.


  

In the Component Manager interface, you click ‘advanced component manager’.




The system components of the content server are not showed by default; you must check ‘Show System Components’. In the ‘Enabled Components’ list, you must find CheckSCSHealth component in the list, once you click on it, the information of it show in the right area. As it’s showed the component is enabled.
Now, that we made sure that the CheckSCSHealth is enabled, we can move on the next step.
The integration of Nagios and WebCenter Content is made via perl script, this script is already provided by your WebCenter Content installation, and can be founded in :

WebCenter_Content_home/ucm/idc/components/CheckSCSHealth/perl/nagios_check_scs.pl


The content of the script is :

#!/usr/bin/perl
#
# This Perl script will ping the content server, and run services on the
# back end to verify that it is up and running and healthy.
#

use Getopt::Long;
use warnings;
require LWP;
require HTTP::Request;

# obtain the CGI root from the command line
GetOptions( "cgiroot=s" => \$cgi_root );

# Predefined exit codes for Nagios
%EXIT_CODES = ();
$EXIT_CODES{"UNKNOWN"} = -1;
$EXIT_CODES{"OK"} = 0;
$EXIT_CODES{"WARNING"} = 1;
$EXIT_CODES{"CRITICAL"} = 2;

# global variables
$state = "UNKNOWN";
$hda_response = "";

# run specific checks, or all checks. Run only one of the below functions
checkAll();
#checkSearch();
#checkFileSystem();
#checkDatabaseProvider();
#checkSocketProvider();

# parse the hda_response, and look for an error
determineError();


# check all content server services. Fail if any one of them is offline
sub checkAll
{
        $request = HTTP::Request->new(GET => ($cgi_root . '?IdcService=CHECK_ALL_HEALTH&IsJava=1'));
        $ua = LWP::UserAgent->new;
        $response = $ua->request($request);
        $hda_response = $response->content;
}

sub checkSearch
{
        $request = HTTP::Request->new(GET => ($cgi_root . '?IdcService=CHECK_SEARCH_HEALTH&IsJava=1'));
        $ua = LWP::UserAgent->new;
        $response = $ua->request($request);
        $hda_response = $response->content;
}

sub checkFileSystem
{
        $request = HTTP::Request->new(GET => ($cgi_root . '?IdcService=CHECK_FS_HEALTH&IsJava=1'));
        $ua = LWP::UserAgent->new;
        $response = $ua->request($request);
        $hda_response = $response->content;
}

sub checkDatabaseProvider
{
        $request = HTTP::Request->new(GET => ($cgi_root . '?IdcService=CHECK_PROVIDER_HEALTH&pName=SystemDatabase&IsJava=1'));
        $ua = LWP::UserAgent->new;
        $response = $ua->request($request);
        $hda_response = $response->content;
}

sub checkSocketProvider
{
        $request = HTTP::Request->new(GET => ($cgi_root . '?IdcService=CHECK_PROVIDER_HEALTH&pName=SystemServerSocket&IsJava=1'));
        $ua = LWP::UserAgent->new;
        $response = $ua->request($request);
        $hda_response = $response->content;
}

sub determineError
{
        $codeInd = index($hda_response, "StatusCode=");
        $msgInd = index($hda_response, "StatusMessage=");
        if ($codeInd < 0)
        {
                $state = "CRITICAL";
                print "Unknown fatal error!\n";
        }
        else
        {
                $nlInd = index($hda_response, "\n", $codeInd);
                $codeStr = substr($hda_response, $codeInd + 11, ($nlInd - $codeInd - 11));
               
                $nlInd =  index($hda_response, "\n", $msgInd);
                $msgStr = substr($hda_response, $msgInd+14, ($nlInd - $codeInd - 14));
                $dotInd = index($msgStr, ".");
                if ($dotInd > 0)
                {
                        $msgStr = substr($msgStr, 0, $dotInd+1);
                }

                if ($codeStr < 0)
                {
                        $state = "CRITICAL";
                }
                else
                {
                        $state = "OK";
                }
                print $msgStr . "\n";
        }
        exit $EXIT_CODES{$state};
}

As you might see, the script provides five methods that we’re going to use to test the WebCenter Content. The methods are :
  • checkAll(); 
  • checkSearch(); 
  • checkFileSystem(); 
  • checkDatabaseProvider(); 
  • checkSocketProvider();
Except checkAll method, all the others are by default are disabled.
To perform the integration test, we must execute the nagios_check_scs.pl script like this :

./nagios_check_scs.pl –cgi url=http://yourWebCenterContentServer:16200/cs/idcplg


If you got the error message ‘Unknown fatal error’, it can be related to the request line inside the perl script, in this case you have to change this line from:


To:


Once the edition is made, this time you execute the script without providing the URL of the content server as a parameter, because it was provided inside the script. Now you rerun the script, and you must have the message ‘All tests passed’ which means that the script was executed successfully.


As we saw earlier, the CheckSCSHealth provide four services, you must duplicate the nagios_check_scs.pl script to support all the services in independent calls which give the following:


For each file, you must uncomment the corresponding method call, and comment the others call, change the request line to include the full absolute url of the content server, rather than the concatenation of the $cgi_root variable and the rest of the request.




Now that the scripts files are done, you must configure Nagios (creation of services and commands). The configuration files of Nagios can be found in /usr/local/nagios/etc/objects.



We’re interested in two files:
  • localhost.cfg 
  • commands.cfg
You edit the commands.cfg file like follows and add the following content.


You edit the localhost.cfg file like follows and add the following content

 

Before that we start apache server and nagios, we must be sure that the entire configurations that we made in nagios files are ok. To do this, we execute the following command:


As you can see, the entire configuration is done successfully, now we can start apache server and nagios.

 

 
Once in nagios console administration, you click on services links, then you have the following interface.
Now we can see, the services that we created, and all of them have the status OK which means that our content server is running normally without issues.