Servlet engine is Resin 2.12. Client code from console version:
public class Translate {
public static void main(String args[]) throws Exception {
try {
TranslationServiceSoapStub service
= new TranslationServiceSoapStub(
new
URL("http://www.webservicex.com/TranslateService.asmx"),
new org.apache.axis.client.Service());
System.out.println(service.translate(new
Language(args[0]), args[1]));
} catch (Exception e) {
e.printStackTrace();
}
} // main
}
Client code from Servlet:
public void doPost(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {
response.setContentType(CONTENT_TYPE);
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<head><title></title></head>");
out.println("<body>");
try {
TranslationServiceSoapStub service
= new TranslationServiceSoapStub(
new
URL("http://www.webservicex.com/TranslateService.asmx"),
new org.apache.axis.client.Service());
String value = service.translate(new Language(mode),
source);
out.println(value);
cat.debug("Result: "+value);
} catch (Exception e) {
e.printStackTrace();
}
out.println("</body></html>");
}
And what I get is this:
java.lang.NoClassDefFoundError
com.myclient.soap.TranslateServlet.doPost(TranslateServlet.java:50)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:165)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:103)
at
com.caucho.server.http.FilterChainServlet.doFilter(FilterChainServlet.java:96)
at
com.caucho.server.http.Invocation.service(Invocation.java:315)
at
com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:135)
at
com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:246)
at
com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:164)
at com.caucho.server.TcpConnection.run(TcpConnection.java:139)
at java.lang.Thread.run(Thread.java:534)
I know its failing at this call:
new org.apache.axis.client.Service();
Because when I explicitly bring it out like this:
org.apache.axis.client.Service srv = new
org.apache.axis.client.Service();
I start getting this :
java.lang.NoClassDefFoundError
at
org.apache.axis.client.Service.getAxisClient(Service.java:143)
at org.apache.axis.client.Service.<init>(Service.java:152)
All the right libraries are in the lib dir and it builds ok. Has
anyone seen this before please? Thanks in advance...