Discussions

Web tier: servlets, JSP, Web frameworks: Unable to access servlet from War

  1. Unable to access servlet from War (4 messages)

    Hi,

     I am working in WL6.1. I have deployed a war file. My war file contains a html and a servlet(WEB-INF\classes). I am able to access my html file. BUt once I try to access the servlet I get the following error. Please help.

    <Jul 21, 2004 11:47:24 AM IST> <Error> <HTTP> <[WebAppServletContext(1386858,Wro
    ng,/Wrong)] Servlet failed with ServletException
    javax.servlet.ServletException: Servlet class: 'TestHello' could not be loaded -
     the requested class wasn't found in the classpath: 'C:\bea\wlserver6.1\config\
    examples\applications\.wlnotdelete\Wrong2876.war'
            at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubI
    mpl.java:609)
            at weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.
    java:370)
            at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:240)
            at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:198)
            at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
    rvletContext.java:2637)
            at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
    pl.java:2359)
            at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
            at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    >
    <Jul 21, 2004 11:47:26 AM IST> <Error> <HTTP> <[WebAppServletContext(1386858,Wro
    ng,/Wrong)] Error loading servlet: "TestHello"
    java.lang.ClassNotFoundException: TestHello
            at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClass
    Loader.java:180)
            at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAw
    areClassLoader.java:65)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:294)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
            at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAw
    areClassLoader.java:44)
            at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubI
    mpl.java:598)
            at weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.
    java:370)
            at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:240)
            at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:198)
            at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
    rvletContext.java:2637)
            at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
    pl.java:2359)
            at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
            at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    >
    <Jul 21, 2004 11:47:26 AM IST> <Error> <HTTP> <[WebAppServletContext(1386858,Wro
    ng,/Wrong)] Servlet failed with ServletException
    javax.servlet.ServletException: Servlet class: 'TestHello' could not be loaded -
     the requested class wasn't found in the classpath: 'C:\bea\wlserver6.1\config\
    examples\applications\.wlnotdelete\Wrong2876.war'
            at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubI
    mpl.java:609)
            at weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.
    java:370)
            at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:240)
            at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:198)
            at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
    rvletContext.java:2637)
            at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
    pl.java:2359)
            at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
            at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    >

    Thanks & regards,
    Srini

    Threaded Messages (4)

  2. Unable to access servlet from War[ Go to top ]

    Best pattern ever. I'm going to use it on every project from now on.
  3. I think I figured the problem . But suggestions are welcome.
    I think while I created the war, some phantom directories were present. When I physically move the files and I created a new folder structure, my war file seems to work fine.

    Thanks
    Srini
  4. I am sure that you did not understand the spirit of the previous post. You must look at the name of the forum and post your message accordingly. The question you posted would have been more appropriate in the:

      Web tier: servlets, JSP, Web frameworks forum

    This discussion forum is for Design Patterns.
  5. Anyway - the solution for you problem may be the missing package of your servlet. In my experience, servlets must not be located in the default package. Simply put it in a package (e.g. test.TestHello). It should work now.

    Cheers,

    René