GeeCON Prague 2014*
The moose likes Servlets and the fly likes How to set up JSDK2.1 server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "How to set up JSDK2.1 server" Watch "How to set up JSDK2.1 server" New topic
Author

How to set up JSDK2.1 server

mike nu
Ranch Hand

Joined: Mar 11, 2001
Posts: 63
Hi all,
I want to use jsdk2.1 server to test the servlet. I got confused on how to set it up. Can anyone tell me how to set properties in default.cfg file if I use Windows NT:
server.port=8080
server.inet=
server.docbase=webpages
server.tempdir=tmp
server.hostname=server.webapp.examples.mapping=/examples
server.webapp.examples.docbase=examples
Thanks a lot.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12792
    
    5
I am curious - why are you using WSDK 2.1 instead of Tomcat?
Bill
mike nu
Ranch Hand

Joined: Mar 11, 2001
Posts: 63
Hi Bill,
Why should I use TomCat, and not JSDK 2.1?
Mike
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12792
    
    5
As far as I know, Sun turned over all development of the "Reference" edition of servlets and JSP to the Apache organization and has not done anything with JSDK since.
The Tomcat implementation fully supports the current servlet API (2.2) and JSP API (1.1) in the 3.2 release and they are working on Tomcat 4.0 which supports the next versions of servlets and JSP.
What is the date on the JAR files for your JSDK?
mike nu
Ranch Hand

Joined: Mar 11, 2001
Posts: 63
Hi William,
Thank you for your reply.
Now I am turning to TomCat, but found that it's more difficult to setup.
I tried to startup the TomCat, and got a message said: You must JAVA_HOME to JDK installation. From the internet forum, I know that I should edit tomcat.bat file in /bin dir. But I can not find this file. I can not get more detail setup info either. Could you give me more info or tell me where I can get more setup info of TomCat?
Thanks a lot.
Mike
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040

Bill:
Nice to see that you could convience another person to
go the Tomcat way.
Now Mike, since you are on NT, goto the Settings->Control
Panel -> System ->Environment and define your
JAVA_HOME = C:\jsdk1.2.2 (or whatever where you installed JDK)
also define another variable,
TOMCAT_HOME=C:\tomcat (or whatever where you installed Tomcat).
Start a DOS window and goto the tomcat bin dir and type
startup
If it starts up correctly, then open a browser and type the
URL http://localhost:8080
You should see the Tomcat Home page with examples.
Let us know how you are doing.
regds.
- satya

Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
mike nu
Ranch Hand

Joined: Mar 11, 2001
Posts: 63
Hi Madhav,
Thank you very much.
I will try it on Monday, I use Windows NT at office, Windows 98 at home.
I tried to setup Tomcat on Windows 98. After I type startup under DOS, I got a message "Out of Environment Space".
Now I really hate Java path issues. I spent a whole try to figure this out. Path setting sometimes work, sometimes not. In order to use jsdk.jar to compile my servlet, I set the classpath to jsdk.jar, but it didn't work. Then I have to unjar rt.jar, then add jsdk.jar to javax folder, then jar a new rt.jar, then it works. Do you know why this could happen?
Which server I should use under Windows98? Tomcat or JSDK server?
Mike
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040

out of environment space....
okay on win98 open a dos window, goto the top bar,
press the right mouse button and bring up the
properties form. select the memory tab.
now you should see a "Initial environment"
drop down box. Select the highest avail say 40??.
then, set your java_home and tomcat_home and you
should be on your way.
good luck......again when you have a problem and can't
figure it out, take a deep breadth, bring up a browser
if you don't have one and then navigate your path to the
javaranch from your favourite book mark.
we are here to help.
regds.
- satya
mike nu
Ranch Hand

Joined: Mar 11, 2001
Posts: 63
Hi Madhav,
I really want to ask you WHO ARE YOU? You know what it works!!!
Why you know so much and I don't know!!!
I found it's too hard to say IT WORKS! But for you it should be CAN'T FOUND ANYTHING DOESN'T WORK.
Thank you so much.
Mike
mike nu
Ranch Hand

Joined: Mar 11, 2001
Posts: 63
Hi Madhav,
Sorry to bring you another question. My happiness didn't last long. Now I got another problem:
When I start the Tomcat by typing startup, there should be a new DOS window come up for Tomcat, but this window just flash, then disappeared. Too shy.
I also got some message, said Unable to set the classpath dynamically, .... using CLASSPATH: ....
What's the reason of this?
Thanks,
Mike
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040
Okay this has to do with your classpath huh!
lets work on it.
YOu are on win98 right?
Open a DOS window, and type this line:
set classpath=%classpath%;C:\jdk1.2.2\lib\tools.jar
Basically, you are adding tools.jar to the classpath. This file is available in the java_home\lib directory. Good luck. Keep me posted with what happens.
I really want to ask you WHO ARE YOU?
I am one of the Bar Tender on the javaranch and the moderator
of Java in General (Intermediate) forum.
You know what it works!!!
IMHO, Not there yet!. We just completed the first step.
Why you know so much and I don't know!!!
Been there done that! Just like all others.
And somehow, I was attracted to Tomcat installation and setup
as many people here say that its difficult. I find it really
interesting to help people in this regard. And so I try to
participate in almost all Tomcat/Apache problem/issue postings
in this forum.
Lets' get to work, shall we!
regds.
- satya

[This message has been edited by Madhav Lakkapragada (edited March 17, 2001).]
mike nu
Ranch Hand

Joined: Mar 11, 2001
Posts: 63
Hi Madhav,
I got new message, could help me to figure it out?
"Including all jars in d:\tomcat\lib in your CLASSPATH.
Using CLASSPATH: d:\tomcat\classes;d:\tomcat\lib\ANT.JAR;d:\tomcat\lib\JAXP.JAR;
d:\tomcat\lib\SERVLET.JAR;d:\tomcat\lib\PARSER.JAR;d:\tomcat\lib\WEBSER~1.JAR;d:
\tomcat\lib\JASPER.JAR;d:\tomcat\lib\ant.jar;d:\tomcat\lib\ant.jar;d:\tomcat\lib
\jasper;d:\tomcat\lib\jaxp.jar;d:\tomcat\lib\parser.jar;d:\tomcat\lib\servlet.ja
r;d:\tomcat\lib\webserver.jar; .;c:\jdk1.3\lib\tools.jar"
How to clear old classpath settings? I tried to place all those jar file settings in a batch file, which in my tomcat/bin dir, I ran this barch file in this dir.
Thank you again.
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040

The message you got is correct.
Tomcat add all the files in its bin to the classpath
automatically. You don't have to add them in your environment.
The only thing you need to have (not really) is the tools.jar
Also, it doesn't harm if you leave them like that.
Hope you are able to run all the JSP and servlet examples.
If they run properly, you are all set with Tomcat.
Next thing you need to worrk about is how to deploy your
own servlets/JSP. Let us know when you get there.
regds.
- satya
mike nu
Ranch Hand

Joined: Mar 11, 2001
Posts: 63
Hi Madhav,
Thank you very much for you patient help. Now I got my server run, and I can test the TomCat and other test examples.
My next step is to get the BookStore example run, and I got a problem. When enter in browser the url: http://localhost:8080/bookstore/enter, then I got an error 500:
Error: 500
Location: /bookstore/enter
Internal Servlet Error:
java.lang.NoSuchMethodError
at BookStoreServlet.service(BookStoreServlet.java:36)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:588)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
at org.apache.tomcat.core.Handler.service(Handler.java:286)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:210)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
at java.lang.Thread.run(Thread.java:484)
In BookStoreServlet.java, the 36 line is:
RequestDispatcher dispatcher =
getServletContext().getRequestDispatcher( //line 36
"/bookstore.html");
What's the problem could be?
In BookStore example, only the banner servlet works.
Also, I got a similar error when trying to load the catolog. This error occurs in line 57 of CatologServlet.java. THis line is:
ShoppingCart cart = (ShoppingCart)session.getAttribute("examples.bookstore.cart");
In HttpSession class, no getAttribute() method.
Could you help me to figure this out?
Thanks a lot.
Mike
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040
BookStoreServlet.java
Not sure what this is. Could you let us know where you got
the Book Store Servlet example? If its from some text book,
then you should also have the instructions for deploying it
in the same book.......
From the exceptions, I am guessing that the deployment is not
correct.
Also, I think we access the servlet by the foll. form http://localhost:8080/examples/servlet/BookStoreServlet
regds.
- satya
Giri Prasad
Ranch Hand

Joined: Mar 08, 2001
Posts: 56
Hi
I am unable to compile my servets. Do I need to download the servlet API(javax)? ia m using tomcat and included the tomcat's lib in the CLASSPATH
Any help?
mike nu
Ranch Hand

Joined: Mar 11, 2001
Posts: 63
Hi Madhav,
I got them from the link in Servlet tutorial of java.sun.com.
And I set it up according to the instruction in this tutorial.
Thanks,
Mike
 
GeeCON Prague 2014
 
subject: How to set up JSDK2.1 server