Servlets & Tomcat problems.

Discussion in 'Java' started by Arun Goel, Oct 1, 2003.

  1. Arun Goel

    Arun Goel Guest

    Hi All ,

    I am using Tomcat 4.1.I am trying to run the servlet.

    1. I wrote one servlet yesterday & put the .class file for that in
    examples\WEB-INF\classes directory & it is working fine.
    .---No Problem.I have few other servlet also running from same class
    directory.
    I didn't do anything in web.xml for this servlet

    2. Today I wrote another servlet , I put it at same location & whenever I am
    trying to invoke it , I always get this error..

    I tried adding
    <servlet>
    <servlet-name>ProcessBMGSpouse</servlet-name>
    <servlet-class>ProcessBMGSpouse</servlet-class>
    </servlet>
    &
    <servlet-mapping>
    <servlet-name>ProcessBMGSpouse</servlet-name>
    <url-pattern>/ProcessBMGSpouse</url-pattern>
    </servlet-mapping>

    also , but no luck.,.

    Any help will be appreciated. I spent almost 2 hrs but not able to figure
    out..

    Thanks in advance..

    Arun

    ----------------------------------------------------------------------------
    -------------------------javax.servlet.ServletException: Cannot allocate
    servlet instance for path /examples/servlet/ProcessBMGSpouse
    at
    org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java
    :435)
    at
    org.apache.catalina.servlets.InvokerServlet.doPost(InvokerServlet.java:216)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
    FilterChain.java:247)
    at
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
    ain.java:193)
    at filters.ExampleFilter.doFilter(ExampleFilter.java:149)
    at
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
    FilterChain.java:213)
    at
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
    ain.java:193)
    at filters.ExampleFilter.doFilter(ExampleFilter.java:149)
    at
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
    FilterChain.java:213)
    at
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
    ain.java:193)
    at
    org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
    va:256)
    at
    org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    eNext(StandardPipeline.java:643)
    at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at
    org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
    va:191)
    at
    org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    eNext(StandardPipeline.java:643)
    at
    org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase
    ..java:494)
    at
    org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    eNext(StandardPipeline.java:641)
    at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at
    org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
    at
    org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
    )
    at
    org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    eNext(StandardPipeline.java:643)
    at
    org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
    java:171)
    at
    org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    eNext(StandardPipeline.java:641)
    at
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172
    )
    at
    org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    eNext(StandardPipeline.java:641)
    at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at
    org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
    :174)
    at
    org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    eNext(StandardPipeline.java:643)
    at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
    at
    org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
    at
    org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConne
    ction(Http11Protocol.java:392)
    at
    org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
    at
    org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
    a:619)
    at java.lang.Thread.run(Thread.java:534)

    root cause

    java.lang.IllegalAccessException: Class
    org.apache.catalina.core.StandardWrapper can not access a member of class
    ProcessBMGSpouse with modifiers ""
    at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:57)
    at java.lang.Class.newInstance0(Class.java:302)
    at java.lang.Class.newInstance(Class.java:261)
    at
    org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:90
    3)
    at
    org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:668)
    at
    org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java
    :416)
    at
    org.apache.catalina.servlets.InvokerServlet.doPost(InvokerServlet.java:216)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
    FilterChain.java:247)
    at
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
    ain.java:193)
    at filters.ExampleFilter.doFilter(ExampleFilter.java:149)
    at
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
    FilterChain.java:213)
    at
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
    ain.java:193)
    at filters.ExampleFilter.doFilter(ExampleFilter.java:149)
    at
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
    FilterChain.java:213)
    at
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
    ain.java:193)
    at
    org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
    va:256)
    at
    org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    eNext(StandardPipeline.java:643)
    at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at
    org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
    va:191)
    at
    org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    eNext(StandardPipeline.java:643)
    at
    org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase
    ..java:494)
    at
    org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    eNext(StandardPipeline.java:641)
    at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at
    org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
    at
    org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
    )
    at
    org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    eNext(StandardPipeline.java:643)
    at
    org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
    java:171)
    at
    org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    eNext(StandardPipeline.java:641)
    at
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172
    )
    at
    org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    eNext(StandardPipeline.java:641)
    at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at
    org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
    :174)
    at
    org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    eNext(StandardPipeline.java:643)
    at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
    at
    org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
    at
    org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConne
    ction(Http11Protocol.java:392)
    at
    org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
    at
    org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
    a:619)
    at java.lang.Thread.run(Thread.java:534)
    ----------------------------------------------------------------------------
    -------------------------------
    Arun Goel, Oct 1, 2003
    #1
    1. Advertising

  2. Arun Goel

    Arun Goel Guest

    > Note that you really should put into packages all classes used in servlets
    > for any purpose
    > in order to avoid really confusing error messages.


    NO. I did & it worked..

    Thanks a lot.

    Arun
    Arun Goel, Oct 1, 2003
    #2
    1. Advertising

  3. "Arun Goel" <> wrote in message
    news:Jiteb.1367$...
    > Hi All ,
    >
    > I am using Tomcat 4.1.I am trying to run the servlet.
    >
    > 1. I wrote one servlet yesterday & put the .class file for that in
    > examples\WEB-INF\classes directory & it is working fine.
    > .---No Problem.I have few other servlet also running from same class
    > directory.
    > I didn't do anything in web.xml for this servlet


    Note that the examples have the "invoker" servlet turned on - read the
    web.xml

    >
    > 2. Today I wrote another servlet , I put it at same location & whenever I

    am
    > trying to invoke it , I always get this error..
    >
    > I tried adding
    > <servlet>
    > <servlet-name>ProcessBMGSpouse</servlet-name>
    > <servlet-class>ProcessBMGSpouse</servlet-class>
    > </servlet>
    > &
    > <servlet-mapping>
    > <servlet-name>ProcessBMGSpouse</servlet-name>
    > <url-pattern>/ProcessBMGSpouse</url-pattern>
    > </servlet-mapping>
    >
    > also , but no luck.,.
    >
    > Any help will be appreciated. I spent almost 2 hrs but not able to figure
    > out..
    >
    > Thanks in advance..
    >
    > Arun
    >
    > --------------------------------------------------------------------------

    --
    > -------------------------javax.servlet.ServletException: Cannot allocate
    > servlet instance for path /examples/servlet/ProcessBMGSpouse
    > at
    >

    org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java
    > :435)
    > at
    >

    org.apache.catalina.servlets.InvokerServlet.doPost(InvokerServlet.java:216)
    > at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    > at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    > at
    >

    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
    > FilterChain.java:247)
    > at
    >

    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
    > ain.java:193)
    > at filters.ExampleFilter.doFilter(ExampleFilter.java:149)
    > at
    >

    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
    > FilterChain.java:213)
    > at
    >

    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
    > ain.java:193)
    > at filters.ExampleFilter.doFilter(ExampleFilter.java:149)
    > at
    >

    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
    > FilterChain.java:213)
    > at
    >

    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
    > ain.java:193)
    > at
    >

    org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
    > va:256)
    > at
    >

    org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    > eNext(StandardPipeline.java:643)
    > at
    >

    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    > at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    > at
    >

    org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
    > va:191)
    > at
    >

    org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    > eNext(StandardPipeline.java:643)
    > at
    >

    org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase
    > .java:494)
    > at
    >

    org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    > eNext(StandardPipeline.java:641)
    > at
    >

    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    > at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    > at
    > org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
    > at
    >

    org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
    > )
    > at
    >

    org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    > eNext(StandardPipeline.java:643)
    > at
    >

    org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
    > java:171)
    > at
    >

    org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    > eNext(StandardPipeline.java:641)
    > at
    >

    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172
    > )
    > at
    >

    org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    > eNext(StandardPipeline.java:641)
    > at
    >

    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    > at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    > at
    >

    org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
    > :174)
    > at
    >

    org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    > eNext(StandardPipeline.java:643)
    > at
    >

    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    > at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    > at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
    > at
    > org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
    > at
    >

    org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConne
    > ction(Http11Protocol.java:392)
    > at
    > org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
    > at
    >

    org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
    > a:619)
    > at java.lang.Thread.run(Thread.java:534)
    >
    > root cause
    >
    > java.lang.IllegalAccessException: Class
    > org.apache.catalina.core.StandardWrapper can not access a member of class
    > ProcessBMGSpouse with modifiers ""
    > at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:57)
    > at java.lang.Class.newInstance0(Class.java:302)


    Did you make this new servlet class "public" ?

    Note that you really should put into packages all classes used in servlets
    for any purpose
    in order to avoid really confusing error messages.

    Bill
    William Brogden, Oct 1, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jim
    Replies:
    4
    Views:
    6,980
  2. Jim
    Replies:
    2
    Views:
    863
  3. M
    Replies:
    5
    Views:
    423
    Christophe Vanfleteren
    Sep 20, 2003
  4. Phil Jarvis
    Replies:
    2
    Views:
    794
    Sudsy
    Jul 7, 2004
  5. JC Koerber
    Replies:
    0
    Views:
    602
    JC Koerber
    Nov 8, 2004
Loading...

Share This Page