Category Archives: axis2

Trying to Build Axis2 tar.gz with Maven

I'm new to S/O posting, and even newer to building Maven project in OSX. So here's my problem. I've downloaded the Apache Axis2 bin and tar.gz files. Normally, the bin would be enough and is easy enough to deploy, but there are added samples and packages I'll need to utilize in the unbuilt version. I've been trying to build with Maven for a couple days now, and I keep running into the same errors... I'll post my error log for everyone to see. Any help would be greatly appreciated!!!

[INFO] 
[INFO] --- maven-jar-plugin:2.2:jar (default-jar) @ axis2-kernel ---
[INFO] Building jar: /Users/USER/axis2/modules/kernel/target/axis2-kernel-1.7.7.jar
[INFO] 
[INFO] --- maven-source-plugin:2.4:jar-no-fork (source-jars) @ axis2-kernel ---
[INFO] Building jar: /Users/USER/axis2/modules/kernel/target/axis2-kernel-1.7.7-sources.jar
[INFO] 
[INFO] --- maven-site-plugin:3.6:attach-descriptor (attach-descriptor) @ axis2-kernel ---
[INFO] Skipping because packaging 'jar' is not pom.
[INFO] 
[INFO] --- animal-sniffer-maven-plugin:1.14:check (check) @ axis2-kernel ---
[INFO] Checking unresolved references to org.codehaus.mojo.signature:java15:1.0
[INFO] 
[INFO] --- maven-install-plugin:2.2:install (default-install) @ axis2-kernel ---
[INFO] Installing /Users/USER/axis2/modules/kernel/target/axis2-kernel-1.7.7.jar to /var/root/.m2/repository/org/apache/axis2/axis2-kernel/1.7.7/axis2-kernel-1.7.7.jar
[INFO] Installing /Users/USER/axis2/modules/kernel/pom.xml to /var/root/.m2/repository/org/apache/axis2/axis2-kernel/1.7.7/axis2-kernel-1.7.7.pom
[INFO] Installing /Users/USER/axis2/modules/kernel/target/axis2-kernel-1.7.7-sources.jar to /var/root/.m2/repository/org/apache/axis2/axis2-kernel/1.7.7/axis2-kernel-1.7.7-sources.jar
[INFO] 
[INFO] ---------------------< org.apache.axis2:axis2-adb >---------------------
[INFO] Building Apache Axis2 - Data Binding 1.7.7                        [4/73]
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:3.0.0:clean (default-clean) @ axis2-adb ---
[INFO] Deleting /Users/USER/axis2/modules/adb/target
[INFO] 
[INFO] --- maven-enforcer-plugin:1.1:enforce (default) @ axis2-adb ---
[INFO] 
[INFO] --- gmavenplus-plugin:1.5:execute (create-tmp-directory) @ axis2-adb ---
[INFO] Using Groovy 2.4.4 to perform execute.
[INFO] 
[INFO] --- maven-remote-resources-plugin:1.5:process (process-resource-bundles) @ axis2-adb ---
[INFO] 
[INFO] --- maven-remote-resources-plugin:1.5:process (default) @ axis2-adb ---
[INFO] 
[INFO] --- maven-resources-plugin:2.4.2:resources (default-resources) @ axis2-adb ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/USER/axis2/modules/adb/conf
[INFO] Copying 2 resources
[INFO] Copying 3 resources
[INFO] Copying 3 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.5.1:compile (default-compile) @ axis2-adb ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 169 source files to /Users/USER/axis2/modules/adb/target/classes
[INFO] /Users/USER/axis2/modules/adb/src/org/apache/axis2/rpc/receivers/RPCMessageReceiver.java: Some input files use or override a deprecated API.
[INFO] /Users/USER/axis2/modules/adb/src/org/apache/axis2/rpc/receivers/RPCMessageReceiver.java: Recompile with -Xlint:deprecation for details.
[INFO] /Users/USER/axis2/modules/adb/src/org/apache/axis2/databinding/types/soapencoding/Array.java: Some input files use unchecked or unsafe operations.
[INFO] /Users/USER/axis2/modules/adb/src/org/apache/axis2/databinding/types/soapencoding/Array.java: Recompile with -Xlint:unchecked for details.
[INFO] 
[INFO] --- maven-clean-plugin:3.0.0:clean (clean-testXjcStaleFlag) @ axis2-adb ---
[INFO] 
[INFO] --- maven-resources-plugin:2.4.2:testResources (default-testResources) @ axis2-adb ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/USER/axis2/modules/adb/src/test/resources
[INFO] Copying 3 resources
[INFO] Copying 3 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.5.1:testCompile (default-testCompile) @ axis2-adb ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 14 source files to /Users/USER/axis2/modules/adb/target/test-classes
[INFO] /Users/USER/axis2/modules/adb/test/org/apache/axis2/databinding/utils/reader/ADBXMLStreamReaderTest.java: /Users/USER/axis2/modules/adb/test/org/apache/axis2/databinding/utils/reader/ADBXMLStreamReaderTest.java uses or overrides a deprecated API.
[INFO] /Users/USER/axis2/modules/adb/test/org/apache/axis2/databinding/utils/reader/ADBXMLStreamReaderTest.java: Recompile with -Xlint:deprecation for details.
[INFO] /Users/USER/axis2/modules/adb/test/org/apache/axis2/databinding/utils/reader/ADBXMLStreamReaderTest.java: Some input files use unchecked or unsafe operations.
[INFO] /Users/USER/axis2/modules/adb/test/org/apache/axis2/databinding/utils/reader/ADBXMLStreamReaderTest.java: Recompile with -Xlint:unchecked for details.
[INFO] 
[INFO] --- maven-surefire-plugin:2.13:test (default-test) @ axis2-adb ---
[INFO] Surefire report directory: /Users/USER/axis2/modules/adb/target/surefire-reports

-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running org.apache.axis2.databinding.types.soapencoding.ArrayTest
Tests run: 6, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.349 sec
Running org.apache.axis2.databinding.types.xsd.ArrayTest
Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.01 sec
Running org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderTest
Tests run: 22, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.125 sec
Running org.apache.axis2.databinding.utils.SimpleElementReaderStateMachineTest
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.003 sec
Running org.apache.axis2.databinding.utils.ConverterUtilTest
Tests run: 12, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.049 sec <<< FAILURE!
testConvertToDateTime(org.apache.axis2.databinding.utils.ConverterUtilTest)  Time elapsed: 0.021 sec  <<< FAILURE!
junit.framework.ComparisonFailure: expected:<2007-02-15T1[4]:54:29> but was:<2007-02-15T1[3]:54:29>
    at junit.framework.Assert.assertEquals(Assert.java:100)
    at junit.framework.Assert.assertEquals(Assert.java:107)
    at junit.framework.TestCase.assertEquals(TestCase.java:269)
    at org.apache.axis2.databinding.utils.ConverterUtilTest.internalTestConvertToDateTime(ConverterUtilTest.java:385)
    at org.apache.axis2.databinding.utils.ConverterUtilTest.testConvertToDateTime(ConverterUtilTest.java:165)

Running org.apache.axis2.databinding.utils.BeanUtilTest
Tests run: 18, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.077 sec
Running org.apache.axis2.databinding.utils.SimpleArrayReaderStateMachineTest
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 sec
Running org.apache.axis2.databinding.utils.MultirefHelperTest
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.017 sec
Running org.apache.axis2.databinding.utils.NamedStaxOMBuilderTest
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 sec

Results :

Failed tests: 
ConverterUtilTest.testConvertToDateTime:165->internalTestConvertToDateTime:385 expected:<2007-02-15T1[4]:54:29> but was:<2007-02-15T1[3]:54:29>

Tests run: 76, Failures: 1, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] Apache Axis2 - Root 1.7.7 .......................... SUCCESS [  2.176 s]
[INFO] Apache Axis2 - Resource bundle ..................... SUCCESS [  0.765 s]
[INFO] Apache Axis2 - Kernel .............................. SUCCESS [  9.694 s]
[INFO] Apache Axis2 - Data Binding ........................ FAILURE [  2.802 s]
[INFO] Apache Axis2 - Transport - Local ................... SKIPPED
[INFO] Apache Axis2 - Addressing .......................... SKIPPED
[INFO] Apache Axis2 - Transport - Base .................... SKIPPED
[INFO] Apache Axis2 - Transport - testkit ................. SKIPPED
[INFO] Apache Axis2 - Transport - HTTP .................... SKIPPED
[INFO] Apache Axis2 - Code Generation ..................... SKIPPED
[INFO] Apache Axis2 - ADB Codegen ......................... SKIPPED
[INFO] Apache Axis2 - Clustering .......................... SKIPPED
[INFO] Apache Axis2 - SAAJ ................................ SKIPPED
[INFO] Apache Axis2 - Ping ................................ SKIPPED
[INFO] Apache Axis2 - MEX ................................. SKIPPED
[INFO] axis2-repo-maven-plugin ............................ SKIPPED
[INFO] Apache Axis2 - Metadata ............................ SKIPPED
[INFO] Apache Axis2 - CORBA ............................... SKIPPED
[INFO] Apache Axis2 - Java2WSDL ........................... SKIPPED
[INFO] Apache Axis2 - Fast Infoset ........................ SKIPPED
[INFO] Apache Axis2 - Test Utilities ...................... SKIPPED
[INFO] Apache Axis2 - JAXB-RI Data Binding ................ SKIPPED
[INFO] Apache Axis2 - JAXWS ............................... SKIPPED
[INFO] Apache Axis2 - JAXWS (mar) ......................... SKIPPED
[INFO] Apache Axis2 - JiBX Data Binding ................... SKIPPED
[INFO] Apache Axis2 - JSON ................................ SKIPPED
[INFO] Apache Axis2 - MTOM Policy ......................... SKIPPED
[INFO] Apache Axis2 - MTOM Policy module .................. SKIPPED
[INFO] Apache Axis2 - OSGi Integration .................... SKIPPED
[INFO] Apache Axis2 - Scripting ........................... SKIPPED
[INFO] Apache Axis2 - SOAP Monitor Servlet ................ SKIPPED
[INFO] Apache Axis2 - SOAP Monitor Module ................. SKIPPED
[INFO] Apache Axis2 - spring .............................. SKIPPED
[INFO] Apache Axis2 - XMLBeans Data Binding ............... SKIPPED
[INFO] Apache Axis2 - Version Service ..................... SKIPPED
[INFO] Apache Axis2 - Transport - JMS ..................... SKIPPED
[INFO] Apache Axis2 - Transport - Mail .................... SKIPPED
[INFO] Apache Axis2 - Transport - TCP ..................... SKIPPED
[INFO] Apache Axis2 - Transport - UDP ..................... SKIPPED
[INFO] Apache Axis2 - Transport - XMPP .................... SKIPPED
[INFO] Apache Axis2 - Web Application module .............. SKIPPED
[INFO] Apache Axis2 - tool - AAR Maven Plugin ............. SKIPPED
[INFO] Apache Axis2 - tool - Ant Plugin ................... SKIPPED
[INFO] Apache Axis2 - tool - Eclipse Codegen Plugin ....... SKIPPED
[INFO] Apache Axis2 - tool - Eclipse service Plugin ....... SKIPPED
[INFO] Apache Axis2 - tool - Intellij IDEA Plugin ......... SKIPPED
[INFO] Apache Axis2 - tool - Java2WSDL Maven Plugin ....... SKIPPED
[INFO] Apache Axis2 - tool - MAR Maven Plugin ............. SKIPPED
[INFO] Apache Axis2 - tool - WSDL2Code Maven Plugin ....... SKIPPED
[INFO] Apache Axis2 Simple HTTP server Maven Plugin ....... SKIPPED
[INFO] Javadoc ............................................ SKIPPED
[INFO] Apache Axis2 - ADB Tests ........................... SKIPPED
[INFO] Apache Axis2 - Integration ......................... SKIPPED
[INFO] Axis2 quickstart archetype ......................... SKIPPED
[INFO] Axis2 quickstart-web archetype ..................... SKIPPED
[INFO] Apache Axis2 - JAXWS Integration Tests ............. SKIPPED
[INFO] Apache Axis2 - OSGi Tests .......................... SKIPPED
[INFO] Apache Axis2 - Distribution ........................ SKIPPED
[INFO] Samples parent POM ................................. SKIPPED
[INFO] JAXWS - Starting from Java Example ................. SKIPPED
[INFO] JAXWS Addressbook Service .......................... SKIPPED
[INFO] JAXWS Calculator Service ........................... SKIPPED
[INFO] JAXWS Interop Sample ............................... SKIPPED
[INFO] JAXWS Samples - Echo, Ping, MTOM ................... SKIPPED
[INFO] Apache Axis2 -JAXWS Version Service ................ SKIPPED
[INFO] Apache Axis2 Transport-HTTPS sample ................ SKIPPED
[INFO] httpsService ....................................... SKIPPED
[INFO] httpsClient ........................................ SKIPPED
[INFO] Apache Axis2 Transport-JMS sample .................. SKIPPED
[INFO] jmsService ......................................... SKIPPED
[INFO] systests ........................................... SKIPPED
[INFO] echo ............................................... SKIPPED
[INFO] webapp-tests 1.7.7 ................................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 16.514 s
[INFO] Finished at: 2018-05-18T16:51:28-07:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.13:test (default-test) on project axis2-adb: There are test failures.
[ERROR] 
[ERROR] Please refer to /Users/USER/axis2/modules/adb/target/surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :axis2-adb

Axis 2 webService FaultString

I'm trying to implement a web-service for the first time. I've followed some tutorials; my problems occurs on the client side. I keep getting this error and I don't know what to do.

The ServiceClass object does not implement the required method in the following form: OMElement arrayEquipement(OMElement e)

This is how I'm trying to invoke it:

ImplementationStub.ArrayEquipement arryEquipement = new ImplementationStub.ArrayEquipement();

    try{
        ImplementationStub.ArrayEquipementResponse response = new ImplementationStub.ArrayEquipementResponse();
                response = stub.arrayEquipement(arryEquipement);
                tableau= response.get_return();
    }catch(Exception e){
        System.out.println(e.getMessage());
    }

wso2 DSS Value type miss match, Expected value type – ‘dateTime’, but found – ‘STRING’

I want to save this object in to database with wso2 dss. but it is showing there is an error in the date format.

Value type miss match, Expected value type - 'dateTime', but found - 'STRING'

example post messgae is this

{
"insert_subscribe_merchant_operation":
{
        "customerrefid": 1,
        "merchantrefid": "1",
        "datetime": "2012-03-14T00:00:00+05:30",
        "registereddevice":"1234567890",
        "latlongregistered": "xczv",
        "totalpoints":1000,
        "redeemablepoints":800,
        "expirydate": "2012-03-14T00:00:00+05:30",
        "qrcode": "xvc",
        "currentoffercount":10,
        "schemerefid":1
      }
}

but when i tried with the xml type it is working fine

<insert_subscribe_merchant_operation>
         <customerrefid>1</customerrefid>
         <merchantrefid>"1"</merchantrefid>
         <datetime>2012-03-14T00:00:00+05:30</datetime>
         <registereddevice>"1234567890"</registereddevice>
         <latlongregistered>"234"</latlongregistered>
         <totalpoints>876</totalpoints>
         <redeemablepoints>345</redeemablepoints>
         <expirydate>2012-03-14T00:00:00+05:30</expirydate>
         <qrcode>"?"</qrcode>
         <currentoffercount>20</currentoffercount>
         <schemerefid>1</schemerefid>
</insert_subscribe_merchant_operation>

Please help me !!!!

Axis2 versions per Tomcat

I am new to Axis2 and I like to know the supported Axis2 versions for :

  • Tomcat 6

  • Tomcat 7

  • Tomcat 8

If it's not too much to ask, I also want the source of the information.

Many Thanks.

EDIT : These are the known Axis2 versions :

  • 1.6.1
  • 1.6.2
  • 1.6.3
  • 1.6.4
  • 1.7.0
  • 1.7.1
  • 1.7.2
  • 1.7.3

Source : http://axis.apache.org/axis2/java/core/release-notes/1.6.1.html

What I need to know, which of these versions is for Tomcat 6, Tomcat 7 and Tomcat 8.

axis2 vasa setup NullPointerException when called method mc.getProperty(HTTPConstants.CACHED_HTTP_CLIENT) while building

While running the vasa samplevp-client on ubuntu terminal by the command ant run-samplevp-server, on the terminal i am getting the null pointer exception when the control goes to the function call mc.getProperty(HTTPConstants.CACHED_HTTP_CLIENT); which is specified below.

public static void dropSSLConnections(VasaServiceStub stub) {
    try {
         System.out.println("oc:"+oc);
         org.apache.axis2.context.OperationContext oc = stub
              ._getServiceClient().getLastOperationContext();

         org.apache.axis2.context.MessageContext mc = oc
              .getMessageContext(org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE);

         org.apache.commons.httpclient.HttpClient client = (org.apache.commons.httpclient.HttpClient) mc
              .getProperty(HTTPConstants.CACHED_HTTP_CLIENT);
         client.getHttpConnectionManager().closeIdleConnections(0);
         System.out.println("Dropped SSL connections. Wait 3 seconds for samplevp to settle");
         Thread.sleep(3000);   
         System.out.println("Continuing...");
    } catch (java.lang.Exception ev) {
        System.out.println("Could not drop SSL connections : "  + ev);
    }
}

I tried finding whether the CACHED_HTTP_CLIENT is set or not. But it didn't worked for me.enter image description here

Apache Rampart Config Files Difference Between Client and Server

I have been evaluating Apache Axis with Apache Rampart. From my understanding thus far, as apart of the deployment of Apache Rampart there are config files which need to be deployed on both the server and client which indicate what security mechanisms must be applied to the soap message. What would happen in the event that the client policy xml file does not agree with the server policy xml file, for example, the server expects to receive an encrypted soap message, but instead receives a unencrypted one. Would this message then be rejected by Apache Rampart on the server as it doesn't conform to the server side policy file?

From what I have read WS-Policy is a part of or can be made part of the Apache Rampart installation. Can the policy be set up in such a way that such messages are rejected?

Thanks in advance.

The http://localhost:8080/axis2 link does not work

Hello fellow programmers,

I have to get axis2 (version 1.7.2) working in Tomcat (version 8.0.33) but here I encounter a annoying problem. I have followed the steps in the tutorial (from the axis.apache website) until the point of checking the link mentioned in the topic title. I have downloaded the Axis2.war file and placed it in the webapps folder in the tomcat home directory (/opt/tomcat).

When I start tomcat using the startup.sh file and visit the homepage it all seems to work. visiting the link http://localhost:8080/ will show me the text:

It works ! If you're seeing this page via a web browser, it means you've setup Tomcat successfully. Congratulations! etc etc

But then when I visit http://localhost:8080/axis2 I get:

HTTP Status 404 - /axis2 type Status report message /axis2 description The requested resource is not available. Apache Tomcat/8.0.28 (Ubuntu)

When I run the .startup file and at the same time look at my webapps folder I see that the .war folder is extracted and makes the axis2 folder appear, thus it works until there at least.

Does someone has an idea of what could be wrong here?

PS: I am using Ubuntu.

run the startUp method at the deploy a web service

I try to execute the startUp method when i deploy my web services, but doesn`t work.

I'm using:

windows 7

tomcat 8.0.30

axis2 1.7.0

I've tryed to deploy my service as a pojo service also i try generating the *.aar and placing it in:

apache-tomcat-8.0.30\webapps\axis2\WEB-INF\services but when i run the tomcat, and deploy this and other services, the startUp method dont launch. this is my code:

import java.io.*;
import java.util.*;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.description.AxisService;
import org.apache.axis2.engine.ServiceLifeCycle;

public class Login implements ServiceLifeCycle{

    static String IPprop = "";
    static String rutaDB = "C:/resources/users_DB.txt";
    static String rutaUddiXml = "C:/resources/uddi.xml";
    static String rutaIP = "C:/resources/ip.txt";
    static boolean registrado=false;
    static String comp ="";

    public static void main(String[] args) {

        IP();
        String nombreServicio = "Login";
        String rutaServicio = "http://"+ IPprop +":8080/axis2/services/Login";
        SimplePublishPortable spp = new SimplePublishPortable(rutaUddiXml);
        spp.publish(nombreServicio, rutaServicio);
        System.out.println("te registraste");
    }

    public static void createUser(String user, String pass) {
        interacFich("crea", user, pass);
    }

    public static String loginAccess(String user, String pass) {
        return interacFich("login", user, pass);
    }

    public static String runComprobation(){
        return "deployed service" + comp;
    } 

    public static String regComprobation(){
        if(registrado==true){
            return "registered";
        }
        else{
            return "failed";
        }
    }

    private static String getToken() {
        String cadenaAleatoria = "";

        int i = 0;
        while (i < 10) {
            char c = (char) ((int) (Math.random() * 255 + 1));
            if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z')) {
                cadenaAleatoria += c;
                i++;
            }
        }
        return cadenaAleatoria;
    }

    private static String interacFich(String accion, String user, String pass) {
        String usuario = "";
        LinkedHashMap<String, String> usuarios = new LinkedHashMap<String, String>();

        File archivo = new File(rutaDB);

        // leer fichero y meterlo en el mapa
        if (archivo.exists() == false) {
            try {
                archivo.createNewFile();
            } catch (IOException e) {
                e.printStackTrace();
            }
        } else {
            try (BufferedReader br = new BufferedReader(new FileReader(archivo))) {
                while (br.ready()) {
                    usuario = br.readLine();
                    String[] param = usuario.split("\\*");
                    usuarios.put(param[0], param[1]);

                }
                br.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        switch (accion) {
        case "crea":
            usuarios.put(user + "-" + pass, getToken());

            try (BufferedWriter bw = new BufferedWriter(new FileWriter(archivo))) {
                Set<String> keysUsuarios = usuarios.keySet();
                for (String k : keysUsuarios) {
                    bw.write(k + "*" + usuarios.get(k).toString());
                    bw.write("\n");

                }
                System.out.println("todo escrito");
                bw.close();

                return "el fichero se crea";
            } catch (IOException e) {
                e.printStackTrace();
            }
            break;
        case "login":
            if (usuarios.containsKey(user + "-" + pass)) {
                return usuarios.get(user + "-" + pass);
            }
            return "User o pass erroneos";
        default:
            break;

        }

        return null;
    }

    private static void IP() {
        File archivo = new File(rutaIP);
        try (BufferedReader br = new BufferedReader(new FileReader(archivo))) {
            br.readLine();
            IPprop = br.readLine();


    br.close();
    } catch (IOException e) {
        e.printStackTrace();
    }

    return;

}
@Override
public void startUp(ConfigurationContext arg0, AxisService arg1) {
    ///////////////
    //registrarse//
    ///////////////
    comp="entramos";
    IP();
    String nombreServicio = "Login";
    String rutaServicio = "http://"+ IPprop +":8080/axis2/services/Login";
    SimplePublishPortable spp = new SimplePublishPortable(rutaUddiXml);
    spp.publish(nombreServicio, rutaServicio);
    registrado=true;
}

@Override
public void shutDown(ConfigurationContext arg0, AxisService arg1) {
    // TODO Auto-generated method stub

}

}

run the startUp method at the deploy a web service

I try to execute the startUp method when i deploy my web services, but doesn`t work.

I'm using:

windows 7

tomcat 8.0.30

axis2 1.7.0

I've tryed to deploy my service as a pojo service also i try generating the *.aar and placing it in:

apache-tomcat-8.0.30\webapps\axis2\WEB-INF\services but when i run the tomcat, and deploy this and other services, the startUp method dont launch. this is my code:

import java.io.*;
import java.util.*;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.description.AxisService;
import org.apache.axis2.engine.ServiceLifeCycle;

public class Login implements ServiceLifeCycle{

    static String IPprop = "";
    static String rutaDB = "C:/resources/users_DB.txt";
    static String rutaUddiXml = "C:/resources/uddi.xml";
    static String rutaIP = "C:/resources/ip.txt";
    static boolean registrado=false;
    static String comp ="";

    public static void main(String[] args) {

        IP();
        String nombreServicio = "Login";
        String rutaServicio = "http://"+ IPprop +":8080/axis2/services/Login";
        SimplePublishPortable spp = new SimplePublishPortable(rutaUddiXml);
        spp.publish(nombreServicio, rutaServicio);
        System.out.println("te registraste");
    }

    public static void createUser(String user, String pass) {
        interacFich("crea", user, pass);
    }

    public static String loginAccess(String user, String pass) {
        return interacFich("login", user, pass);
    }

    public static String runComprobation(){
        return "deployed service" + comp;
    } 

    public static String regComprobation(){
        if(registrado==true){
            return "registered";
        }
        else{
            return "failed";
        }
    }

    private static String getToken() {
        String cadenaAleatoria = "";

        int i = 0;
        while (i < 10) {
            char c = (char) ((int) (Math.random() * 255 + 1));
            if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z')) {
                cadenaAleatoria += c;
                i++;
            }
        }
        return cadenaAleatoria;
    }

    private static String interacFich(String accion, String user, String pass) {
        String usuario = "";
        LinkedHashMap<String, String> usuarios = new LinkedHashMap<String, String>();

        File archivo = new File(rutaDB);

        // leer fichero y meterlo en el mapa
        if (archivo.exists() == false) {
            try {
                archivo.createNewFile();
            } catch (IOException e) {
                e.printStackTrace();
            }
        } else {
            try (BufferedReader br = new BufferedReader(new FileReader(archivo))) {
                while (br.ready()) {
                    usuario = br.readLine();
                    String[] param = usuario.split("\\*");
                    usuarios.put(param[0], param[1]);

                }
                br.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        switch (accion) {
        case "crea":
            usuarios.put(user + "-" + pass, getToken());

            try (BufferedWriter bw = new BufferedWriter(new FileWriter(archivo))) {
                Set<String> keysUsuarios = usuarios.keySet();
                for (String k : keysUsuarios) {
                    bw.write(k + "*" + usuarios.get(k).toString());
                    bw.write("\n");

                }
                System.out.println("todo escrito");
                bw.close();

                return "el fichero se crea";
            } catch (IOException e) {
                e.printStackTrace();
            }
            break;
        case "login":
            if (usuarios.containsKey(user + "-" + pass)) {
                return usuarios.get(user + "-" + pass);
            }
            return "User o pass erroneos";
        default:
            break;

        }

        return null;
    }

    private static void IP() {
        File archivo = new File(rutaIP);
        try (BufferedReader br = new BufferedReader(new FileReader(archivo))) {
            br.readLine();
            IPprop = br.readLine();


    br.close();
    } catch (IOException e) {
        e.printStackTrace();
    }

    return;

}
@Override
public void startUp(ConfigurationContext arg0, AxisService arg1) {
    ///////////////
    //registrarse//
    ///////////////
    comp="entramos";
    IP();
    String nombreServicio = "Login";
    String rutaServicio = "http://"+ IPprop +":8080/axis2/services/Login";
    SimplePublishPortable spp = new SimplePublishPortable(rutaUddiXml);
    spp.publish(nombreServicio, rutaServicio);
    registrado=true;
}

@Override
public void shutDown(ConfigurationContext arg0, AxisService arg1) {
    // TODO Auto-generated method stub

}

}