CA Gen Web Service Wizard web service deployed to Tomcat/Axis gives "Could not find class for the service" with java.lang.ClassNotFoundException

book

Article ID: 200545

calendar_today

Updated On:

Products

CA Gen CA Gen - Workstation Toolset

Issue/Introduction

Apache Tomcat 9.0.38 with Apache Axis 1.4 under Windows.
Using the CA Gen 8.6 Workstation Toolset Web Service Wizard, successfully created web service ws1 with deployment jar file ws1.jar which has been copied to the directory "C:\apache-tomcat-9.0.38\webapps\axis\WEB-INF\lib"
The service has been made available to axis by running the command: java org.apache.axis.client.AdminClient ws1Deploy.wsdd
That step updated the file "C:\apache-tomcat-9.0.38\webapps\axis\WEB-INF\server-config.wsdd"

On the Tomcat axis page ("http://localhost:8080/axis") use the List link ("http://localhost:8080/axis/servlet/AxisServlet") and this error is shown:

===
And now... Some Services
AXIS error
Sorry, something seems to have gone wrong... here are the details:

Fault - Could not find class for the service named: ws1
Hint: you may need to copy your class files/tree into the right location (which depends on the servlet system you are using).; nested exception is: 
 java.lang.ClassNotFoundException: ws1

AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.generalException
 faultSubcode: 
 faultString: Could not find class for the service named: ws1
Hint: you may need to copy your class files/tree into the right location (which depends on the servlet system you are using).; nested exception is: 
 java.lang.ClassNotFoundException: ws1
 faultActor: 
 faultNode: 
 faultDetail: 
 {http://xml.apache.org/axis/}hostname:lvntest004434
===

Cause

The files in ws1.jar have not yet been properly deployed by axis and per the Axis 1.x documentation that requires the restart of Tomcat or the axis webapp:
https://axis.apache.org/axis/java/install.html#Step_5:_Installing_new_Web_Services
i.e. 

Step 5: Installing new Web Services

So far you have got Axis installed and working--now it is time to add your own Web Service.

The process here boils down to (1) get the classes and libraries of your new service into the Axis WAR directory tree, and (2) tell the AxisEngine about the new file. The latter is done by submitting an XML deployment descriptor to the service via the Admin web service, which is usually done with the AdminClient program or the <axis-admin> Ant task. Both of these do the same thing: they run the Axis SOAP client to talk to the Axis administration service, which is a SOAP service in its own right. It's also a special SOAP service in one regard--it is restricted to local callers only (not remote access) and is password protected to stop random people from administrating your service. There is a default password that the client knows; if you change it then you need to pass the new password to the client.

The first step is to add your code to the server.

In the WEB-INF directory, look for (or create) a "classes" directory (i.e. axis/WEB-INF/classes ). In this directory, copy the compiled Java classes you wish to install, being careful to preserve the directory structure of the Java packages.

If your classes services are already packaged into JAR files, feel free to drop them into the WEB-INF/lib directory instead. Also add any third party libraries you depend on into the same directory.

After adding new classes or libraries to the Axis webapp, you must restart the webapp. This can be done by restarting your application server, or by using a server-specific mechanism to restart a specific webapp.

Note: If your web service uses the simple authorization handlers provided with xml-axis (this is actually not recommended as these are merely illustrations of how to write a handler than intended for production use), then you will need to copy the corresponding users.lst file into the WEB-INF directory.

Resolution

Go to the Tomcat "Manager App" page (e.g. http://localhost:8080/manager/html) and Reload the axis webapp to resolve the problem.

Additional Information

CA Gen 8.6 > Developing > Designing > Using the Web Service Wizard