Search code examples
javaapache-axis

Axis2 PhaseException ServiceClient.engageModule()


Hi i am facing an issue with modules in Axis2 1.6.2. As per the axis documentation, I have created a module.xml, also i have updated the phase in axis2.xml.

Now when i try to engage a module using

ServiceClient.enageModule().

I get a PhaseException as follows

org.apache.axis2.phaseresolver.PhaseException: Did not find the desired phase 'myPhase' while deploying handler 'MyInFlowHandler'.

I think the configuration (xml) is just fine as needed...i even tried keeping the.mar file in lib folder and included in the build path.

I have searched and all point to something missing in xml axis2.xml or services.xml or module.xml may cause this exception, i have checked and all the files are fine.

Also when i do this:

Map<String, AxisModule> modules = serviceClient.getAxisConfiguration().getModules();

the map(modules) is not empty and contains my module that needs to be engaged.

Other thing that i should mention is that i am creating a new MessageContext and somehow m MessageContext.getCurrentMessageContext() returns null.

I want to find out if the improper xml declaration is the only reason for this PhaseException or is there any other reason to it that I may be neglecting.

I hope i was clear as i am sorry cannot provide any more details(code and all).


Solution

  • This was solved... Apparently the issue was no ServiceContext/ ConfigurationContext was found for the ServiceClient to load all the modules(mar's).

    Creating a ServiceClient with a new custom ConfigurationContext did the trick.

    ConfigurationContext CTX = new ConfigurationContext("path to axis2 repo","path to axis2.XML");
    
    ServiceClient sender=new ServiceClient(CTX, null);