0 Replies Latest reply on Apr 7, 2003 1:50 PM by Manoj G. Kithany

    javax.servlet.ServletException: Cannot allocate servlet inst

    Manoj G. Kithany Newbie

      Hello JBosses:

      I am using JBoss + Tomcat + Apache on UNIX.

      My Web App name is "HARI" which has following structure:

      This is a very basic WEB APP which checks for USerName/Password.

      I run my app as http://hariom.com/hari/servlet/login


      I have following directory and organized the servlets as:

      /hari/index.jsp
      /hari/hari.war
      /hari/WEB-INF/web.xml
      /hari/WEB-INF/classes/shiva/login.class
      /hari/WEB-INF/classes/shiva/process.class
      /hari/WEB-INF/classes/shiva/main.class
      /hari/WEB-INF/classes/shiva/list.class
      /hari/META-INF/application.xml

      In every Servlet I have added "package shiva;"

      My "main.class" has a Form which calls "list.class" but when I click the Form Submit button I get following error wonder why?

      -----------------------------------------------------------------------------
      Apache Tomcat/4.0.3 - HTTP Status 500 - Internal Server Error
      The server encountered an internal error (Internal Server Error) that prevented it from fulfilling this request.

      javax.servlet.ServletException: Cannot allocate servlet instance for path /hari/servlet/list

      at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:415)
      at org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:180)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)

      root cause
      java.lang.NoClassDefFoundError: shiva/list (wrong name: list)
      at java.lang.ClassLoader.defineClass0(Native Method)
      at java.lang.ClassLoader.defineClass(ClassLoader.java(Compiled Code))
      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java(Compiled Code))
      -----------------------------------------------------------------------------

      My classpath is set as "/hari/WEB-INF/classes"


      My WEB.XML file is:
      -----------------------------------------------------------------------------
      <web-app>

      <servlet-name>login</servlet-name>
      <servlet-class>shiva.login</servlet-class>


      <servlet-name>process</servlet-name>
      <servlet-class>shiva.process</servlet-class>


      <servlet-name>main</servlet-name>
      <servlet-class>shiva.main</servlet-class>


      <servlet-name>list</servlet-name>
      <servlet-class>shiva.list</servlet-class>


      <servlet-mapping>
      <servlet-name>process</servlet-name>
      <url-pattern>shiva/process</url-pattern>
      </servlet-mapping>
      <servlet-mapping>
      <servlet-name>login</servlet-name>
      <url-pattern>shiva/login</url-pattern>
      </servlet-mapping>
      <servlet-mapping>
      <servlet-name>main</servlet-name>
      <url-pattern>shiva/main</url-pattern>
      </servlet-mapping>
      <servlet-mapping>
      <servlet-name>list</servlet-name>
      <url-pattern>ahiva/list</url-pattern>
      </servlet-mapping>
      -----------------------------------------------------------------------------

      Can anyone point out what is wrong?

      what other changes do I have to make to make it work?