Servlets & Tomcat problems.

A

Arun Goel

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)
 
A

Arun Goel

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
 
W

William Brogden

Arun Goel said:
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
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
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
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
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
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
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
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
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
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
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
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
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,983
Messages
2,570,187
Members
46,747
Latest member
jojoBizaroo

Latest Threads

Top