File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Cannot Preload Servlet - How to Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Cannot Preload Servlet - How to" Watch "Cannot Preload Servlet - How to" New topic
Author

Cannot Preload Servlet - How to

Raj Mohan
Ranch Hand

Joined: Sep 26, 2000
Posts: 73
Hi!.
Any body help me in the following problem.
I have an online catalog in Java servlets. To run this catalog, I have to preload one servlet. But I don't have any web servers.
I am using JSDK 2.1 -Startserver & stopserver things. Is there any way to preload servlets in JSDK.
OR
Do have to load an web server?. In that case, please mention the smallest size file servlet and where to get it.
Many thanks.
Raj
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
Why are you using JSDK? I think the last time that was
updated was in late 1999. Sun turned over all of that development to the Apache organization. The Tomcat server is where current development is occurring.
In Tomcat you can specify that a servlet will be loaded on startup.
There are also other servlet engines with free development downloads that are better documented than the old JSDK.
Look at www.orionserver.com for instance.
Bill
knex knex
Greenhorn

Joined: Jun 15, 2001
Posts: 2
try this in your web.xml
<servlet>
<servlet-name>
startup_servlet
</servlet-name>
<servlet-class>
PATH.StartupServ
</servlet-class>
<load-on-startup>
1 <-----------------priority
</load-on-startup>
</servlet>
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

knex...

Have you tried this <load-on-startup> tag for any J2EE apps? We are trying to figure out how to get an enterprise application to load some classes on startup... if we could get a servlet to start up though, perhaps we can write a small utility servlet to poke some EJB's.

In any case, thanks for giving me hope.
vikinsa
Ranch Hand

Joined: Apr 18, 2001
Posts: 46
Hi!,
If you are using only the JSDK any version you can still be able to preload the servlet. Do one thing aupdate the classpath of your system and make sure that the classpath has the path of the class file of that servlet.
try appending like this..
c:\<servlet-directory>\<servlet-name>.class

Originally posted by Raj Mohan:
Hi!.
Any body help me in the following problem.
I have an online catalog in Java servlets. To run this catalog, I have to preload one servlet. But I don't have any web servers.
I am using JSDK 2.1 -Startserver & stopserver things. Is there any way to preload servlets in JSDK.
OR
Do have to load an web server?. In that case, please mention the smallest size file servlet and where to get it.
Many thanks.
Raj


------------------
Vikas Aggarwal
Technology Associate
http://www.vikinsa.com


Vikas Aggarwal<BR>Technology Associate<BR>http://www.vikinsa.com
Michael OConnor
Greenhorn

Joined: Jun 18, 2001
Posts: 2
I have tried getting the load
on startup tag working in my web.xml
but to no avail.
Here is my line,
<servlet>
<servlet-name>
TrapReceiver.class
</servlet-name>
<servlet-class>
TrapReceiver
</servlet-class>
<load-on-startup>5</load-on-startup>
</servlet>
I've tried using priorty 1 also,
My servlet log just says
2001-07-10 02:50:05 - path="/examples" :jsp: init
2001-07-10 02:50:05 - path="/datacenter" :jsp: init
2001-07-10 02:50:05 - path="/admin" :jsp: init
And when i start tomcat the error i get is :
cannot load servlet name: TrapReceiver.class
The TrapReciever.class file is located in C:\tomcat\webapps\examples\WEB-INF\classes
I've tried <servlet-class>
TrapReceiver.class
& also/webapps/examples/WEB-INF/classes/TrapReceiver.class
</servlet-class>
But to no avail
Can anyone shed any light on this ??
Cherry Mathew
Ranch Hand

Joined: Dec 26, 2000
Posts: 159
Originally posted by Michael OConnor:
I have tried getting the load
on startup tag working in my web.xml
but to no avail.
Here is my line,
<servlet>
<servlet-name>
TrapReceiver.class
</servlet-name>
<servlet-class>
TrapReceiver
</servlet-class>
<load-on-startup>5</load-on-startup>
</servlet>
I've tried using priorty 1 also,
My servlet log just says
2001-07-10 02:50:05 - path="/examples" :jsp: init
2001-07-10 02:50:05 - path="/datacenter" :jsp: init
2001-07-10 02:50:05 - path="/admin" :jsp: init
And when i start tomcat the error i get is :
cannot load servlet name: TrapReceiver.class
The TrapReciever.class file is located in C:\tomcat\webapps\examples\WEB-INF\classes
I've tried <servlet-class>
TrapReceiver.class
& also/webapps/examples/WEB-INF/classes/TrapReceiver.class
</servlet-class>
But to no avail
Can anyone shed any light on this ??

Hi Michael,
Where did u put u r web.xml file?. If its not in the /example/web-inf/web.xml then paste u r <servlet> tag there. And it should work.
I think tomcat is more comfortable if u use the packages for all the classes u use.
Hope this will help u
Cherry
Cherry Mathew
Ranch Hand

Joined: Dec 26, 2000
Posts: 159
Originally posted by Michael OConnor:
I have tried getting the load
on startup tag working in my web.xml
but to no avail.
Here is my line,
<servlet>
<servlet-name>
TrapReceiver.class
</servlet-name>
<servlet-class>
TrapReceiver
</servlet-class>
<load-on-startup>5</load-on-startup>
</servlet>
I've tried using priorty 1 also,
My servlet log just says
2001-07-10 02:50:05 - path="/examples" :jsp: init
2001-07-10 02:50:05 - path="/datacenter" :jsp: init
2001-07-10 02:50:05 - path="/admin" :jsp: init
And when i start tomcat the error i get is :
cannot load servlet name: TrapReceiver.class
The TrapReciever.class file is located in C:\tomcat\webapps\examples\WEB-INF\classes
I've tried <servlet-class>
TrapReceiver.class
& also/webapps/examples/WEB-INF/classes/TrapReceiver.class
</servlet-class>
But to no avail
Can anyone shed any light on this ??

Hi Michael,
Where did u put u r web.xml file?. If its not in the /example/web-inf/web.xml then paste u r <servlet> tag there. And it should work.
I think tomcat is more comfortable if u use the packages for all the classes u use.
Hope this will help u
Cherry
 
 
subject: Cannot Preload Servlet - How to
 
Similar Threads
Loading Properties into WAS on Startup
Connect to Oracle 8i Database
Servlet problem
Why should the URL have /servlet/
JSDK...