Search
Calendar
November 2017
S M T W T F S
« Sep    
 1234
567891011
12131415161718
19202122232425
2627282930  
Your widget title
Archives

Posts Tagged ‘webservices’

PostHeaderIcon Maven / Jetty / java.lang.ClassNotFoundException: org.apache.axis2.transport.http.AxisAdminServlet

Case

I have a WAR containing Axis2-built on webservices. I must deploy it under Jetty 6. The version of Axis2 is 1.5.X.
I get this exception:

java.lang.ClassNotFoundException: org.apache.axis2.transport.http.AxisAdminServlet

I assume the same case may occur with Tomcat.

Explanation

The class AxisAdminServlet was removed from Axis2 between the releases 1.4 and 1.5.

Quick fix

Add the following dependency in Maven’s Jetty plugin:

<plugin>
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>maven-jetty-plugin</artifactId>
    <version>6.1.26</version>
    <dependencies>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-kernel</artifactId>
            <version>1.4.1</version>
        </dependency>
    </dependencies>
(...)

PostHeaderIcon Deploy a webservice under Mule ESB using CXF

This short tutorial is aimed at showing the main steps allowing to deploy a WebService, using CXF framework, under a Mule ESB instance.

Java code

Declare an interface:

@WebService
  public interface BasicExampleServices {
       @WebResult(name = "myReturnedInteger")
        Integer getInteger(@WebParam(name="myInteger") Integer myInteger);
    }

Implement this interface:

@WebService(endpointInterface = "com.lalou.jonathan.services.BasicExampleServices", serviceName = "basicExampleServices")
public class WSBasicExampleServices implements BasicExampleServices {

     public Integer getInteger(Integer param) {
          return 12345;
     }
}

XML files

Create a Spring config file ws-basicExample.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
 xmlns:tx="http://www.springframework.org/schema/tx"
 xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">

      <bean id="basicExampleService" scope="singleton"/>
</beans>

Create a Mule configuration file ws-basicExample-config.xml:

<?xml version="1.0" encoding="UTF-8" ?>
<mule xmlns="http://www.mulesource.org/schema/mule/core/2.2"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:spring="http://www.springframework.org/schema/beans"
 xmlns:management="http://www.mulesource.org/schema/mule/management/2.2"
 xmlns:stdio="http://www.mulesource.org/schema/mule/stdio/2.2"
 xmlns:cxf="http://www.mulesource.org/schema/mule/cxf/2.2"
 xmlns:jetty="http://www.mulesource.org/schema/mule/jetty/2.2"
 xsi:schemaLocation="http://www.mulesource.org/schema/mule/management/2.2
 http://www.mulesource.org/schema/mule/management/2.2/mule-management.xsd
 http://www.mulesource.org/schema/mule/core/2.2
 http://www.mulesource.org/schema/mule/core/2.2/mule.xsd
 http://www.springframework.org/schema/beans
 http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
 http://www.mulesource.org/schema/mule/vm/2.2
 http://www.mulesource.org/schema/mule/vm/2.2/mule-vm.xsd
 http://www.mulesource.org/schema/mule/cxf/2.2
 http://www.mulesource.org/schema/mule/cxf/2.2/mule-cxf.xsd
http://www.mulesource.org/schema/mule/stdio/2.2
 http://www.mulesource.org/schema/mule/stdio/2.2/mule-stdio.xsd">

 <spring:beans>
      <spring:import resource="ws-basicExample.xml"/>
 </spring:beans>

 <model name="wsBasicExampleModel">
      <service name="wsBasicExampleService">
          <inbound>
              <cxf:inbound-endpoint address="http://localhost:8282/services/basicExampleServices"/>
           </inbound>
           <component>
              <spring-object bean="basicExampleService"/>
           </component>
       </service>
   </model>
</mule>

Checks

  • Run the Mule, pointing your config file.
  • In your favorite webbrowser, open the URL:
    http://localhost:8282/services/basicExampleServices?wsdl
  • The webservice contract is expected to be displayed.

  • You can also execute a runtime test:
    public class WSBasicExampleServicesRuntimeTest {
    
     private BasicExampleServices basicExampleServices;
    
     @Before
       public void setup() {
         JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
         factory.getInInterceptors().add(new LoggingInInterceptor());
         factory.getOutInterceptors().add(new LoggingOutInterceptor());
         factory.setServiceClass(BasicExampleServices.class);
         factory.setAddress("http://localhost:8282/services/basicExampleServices");
         basicExampleServices = (BasicExampleServices) factory.create();
       }
      
       @Test
       public void testGetInteger() {
         final Integer expectedAnswer = 12345;
         final Integer actualAnswer;
         final Integer param = 912354;
        
         actualAnswer = basicExampleServices.getInteger(param);
        
         assertNotNull(actualAnswer);
         assertEquals(expectedAnswer, actualAnswer);
       }
    
    }

PostHeaderIcon This RJVM has already been shutdown

Error

Could not connect to remote service [ejb.services.myEjb]; nested exception is java.rmi.ConnectException: This RJVM has already been shutdown 4967659282374941940S:myServer:[7404,7404,-1,-1,-1,-1,-1]:myDomain:myEjbInstance

Explanation

Your EJB instance tries to lookup for a remote instance which seems to be shutdown. There may be many causes: IP / hostname resolution failed, remote servers are actually unreachables (such in the case of network issues), etc. Another potential issue may come from a bug in cluster management by WebLogic. Such a bug was identified and fixed by BEA with version 8 release ; yet, the bug may have kept on occuring on later version (9.2 in my case).
In my current case, the issue was that webservices, theorically deployed in the same WebLogic, were not started. Once the web services started, the issue vanished.