Solved

Unable to get servlets to run - error from TOMCAT4

Posted on 2006-11-30
42
206 Views
Last Modified: 2010-04-01
Hi,

I have some problems running my servlets in tomcat4. Here's the error generated from TOMCAT. Sorry i have not used tomcat or jsp/servlets too frequent and not very familiar with it. Please help me have a look what does the error means.

thanks

2006-12-01 10:56:10 invoker: Cannot allocate servlet instance for path /servlet/DT_2DBServlet
javax.servlet.ServletException: Servlet.init() for servlet org.apache.catalina.INVOKER.DT_2DBServlet threw exception
      at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:871)
      at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:615)
      at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:396)
      at org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:180)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
0
Comment
Question by:jaxrpc
  • 23
  • 16
  • +1
42 Comments
 
LVL 16

Expert Comment

by:suprapto45
ID: 18051431
Hi,

It means that your Servlet is not available. Have you added the entries in your web.xml? If so, can you post your web.xml?
0
 

Author Comment

by:jaxrpc
ID: 18051490
sorry, but where can i find web.xml...can't seems to find it because i am following the installation manual provided by the software maker 4years ago.

0
 
LVL 16

Expert Comment

by:suprapto45
ID: 18051687
No problem.

Now, do you know where Tomcat is installed? Normaly, it would be like C:/tomcat4. Let's call it TOMCAT_HOME.

If you have found it, do you find the folder called "webapps" in <TOMCAT_HOME>/webapps. The web.xml is located in <TOMCAT_HOME>/webapps/<YOUR WEB APP NAME>/WEB-INF/web.xml

Can you find it?
0
 
LVL 16

Expert Comment

by:suprapto45
ID: 18051688
>>"i am following the installation manual provided by the software maker 4years ago."
So it is an existing system. Are you trying to enhance the existing system?
0
 
LVL 16

Expert Comment

by:suprapto45
ID: 18051715
If everything is okay, you may need to enable your /servlet invoker.

http://tomcat.apache.org/faq/misc.html#invoker
0
 

Author Comment

by:jaxrpc
ID: 18051740
yup, there's no web.xml in myWebApp/Web-INF

actually i am trying to reinstall an existing system. Anyway how do i go about create a web.xml?

i have DT_2DBServlet.class in the web-inf and HDBIDSServlet.class in the web-inf.
where do i create or insert the servlet tags into the web.xml?

thanks
0
 
LVL 16

Expert Comment

by:suprapto45
ID: 18051746
Hi,

>>"actually i am trying to reinstall an existing system"
Well, do they provide you with any WAR file?
0
 

Author Comment

by:jaxrpc
ID: 18051799
hi,

really appreciate your help and fast reply.

Nope. Just an instruction manaul which instructs me to copy and paste the whole TOMCAT4 folder into C:\ and set a few system variables and stuffs.
0
 
LVL 16

Expert Comment

by:suprapto45
ID: 18051802
Can you possibly post the instructions here (if no privacy exposed)?
0
 
LVL 16

Expert Comment

by:suprapto45
ID: 18051803
>>"really appreciate your help and fast reply."
:), we are here to help
0
 

Author Comment

by:jaxrpc
ID: 18051850
Under tomcat i have the following files.

C:\Tomcat4\webapps\ROOT\WEB-INF\classes

DT_2.class
DT_2DataAccessor.class
DT_2DBServlet.class
HDBIDSServlet.class
HDBIDSDataAccessor.class
HDBIDSDBServlet.class

HDBIDS.java
HDBIDSDataAccessor.java
HDBIDSDBServlet.java

and another program written in VB6 which will call a java applet which communicates with the servlet.

So far i have got the web server running and i am able to call the java applet but it won't communicate with the servlet which might be the problem you suspected.

anyway the manual is just pure copy & paste TOMCAT4 folder to C:\ and everything will work...according to the manual.

thanks
0
 
LVL 16

Expert Comment

by:suprapto45
ID: 18051854
Ok,

Is there any web.xml in your C:\Tomcat4\webapps\ROOT\WEB-INF\
0
 

Author Comment

by:jaxrpc
ID: 18051857
no...there isnt
0
 
LVL 16

Expert Comment

by:suprapto45
ID: 18051862
ok, give me a sec
0
 
LVL 16

Expert Comment

by:suprapto45
ID: 18051872
Assuming that your Tomcat's port is 8080.

What happen if you execute http://localhost:8080. Is there any Tomcat page displayed? Additionally, when you run your Tomcat, is there any error in the Tomcat's console?
0
 

Author Comment

by:jaxrpc
ID: 18051877
The root directory for the tomcat appear. There's no error in the catalina when i started it. infact each time i launch the applet...there will be some messages from the program.
0
 

Author Comment

by:jaxrpc
ID: 18051884
i have checked the web.xml in the conf folder but i dont see any servlet tags belonging to my servlets.

Do i need a web.xml for the servlets?
0
 
LVL 16

Expert Comment

by:suprapto45
ID: 18051886
Try to go to your <TOMCAT_HOME>/conf/web.xml and enable the invoker by changing

 <!--
    <servlet-mapping>
        <servlet-name>invoker</servlet-name>
        <url-pattern>/servlet/*</url-pattern>
    </servlet-mapping>
  -->

into

    <servlet-mapping>
        <servlet-name>invoker</servlet-name>
        <url-pattern>/servlet/*</url-pattern>
    </servlet-mapping>
0
 
LVL 16

Expert Comment

by:suprapto45
ID: 18051897
>>"Do i need a web.xml for the servlets?"
If you follow the normal and recommended ways to deploy web app in J2EE in Tomcat, YES, each web app will have its own web.xml.

Now, what you used is to deploy the application in the ROOT folder of Tomcat which is actually not recommended (though can run). If you run this in Production environment, you are actually opening the security hole of the Tomcat to your user (although I am not sure how but it is not recommended).
0
 

Author Comment

by:jaxrpc
ID: 18051912
hi,

it is already

 <servlet-mapping>
        <servlet-name>invoker</servlet-name>
        <url-pattern>/servlet/*</url-pattern>
    </servlet-mapping>

but...still not working... any other ideas?

thanks...
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 16

Expert Comment

by:suprapto45
ID: 18051917
Okay,

Just curious, is there any entry for DT_2DBServlet in your <TOMCAT_HOME>/conf/web.xml such as

<servlet>
<servlet-name>DT_2DBServlet</servlet-name>
0
 

Author Comment

by:jaxrpc
ID: 18051919
nope..there's not such an entry.
0
 
LVL 16

Expert Comment

by:suprapto45
ID: 18051926
Try to add that then.

Add below codes after your last </servlet> entry.

<servlet>
<servlet-name>DT_2DBServlet</servlet-name>
<servlet-class>YOUHAVETOPROVIDETHIS.DT_2DBServlet</servlet-class>
</servlet>

Then add

    <servlet-mapping>
        <servlet-name>DT_2DBServlet</servlet-name>
        <url-pattern>/servlet/DT_2DBServlet</url-pattern>
    </servlet-mapping>

after your last </servlet-mapping> entry
0
 
LVL 16

Expert Comment

by:suprapto45
ID: 18051928
and restart your Tomcat and try your applet again
0
 

Author Comment

by:jaxrpc
ID: 18051960
hi,

now i have another error from the log. unable to find the DT_2DBServlet class

the DT_2DBServlet is physically located in the root/web-inf/classes

so do i write the full path? or just the class name is enough?

thanks alot!!..
0
 
LVL 16

Expert Comment

by:suprapto45
ID: 18051970
Hi,

>>"<servlet>
<servlet-name>DT_2DBServlet</servlet-name>
<servlet-class>YOUHAVETOPROVIDETHIS.DT_2DBServlet</servlet-class>
</servlet>"

YOUHAVETOPROVIDETHIS is actually the package of your class. You can find this on your DT_2DBServlet.java

DT_2DBServlet.java
-----------------------

package xx.xx.xx;

If that is the case then
<servlet>
<servlet-name>DT_2DBServlet</servlet-name>
<servlet-class>xx.xx.xx.DT_2DBServlet</servlet-class>
</servlet>
0
 

Author Comment

by:jaxrpc
ID: 18051987
hi,

really sorry....but i dont know how to read java code. ... still can't figure out which is the package.

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
import DT_2;
import DT_2DataAccessor;


public class DT_2DBServlet extends HttpServlet implements SingleThreadModel
{

    private DT_2DataAccessor myDataAccessor;
      private String CR = "\n";
      private boolean booShowVideo=false;
      String strReqDTName = null;
      String strIPAddress = null;
      boolean booUseDTName = false;
0
 
LVL 16

Expert Comment

by:suprapto45
ID: 18051994
Any other codes before import java.io.*; ?

If not,
<servlet>
<servlet-name>DT_2DBServlet</servlet-name>
<servlet-class>DT_2DBServlet</servlet-class>
</servlet>

should be okay
0
 

Author Comment

by:jaxrpc
ID: 18052019
no other codes.

yup..this is the error i got

2006-12-01 15:37:54 StandardWrapper[:DT_2DBServlet]: Marking servlet DT_2DBServlet as unavailable
2006-12-01 15:37:54 StandardWrapperValve[DT_2DBServlet]: Allocate exception for servlet DT_2DBServlet
javax.servlet.ServletException: Wrapper cannot find servlet class DT_2DBSerlet or a class it depends on
      at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:807)
      at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:615)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
0
 
LVL 16

Expert Comment

by:suprapto45
ID: 18052028
>>"Wrapper cannot find servlet class DT_2DBSerlet or a class it depends on"
I am afraid that you have to provide all the necessary classes which would be hard if you do not know what are the files involved and only your original coders know it :(.
0
 
LVL 16

Expert Comment

by:suprapto45
ID: 18052032
Worth to try though. If you know what are the servlets? Try to add all of them to your web.xml

DT_2.class
DT_2DataAccessor.class
DT_2DBServlet.class
HDBIDSServlet.class
HDBIDSDataAccessor.class
HDBIDSDBServlet.class
0
 

Author Comment

by:jaxrpc
ID: 18052052
i found out... i mis-spelled the servletname but after i corrected it... i got back the same error as in the 1st post....

heh...
0
 
LVL 16

Expert Comment

by:suprapto45
ID: 18052056
Can you post the entire stack trace (error codes)?
0
 
LVL 16

Expert Comment

by:suprapto45
ID: 18052097
Oh yes,

I will be leaving in 30 mins time and will only be back by Monday. Just in case that your problem is not solved at that time, I hope that other experts may pop in during weekend and help you.

One more thing. Is this working previously? If so, what is the URL that you used before to run this?
0
 

Author Comment

by:jaxrpc
ID: 18052137
ok thanks alot!! for your help..

enjoy...your weekends.
0
 

Author Comment

by:jaxrpc
ID: 18052430
Anyone else has any ideas on what problem i am facing?

thanks
0
 
LVL 16

Expert Comment

by:suprapto45
ID: 18054646
Hi,

http://www.experts-exchange.com/Web/Web_Languages/JSP/Q_22079287.html

I have asked some pointer question so everyone can help you.

David
0
 
LVL 27

Assisted Solution

by:rrz
rrz earned 100 total points
ID: 18055553
I don't know if I can fill David's shoes, but I'll give it go. First let's try without using invoker.  Change the file  C:\Tomcat4/conf/web.xml   back to what it was originally.  Next use the following to create a file .
---------------------------------------------------------------------------------------------------------------------------------
<?xml version="1.0"?>

<!DOCTYPE web-app PUBLIC
   "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
   "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>
   <servlet>
      <servlet-name>yourServlet</servlet-name>
      <servlet-class>DT_2DBServlet</servlet-class>
      <load-on-startup>1</load-on-startup>
   </servlet>  

   <servlet-mapping>
      <servlet-name>yourServlet</servlet-name>
      <url-pattern>/Dt2db</url-pattern>
   </servlet-mapping>  
</web-app>
-----------------------------------------------------------------------------------------------------
it should be located at  C:\Tomcat4\webapps\ROOT\WEB-INF\web.xml  
Restart Tomcat and  try to access with   http://localhost:8080/Dt2db 
Show us any  error message.
0
 
LVL 23

Assisted Solution

by:rama_krishna580
rama_krishna580 earned 100 total points
ID: 18056306
Hi,

The problem was a bug in version 4.1.27 of tomcat so anyone having this problem go to http://www.apache.org/dist/jakarta/tomcat-4/binaries/ and download hotfix 22096 extract it and copy the directory org to tomcat_install_dir\server\classes directory and restart tomcat.

R.K
0
 
LVL 16

Accepted Solution

by:
suprapto45 earned 300 total points
ID: 18065688
Just get back to my machine.

Are you still getting error of your servlet?

David
0
 

Author Comment

by:jaxrpc
ID: 18834360
sorry. actually the servlet works another PC. it seems that the problem could be with the last PC that i worked with though i am not sure what it is.. i will split the points evenly to everyone who tried to help. Thanks for the time and effort.

Moderator - Please close this question for me. thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
JTable - RowFilter & Columns Header. 3 140
Using Tomcat as raspberry pi java app server 13 141
maven j2ee examles 2 49
Java Script nested call 3 76
Scenario: Your operations manager has discovered an anomaly in your security system. The business will start to suffer within 15 minutes if it is a major IT incident. What should she do? We have 6 recommendations for managing major incidents (https:…
Cloud-based technologies and services will continue to grow in popularity in 2017 thanks to the simple, scalable and cost-effective solutions they deliver. Here are three areas where cloud adoption is poised to really take off.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now