• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Tomcat 5.0.19 (How can i run servlet in client host)

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I have installed apache tomcat 5.0.19 in
windows XP.Iam able to start and run servlet
code in my machine.
http://1.0.0.127/servlet/Hello
But what should i do to run the same
code in the client systems present.
I want to run the same code from my
other client machines...Please do help
me..Should i have to just give the same
"http://1.0.0.127/servlet/Hello" in my
client machine..
It is urgent!!!
Regards
Madhan
 
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Madhan Kumar:
Iam able to start and run servlet
code in my machine.
http://1.0.0.127/servlet/Hello


I think you got some misunderstanding here... Instead of the IP 1.0.0.127, I think u type 127.0.0.1 and it's ok to run your servlet... localhost is the same as 127.0.0.1 on the same machine...


But what should i do to run the same
code in the client systems present.
I want to run the same code from my
other client machines...Please do help
me..Should i have to just give the same
"http://1.0.0.127/servlet/Hello" in my
client machine..


If you want to run from other machines, u have to know the IP address of the machine that is running tomcat... Using the IP address of that machine, you can acccess your servlet from other machines as well.... You can check the server machine IP address by typing "ipconfig" command in console...
Hope it helps...
 
Madhan Kumar
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank u. It works. Now i have a big problem.
I got t expain to u in detail.I have installed
tomcat 5.0.19 in windows xp.
I have set the classpath as follows:
C:\Documents and Settings\madhan\My Documents\servlets
C:\Tomcat\jakarta-tomcat-5.0.19\common\lib\servlet-api.jar
C:\Tomcat\jakarta-tomcat-5.0.19\common\lib\jsp-api.jar
catalina_home=c:\tomcat\jakarta-tomcat
path = c:\j2sdk1.4.2_04\bin;c:\tomcat\jakarta-tomcat\bin;%path%
Java_home=c:\j2sdk1.4.2_04
Iam able to run a simple servlet in "http://localhost:8080/servlet/Hello"
I have used "bridge2java" software to convert a
Visual Basic dll(trimSDK.dll) to a java dll
(bridge2java.dll)which contains the converted
java classes(COM objects).
Now i have these java classes(COM objects)
in c:\IBM\bridge2java
I can run a code using some classes
from it in c:\IBM\bridge2java
and it works fine.
c:\IBM\bridge2java\javac trim.java
c:\IBM\bridge2java\java trim
But when i include it in servlet it doesnt
run and i get an error like this:
Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Cannot allocate servlet instance for path /servlet/trim
org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:435)
org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:180)
javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

root cause
java.lang.NoClassDefFoundError: trimIBM/IDatabase
java.lang.Class.getDeclaredConstructors0(Native Method)
java.lang.Class.privateGetDeclaredConstructors(Class.java:1610)
java.lang.Class.getConstructor0(Class.java:1922)
java.lang.Class.newInstance0(Class.java:278)
java.lang.Class.newInstance(Class.java:261)
org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:416)
org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:180)
javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
The code i used is:
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.swing.*;
import trimIBM.*;
/** Simple servlet used to test server.
* <P>
* Taken from Core Servlets and JavaServer Pages 2nd Edition
* from Prentice Hall and Sun Microsystems Press,
* http://www.coreservlets.com/.
* © 2003 Marty Hall; may be freely used or adapted.
*/
public class trim extends HttpServlet {
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
com.ibm.bridge2java.OleEnvironment.Initialize();
IDatabase d = (IDatabase) new Database();
d.set_Id("11");
response.setContentType("text/html");
PrintWriter out = response.getWriter();
String docType =
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 " +
"Transitional//EN\">\n";
out.println(docType +
"<HTML>\n" +
"<HEAD><TITLE>"+d.get_Name()+"</TITLE></HEAD>\n" +
"<BODY BGCOLOR=\"#FDF5E6\">\n" +
"<H1>"+d.get_Name()+"</H1>\n" +
"</BODY></HTML>");
}
}

please do reply me with the solution of how to
use COM objects in tom cat servlet...
Regards
Madhan
 
Ko Ko Naing
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First of all, I would like to point you the basic error that you made in specifying the CATALINA_HOME...
Instead of
catalina_home=c:\tomcat\jakarta-tomcat
it should be
catalina_home=C:\Tomcat\jakarta-tomcat-5.0.19
AND
Instead of
path = c:\j2sdk1.4.2_04\bin;c:\tomcat\jakarta-tomcat\bin;%path%
it should be
path = c:\j2sdk1.4.2_04\bin;c:\tomcat\jakarta-tomcat-5.0.19\bin;%path%
What I mean is that you have to know the actual directory of the tomcat installation point... If not, your web app won't work properly...
Try to adjust the things that I mentioned above and try your stuff... I hope it might be helpful....
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You may be getting tangled up in "invoker" servlet problems if you are using URL that look like "http://localhost:8080/servlet/Hello"
See the Javaranch invoker servlet FAQ.
You should never try to do anything complicated with servlets that depends on the invoker being present.
Bill
 
reply
    Bookmark Topic Watch Topic
  • New Topic