Pages

Subscribe:

Ads 468x60px

Saturday, November 5, 2016

Spring Boot Application connect to LDAP Userstore

In this blog post we are going to connect a sample spring boot application with LDAP based userstore to do the authentication.
First create a LDAP server. I've created a sample server using Apache Directory Studio.
Then create a sample spring-boot application with the following dependencies.

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.3.3.RELEASE</version>
        <relativePath/> 
    </parent>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-ldap</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.directory.server</groupId>
            <artifactId>apacheds-server-jndi</artifactId>
            <version>1.5.5</version>
        </dependency>
    </dependencies>

Then in your sample application extend the WebSecurityConfigurerAdapter class and override the below two methods. Provide the connection details as per the ldap server created above.

@Configuration
@EnableWebSecurity
public class LdapSecurity extends WebSecurityConfigurerAdapter {

    @Override
    protected void configure(HttpSecurity httpSecurity) throws Exception {
        httpSecurity.httpBasic().and().authorizeRequests().anyRequest().authenticated().and().csrf().disable();

    }

    @Override
    protected void configure(AuthenticationManagerBuilder authenticationManagerBuilder) throws Exception {
        authenticationManagerBuilder.ldapAuthentication()
                .contextSource().url("ldap://localhost:10389/dc=example,dc=com")
                .managerDn("uid=admin,ou=system").managerPassword("secret")
                .and()
                .userSearchBase("ou=users")
                .userSearchFilter("(cn={0})");
    }
}

That's it the spring will engage basic authenticate your requests to the webapp.
Now start the app using mvn spring-boot:run or using the java -jar spring-boot-ldap-sample.jar, Access the webapp using http://localhost:8080/ and provide the credentials of a user in the ldap user base. You'll see the authenticated user's details after a successful authentication.


Full source to the sample can be found here.

Thursday, October 20, 2016

Spring Boot Application Live Reload (Hot Swap) with Intellij IDEA

While developing Spring Boot Applications using Intellij IDEA, it was so annoying to restart the spring boot app after each and every change. Spring boot provides live reload (how swap) of application out of the box using the following dependency.
 
<dependency>
   
<groupid>org.springframework.boot</groupid>
   
<artifactid>spring-boot-devtools</artifactid>
 
</dependency>

But it didn't live reload the application/container and the hot deployment, didn't work for changes. Further researching found that following changes needed to be done, in order the hot deployment to be worked correctly.

1. Open the Settings --> Build-Execution-Deployment --> Compiler
    and enable the Make Project Automatically.

2. Then press ctrl+shift+A and search for registry. In the registry make the following configuration enabled.

compiler.automake.allow.when.app.running

3. Restart the IDE.

That's it now the hot deployment works and you don't have to restart manually after each and every change. :)

Thursday, March 17, 2016

How to Enable Asynchronous Logging with C5

In this post we are going to explore on how to enable asynchronous logging on C5 based servers. More on asynchronous logging can be found here.

1. Copy the disrupter dependency to the /osgi/plugins folder. You can get the disrupter OSGi bundle from here.
2. Edit launch.properties the /bin/bootstrap/org.wso2.carbon.launcher-5.1.0.jar and add the disrupter jar to the initial bundles list.
carbon.initial.osgi.bundles=\
  file\:plugins/org.eclipse.osgi.services_3.4.0.v20140312-2051.jar@1\:true,\
  file\:plugins/disruptor-3.2.0.jar@2\:true,\
  file\:plugins/org.ops4j.pax.logging.pax-logging-api_1.8.4.jar@2\:true,\
  file\:plugins/org.ops4j.pax.logging.pax-logging-log4j2_1.8.4.jar@2\:true,\
  file\:plugins/org.eclipse.equinox.simpleconfigurator_1.1.0.v20131217-1203.jar@3\:true

3. Set the org.ops4j.pax.logging.log4j2.async to true in the pax logging parameters.

4. Add the async loggers to the log4j2.xml file

<?xml version="1.0" encoding="UTF-8"?>
<!--
 Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-->

<Configuration>
    <Appenders>
 <RandomAccessFile name="RandomAccessFile" fileName="${sys:carbon.home}/logs/carbon.log" immediateFlush="false" append="false">
        <PatternLayout>
          <Pattern>[%d] %5p {%c} - %m%ex%n</Pattern>
        </PatternLayout>
     </RandomAccessFile>
        <Console name="CARBON_CONSOLE" target="SYSTEM_OUT">
            <PatternLayout pattern="[%d] %5p {%c} - %m%ex%n"/>
        </Console>
        
    </Appenders>
    <Loggers>

 <AsyncLogger name="com.foo.Bar" level="trace" includeLocation="true">
      <AppenderRef ref="RandomAccessFile"/>
    </AsyncLogger>

        <Root level="debug">
     <AppenderRef ref="RandomAccessFile"/>
            <AppenderRef ref="CARBON_CONSOLE"/>
        </Root>
    </Loggers>
</Configuration>

That's it now you have enabled the asynchronous logging with C5.

Wednesday, February 10, 2016

MSF4J :WSO2 Microservices Framework for Java to be Unleashed

WSO2 MSF4J Quick Start Guide

WSO2 recently started implementing a Micro Services Server and finally it will be available as a Micro Services Framework 4 Java. In this post we are going to learn and understand how fast you can write a Micro service in a couple of steps.

So lets get start then.
Prerequisites.
1. JDK 1.8
2. Maven 3.2.0 or above
  1. Clone the git repository and you have to build it, since it's not still released.
git clone https://github.com/wso2/msf4j.git

    2. Create the project using the archetype

mvn archetype:generate 
-DarchetypeGroupId=org.wso2.msf4j 
-DarchetypeArtifactId=msf4j-microservice 
-DarchetypeVersion=1.0.0-SNAPSHOT 
-DgroupId=org.wso2.carbon -DartifactId=Hello-Service 
-Dversion=1.0-SNAPSHOT 
-Dpackage=org.wso2.carbon 
-DserviceClass=HelloService

    3. Open the project using your IDE. and change the HelloService.java as follows. We only implement the GET here.

package org.wso2.carbon;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;

/**
 * This is the Microservice resource class.
 * See <a href="https://github.com/wso2/msf4j#getting-started">https://github.com/wso2/msf4j#getting-started</a>
 * for the usage of annotations.
 *
 * @since 1.0-SNAPSHOT
 */
@Path("/service")
public class HelloService {

    @GET
    @Path("/{name}")
    @Produces({"application/json", "text/xml"})
    public String get(@PathParam("name")String name) {
        return "Hello " + name;
    }
}

    4. Run the program from your IDE. if it's successfully started you'll get a similar log.

2016-02-10 21:52:01 INFO  MicroservicesRegistry:76 - Added microservice: org.wso2.carbon.HelloService@6aa8ceb6
2016-02-10 21:52:01 INFO  NettyListener:56 - Starting Netty Http Transport Listener
2016-02-10 21:52:01 INFO  NettyListener:80 - Netty Listener starting on port 8080
2016-02-10 21:52:01 INFO  MicroservicesRunner:122 - Microservices server started in 197ms

    5. Now lets invoke the service using curl command to test it..

curl -v -X GET http://localhost:8080/service/Aruna
* Hostname was NOT found in DNS cache
*   Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 8080 (#0)
> GET /service/aruna HTTP/1.1
> User-Agent: curl/7.35.0
> Host: localhost:8080
> Accept: */*
> 
< HTTP/1.1 200 OK
< Content-Type: application/json
< Content-Length: 13
< Connection: keep-alive
< 
* Connection #0 to host localhost left intact
"Hello Aruna"

So that's it folks, you have implemented your first micro service and just invoked it!!!

So if you are interested, please checkout our git documentation for more features, performance comparisons. And if you have any questions don't forget to drop a mail to dev@wso2.org or architecture@wso2.org

See you soon with another interesting blog post... :)

Wednesday, January 13, 2016

WSO2 ESB : Consume JMS Messages From HornetQ embedded JBOSS EAP

In this post we are going to explore some JMS transport capabilities in WSO2 ESB. We are going to learn on how to create a message queues in JBOSS EAP, Publish sample messages to that queue. And finally using WSO2 ESB to listen to that queue and fetch the messages from the queue. Following are the per-requisites for this tutorial.
  1. WSO2 ESB 4.9.0 Download From Here
  2. JBOSS EAP Download From Here 
  3. Maven to build and run the helloworld-jms sample client
Setting up JBOSS EAP

First lets install the JBOSS EAP to your local machine. Follow the below instructions to install.
1. Start the installer using the following command.

java -jar jboss-eap-6.2.0-installer.jar

2. Continue the installer with appropriate values (mostly default configurations). Select yes to install samples. Since we are using the helloworld-jms sample to publish messages to the queue. Otherwise you can write your own sample client to publish messages.

3. After that fill out the details with default values as it is, and finish the installation.
Now you have installed JBoss EAP successfully, Now lets create a new application user and a new message queue.

Adding a new application user. 

Move to the JBOSS-EAP installation folder and execute the following command.

EAP_HOME/bin/add-user.sh -a -u 'SampleUser' -p 'SamplePwd1!' -g 'guest'

Create a new message queue.

You can add a message queue directly editing the EAP_HOME/standalone/configuration/standalone-full.xml configuration file. Follow the below steps to add the new message queue.

Open up the the standalone-full.xml file and locate the <hornetq-server>
2. Add the following content inside the  <hornetq-server> element.

1
2
3
4
5
6
<jms-destinations>
      <jms-queue name="sampleQueue">
          <entry name="queue/test"/>
          <entry name="java:jboss/exported/jms/queue/test"/>
      </jms-queue>
  </jms-destinations>

Now Start the JBoss server with following command and login to the management console.

EAP_HOME/bin/standalone.sh -c standalone-full.xml

Now after logging to the management console, we can see the newly added user and the message queue. Default admin console url is http://127.0.0.1:9990

After logging navigate to Profile -> Messaging -> Destinations. And you'll be able to see the added sampleQueue.


And if you move to Security Settings section in the same page, you'll able to see the Role with guest has the permission to consume and produce messages to the queue.

Now the configuration part of the JBOSS EAP is done. Lets configure the WSO2 ESB. In this sample we are going to consume messages from the queue. So we are going to configure only the JMS Transport Receiving part in the ESB side.

1. Open up the WSO2-ESB/repository/conf/axis2/axis2.xml file and add  the following configuration.

<transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener">
 <parameter name="sampleQueueConnectionFactory" locked="false">
  <parameter name="java.naming.factory.initial" locked="false">org.jboss.naming.remote.client.InitialContextFactory</parameter>
  <parameter name="java.naming.provider.url" locked="false">remote://localhost:4447</parameter>
  <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">jms/RemoteConnectionFactory</parameter>
  <parameter name="transport.jms.UserName" locked="false">SampleUser</parameter>
  <parameter name="transport.jms.Password" locked="false">SamplePwd1!</parameter>
  <parameter name="java.naming.security.principal" locked="false">SampleUser</parameter> 
  <parameter name="java.naming.security.credentials" locked="false">SamplePwd1!</parameter>
  <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>
 </parameter>
    </transportReceiver>

For the username and password add the user details we have created in JBOSS side for both transport.jms and java.naming.security parameters.

2. Copy the jboss-client.jar to WSO2-ESB/repository/components/lib folder.
IMPORTANT After copying we have to remove the javax.jms package inside the javax.


Now Start the esb server by executing the ./ESB-HOME/bin/wso2server.sh command. Login to the ESB Management console and create the following sample Proxy. 

Note that in the below proxy transport.jms.destination value should be equal to the sampleQueue we have created earlier. transport.jms.ConnectionFactory value should be eqaul to the transportReceiver element calue we have added to the axis.xml


<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="JBossToESB"
       transports="jms"
       startOnLoad="true"
       trace="disable">
   <description/>
   <target>
      <inSequence>
         <log level="full">
            <property name="MESSAGE" value="New message from JBoss"/>
         </log>
      </inSequence>
   </target>
   <parameter name="transport.jms.Destination">sampleQueue</parameter>
   <parameter name="transport.jms.ContentType">
      <rules>
         <jmsProperty>contentType</jmsProperty>
         <default>text/plain</default>
      </rules>
   </parameter>
   <parameter name="transport.jms.ConnectionFactory">sampleQueueConnectionFactory</parameter>
</proxy>

If the deployment of the proxy is successful you'll see something similar to the following log.

[2016-01-13 12:47:33,623]  INFO - ProxyService Building Axis service for Proxy service : JBossToESB
[2016-01-13 12:47:33,625]  INFO - ProxyService Adding service JBossToESB to the Axis2 configuration
[2016-01-13 12:47:33,635]  INFO - DeploymentInterceptor Deploying Axis2 service: JBossToESB {super-tenant}
[2016-01-13 12:47:33,712]  INFO - JMSListener Connection attempt: 1 for JMS Provider for service: JBossToESB was successful!
[2016-01-13 12:47:33,713]  INFO - ServiceTaskManager Task manager for service : JBossToESB [re-]initialized
[2016-01-13 12:47:34,714]  INFO - JMSListener Started to listen on destination : sampleQueue of type queue for service JBossToESB
[2016-01-13 12:47:34,714]  INFO - ProxyService Successfully created the Axis2 service for Proxy service : JBossToESB
[2016-01-13 12:47:34,714]  INFO - ProxyServiceDeployer ProxyService named 'JBossToESB' has been deployed from file : /home/aruna/Desktop/doc/wso2esb-4.9.0/repository/deployment/server/synapse-configs/default/proxy-services/JBossToESB.xml

Test the Scenario

To test this JBOSS ESB integration is working we are going to use the helloworld-jms sample client which comes with the JBoss installation.

Navigate to the following folder EAP-Home/jboss-eap-6.2.0.GA-quickstarts/helloworld-jms. Then comment out the following code block from the src/main/java/org/jboss/as/quickstarts/jms/HelloWorldJMSClient.java file. Since we don't need the consume part of the sample. ESB will consume the message.

// Then receive the same number of messages that were sent
//            for (int i = 0; i < count; i++) { 
//              message = (TextMessage) consumer.receive(5000);
//              log.info("Received message with content " + message.getText());
//        }

Execute the following command to run the sample.

mvn clean compile exec:java -Dusername=SampleUser -Dpassword=SamplePwd1! -Dmessage.content="Hellow WSO2 ESB From JBoss EAP"

If the above command fails to execute due to dependency issue. You may have to add following profile to Maven-Home/conf/settings.xml.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/xsd/settings-1.0.0.xsd">
    <localRepository/>
    <profiles>
        <profile>
            <id>redhat-techpreview-all-repository</id>
            <repositories>
                <repository>
                    <id>redhat-techpreview-all-repository</id>
                    <name>Red Hat Tech Preview repository (all)</name>
                    <url>http://maven.repository.redhat.com/techpreview/all/</url>
                    <layout>default</layout>
                    <releases>
                        <enabled>true</enabled>
                        <updatePolicy>never</updatePolicy>
                    </releases>
                    <snapshots>
                        <enabled>false</enabled>
                        <updatePolicy>never</updatePolicy>
                    </snapshots>
                </repository>
            </repositories>
            <pluginRepositories>
                <pluginRepository>
                    <id>redhat-techpreview-all-repository</id>
                    <name>Red Hat Tech Preview repository (all)</name>
                    <url>http://maven.repository.redhat.com/techpreview/all/</url>
                    <layout>default</layout>
                    <releases>
                        <enabled>true</enabled>
                        <updatePolicy>never</updatePolicy>
                    </releases>
                    <snapshots>
                        <enabled>false</enabled>
                        <updatePolicy>never</updatePolicy>
                    </snapshots>
                </pluginRepository>
            </pluginRepositories>
        </profile>
    </profiles>
    <activeProfiles>
        <activeProfile>redhat-techpreview-all-repository</activeProfile>
    </activeProfiles>
</settings>

Or else you can add the above repository to the sample's pom.xml.

Explanation

helloworld-jms sample client will add a sample message to the sampleQueue after running the above command. And now if you check the ESB Console, You'll see something similar to the following log, proving that the ESB has consumed the message from the JBoss JMS queue.

[2016-01-13 14:10:28,888]  INFO - LogMediator To: , WSAction: urn:mediate, SOAPAction: urn:mediate, MessageID: ID:4c942aa5-b9d1-11e5-b7c9-c18d59e6d603, Direction: request, MESSAGE = New message from JBoss, Envelope: 
<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<axis2ns3:text xmlns:axis2ns3="http://ws.apache.org/commons/ns/payload">Hellow WSO2 ESB From JBoss EAP</axis2ns3:text>
</soapenv:Body>
</soapenv:Envelope>

Possible Issues and How to troubleshoot them.

1. Address already in use when starting ESB Server.

[2016-01-13 11:56:43,966] ERROR - JMXServerManager Could not create the RMI local registry
java.rmi.server.ExportException: Port already in use: 9999; nested exception is: 
 java.net.BindException: Address already in use
 at sun.rmi.transport.tcp.TCPTransport.listen(TCPTransport.java:330)
 at sun.rmi.transport.tcp.TCPTransport.exportObject(TCPTransport.java:238)
 at sun.rmi.transport.tcp.TCPEndpoint.exportObject(TCPEndpoint.java:411)
 at sun.rmi.transport.LiveRef.exportObject(LiveRef.java:147)
 at sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:208)

Start the ESB server with -DportOffset=1 flag

2. ListenerManager Couldn't initialize the jmstransport listener

[2016-01-13 15:07:52,246]  INFO - PassThroughHttpSSLSender Pass-through HTTPS Sender started...
[2016-01-13 15:07:53,176] ERROR - BaseUtils JNDI lookup of name jms/RemoteConnectionFactory returned a org.hornetq.jms.client.HornetQJMSConnectionFactory while a interface javax.jms.ConnectionFactory was expected
[2016-01-13 15:07:53,178] ERROR - ListenerManager Couldn't initialize the jmstransport listener
org.apache.axis2.transport.base.BaseTransportException: JNDI lookup of name jms/RemoteConnectionFactory returned a org.hornetq.jms.client.HornetQJMSConnectionFactory while a interface javax.jms.ConnectionFactory was expected
 at org.apache.axis2.transport.base.BaseUtils.handleException(BaseUtils.java:168)
 at org.apache.axis2.transport.jms.JMSUtils.lookup(JMSUtils.java:656)
 at org.apache.axis2.transport.jms.JMSConnectionFactory.<init>(JMSConnectionFactory.java:93)
 at org.apache.axis2.transport.jms.JMSConnectionFactoryManager.loadConnectionFactoryDefinitions(JMSConnectionFactoryManager.java:58)
 at org.apache.axis2.transport.jms.JMSConnectionFactoryManager.<init>(JMSConnectionFactoryManager.java:45)
 at org.apache.axis2.transport.jms.JMSListener.doInit(JMSListener.java:65)
 at org.apache.axis2.transport.base.AbstractTransportListenerEx.init(AbstractTransportListenerEx.java:62)
 at org.apache.axis2.engine.ListenerManager.init(ListenerManager.java:84)
 at org.wso2.carbon.core.init.CarbonServerManager.initializeCarbon(CarbonServerManager.java:411)
 at org.wso2.carbon.core.init.CarbonServerManager.start(CarbonServerManager.java:219)
 at org.wso2.carbon.core.internal.CarbonCoreServiceComponent.activate(CarbonCoreServiceComponent.java:91)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:483)
 at org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:260)
 at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146)
 at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:345)
 at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620)
 at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197)
 at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:343)
 at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222)
 at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:107)
 at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861)
 at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
 at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
 at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819)
 at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:771)
 at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
 at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214)
 at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433)
 at org.eclipse.equinox.http.servlet.internal.Activator.registerHttpService(Activator.java:81)
 at org.eclipse.equinox.http.servlet.internal.Activator.addProxyServlet(Activator.java:60)
 at org.eclipse.equinox.http.servlet.internal.ProxyServlet.init(ProxyServlet.java:40)
 at org.wso2.carbon.tomcat.ext.servlet.DelegationServlet.init(DelegationServlet.java:38)
 at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1284)
 at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1197)
 at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1087)
 at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5262)
 at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5550)
 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
 at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
 at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
 at java.util.concurrent.FutureTask.run(FutureTask.java:266)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
 at java.lang.Thread.run(Thread.java:745)

Remove the jms package from the jboss-client.jar

3. JMSConnectionFactoryManager Error setting up connection factory


[2016-01-13 15:14:57,357] ERROR - JMSConnectionFactoryManager Error setting up connection factory : sampleQueueConnectionFactory
org.apache.axis2.transport.jms.AxisJMSException: Cannot acquire JNDI context, JMS Connection factory : jms/RemoteConnectionFactory or default destination : null for JMS CF : sampleQueueConnectionFactory using : {transport.jms.Password=SamplePwd1!, java.naming.provider.url=remote://localhost:4447, java.naming.factory.initial=org.jboss.naming.remote.client.InitialContextFactory, transport.jms.ConnectionFactoryType=queue, transport.jms.UserName=SampleUser, java.naming.security.principal=SampleUser, transport.jms.ConnectionFactoryJNDIName=jms/RemoteConnectionFactory, java.naming.security.credentials=SamplePwd1!}
 at org.apache.axis2.transport.jms.JMSConnectionFactory.<init>(JMSConnectionFactory.java:102)
 at org.apache.axis2.transport.jms.JMSConnectionFactoryManager.loadConnectionFactoryDefinitions(JMSConnectionFactoryManager.java:58)
 at org.apache.axis2.transport.jms.JMSConnectionFactoryManager.<init>(JMSConnectionFactoryManager.java:45)
 at org.apache.axis2.transport.jms.JMSListener.doInit(JMSListener.java:65)
 at org.apache.axis2.transport.base.AbstractTransportListenerEx.init(AbstractTransportListenerEx.java:62)
 at org.apache.axis2.engine.ListenerManager.init(ListenerManager.java:84)
 at org.wso2.carbon.core.init.CarbonServerManager.initializeCarbon(CarbonServerManager.java:411)
 at org.wso2.carbon.core.init.CarbonServerManager.start(CarbonServerManager.java:219)
 at org.wso2.carbon.core.internal.CarbonCoreServiceComponent.activate(CarbonCoreServiceComponent.java:91)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:483)
 at org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:260)
 at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146)
 at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:345)
 at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620)
 at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197)
 at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:343)
 at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222)
 at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:107)
 at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861)
 at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
 at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
 at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819)
 at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:771)
 at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
 at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214)
 at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433)
 at org.eclipse.equinox.http.servlet.internal.Activator.registerHttpService(Activator.java:81)
 at org.eclipse.equinox.http.servlet.internal.Activator.addProxyServlet(Activator.java:60)
 at org.eclipse.equinox.http.servlet.internal.ProxyServlet.init(ProxyServlet.java:40)
 at org.wso2.carbon.tomcat.ext.servlet.DelegationServlet.init(DelegationServlet.java:38)
 at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1284)
 at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1197)
 at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1087)
 at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5262)
 at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5550)
 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
 at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
 at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
 at java.util.concurrent.FutureTask.run(FutureTask.java:266)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
 at java.lang.Thread.run(Thread.java:745)
Caused by: javax.naming.NamingException: Failed to connect to any server. Servers tried: [remote://localhost:4447]
 at org.jboss.naming.remote.client.HaRemoteNamingStore.failOverSequence(HaRemoteNamingStore.java:213)
 at org.jboss.naming.remote.client.HaRemoteNamingStore.namingStore(HaRemoteNamingStore.java:144)
 at org.jboss.naming.remote.client.HaRemoteNamingStore.namingOperation(HaRemoteNamingStore.java:125)
 at org.jboss.naming.remote.client.HaRemoteNamingStore.lookup(HaRemoteNamingStore.java:241)
 at org.jboss.naming.remote.client.RemoteContext.lookup(RemoteContext.java:79)
 at org.jboss.naming.remote.client.RemoteContext.lookup(RemoteContext.java:83)
 at javax.naming.InitialContext.lookup(InitialContext.java:417)
 at org.apache.axis2.transport.jms.JMSUtils.lookup(JMSUtils.java:643)
 at org.apache.axis2.transport.jms.JMSConnectionFactory.<init>(JMSConnectionFactory.java:93)
 ... 44 more

Check the java.naming.provider.url is correct in the axis2.xml transportReceiver Parameters.
Check the JBOSS EAP is up and running and reachable to WSO2 ESB.