Could not initialize class org.apache.axis.client.AxisClient

kunti pawar June 18, 2018

I am getting below error 

java.lang.NoClassDefFoundError: Could not initialize class org.apache.axis.client.AxisClient at org.apache.axis.client.Service.getAxisClient(Service.java:104) at org.apache.axis.client.Service.<init>(Service.java:113) at com.polarion.alm.ws.client.tracker.TrackerWebServiceServiceLocator.<init>(TrackerWebServiceServiceLocator.java:16) at com.polarion.alm.ws.client.WebServiceFactory.<init>(WebServiceFactory.java:87) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source)

-----------------------------------------------------------------------------

MY CODE : -

import com.polarion.alm.ws.client.WebServiceFactory;
import com.polarion.alm.ws.client.session.SessionWebService;
import com.polarion.alm.ws.client.tracker.TrackerWebService;
import com.polarion.alm.ws.client.types.tracker.WorkItem;
import org.apache.axis.client.AxisClient
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

 

def myLog = LoggerFactory.getLogger("com.onresolve.jira.groovy")
myLog.info("Hello kunti from Jira")
try {
WebServiceFactory factory;
TrackerWebService trackerService;
SessionWebService sessionService;

factory = new WebServiceFactory("http://inchnsirplmvma1.india.tcs.com:7002/polarion/ws/services/");

sessionService = factory.getSessionService();
sessionService.logIn("admin", "admin");
myLog.info(("Login Started.... "));
trackerService = factory.getTrackerService();
String query = "project.id:" + "Kunti";
//query = "project.id:Kunti AND NOT HAS_VALUE:resolution AND id:KUNT-461";
query = "project.id:APTIV AND NOT HAS_VALUE:resolution AND id:APTIV-1215";

String sort = "id";
//String[] fields = {"id", "title", "status","linkedWorkItems"};
String[] fields = ["id", "title", "status","customFields"];
WorkItem[] workItems = trackerService.queryWorkItems(query, sort, fields);
WorkItem ws1 = null;

if (workItems.length != 1) {
myLog.info(("XYZ3 "+sessionService));
}
ws1 = workItems[0];

myLog.info("<p>work item: " + ws1.getId() + " " + ws1.getTitle());
myLog.info("<p>work item: " +ws1.getStatus().getId()+" "+ws1.getCustomFields());
} catch (Exception e) {
e.printStackTrace();
}

2 answers

0 votes
Gonchik Tsymzhitov
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 18, 2018

Well. let's check step by step.

 

Are you using axis2 or just axis? 

If you use axis, let's try wrap into plugin. 

I am using in my plugin with compile scope. 

Because axis in WEB-INF/lib needs to be restarted after uploading library. Therefore I am using like this 

<!--  dependencies for Axis used in SF SOAP Integration  -->
<dependency>
<groupId>axis</groupId>
<artifactId>axis</artifactId>
<version>1.4</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>axis</groupId>
<artifactId>axis-wsdl4j</artifactId>
<version>1.5.1</version>
<scope>compile</scope>
</dependency>

 

Summary: try to restart instance or wrap your code into own plugin.

Hope it helps. 

 

Cheers,

Gonchik Tsymzhitov

0 votes
Gonchik Tsymzhitov
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 18, 2018
kunti pawar June 18, 2018

Yes I have tried as last comment then also I am getting same error

Suggest an answer

Log in or Sign up to answer